Question

In: Computer Science

urgent please, in operating system: One simple method to protect a critical section is to use...

urgent please, in operating system:

One simple method to protect a critical section is to use mutex locks, also called spinlocks. An alternative method would be use a binary semaphore initialized to 1, with the implementation that uses busy waiting. Is there any real difference between these two methods? Explain.

Solutions

Expert Solution

Dear Student,

Answer :

BINARY SEMAPHORE MUTEX

It's functionality is based up on signalling mechanism It's functionality is based up on locking mechanism
The thread which is having higher priority than current thread can also release binary semaphore and take lock. The thread which has acquired mutex can only release Mutex when it goes out from critical section.
Semaphore value is varied according to wait () and signal () operations. Mutex values can be changed just as locked or unlocked.
Multiple number of threads can acquire binary semaphore at a time concurrently. Only one thread can have mutex at a time
Binary semaphore does not have ownership. There is ownership associated with mutex because only owner can release the lock.
They are faster than mutex because any other thread/process can unlock binary semaphore. They are slower than binary semaphores because only thread which has acquired must release the lock.
If you have number of instances for resource it is better to use Binary semaphore. If you have single instance for resource it is better to use mutex.

Hope This Helps.

All The Best


Related Solutions

Operating systems Explain what the critical section problem is. Please explain this in about 1-2 paragraphs.
Operating systems Explain what the critical section problem is. Please explain this in about 1-2 paragraphs.
Create the “Operating Section”of the statement of cash flows using the indirect method(ONLYTHE OPERATING SECTION). Place...
Create the “Operating Section”of the statement of cash flows using the indirect method(ONLYTHE OPERATING SECTION). Place your answer on this page(operating section only, indirect method).
Operating system : Concurrent processes P0 and P1 use the following C-codes to access a critical...
Operating system : Concurrent processes P0 and P1 use the following C-codes to access a critical section CS: Void p0() / / process P0 { while (TURE){ Flag[0]=TURE; turn=1; While (flag[1]&&(turn==1)) Critical section; Flag[0]=FALSE; } } Void p1() / / process P1 { while (TURE){ Flag[1]=TURE; turn=0; While (flag[0]&&(turn==0)) Critical Section (CS); Flag[1]=FALSE; } } where the initial values for the shared variables are: boolean flag[2] ; int turn=0; flag[0]=false; flag[1]=false; The above implementation of P0 and P1 guarantees ()...
Operating system : Concurrent processes P0 and P1 use the following C-codes to access a critical...
Operating system : Concurrent processes P0 and P1 use the following C-codes to access a critical section CS: Void p0() / / process P0 { while (TURE){ Flag[0]=TURE; turn=1; While (flag[1]&&(turn==1)) Critical section; Flag[0]=FALSE; } } Void p1() / / process P1 { while (TURE){ Flag[1]=TURE; turn=0; While (flag[0]&&(turn==0)) Critical Section (CS); Flag[1]=FALSE; } } where the initial values for the shared variables are: boolean flag[2] ; int turn=0; flag[0]=false; flag[1]=false; The above implementation of P0 and P1 guarantees ()...
urgent!!! code in c++ - cannot use vector - please use inheritance -please identify the .h...
urgent!!! code in c++ - cannot use vector - please use inheritance -please identify the .h and .cpp files and add tester program and screenshot of output! -please complete all parts I will upvote thank you!!! Define the following classes to manage the booking of patients in a medical clinic. a) Define a class Date that has the following integer data members: month, day and year. b) Define a class AppointmentTime that has the following data members: day (string), hour...
urgent!!! code in c++ - cannot use vector - please use inheritance -please identify the .h...
urgent!!! code in c++ - cannot use vector - please use inheritance -please identify the .h and .cpp files and add tester program and screenshot of output! -please complete all parts I will upvote thank you!!! Define the following classes to manage the booking of patients in a medical clinic. a) Define a class Date that has the following integer data members: month, day and year. b) Define a class AppointmentTime that has the following data members: day (string), hour...
Please urgent, Patient Care Instruments uses a manufacturing costing system with one direct cost category​ (direct...
Please urgent, Patient Care Instruments uses a manufacturing costing system with one direct cost category​ (direct materials) and three indirect cost​ categories: The management of Patient Care Instruments wants to evaluate whether value engineering has succeeded in reducing the target manufacturing cost per unit of one of its​ products, HJ6, by 20​% In response to competitive pressures at the end of 2017​, Patient Care Instruments used​ value-engineering techniques to reduce manufacturing costs. Actual information for 2017and 2018 ​is: 2017 2018...
A simple saturation cycle of refrigeration system is operating on R22. This system has an evaporator...
A simple saturation cycle of refrigeration system is operating on R22. This system has an evaporator pressure of 350 kPa, condensing pressure of 1550 kPa and a discharge temperature of 80°C. Degree of sub cooling of 8 K and degree of superheat of 5 K. Draw p – h diagram and calculate the following. a. Refrigeration Effect. b. Refrigerant mass flow rate, at a plant capacity of 196 kW. c. Power input into the compressor. d. Coefficient of performance of...
Please analyze and summarize the command driven operating system with a GUI operating system in a...
Please analyze and summarize the command driven operating system with a GUI operating system in a paragraph or two.
Please answer this. ITS URGENT!!!! Describe how the endocrine system is different from the nervous system...
Please answer this. ITS URGENT!!!! Describe how the endocrine system is different from the nervous system the other control system of the body. (Please answer in ~250 words)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT