Practical TLA+ by Hillel Wayne

Practical TLA+ by Hillel Wayne

Author:Hillel Wayne
Language: eng
Format: epub
ISBN: 9781484238295
Publisher: Apress


For any two threads, they both can’t be in CS at the same time. We need the t1 /= t2 clause in there to make sure they’re different threads. Otherwise, TLC can pick the same thread as both t1 and t2.

In any case, let’s run the spec with Threads <- 1..2, INVARIANT AtMostOneCritical, Deadlock. The spec should fail with a deadlock after three steps. Both threads can turn on the flag at once. An early attempted solution was to have the flags enter a loop, constantly turning their own flag on and off until one of them gets into the critical section.fair process thread \in Threads

begin

P1: flag[self] := TRUE;

P2:

while \E t \in Threads \ {self}: flag[t] do

P2_1: flag[self] := FALSE;

P2_2: flag[self] := TRUE;

end while;

CS: skip;

P3: flag[self] := FALSE;

P4: goto P1;

end process;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.