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

In summary, Galwin says that busy waiting is eliminated except for the idle case, while the book says that busy waiting is eliminated except for the idle case when there's nothing to do in any thread.
  • #1
prashantgolu
50
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
  • #2
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.
 
  • #3
Using Galwin for operating system...and using c++ :)
 
  • #4
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.
 
  • #5
when we use block and wakeup...now...is busy waiting altogether eliminated ..?
 
  • #6
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.
 

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

1. What is busy waiting in wait() and signal() functions?

Busy waiting in wait() and signal() functions refers to a programming technique where a process continuously checks for a certain condition to be satisfied before proceeding with its execution. In this case, the process is waiting for a signal from another process to continue.

2. How do wait() and signal() functions work?

Wait() and signal() functions are typically used in multi-process or multi-threaded programming to allow processes to synchronize with each other. The wait() function causes a process to block or pause until a certain condition is met, while the signal() function sends a signal to another process to continue its execution.

3. What are the advantages of using wait() and signal() functions?

The use of wait() and signal() functions allows for efficient communication and synchronization between processes. It also helps prevent race conditions and ensures that processes are executed in the correct order, improving the overall performance and reliability of the program.

4. What are some common problems that can arise from using busy waiting in wait() and signal() functions?

One common problem is the potential for deadlocks, where two processes are waiting for each other to continue, resulting in both processes being stuck. Another issue is the waste of system resources, as the process continuously checks for a condition instead of performing other tasks.

5. How can busy waiting in wait() and signal() functions be avoided?

Busy waiting can be avoided by using other synchronization techniques such as semaphores or mutex locks. These methods allow processes to block and wait without continuously checking for a condition, reducing wasted resources. Alternatively, event-driven programming can also be used to eliminate the need for busy waiting altogether.

Similar threads

  • Calculus and Beyond Homework Help
2
Replies
56
Views
3K
Replies
1
Views
765
  • Classical Physics
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
Replies
8
Views
1K
Replies
9
Views
2K
  • Sci-Fi Writing and World Building
Replies
6
Views
850
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Quantum Interpretations and Foundations
Replies
14
Views
2K
Back
Top