Question: Problem 1. Bidirectional array ( 20 points). Model the following token-based mutual exclusion algorithm that works on a bidirectional array. There are N processes {0,,N1}
Problem 1. Bidirectional array ( 20 points). Model the following token-based mutual exclusion algorithm that works on a bidirectional array. There are N processes {0,,N1} in an array. Each process i, has a single variable s[i] that takes values in the set {0,1,2,3} independent of the size of the array. The two processes 0 and N1 behave differently from the rest, they can take two values each s[0] can take values {1,3} and s[N1] can take values {0,2}. Let Nbrs(i) be the set of neighboring processes for process i. That is, Nbrs(i)={(i+1)modN,(i1)modN} Note that Nbrs(0)={1} and Nbrs(N1)={N2}. 1. Program for processes, i,i=0 or i=N1 : if jNbrs(i):s[j]=s[i]+1mod4 then s[i]=s[i]+2mod4 2. Program for processes, i,0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
