分布式系统-时间和全局状态.pptVIP

  • 64
  • 0
  • 约9.71千字
  • 约 68页
  • 2017-07-01 发布于湖北
  • 举报
分布式系统-时间和全局状态

分布式调试 异步系统   开销很大,需要作O(kN)次比较。  同步系统  物理时钟:|Ci(t) - Cj(t) |D,即在范围D内同步。 同步系统中的算法改进 消息中同时携带物理时间戳和向量时间戳 测试条件   V(si)[i] ≧V(si)[i] ,且si和sj能在同一时间发生 第3章 时间和全局状态 简介 时钟、事件和进程状态 物理时钟同步 逻辑时间和逻辑时钟 全局状态 分布式调试 小结 小结 时钟偏移和时钟漂移 物理时钟同步 Cristian方法 Berkeley方法 网络时间协议 逻辑时间 发生在先关系 Lamport时间戳 向量时钟 小结 全局状态 一致割集,一致全局状态 “快照”算法 分布式调试 状态收集 判定可能的?和明确的? 作业 11.4 11.14 Databases-R-Us runs a cluster of three servers A, B, and C, which communicate with one another. You are told that the current clock skews between server pairs are as follows: A-B: 3 ms; B-C: 1 ms; C-A: -4 ms. Further, you are told that correctness in the database requires that no two server clocks be more than 30ms apart. If each of the servers has an absolute clock drift of 2 ms per minute, how many minimum (i.e., worst-case) minutes can the cluster go without running a synchronization algorithm among its servers? 作业 a, b, and c are events and no two events belong to the same process. Prove or disprove (give counter-example) the following: (a)a is concurrent with b and b is before c implies that a is before c. (b)a is concurrent with b and b is concurrent with c implies that a is concurrent with c. 逻辑时间和逻辑时钟 Lamport时钟练习答案 逻辑时钟:0 1 4 4 3 2 8 6 5 7 5 7 9 逻辑时间和逻辑时钟 不同进程产生的消息可能具有相同数值的Lamport时间戳 物理 时间 逻辑时间和逻辑时钟 基于Lamport时间戳的事件排序---总结 算法不依赖于事件发生的真实时间 与真实物理时间中事件的发生顺序可能不一致   基于Lamport时间戳的排序中,在时刻(2,1)发生的事件发生比在时刻(2,2)发生的事件要早,然而在真实物理时间中可能恰好相反。 逻辑时间和逻辑时钟 Lamport时钟不具备性质:若L(A) L(B)则A?B 没有捕获事件的因果关系  节点B发布一篇文章并传送给节点A和C。节点A就此发表评论并传送给节点B和C。 a r a a r r 我们无法准确确定r的先后关系: C(a) C(r) a ?r a 是节点A发布的文章 r 是节点B对文章a的评论 全序逻辑时钟 引入进程标示符创建事件的全序关系 若e、e’分别为进程pi、pj中发生的事件,则其全局逻辑时间戳分别为(Ti,i)、(Tj,j)。 e?e’ TiTj || Ti=Tj ij 系统中各个事件Lamport时间戳均不相同 向量时钟 克服Lamport时钟的缺点:若L(e) L(e’)不能推出则e?e’。 每个进程维护它自己的向量时钟Vi VC1:初始情况下,Vi[j]=0,i,j=1,2,...N. VC2:在pi给事件加时间戳之前,设置Vi[i]= Vi[i]+1。 VC3:pi在它发送的每个消息中包括t=Vi。 VC4:当pi接收到消息中的时间戳t时,设置Vi[j]=max(Vi[j],t[j]),j=1,2,...,N。 向量时钟 Host 1 Host 2 Host 3 Host 4 0,0,0,0 Vector logical clock Message (vector ti

文档评论(0)

1亿VIP精品文档

相关文档