1. Process O turns red ; records no =0,| sent (0,1)|=1, and | received (2,0)|=0; and sends the marker along (0,1). 2. Process 1 receives the token and forwards it along (1,2) before receiving the marker . Then , it receives the marker ; turns red ; records n1=0,| received (0,1)|=1, and t ,2= l ; andsends the marker along (1,2). 3. Process 2 receives the token and forwards it along (2,0) before receiving the marker . Then , it receives the marker ; turns red ; records n2=0,| received (1,2)=1, and | sent (2,0)|=1; and forwards the marker to process 0. 4. Process O receives the token and then receives the marker along (2,0). The algorithm terminates here .The total number of tokens recorded is as follows :( no + n ]+n2)+(| sent (0,1)- received (0,1)|)+(| sent (1,2)|-| received (1,2)|)+(| sent (2,0)|-| received (2,0)|)=1. This is consistent with the expected outcome .. Let machine i start Chandy-Lamport snapshot before it has sent M along ch1. Also, let machine j receive the marker after it sends out M’ along ch2. Observe that the snapshot state is down ∅ up M’ Doesn’t this appear strange? This state was never reached during the computation!再举至少两个运行场景的例子,并分析它们的特征,比如是否仍然是循环的;若有循环,循环的规律是什么等等
时间: 2024-01-14 15:03:57 浏览: 64
运行场景1:
1. Process 0 turns red; records no=0, |sent(0,1)|=1, and |received(2,0)|=0; and sends the marker along (0,1).
2. Process 1 receives the token and forwards it along (1,2) before receiving the marker. Then, it receives the marker; turns red; records n1=0, |received(0,1)|=1, and |sent(1,2)|=1; and sends the marker along (1,2).
3. Process 2 receives the token and forwards it along (2,0) before receiving the marker. Then, it receives the marker; turns red; records n2=0, |received(1,2)|=1, and |sent(2,0)|=1; and forwards the marker to process 0.
4. Process 0 receives the token and then receives the marker along (2,0). The algorithm terminates here.
特征:这个运行场景与原始的运行场景相同,除了Process 2在接收到标记之前还将令牌转发到了Process 0。
运行场景2:
1. Process 0 turns red; records no=0, |sent(0,1)|=1, and |received(2,0)|=0; and sends the marker along (0,1).
2. Process 1 receives the token and forwards it along (1,2) before receiving the marker. Then, it receives the marker; turns red; records n1=0, |received(0,1)|=1, and |sent(1,2)|=1; and sends the marker along (1,2).
3. Process 2 receives the marker before receiving the token. It turns red; records n2=0, |received(1,2)|=1, and |sent(2,0)|=0; and forwards the marker to process 0.
4. Process 0 receives the token and then receives the marker along (2,0). The algorithm terminates here.
特征:这个运行场景与原始的运行场景相同,除了Process 2在接收到标记之前没有将令牌转发到Process 0。这个场景证明了即使有一些进程在接收到标记之前没有将令牌转发到下一个进程,仍然能够捕获到一致的全局快照。
阅读全文