The following algorithm attempts to enforce mutual exclusion between two processes P1 and P2 each of which runs the code below. You can assume that initially sema = 0.
while true do{
atomic{if sema = 0
then sema:= 1
else
go to line 2}
critical section;
sema:= 0;
}
How Can I model this code in promela/SPIN?
Thank you.