subject

The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and P1, share the following variables:

boolean flag[2]; / initially false /
int turn;

The structure of process Pi (i == 0 or 1) is shown in Figure 5.21. The other process is Pj (j == 1 or 0). Prove that the algorithm satisfies all three requirements for the critical-section problem.

FIGURE 5.21
do {
flag[i] = true;

while (flag[j]) {

if (turn == j) {
flag[i] = false;
while (turn == j) ; / do nothing /
flag[i] = true;
}
}

/ critical section /

turn = j;
flag[i] = false;

/ remainder section /

} while (true);

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, kadariusmerchan
Determine which of the four levels of measurement (nominal, ordinal, interval, ratio) is most appropriate for the data below. internet speed levels of "fast comma " "medium comma " and "slow" choose the correct answer below. a. the ordinal level of measurement is most appropriate because the data can be ordered comma but differences left parenthesis obtained by subtraction right parenthesis cannot be found or are meaningless. nothing nothing nothing nothing nothing b. the interval level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is no natural starting point. c. the nominal level of measurement is most appropriate because the data cannot be ordered. nothing d. the ratio level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is a natural starting point.
Answers: 2
image
Computers and Technology, 22.06.2019 15:30, 1232444553
Which of the following examples has four beats in each measure?
Answers: 2
image
Computers and Technology, 22.06.2019 16:10, katherineweightman
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, Arealbot
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
You know the right answer?
The first known correct software solution to the critical-section problem for two processes was deve...

Questions in other subjects:

Konu
English, 06.11.2020 23:40
Konu
Mathematics, 06.11.2020 23:40