1 / 6

Eisenburg-McGuire algorithm for mutual exclusion

Learn about the Eisenburg-McGuire algorithm for mutual exclusion, its fairness property, implementation details, and potential issues.

lnieto
Download Presentation

Eisenburg-McGuire algorithm for mutual exclusion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Eisenburg-McGuire algorithm for mutual exclusion • Eisenburg-McGuire algorithm, CACM 1972 • Also appears in a popular OS textbook (Operating System Concepts, Silberschatz & Galvin) • The first mutual exclusion algorithm with good fairness property : n-1 bounded bypass

  2. Eisenburg-McGuire ME Algorithm – Data Structure There are n processes with id i in {0,1,…,n-1} Shared variables: • turn :{0,.....,n-1}, initially arbitrary • flag(i): {idle, want-in, in-cs} for each process i; initially idle Private variable j : integer ; for each process i In general, the contending process with id larger than turn and is closer to turn has higher priority.

  3. Eisenburg-McGuire ME Algorithm – Trying Region 1 repeat 2 flag(i) := want-in 3 j := turn 4 while not(j=i) do 5 if not(flag(j) = idle)) then j := turn 6 else j := j+1 mod n fi 7 od 8 flag(i) := in-cs 9 j := 0 10 while ( j < n) and ( j = i or not(flag( j) = in-cs) ) do j:= j+1 od 11 until ( j >= n) and (turn = i or flag(turn) = idle) 12 turn := i

  4. Eisenburg-McGuire ME Algorithm – Exit Region 13 ***** CS ****** 14 j := i+1 mod n 15 while flag( j) = idle do j := j+1 mod n od 16 turn := j 17 flag(i) := idle • ***** Remainder Region ***** • until false

  5. Question 1: • Is it possible for more than one process to reach line 8 at the same time? Why? Show the details. • Question 2: • Suppose the code of trying region is as follows. • 1 repeat • 8 flag(i) := in-cs • 9 j := 0 • 10 while ( j < n) and ( j = i or not(flag( j) = in-cs) ) do j:= j+1 od • 11 until ( j >= n) • 12 turn := i • What will go wrong with the algorithm? Why? Show the details.

  6. Question 3: • Prove that the original algorithm satisfies progress requirement (that is, there is no deadlock).

More Related