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

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 03:00
Using a conditional expression, write a statement that increments numusers if updatedirection is 1, otherwise decrements numusers. ex: if numusers is 8 and updatedirection is 1, numusers becomes 9; if updatedirection is 0, numusers becomes 7.
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
question
Computers and Technology, 24.06.2019 22:00
Difference between ancient and modern mode of information transmission
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
Rom is designed for computer instructions temporary storage of data processing data
Answers: 1
You know the right answer?
The first known correct software solution to the critical-section problem for two processes was deve...
Questions
question
Mathematics, 23.04.2021 21:50
question
Social Studies, 23.04.2021 21:50
question
Chemistry, 23.04.2021 21:50
question
Mathematics, 23.04.2021 21:50
question
Mathematics, 23.04.2021 21:50
question
Mathematics, 23.04.2021 21:50
Questions on the website: 13722362