计算机体系结构3_单处理器内存访问顺序

一,单处理器访问顺序

     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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值