Consider the following program which provides a software approach to mutual exclusion: Integer array control [1: N];

Question:

Consider the following program which provides a software approach to mutual exclusion:

Integer array control [1: N]; integer k

Where 1 ≤ k ≤ N, and each element of “control” is either 0, 1, Or 2. All elements of “control” are initially zero; the initial valueof k is immaterial.

The program of the ith process (1 ≤ i ≤ N) is

begin integer j;

L0: control [i] := l;

LI: for j:=k step l until N, l step l until k do

begin

if j = i then goto L2;

if control [j] ≠ 0 then goto L1

end;

L2: control [i] := 2;

for j := 1 step 1 until N do

if j ≠ i and control [j] = 2 then goto L0;

L3: if control [k] ≠ 0 and k ≠ i then goto L0;

L4: k := i;

critical section;

L5: for j := k step 1 until N, 1 step 1 until k do

if j ≠ k and control [j] ≠ 0 then

begin

k := j;

goto L6

end;

L6: control [i] := 0;

L7: remainder of cycle;

goto L0;

end

This is referred to as the Eisenberg-McGuire algorithm. Explain its operation and its key features.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: