subject

You are given a new atomic primitive, called FetchAndSubtract(). It executes as a single atomic instruction, and is defined as follows: int FetchAndSubtract(int *location) {
int value = *location; // read the value pointed to by location
*location = value - 1; // decrement it, and store result back
return value; // return old value
}

Write the lock_init(), lock(), and unlock() routines that use FetchAndSubtract() to implement a working lock. Also define a lock_t structure.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
question
Computers and Technology, 24.06.2019 09:50
Self contained sequences of actions to be performed are? a. expressions b. algorithms c. functions d. formulas
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
You know the right answer?
You are given a new atomic primitive, called FetchAndSubtract(). It executes as a single atomic inst...
Questions
question
English, 08.12.2020 19:30
question
Arts, 08.12.2020 19:30
question
Mathematics, 08.12.2020 19:30
Questions on the website: 13722363