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

  • Thread starter Thread starter prashantgolu
  • Start date Start date
  • Tags Tags
    Functions Signal
Click For Summary
The discussion centers on the concept of busy waiting in operating systems, specifically in the context of using block and wakeup functions within wait() and signal() operations. While these functions aim to minimize busy waiting by blocking threads instead of having them continuously loop while waiting for a resource, it is noted that busy waiting cannot be completely eliminated. According to Galwin, busy waiting has been largely removed from entering the critical section but still exists within the critical sections of wait() and signal() operations, which are typically short. This means that while busy waiting is rare, it can still occur during these operations. The conversation also highlights that using block() and wakeup() calls reduces CPU overhead significantly compared to traditional busy waiting, as threads are not actively looping but rather waiting for an interrupt event. However, in scenarios where all threads are blocked, some minimal busy waiting may still occur, particularly in idle states where the CPU may enter a halt state to conserve power.
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.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

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