Question: Implementing locks using busy waiting i . e . spinning in a tight loop waiting for the lock to become free ) is a big
Implementing locks using busy waiting ie spinning in a tight loop waiting for the lock to become free is a big NONO for synchronization on singleCPU systems. Why is it admissible even encouraged for short critical sections in multiCPU systems?
In a multiCPU system, the thread holding the lock is likely running on another CPU, and so can release the lock while our thread is spinning.
MultiCPU systems have much more processing power than singleCPU systems, and having one CPU tied up with busy looping is much less of an issue.
The alternative to busy looping is to give up the CPU and let another thread run. This is much more expensive in multiCPU systems, which makes busy looping very attractive.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
