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 i.e. spinning in a tight loop waiting for the lock to become free) is a big NO-NO for synchronization on single-CPU systems. Why is it admissible (even encouraged for short critical sections) in multi-CPU systems?
1. In a multi-CPU system, the thread holding the lock is likely running on another CPU, and so can release the lock while our thread is spinning.
2. Multi-CPU systems have much more processing power than single-CPU systems, and having one CPU tied up with busy looping is much less of an issue.
3. The alternative to busy looping is to give up the CPU and let another thread run. This is much more expensive in multi-CPU 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!