subject

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.

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 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 24.06.2019 10:00
(, urgent need): how do i change my username
Answers: 1
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
You know the right answer?
A multithreaded web server wishes to keep track of the number of requests it services (known as hits...
Questions
question
Mathematics, 15.01.2020 13:31
question
Mathematics, 15.01.2020 13:31
Questions on the website: 13722367