| Model Name | mutex_L_N2 | 
| Description | Mutual exclusion with nonatomic operations by Lamport. This algorithm is not starvation-free.  | 
| Source Code | mutex_L_N2.pml | 
| 出典 | James H. Anderson and Yong-jik Kim. Shared-memory mutual exclusion: Major research trends since (1986). Distributed Computing, pages 75-110, 2003.  | 
shared variable P: array[0..N - 1] of boolean initially false process p /* 0 <= p < N */ private variable i: 0..N - 1 while true do 1: Noncritical Section; 2: P[p] := true; 3: for i := 0 to p - 1 do 4: if P[i] then 5: while P[i] do 6: P[p] := false od; 7: go to 2 fi od; 8: for i := p + 1 to N - 1 do 9: await ¬P[i] od; 10: Critical Section; 11: P[p] := false od
| N | プロセス数 | 
| 名前 | Source Code | 性質(LTL記述) | 説明 | 
| safety1 | mutex_L_N2.safe1 | collision | クリティカルセクションに複数のプロセスが侵入してしまう. | 
| liveness1 | mutex_L_N2.live1 | ! ([] (wait -> <> (cs))) | プロセスがwait状態にあるならば、いつかクリティカルセクションに入る. | 
| liveness2 | mutex_L_N2.live2 | ! ([] ( (! cs) -> <> cs)) | クリティカルセクションにいないプロセスは、いつかクリティカルセクションに入ることができる. | 
| liveness3 | mutex_L_N2.live3 | ! ([] <> someoneincs) | いつか、あるプロセスがクリティカルセクションに入る. | 
$ spin -a -DN=5 -N mutex_L_N2.safe1 mutex_L_N2.pml $ gcc -o pan pan.c $ ./pan
$ spin -a -DN=6 -N mutex_L_N2.live2 mutex_L_N2.pml $ gcc -o pan pan.c $ ./pan -a
最終更新日:2008/08/24