UniTO/anno2/YearI/SecondSem/VPC/labs/analisi/3.2/alg36.smv

42 lines
901 B
Text
Raw Normal View History

2018-11-22 13:09:11 +01:00
MODULE main
VAR
wp : boolean;
wq : boolean;
p : process user(wp,wq);
q : process user(wq,wp);
ASSIGN
init(wp) := FALSE;
init(wq) := FALSE;
SPEC -- PROGRESS
AG (p.state = local -> EF p.state = enter )
SPEC -- MUTUAL EXCLUSION
AG !(p.state = critical & q.state = critical)
SPEC -- DEADLOCK
AG (p.state = enter -> AF (p.state = critical | q.state = critical))
SPEC -- INDIVIDUAL STARVATION
AG (p.state = enter -> AF p.state = critical)
MODULE user(wp, wq)
VAR
state : {local,enter,set,critical,exit};
ASSIGN
init(state) := local;
next(state) :=
case
state = local : {local, enter};
state = enter & wq = FALSE : set;
state = set : critical;
state = critical : exit;
state = exit : local;
TRUE : state;
esac;
next(wp) :=
case
state = set : TRUE;
state = exit : FALSE;
TRUE : wp;
esac;
FAIRNESS
running