当前位置:网站首页>Instruction rearrangement concept
Instruction rearrangement concept
2022-06-24 19:32:00 【Jade label】
Instruction reordering means that the sequence of source code is different from that of program , Or the program sequence is inconsistent with the execution sequence , Reordering objects are instructions . Instruction reordering is a performance concern for the compiler , Without affecting the program ( Single threaded program ) Reorder under the condition of correctness . Instruction reordering is not inevitable , Reordering instructions can lead to thread safety problems . Instruction reordering is also called processor out of order execution , In this case, although the execution order of the instructions may not be completely in accordance with the program order , However, due to the submission of the execution result of the instruction ( To register and memory ), It's still in procedural order , Therefore, the instruction reordering of the processor will not affect the correctness of single thread . Instruction reordering does not affect the correctness of a single threaded program , But it may lead to unexpected results in multithreaded programs .
Guess execution can result in if The effect that the body of a statement is executed before its conditional statement .
Reordering is divided into instruction reordering ( compiler 、 processor ) And storage subsystem reorder ( Memory reordering , For cache , Write buffer )
Storage subsystem reordering : When the processor performs two memory access operations in strict program order , Under the action of the storage subsystem, the perceived order of these two operations by other processors may still be inconsistent with the program order , That is, the execution sequence of the two operations seems to have changed , This phenomenon is storage subsystem reordering . This is just a phenomenon, not an action , It does not really adjust the order of instruction execution , But it just causes a phenomenon that the execution order of instructions seems to have been adjusted , Its reorder object is the result of memory operation . Memory reordering can also cause thread safety problems , Like that one. s0 and s1 Write to write buffer , But the order changes ,P1 Did not read p2 The thread writes to the buffer , Reading is still old , Thread safety occurs It's all a problem .
Reordering is not disorderly, but has certain rules , Statements with data dependencies are not reordered , Only statements that do not have data dependencies are reordered . Seemingly serial , Only from a single thread point of view to ensure that the running results after reordering do not affect the correctness of the program , It does not guarantee the correctness of the program in a multithreaded environment .
边栏推荐
- Real time rendering: the difference between real-time, offline, cloud rendering and hybrid rendering
- Module V
- What other data besides SHP data
- 論文解讀(SR-GNN)《Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data》
- Saltstack state state file configuration instance
- ArrayList源码解析
- cdc+mysql connector从维表中join的日期时间字段会被+8:00,请问阿里云托管的
- Kubernetes集群部署
- Some small requirements for SQL Engine for domestic database manufacturers
- How to select the ECS type and what to consider?
猜你喜欢
![[R tidyverse] use of select verb](/img/2d/768391bc6ec497432915024bc90842.jpg)
[R tidyverse] use of select verb

The efficiency of okcc call center data operation

Volcano becomes spark default batch scheduler

Steering gear control (stm32f103c8t6)

【Go语言刷题篇】Go从0到入门4:切片的高级用法、初级复习与Map入门学习

Kubernetes集群部署

Power efficiency test

STM32 uses time delay to realize breathing lamp register version

程序员大部分时间不是写代码,而是。。。

Do you have all the basic embedded knowledge points that novices often ignore?
随机推荐
Dataworks development ODPs SQL development production environment automatic completion of ProjectName
PHP OSS file reads and writes files, and workman generates temporary files and outputs them to the browser for download
BSS应用程序云原生部署的8大挑战
The script implements the automated deployment of raid0
MySQL binlog data source configuration document, please share
智能合约安全审计入门篇 —— delegatecall (2)
The agile way? Is agile development really out of date?
Some small requirements for SQL Engine for domestic database manufacturers
Why useevent is not good enough
Why is nodejs so fast?
NFT双币质押流动性挖矿系统开发
多云模式并非“万能钥匙”
Game between apifox and other interface development tools
An accident caused by a MySQL misoperation cannot be withstood by High Availability!
LCD1602 string display (STM32F103)
Xiaobai, let me ask you guys, is MySQL binlog extracted by CDC in strict order
If the programmer tells the truth during the interview
IBPS开源表单设计器有什么功能?
Server lease error in Hong Kong may lead to serious consequences
Do you have all the basic embedded knowledge points that novices often ignore?