6.4 Demonstrate that monitors and semaphores are equivalent to the degree that they can be used to implement solutions to the same types of synchronization problems. (5 points)
Added by Angela S.
Close
Step 1
Step 1: Monitors and semaphores are both synchronization mechanisms used to control access to shared resources in concurrent programming. Show more…
Show all steps
Your feedback will help us improve your experience
Adi S and 99 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Demonstrate that monitors and semaphores are equivalent insofar as they can be used to implement the same types of synchronization problems.
Adi S.
5.14 Describe how the compare and swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting requirement. (15 pts)
Haricharan G.
5. Give an example in pseudo-code of 3 processes that use semaphores such that, according to the order in which they are executed, can either: terminate normally; or deadlock. Remember to indicate how the semaphores are initialized. 6. Insert semaphores to satisfy the properties: P1: print(A); print(B); print(C); P2: print(E); print(F); print(G); * print A before printing F * print F before printing C Don't forget to indicate the initial value of the semaphores. 7. Insert semaphores such that only ACERO or ACREO is printed. P1: print(C); print(E); P2: print(A); print(R); print(O); Don't forget to indicate the initial value of the semaphores. 8. Assuming semaphores SA, SB, and SC are initialized at 0, what strings can be printed? P1: repeat print(A); SC.V; SA.P; forever P2: repeat print(B); SC.V; SB.P; forever P3: repeat SC.P; SC.P; print(C); SA.V; SB.V; forever 9. Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor systems. 10. 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. 11. Consider the version of the dining-philosophers problem in which the chopsticks are placed at the center of the table and any two of them can be used by a philosopher. Assume that requests for chopsticks are made one at a time. Describe a simple rule for determining whether a particular request can be satisfied without causing deadlock given the current allocation of chopsticks to philosophers.
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD