Question

Consider a monitor with 5 condition variables, C1-C5. Assume that no process has entered the monitor yet and C1-C5 are free.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

There are only two processes in the system which are P1 and P2. And we have 5 condition variables C1-C5.
We will start with the given sequence of operations.

P1 : C1.wait(); : As it is given that all the condition variables are free, this wait operation will acquire the lock related to C1 variable and allow the the process to P1 to use the resource that it requires.

P2 : C2.wait(); : This will acquire the lock of C2 variable and allow P2 to use the required resources.

P1 : C2.wait(); : Due to the fact that process P2 just acquired this lock, process P1 will not be able to do the same, unless someone performs a signal(). So the P1 process will now have to wait until this lock is released so it will go to sleep.
(Signal() is used to release the acquired lock so that the process which went to sleep would wake up and use the resources by acquiring this lock.)

P2 : C2.signal(); : This will release the lock of C2 variable the process which are in queue for this lock can acquire it. Here process P1 needed this lock, which is currently put to sleep. This sleep() will wake up P1 so that it can continue with its execution.

P1 : C3.wait(); : This will simply acquire the lock of another condition variable which is C2 and allow P1 to use the required resources.

Add a comment
Know the answer?
Add Answer to:
Consider a monitor with 5 condition variables, C1-C5. Assume that no process has entered the monitor...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 Process P1 waits on the condition x in the monitor M. Process P2 calls...

    QUESTION 1 Process P1 waits on the condition x in the monitor M. Process P2 calls x.signal() within a function defined in the same monitor M. What further scenario is possible? (Check all that apply.) Process P2 is suspended. Process P1 resumes the execution. Process P1 resumes the execution. Process P2 continues the execution. Process P2 continues the execution. Process P1 is nonetheless suspended until P2 leaves the monitor. The operation x.signal() fails. QUESTION 2 The following pseudocode fragment adds...

  • Consider the multicore processor with 6 heterogeneous cores labelled C1, C2, C3, C4, C5, and C6....

    Consider the multicore processor with 6 heterogeneous cores labelled C1, C2, C3, C4, C5, and C6. Assume cores C1 and C6 have the same speed. C2 runs twice as fast as C1 and core C3 runs 3 times faster than C1, and C4 and C5 are four times faster than C1. Assume all six cores start executing the application CUBE-X at the time and no cache misses are encountered in all core operations. Suppose the CUBE-X application computes the cube...

  • Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In...

    Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In this scheme, some procedure is used to identify when a deadlock occurs, and then another procedure is used to deal with the blocked processes. One technique to identify a deadlock is to maintain a resource graph that identifies all processes, all resources, and the relationships between them (that is, which processes exclusively own which resources, and which processes are blocked waiting for which...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT