subject
Computers and Technology, 10.03.2020 01:37 leighsa

Race conditions are possible in many computer systems. Consider an online auction system where the current highest bid for each item must be maintained. A person who wishes to bid on an item calls the bid(amount) function, which compares the amount being bid to the current highest bid. If the amount exceeds the current highest bid, the highest bid is set to the new amount. This is illustrated below:
double amount = 0.0;
void bid(double amount) {
if (amount > highestBid)
highestBid = amount;

}
Describe how a race condition is possible in this situation (you may describe it with some scenario)?
What might be done to prevent the race condition from occurring? (you may just modify the code using "acquire()" and "release()" statements)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
question
Computers and Technology, 22.06.2019 17:30
Where would you click to edit the chart data?
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
You know the right answer?
Race conditions are possible in many computer systems. Consider an online auction system where the c...
Questions
question
Computers and Technology, 19.10.2019 01:30
question
Mathematics, 19.10.2019 01:30
question
History, 19.10.2019 01:30
question
Mathematics, 19.10.2019 01:30
Questions on the website: 13722367