|
Waiting Algorithms
- Busy wait (common in multiprocessors)
- Waiting processes repeatedly poll a location (implemented as a load in a loop)
- Releasing process sets the location appropriately
- May cause network or bus transactions
- Block
- Waiting processes are de-scheduled
- Frees up processor cycles for doing something else
- Busy waiting is better if
- De-scheduling and re-scheduling take longer than busy waiting
- No other active process
- Does not work for single processor
- Hybrid policies: busy wait for some time and then block
Implementation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|