38 lines
No EOL
822 B
Text
38 lines
No EOL
822 B
Text
MODULE main
|
|
VAR
|
|
wantp : boolean;
|
|
wantq : boolean;
|
|
procp : process user(wantp, wantq);
|
|
procq : process user(wantq, wantp);
|
|
ASSIGN
|
|
init(wantp) := FALSE;
|
|
init(wantq) := FALSE;
|
|
--SPEC
|
|
--AG (proc1.state = entering -> AF proc1.state = critical)
|
|
|
|
MODULE user(wantp, wantq)
|
|
VAR
|
|
state : {p1,p2,p3,p4,p5,p6,p7};
|
|
ASSIGN
|
|
init(state) := p1;
|
|
next(state) :=
|
|
case
|
|
state = p1 : {p1,p2};
|
|
state = p2 : p3;
|
|
state = p3 & wantq = TRUE : p4;
|
|
state = p3 & wantq = FALSE : p6;
|
|
state = p4 : p5;
|
|
state = p5 : p3;
|
|
state = p6 : p7;
|
|
state = p7 : p1;
|
|
TRUE : state;
|
|
esac;
|
|
next(wantp) :=
|
|
case
|
|
next(state) = p3 : TRUE;
|
|
next(state) = p5 : FALSE;
|
|
next(state) = p1 & state = p7 : FALSE;
|
|
TRUE : wantp;
|
|
esac;
|
|
FAIRNESS
|
|
running |