subject

Do {
while (true) {
flag[i] = want in; j = turn;
while (j != i) {
if (flag[j] != idle) {
j = turn;
else
j = (j + 1) % n;
}
flag[i] = in cs;
j = 0;
while ( (j < n) && (j == i || flag[j] != in cs))
j++;
if ( (j >= n) && (turn == i || flag[turn] == idle))
break;
}
/* critical section */
j = (turn + 1) % n;
while (flag[j] == idle)
j = (j + 1) % n;
turn = j;
flag[i] = idle;
/* remainder section */
} while (true) ;

Think about this general question:
Why does Eisenberg-McGuire as a software solution to the n-process critical sector problem require 2 levels of scanning, and 2 levels of activation (WANT_IN, IN_CS)?
Hint: this is a software solution and does not imply the use of an atomic test-and-set or compare_and_swap. Answer each part of the specific question 1 that applies (a and b, or a and c).
The first while loop in Eisenberg-McGuire checks all processes' flag[] from the one holding "turn" to ourselves, stopping at each one that is not idle until it is idle, then proceeding.

(a) Is it possible for two or more processes to go through this first loop and find all processes but itself idle? Explain either way, not just yes or no.
(b) If this is not possible, why docs each process finding all others idle need the second loop, to tentatively claim the CS, that is set its flag to IN_CS and then scan to see if any other process has also asserted IN_CS? Why wouldn't the process finding all but itself idle automatically have turn set to it by the process exiting the CS? Why not just enter the CS if all other processes are idle?
(c) If it is possible for 2 or more processes to find all but themselves idle, would they have to wait for "turn" or could they try to enter the CS at the same time? Explain your conclusion. Hint: must a process waiting for the CS have to get the "turn" or is there another condition in which it can enter?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 21:10
Asample of 200 rom computer chips was selected on each of 30 consecutive days, and the number of nonconforming chips on each day was as follows: 8, 19, 27, 17, 38, 18, 4, 27, 9, 22, 30, 17, 14, 23, 15, 14, 12, 20, 13, 18, 14, 20, 9, 27, 30, 13, 10, 19, 12, 26. construct a p chart and examine it for any out-of-control points. (round your answers to four decimal places.)
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
Cómo pongo un tomo de llamada sin pagar?
Answers: 1
question
Computers and Technology, 24.06.2019 09:50
Create a string list. 2. use console.readline() to collect values of firstname, lastname, street, city, state, zip, save them to list. 3. write a simple linq statement, call method uppercasewords() to change first letter to uppercase. 4. create a foreach statment to display the information. public static string uppercasewords(string value) { char[] array = value.tochararray(); if (array.length > = 1) { if (char.islower(array[0])) { array[0] = char.toupper(array[0]); } } for (int i = 1; i < array.length; i++) { if (array[i - 1] == ' ') { if (char.islower(array[i])) { array[i] = char.toupper(array[i]); } } } return new string(array);
Answers: 3
question
Computers and Technology, 24.06.2019 13:00
Which one of the following functions is not available on the autosum tool? sum average if max
Answers: 3
You know the right answer?
Do {
while (true) {
flag[i] = want in; j = turn;
while (j != i) {
if (fla...
Questions
question
Mathematics, 19.07.2021 17:00
Questions on the website: 13722362