subject

A multithreaded web server wishes to keep track of the number of requests it services (known as hits). Consider the two following
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();
hits++;
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, 21.06.2019 22:00
Which is produced by the endocrine system to control how cells and organs function
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone else’s ?
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
You know the right answer?
A multithreaded web server wishes to keep track of the number of requests it services (known as hit...
Questions
question
English, 27.05.2021 14:00
question
Mathematics, 27.05.2021 14:00
question
Mathematics, 27.05.2021 14:00