计算机体系结构3_单处理器内存访问顺序
2013-11-07 11:00
281 查看
一,单处理器访问顺序
1.指令execute和指令retire
Instruction execution creates results and status and determines whether or not the instruction causes an exception.
Instruction retirement commits the results of instruction execution, in program order, to software-visible resources such as memory, caches, write-combining
buffers, and registers, or it causes an exception to occur if instruction execution created one.
Retire instructions in program order, but implementations can execute instructions in any order, subject only to data dependencies.
2.读顺序
Generally, reads do not affect program order because they do not affect the state of software-visible resources other than register contents.
However, some system devices might be sensitive to reads. In such a situation software can map a read-sensitive device to a memory type that enforces strong
read-ordering, or use read/write barrier instructions to force strong read-ordering.
读不会影响程序运行顺序,因为读不会影响软件可见资源的状态和内容,对于读敏感的设备,软件可以将设备映射到strong-read-ordering的内存,或使用
barrier强制读顺序。
3.读准则
对于可缓存的内存,以下规则管理读的顺序:
当乱序读对软件透明,与顺序执行具有相同的效果时,乱序读允许。
允许预读。
当读的位置与写位置相同时,不允许读重排到写前边,否则,可以重排读操作到写操作前边。
4.写准则
写会影响程序运行顺序,因为写会影响软件可见资源的状态和内容,以下规则管理写的顺序:
通常不允许乱序写,如果执行乱序写,写操作只有知道前边的操作完成时,才可以写内存。处理器需要在软件不可见的buffer保存乱序写的结果,
直到可以将结果写到内存中。
对write-combining内存可能会执行乱序写。
不允许预测写,像乱序写一样,只有之前所有的操作都完成时,才可以将预写的结果保存到内存中,处理器通过一个私有buffer暂存预写结果直
到被这些结果写到内存中。
允许将写的结果缓存在buffer中,之后按照程序执行顺序将buffer中结果再写入到主存中。用于暂存写结果的buffer不被软件可见,但是之后
对被缓存数据的读写操作可以直接通过此buffer来完成。
允许写合并,通过使用使用类型为wc内存或non-temporal store指令,将多个写操作合并为一个写操作。当使用写合并时,其他写不同地址的
操作可能会被提前执行,只有当写顺序不影响程序执行顺序时,才可以被使用。
参考:
AMD64 Architecture Programmer’s Manual Volume 2: System Programming Chpter7
1.指令execute和指令retire
Instruction execution creates results and status and determines whether or not the instruction causes an exception.
Instruction retirement commits the results of instruction execution, in program order, to software-visible resources such as memory, caches, write-combining
buffers, and registers, or it causes an exception to occur if instruction execution created one.
Retire instructions in program order, but implementations can execute instructions in any order, subject only to data dependencies.
2.读顺序
Generally, reads do not affect program order because they do not affect the state of software-visible resources other than register contents.
However, some system devices might be sensitive to reads. In such a situation software can map a read-sensitive device to a memory type that enforces strong
read-ordering, or use read/write barrier instructions to force strong read-ordering.
读不会影响程序运行顺序,因为读不会影响软件可见资源的状态和内容,对于读敏感的设备,软件可以将设备映射到strong-read-ordering的内存,或使用
barrier强制读顺序。
3.读准则
对于可缓存的内存,以下规则管理读的顺序:
当乱序读对软件透明,与顺序执行具有相同的效果时,乱序读允许。
允许预读。
当读的位置与写位置相同时,不允许读重排到写前边,否则,可以重排读操作到写操作前边。
4.写准则
写会影响程序运行顺序,因为写会影响软件可见资源的状态和内容,以下规则管理写的顺序:
通常不允许乱序写,如果执行乱序写,写操作只有知道前边的操作完成时,才可以写内存。处理器需要在软件不可见的buffer保存乱序写的结果,
直到可以将结果写到内存中。
对write-combining内存可能会执行乱序写。
不允许预测写,像乱序写一样,只有之前所有的操作都完成时,才可以将预写的结果保存到内存中,处理器通过一个私有buffer暂存预写结果直
到被这些结果写到内存中。
允许将写的结果缓存在buffer中,之后按照程序执行顺序将buffer中结果再写入到主存中。用于暂存写结果的buffer不被软件可见,但是之后
对被缓存数据的读写操作可以直接通过此buffer来完成。
允许写合并,通过使用使用类型为wc内存或non-temporal store指令,将多个写操作合并为一个写操作。当使用写合并时,其他写不同地址的
操作可能会被提前执行,只有当写顺序不影响程序执行顺序时,才可以被使用。
参考:
AMD64 Architecture Programmer’s Manual Volume 2: System Programming Chpter7
相关文章推荐
- 深入理解计算机系统之旅(四)处理器(CPU)的体系结构
- 计算机体系结构之内存讲解
- 深入理解计算机系统——第04章——处理器体系结构
- 深入理解计算机系统--处理器体系结构
- 计算机体系结构1_内存类型
- 回过头再看 计算机体系结构3----内存屏蔽和内存栅栏
- (七)计算机体系结构/内存层次
- OS-计算机体系结构和内存层次
- 操作系统 笔记(三)计算机体系结构,地址空间、连续内存分配(四)非连续内存分配:分段,分页
- (二)计算机网络体系结构与参考模型
- 微机原理、计算机组成原理与计算机体系结构之间的关系
- 目前TOP500上的计算机采用什么体系结构?
- C++异常机制的实现方式和开销分析 (大图,编译器会为每个函数增加EHDL结构,组成一个单向链表,非常著名的“内存访问违例”出错对话框就是该机制的一种体现)
- 计算机组成与体系结构------磁盘调度
- 哲学意思上的计算机知识体系结构
- 深入理解计算机系统(4.1)---X86的孪生兄弟,Y86指令体系结构
- 【计算机体系结构】汇编语言--jmp 指令 IP修改问题
- 计算机体系结构 ---图2
- 【计算机体系结构】硬盘--硬件设备在linux下的文件名