- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* c1 = 1 c2 = 1 ……. Deadlock * 两个进程都在不断的改变状态,但是都无法进入 另外一种情况,是某个进程始终无法得到服务 * 注意由于turn 只有一个值,因此L:中的条件 两进程只能有一个条件满足。 * * * * * * * * * * * * * * * * * * * * * * * * * * * The University of Adelaide, School of Computer Science * Chapter 2 — Instructions: Language of the Computer * * * * * * * * * * * Sequential Consistency * Sequential concurrent tasks: T1, T2 Shared variables: X, Y (initially X = 0, Y = 10) T1: T2: Store (X), 1 (X = 1) Load R1, (Y) Store (Y), 11 (Y = 11) Store (Y’), R1 (Y’= Y) Load R2, (X) Store (X’), R2 (X’= X) what are the legitimate answers for X’ and Y’ ? (X’,Y’) ? {(1,11), (0,10), (1,10), (0,11)} ? If y is 11 then x cannot be 0 * 计算机体系结构 Sequential Consistency * 存储同一性模型比单处理器上运行的程序的数据相关约束施加了更多的存储器操作约束 T1: T2: Store (X), 1 (X = 1) Load R1, (Y) Store (Y), 11 (Y = 11) Store (Y’), R1 (Y’= Y) Load R2, (X) Store (X’), R2 (X’= X) additional SC requirements 带有Cache 或 具有out-of-order执行能力的系统可以提供SC的存储器视图吗? Dependencies requirements * 计算机体系结构 Issues in Implementing Sequential Consistency * 现代计算机系统实现SC 的两个问题 Out-of-order execution capability Load(a); Load(b) yes Load(a); Store(b) yes if a ? b Store(a); Load(b) yes if a ? b Store(a); Store(b) yes if a ? b Caches Cache使得某一处理器的store操作不能被另一处理器即时看到 No common commercial architecture has a sequentially consistent memory model! * 计算机体系结构 Memory FencesInstructions to sequentialize memory accesses * 实现弱同一性或放松的存储器模型的处理器(允许针对不同地址的 loads 和stores操作乱序)需要提供存储器栅栏指令来强制对某些存储器操作串行化 Examples of processors with relaxed memory models: Sparc V8 (TSO,PSO): Membar Sparc V9 (RMO): Membar #LoadLoad, Membar #LoadStore Membar #StoreLoad, Membar #StoreStore PowerPC (WO): Sync, EIEIO ARM: DMB (Data Memory Barrier) X86/64: mfence (Global Memory Barrier) 存储器栅栏是一种代价比较大的操作,仅仅在需要时,对存储器操作串行化 * 计算机体系结构 Using Memory Fences * Producer posting Item x: Load Rtail, (tail) Store (Rtail), x MembarSS Rtail=Rtail+1 Store (tail),
文档评论(0)