Computers and Technology

A multithreaded web server wishes to keep track of the number of requests it services (known as hits.) Consider the following two strategies to prevent a race condition on the variable hits. The first strategy is to use a basic mutex lock when updating hits: int hits;
mutex lock hit lock;
hit lock. acquire();
hit lock. release();
A second strategy is to use an atomic integer:
atomic t hits;
atomic inc(&hits);
Explain which of these two strategies is more efficient.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, uh8hardiek
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
image
Computers and Technology, 24.06.2019 06:30, toolazytobehuman
Me and category do i put them in because this is science
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, Dkhaurithompson
Selective is defined as paying attention to messages that are consistent with one’s attitudes and beliefs and ignoring messages that are inconsistent.
Answers: 1
image
Computers and Technology, 24.06.2019 11:00, asiaosterling
The program below has been generalized to read a user's input value for hourlywage. run the program. notice the user's input value of 10 is used. modify that input value, and run again. generalize the program to get user input values for workhoursperweek and workweeksperyear (change those variables' initializations to 0). run the program. monthsperyear will never change, so define that variable as final. use the standard for naming final variables. ex: final int max_length
Answers: 2
Do you know the correct answer?
A multithreaded web server wishes to keep track of the number of requests it services (known as hits...

Questions in other subjects: