Question: Three processes share a global variable x , and each process ( named P; in a mixed syntax ) performs the following: int k; /
Three processes share a global variable x and each process named P; in a mixed syntax performs the following:
int k; local variable
for k ; k ; k
LOADx; INCREMENTx; STOREx;
That is each process executes x; five times, but each assignment is realized in three steps using its own local register. Now consider the following parallel program:
x ;
run P; run P; run P;
Can the final value of x be as small as or Check possible outcomes using Spin, explain the results, and generalize them.
Hint:
Model the three processes and the main init program in Prolmela by implementing the behavior of LOAD, INCREMENT, and STORE using the constructs of Promela eg local variables
Suppose you think x can be but not less. Then you should: a verify that x is a possible outcome upon termination. This can be done by asserting that, when only one process the main process remains active after three run P; x cannot be The number of active processes can be obtained by the nrpr special variable or by counting them explicitly. b Verify that x is not a possible outcome upon termination.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
