Understanding Busy Waiting in Wait() and Signal() Functions

  • Thread starter Thread starter prashantgolu
  • Start date Start date
  • Tags Tags
    Functions Signal
Click For Summary

Discussion Overview

The discussion revolves around the concept of busy waiting in the context of the wait() and signal() functions, particularly in operating systems. Participants explore how busy waiting can be mitigated through the use of block and wakeup functions, referencing the text by Galwin.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants note that while block and wakeup functions are used to avoid busy waiting, Galwin suggests that busy waiting cannot be completely eliminated.
  • It is mentioned that busy waiting has been removed from the entry to the critical section but is still present in the critical sections of wait() and signal() operations, which are described as short.
  • One participant questions the definition of busy waiting, suggesting it typically involves a thread being CPU-bound in a loop waiting for a variable to change, and contrasts this with the behavior of block() and wakeup() calls.
  • Another participant states that busy waiting is not entirely eliminated, particularly in idle cases where no threads are active until an event occurs, and mentions that some operating systems may use a halt instruction to reduce CPU overhead during idle times.

Areas of Agreement / Disagreement

Participants express differing views on the extent to which busy waiting can be eliminated, with some suggesting it is reduced but not entirely removed, while others seek clarification on the implications of using block and wakeup functions.

Contextual Notes

There is a lack of consensus on the definitions and implications of busy waiting, particularly in relation to different operating systems and their handling of thread states.

prashantgolu
Messages
50
Reaction score
0
To avoid busy waiting...we use block and wakeup functions in our definition of wait() and signal()

but its mentioned in Galwin that still we have not been able to eliminate busy waiting completely...

"we have just removed busy waiting from entry to the critical section...futhermore we have limited busy waiting to only the critical sections of Wait() and Signal() operations...and these sections are short...thus critical section is alsmost never occupied and busy waiting occurs rarely..."

what do they mean by this...?
 
Technology news on Phys.org
prashantgolu said:
To avoid busy waiting...we use block and wakeup functions in our definition of wait() and signal()

but its mentioned in Galwin that still we have not been able to eliminate busy waiting completely...

"we have just removed busy waiting from entry to the critical section...futhermore we have limited busy waiting to only the critical sections of Wait() and Signal() operations...and these sections are short...thus critical section is alsmost never occupied and busy waiting occurs rarely..."

what do they mean by this...?

It would help if you stated what language and book you're referring to.
 
Using Galwin for operating system...and using c++ :)
 
I don't understand this. "Busy waiting" normally implies that a thread is cpu bound in a loop waiting for a volatile variable to change by some other thread (it there's no time slicing with the particular OS, then the other thread would have to be higher priority).

With block() and wakeup() calls (for Windows mutexes and semaphores are normally used), the cpu overhead isn't zero, but nothing is looping unless all threads are blocked waiting for some interrupt event, and in that case, the cpu may be halted instead of looping in an idle loop.
 
when we use block and wakeup...now...is busy waiting altogether eliminated ..?
 
prashantgolu said:
when we use block and wakeup...now...is busy waiting altogether eliminated?
It's eliminated except for the idle case where there's nothing to do in any thread until some event (interrupt) occurs. As mentioned, in some OS's the idle "loop" is actually a halt instruction, which reduces power consumption slightly on some cpu's.
 

Similar threads

Replies
56
Views
6K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
17
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K