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, 24.06.2019 16:50
How many types of string types does python support?
Answers: 1
question
Computers and Technology, 25.06.2019 04:20
Austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names. an unknown individual took control of austin's servers and transferred the domain names to another registrant without austin's permission. the new registrant began using the domain names to host malicious content—including hate letters to customers and fraudulent contact information—and to post customers' credit-card numbers and other private information, thereby tarnishing austin's goodwill. austin filed a suit in a federal district court against the new registrant under the anticybersquatting consumer protection act. is austin entitled to a transfer of the domain names? austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names
Answers: 3
question
Computers and Technology, 25.06.2019 06:00
If an image has only 4 colors, how many bits are necessary to represent one pixel’s color?
Answers: 1
question
Computers and Technology, 25.06.2019 08:00
In researching his history report about the civil war, why is ariq most likely to use secondary data than primary data? secondary data provides a starting point to find primary data. secondary data is easier and less time consuming to find. secondary data is always more reliable and credible. secondary data eliminates the need for other research.
Answers: 1
You know the right answer?
Do {
while (true) {
flag[i] = want in; j = turn;
while (j != i) {
if (fla...
Questions