Computers and Technology

Dijkstra posed each of the following solutions as a potential software solution to the critical section problem and then explained why they failed [Dijkstra, 1968]. Provide your explanation about why they failed. a. proc (int i) {
while (TRUE ) {
compute;
while (turn ! = i);
critical_section ;
turn = (i+1) mod 2;
}
shared int turn;
turn = 1;
fork ( proc, 1, 0);
fork (proc, 1, 1); 8.6
b. proc (int i) {
while (TRUE)
compute;
while (flagt ( i+1 ) mod 21);
flag [i]
critical_section; TRUE;
flag[i] FALSE;
}
}
shared boolean flag[2];
flag[1] = FALSE; flag[0]
fork ( proc , 1, 0);
fork (proc, 1, 1);
c. proc (int i) {
while (TRUE ) {
compute;
flag [i] = TRUE ;
while (flagl (i+1) mod 2] );
critical_section;
flag [i] = TRUE; FALSE;
}
}
shared boolean flag[2];
flag[0] flag [ 1 ] = FALSE;
fork (proc, 1, 0);
fork ( proc, 1, 1);

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:30, Princessirisperez0
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e. g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
image
Computers and Technology, 24.06.2019 04:10, kris1920
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
image
Computers and Technology, 24.06.2019 22:10, jsjsjsskakwkowwj
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 ∗ x3+ . . +an ∗ xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 ∗ 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
image
Computers and Technology, 24.06.2019 23:30, binkyv15
Adrian has decided to subscribe for a new internet connection. he wants a high speed connection so that he can stream video content smoothly. which access technology would you advise adrian against using?
Answers: 1
Do you know the correct answer?
Dijkstra posed each of the following solutions as a potential software solution to the critical sect...

Questions in other subjects:

Konu
Mathematics, 17.02.2022 03:20