1

"Given the following algorithm for two processes, 0 and 1:

Process (i)
REPEAT WHILE Interest [j] = 1 DO;
START
     Interest [i]:=1;
     Critical Section;
     Interest [i]:=0;
     Non-critical Section;
END

where i=0,1; j=1-i;, and Interest is a vector of shared variables of size 2 and initialized at 0.

Check if the mutual exclusion requirements are met. Does the algorithm comply with the conditions to have processes adequately progressing?"

Can you help me reasoning this problem from my OS class?

Leon Horka
  • 153
  • 2
  • 15

1 Answers1

0

The algorithm does guarantee progress, but does not guarantee mutual exclusion. Its very clear that when both the process simultaneously try to enter the critical section, they both will succeed in entering the critical section, and the reason is:

both Interest [0] := 0 and Interest [1] := 0, therefore both the processes would come out of the while loop.

Sumeet
  • 8,086
  • 3
  • 25
  • 45