当前位置:网站首页>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
边栏推荐
- Android handler memory leak kotlin memory leak handling
- 啊哈C语言 第8章 游戏时间到了(第29讲)
- TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 网桥与交换机
- MySQL面试真题(二十八)——案例-通讯运营商指标分析
- [graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming
- 【owt】owt-client-native-p2p-e2e-test vs2017构建 6:修改脚本自动生成vs工程
- Opencv display image
- AHA C language Chapter 7 you can do more with it (talks 27-28)
- ORB_SLAM2运行
- What is the reason for the black screen of the computer monitor when the computer is turned on? What should I do about the black screen of the computer monitor
猜你喜欢

runc 符号链接挂载与容器逃逸漏洞预警(CVE-2021-30465)

MySQL面试真题(二十九)——案例-找到爱看的电影

iNFTnews | 加密之家从宇宙寄来的明信片,你会收到哪一张?

Jvm: when a method is overloaded, the specific method to call is determined by the static type of the incoming parameter rather than the actual type of the parameter

C primer plus学习笔记 —— 2、常量与格式化IO(输入/输出)

jvm-04.对象的内存布局

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

A bit of knowledge - folding forging and Damascus steel

How to move the software downloaded from win11 app store to the desktop

数字藏品市场才刚刚开始
随机推荐
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-7 personal solutions
ArcTime 制作中英文字幕视频
APP SHA1获取程序 百度地图 高德地图获取SHA1值的简单程序
The author believes that the so-called industrial Internet is a process of deep integration of industry and the Internet
JS interview question - anti shake function
Activity startup mode and life cycle measurement results
iNFTnews | 加密之家从宇宙寄来的明信片,你会收到哪一张?
node中操作mongoDB
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 网桥与交换机
Wireshark TS | 视频 APP 无法播放问题
PAT 乙等 1018 C语言
Genetic engineering of AI art? Use # artbreeder to change any shape of the image
MySQL面试真题(二十九)——案例-找到爱看的电影
PAT 乙等 1025 反转链表
AHA C language Chapter 7 you can do more with it (talks 27-28)
Deploy docker and install MySQL in centos7
PAT 乙等 1019 C语言
opencv显示图像
Opportunities and challenges of digital collections from the perspective of technology development team
关于安装pip3 install chatterbot报错的问题