Please submit all solutions in hard-copy (i.e., printed on paper).
a[N].
Using Java, implement solutions in Java in the following styles:
PR
processes.T.
S1: x = x + y
S2: y = x - y
S3: x = x - y
Assume that x is initally 2 and that y is
initally 5. For each of the following, what are the possible final values
of x and y? Explain your aswers.
S1; S2; S3; co < S1; > // < S2; >
//< S3; > oc co < await (x > y) S1; S2; > //
< S3; > oc
int x = 0;
co < await (x != 0) x = x -2; >
// < await (x != 0) x = x - 3; >
// < await (x == 0) x = x + 5; >
oc
Develop a proof outline that demonstrates that the final value of
x is 0. Use the techniques of weakened assertions and excluded
configurations (you may need to introduce one or more thought variables) to
show non-interference.
int lock = 0;
process CS[i = 1 to n] {
while (true) {
< await (lock == 0) >; lock = i; Delay;
while (lock != i) {
< await (lock == 0) >; lock = i; Delay;
}
critical section;
lock = 0;
noncritical section;
}
}
Delay code is deleted. Does the protocol have
the four required properties of a CS protocol? Carefully explain your
answer in each case.Delay code spins for long enough
to ensure tha tevery process i that waits for
lock to be 0 has time to execute the assignmetn statement that
sets lock to i. Does the protocol now satisfy the
CS requirements? Again carefully explain each of your answer.Last modified: Mon 2004.02.02 at 16:59 NST by Dennis Peters