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 09:00
What is one way in which tablets differ from laptops and notebooks? tablets are designed for touch-based interaction. tablets are designed to be used as desktops. tablets are designed for input via a keyboard and mouse. tablets are designed to be larger than laptops.
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Sports and entertainment class, your goal is to increase attendance and make a profit for a game by getting your team on a winning track with total salaries less than $3,000,000
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
Pressing the backspace key deletes the text to the of the insertion point. the left or the right?
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
What are some examples of what can be changed through options available in the font dialog box? check all that apply. font family italicizing bolding pasting drop shadow cutting character spacing special symbols
Answers: 2
You know the right answer?
Race conditions are possible in many computer systems. Consider an online auction system where the c...
Questions
question
History, 25.01.2021 20:30
question
Chemistry, 25.01.2021 20:30
Questions on the website: 13722363