当前位置:网站首页>jvm-01. Instruction rearrangement
jvm-01. Instruction rearrangement
2022-06-23 05:56:00 【CaptainCats】
Command rearrangement
The execution of instructions 5 Stages
Almost all von Neumann computers CPU, The execution of an instruction can be divided into 5 Stages :
1、 Take command IF;
2、 Number of decoded and read accesses ( Read operands )ID;
3、 Execution instruction EX;
4、 Memory access ( The calculation results are loaded into memory )MEM;
5、 The result is written back to ( register )WB;
Each of these steps is handled by different hardware ,
The same steps need to wait for the hardware to idle before continuing , That is to say :
Two consecutive instructions need to consume at least 6 A clock unit .
A=B+C, You need to perform 4 An instruction
Java The code in :A=B+C, You need to perform 4 An instruction :
Instructions 1: load B To register R1 in ;
Instructions 2: load C To register R2 in ;
Instructions 3: take R1 And R2 Add up , calculated R3;
Instructions 4: take R3 Assign a value to A.
Instructions 1 And instructions 2 There is no dependency between , Execute in normal order ,
Instructions 3 Depending on the results of the first two instructions ,
Need to wait for instructions 1、2 Load all calculation results into memory (MEM) after , To execute (EX),
Instructions 4 Depending on instructions 3 Result , We also need to wait in a wrong place .
The red circle in the picture indicates that the hardware is idle due to waiting , Called bubbles ,
such 4 The clock unit length of an instruction is not ideal 8, It is 9.
A=B+C; D=E+F;
Take a more complicated example
A=B+C;
D=E+F;
Instructions 1: load B To register R1 in ;
Instructions 2: load C To register R2 in ;
Instructions 3: take R1 And R2 Add up , calculated R3;
Instructions 4: take R3 Assign a value to A.
Instructions 5: load E To register R4 in ;
Instructions 6: load F To register R5 in ;
Instructions 7: take R4 And R5 Add up , calculated R6;
Instructions 8: take R6 Assign a value to D.
This requires 14 A clock unit ,
Is there any way to eliminate these bubbles , Reduce the loss caused by idle hardware ,
The way is to put the instructions 5、6 Line up to the command 2 after ,
Then give the instructions 6 Line up to the command 3 after , Eliminate all bubbles , Make the most of your computer hardware ,

Command rearrangement
The clock unit length ranges from 14 Reduced to 12, This is the purpose of instruction rearrangement .
Disorderly execution
However, instruction rearrangement also brings the problem of out of order execution , If the sequence is out of order, the data will be inconsistent ,
Java How to ensure orderly execution under specific circumstances :jvm-02. Order guarantees .
Impropriety , Please correct .
Reference material :
The road is round :Java Memory model and instruction rearrangement
Technical tinkle : The meaning of instruction rearrangement
Let nature take its course ~: Detailed explanation of computer instruction execution process
边栏推荐
- Real MySQL interview questions (XXVII) -- Classification of users by RFM analysis method
- Centos7部署radius服务-freeradius-3.0.13-15.el7集成mysql
- Real MySQL interview question (30) -- shell real estate order analysis
- JS面试题----防抖函数
- PAT 乙等 1024 科学记数法 C语言
- [image fusion] sparse regularization based on non convex penalty to realize image fusion with matlab code
- MySQL面试真题(二十六)——滴滴2020年笔试题
- MySQL面试真题(二十一)——金融-贷款逾期
- node中操作mongoDB
- 啊哈C语言 第7章 有了它你能做更多的事(第27-28讲)
猜你喜欢

True MySQL interview question (24) -- row column exchange

Real MySQL interview questions (XXVII) -- Classification of users by RFM analysis method

True MySQL interview question (XXII) -- condition screening and grouping screening after table connection

Android handler memory leak kotlin memory leak handling

数字化工厂建设可划分为三个方面

数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发

Visdom draws multiple dynamic loss curves

The construction of digital factory can be divided into three aspects

Real MySQL interview question (30) -- shell real estate order analysis

Real MySQL interview questions (25) -- common group comparison scenarios
随机推荐
Genetic engineering of AI art? Use # artbreeder to change any shape of the image
MySQL面试真题(二十七)——RFM分析法对用户进行分类
Alibaba cloud ack one and ACK cloud native AI suite have been newly released to meet the needs of the end of the computing era
Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators
visdom的使用
Excel sheet column title for leetcode Title Resolution
Huawei's software and hardware ecosystem has taken shape, fundamentally changing the leading position of the United States in the software and hardware system
What benefits have digital collections enabled the real industry to release?
jvm-04.对象的内存布局
Wechat applet: unfashionable love talk
MySQL面试真题(二十八)——案例-通讯运营商指标分析
How does win11 enable mobile hotspot? How to enable mobile hotspot in win11
How to move the software downloaded from win11 app store to the desktop
数字化工厂建设可划分为三个方面
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.3 全双工, 节能, 自动协商机制, 802.1X 流控制 / 3.3.3 链路层流量控制
雷达图canvas
[OWT] OWT client native P2P E2E test vs2017 build 6: modify script automatic generation vs Project
PAT 乙等 1021 个位数统计
最优传输理论下对抗攻击可解释性
云原生数据库是未来