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

  • Thread starter Thread starter prashantgolu
  • Start date Start date
  • Tags Tags
    Functions Signal
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 5K views
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...?
 
Physics 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.