当前位置:网站首页>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
边栏推荐
- True question of MySQL interview (29) -- case - finding favorite movies
- ArcTime 制作中英文字幕视频
- 雷达图canvas
- Special research on Intelligent upgrading of heavy trucks in China in 2022
- Wechat applet; AI intelligent dubbing assistant
- Basic calculator for leetcode topic analysis
- June 22, 2022: golang multiple choice question, what does the following golang code output? A:3; B:1; C:4; D: Compilation failed. package main import ( “fmt“ ) func mai
- visdom的使用
- 关于安装pip3 install chatterbot报错的问题
- ORB_ Slam2 operation
猜你喜欢

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

雷达图canvas

jvm-06.垃圾回收器

Use of visdom

阿里云对象存储oss+picgo+typora实现构建图床

数字藏品赋能实体产业释放了哪些利好?

Prometheus, incluxdb2.2 installation and flume_ Export download compile use

Adnroid activity screenshot save display to album view display picture animation disappear

Wireshark TS | 视频 APP 无法播放问题

MySQL面试真题(二十五)——常见的分组比较场景
随机推荐
True MySQL interview question (21) - Finance - overdue loan
数字藏品——新的投资机遇
阿里云 ACK One、ACK 云原生 AI 套件新发布,解决算力时代下场景化需求
Real MySQL interview question (XXVIII) -- case - Analysis of indicators of communication operators
Alibaba cloud object storage oss+picgo+typera implements the construction map
C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)
The traditional Internet like platform may no longer exist, and a new industry integrating industrial characteristics and Internet characteristics
Special research on Intelligent upgrading of heavy trucks in China in 2022
啊哈C语言 第8章 游戏时间到了(第29讲)
jvm-04.对象的内存布局
PAT 乙等 1015 C语言
Work accumulation - judge whether GPS is on
MySQL面试真题(二十九)——案例-找到爱看的电影
vant weapp日历组件性能优化 Calendar 日历添加min-date最小日期页面加载缓慢
Analysis on the problems and causes of digital transformation of manufacturing industry
Adnroid activity截屏 保存显示到相册 View显示图片 动画消失
Excel sheet column title for leetcode Title Resolution
云原生数据库是未来
PAT 乙等 1012 C语言
MySQL面试真题(二十六)——滴滴2020年笔试题