Question

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 an item to the tail of a doubly linked list that is shared among multiple processes. Which statement(s) is/are true about this fragment? (May have multiple answers)

/*1*/
/*2*/ item.prev = tail;
/*3*/ tail.next = item;
/*4*/ tail = item;
/*5*/

This pseudocode does not represent a critical section.

This pseudocode represents a critical section. An entry section shall be added on the line 1 and an exit section shall be added on the line 5.

The pseudocode represents a critical section. Keyword monitor and an opening brace { shall be added on the line 1, and a closing brace } shall be added on the line 5.

This pseudocode represents a critical section. Statements P(S) and V(S) shall be added on the lines 1 and 5, respectively.

QUESTION 3

Let S is a semaphore and C is a condition in a monitor. Which statement is true about the semantics of the operations S.signal() (same as S.unlock() or V(S)) and C.signal()?

S.signal() may change the state of the semaphore, but C.signal() never changes the state of the condition.

S.signal() is a blocking operation, but C.signal() is not.

S.signal() unblocks all processes waiting on S, but C.signal() unblocks at most one process waiting on C.

There is no difference between them: both allow a blocked process resume the execution.

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

if you require any further information please feel free to ask

1) Process P2 continues the execution. Process P1 is nonetheless suspended until P2 leaves the monitor.

Process P2 is suspended. Process P1 resumes the execution.

2) This pseudocode represents a critical section. An entry section shall be added on the line 1 and an exit section shall be added on the line 5

This pseudocode represents a critical section. Statements P(S) and V(S) shall be added on the lines 1 and 5, respectively.

3) S.signal() may change the state of the semaphore, but C.signal() never changes the state of the condition.

Add a comment
Know the answer?
Add Answer to:
QUESTION 1 Process P1 waits on the condition x in the monitor M. Process P2 calls...
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
  • Consider a monitor with 5 condition variables, C1-C5. Assume that no process has entered the monitor...

    Consider a monitor with 5 condition variables, C1-C5. Assume that no process has entered the monitor yet and C1-C5 are free. Briefly describe, the effect of the following sequence of five operations by processes P1-P2. State any assumption you make. (In other words, for each operation in the sequence, state what happens on its execution, given the state of the monitor at that time.) Assume that there are no other processes in the system except P1 and P2. P1: C1.wait();...

  • Need the process that how we get P2 P1 P4 P3 and waiting time please 1....

    Need the process that how we get P2 P1 P4 P3 and waiting time please 1. Draw a Gantt chart below similar to the ones from lecture that illustrates the execution of the processes using the shortest-job-first CPU scheduling algorithm. Process Arrival Burst | Time Time P. 7 ms 2 ms | P2 Oms 8 ms 11 ms 5 ms P4 4 ms 9 ms P2 P2 P4 P3 oms 8 10 19 24 | Using the chart you drew,...

  • Q.2] Answer the following questions Process Burst Time Priority P1 3 1 P2 8 3 P3...

    Q.2] Answer the following questions Process Burst Time Priority P1 3 1 P2 8 3 P3 2 4 P4 4 5 P5 5 1 (21 points) Consider the set of processes shown in the table above, with the length of the CPU-burst time given in milliseconds. The processes are assumed to have arrived in the order P5, P4, P3, P2 , and P1, all approximately at time 0. Draw three Gantt charts illustrating the execution of these processes using SJF,...

  • Let I represent an execution of init(s), W of wait(s), and S of signal(s). Then, for...

    Let I represent an execution of init(s), W of wait(s), and S of signal(s). Then, for example, IWWS represents the sequence of calls init(s), wait(s), wait(s), and signal(s) by some processes in an operating system. For each of the following sequences of calls, state the value of s and the number of processes blocked after the last call in the sequence: (b) IS (c) ISSSW (d) IWWWS (e) ISWWWW Each of the following code fragments contains a bug in the...

  • Question I This question carries 20% of the marks for this assignment. You are asked to...

    Question I This question carries 20% of the marks for this assignment. You are asked to develop a set of bash shell script: Write a script that asks for the user's salary per month. If it is less or equals to 800, print a message saying that you need to get another job to increase your income, what you earn is the Minim living cost. If the user's salary is higher than 800 and below 2000, print a message telling...

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