Question

In: Computer Science

There are two different ways to implement semaphore, one is to use busy waiting and the...

There are two different ways to implement semaphore, one is to use busy waiting and the other is to use block and wakeup. What are the differences between the two implementation schemes? In what scenario does the busy-waiting semaphore have a better performance than the block-and-wakeup semaphore?

Solutions

Expert Solution

ANSWERS :

ANS 1.  Differences between the two implementation schemes :

* Busy waiting --

# It is also called as spin waiting.

# In this a process does not do anything unless it gets permission to enter the critical section, but only keeps on checkng the condition and matching it with the condition to gain access to the critical section.

# It watses a lot of CPU cycles.

* Block and wake up --

# In this if a process waits to access the critical section to start execution it is blocked and then put into a queue. Where at regular intervals one process is removed and that process is being moved to ready queue.

# The increement and decreement of the semaphore is responsible in blocking the process and in controlling the entry to the critical section.

In following scenario the busy-waiting semaphore have a better performance than the block-and wakeup semaphore :

* If the the resources of the processors are not needed for any other tasks.

* When the wait time is less than the Scheduling overhead.

* Can be preffered in case of parallel program sometimes.


Related Solutions

busy waiting always less efficient
Is busy waiting always less efficient (in terms of using processor time) than a blocking wait? Explain.
6.2_What is the meaning of the term busy waiting? What other kinds of waiting are there...
6.2_What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answer. 7.4_Describe how deadlock is possible with the dining-philosophers problem. Why is it necessary to have an atomic instruction for providing access to a critical section?
Problem 1 This problem will present the same scenario two different ways – the second one...
Problem 1 This problem will present the same scenario two different ways – the second one will add an additional piece of information. For each scenario, you will construct an influence diagram, as indicated in the problem. (a) Imagine that a close friend has been diagnosed with heart disease. The physician recommends bypass surgery. The surgery should solve the problem. When asked about the risks, the physician replies that a few individuals die during the operation, but most recover and...
Use two different ways to prove X Y + Z = (X + Z)(Y + Z)....
Use two different ways to prove X Y + Z = (X + Z)(Y + Z). a) Use pure algebraic way b) k-maps
The values listed below are waiting times? (in minutes) of customers at two different banks. At...
The values listed below are waiting times? (in minutes) of customers at two different banks. At Bank? A, customers enter a single waiting line that feeds three teller windows. At Bank? B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.36.3 6.66.6 6.76.7 6.86.8 7.17.1 7.37.3 7.47.4 7.87.8 7.87.8 7.87.8 Bank Upper BBank B 4.24.2 5.45.4 5.85.8 6.26.2 6.76.7 7.77.7 7.77.7 8.68.6 9.39.3 10.010.0 Construct aa...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.4 6.6 6.7 6.8 7.1 7.3 7.4 7.7 7.7 7.7 Bank B 4.1 5.3 5.9 6.2 6.8 7.6 7.6 8.4 9.4 10 Construct a 99​% confidence...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.46.4 6.66.6 6.76.7 6.86.8 7.17.1 7.27.2 7.57.5 7.87.8 7.87.8 7.87.8 Bank Upper BBank B 4.24.2 5.35.3 5.85.8 6.16.1 6.76.7 7.87.8 7.87.8 8.48.4 9.49.4 10.010.0 LOADING... Click...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.5 6.6 6.7 6.8 7.1 7.3 7.6 7.9 7.9 7.9 Bank Upper B 4.3 5.3 5.9 6.2 6.8 7.8 7.8 8.4 9.2 10.0 Construct a 95%...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.5 6.6 6.7 6.8 7.1 7.2 7.5 7.9 7.9 7.9 Bank B 4.2 5.4 5.8 6.2 6.8 7.7 7.7 8.5 9.3 10.00 a) Using Chi-Square critical...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At...
The values listed below are waiting times​ (in minutes) of customers at two different banks. At Bank​ A, customers enter a single waiting line that feeds three teller windows. At Bank​ B, customers may enter any one of three different lines that have formed at three teller windows. Answer the following questions. Bank A 6.46.4 6.66.6 6.76.7 6.86.8 7.17.1 7.37.3 7.47.4 7.97.9 7.97.9 7.97.9 Bank B 4.14.1 5.35.3 5.85.8 6.26.2 6.66.6 7.87.8 7.87.8 8.48.4 9.39.3 10.010.0 Construct a 99​% confidence...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT