At a particular time of computation, the value of a counting semaphore is 7. Then 20 P operation and ‘x’ V operation were completed on this semaphore. If the final value of the semaphore is 5, x will be
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Each process Pi, i = 1,2, 3,...., 9 is coded as
follows:
repeat
P (mutex)
{ critical section }
V (mutex)
forever
The code for P 10 is identical except that is uses V (mutex) instead of P (mutex). What is the largest number of processes that can be inside the critical section at any moment?
Process P1 and P2 have a producer-consumer relationship, communicating by the use of a set of shared buffers:
P1 :
repeat
obtain an empty buffer
Fill it
return a full buffer
forever
P2:
repeat
obtain a full buffer
empty it
return an empty buffer
forever
Increasing the number of buffers is likely to do which of the following?
1. Increase the rate at which requests are satisfied.
2. Decrease the likelihood of deadlock.
3. Increase the case of achieving a correct implementation.
Consider a queue between the two processes indicated below. A/is the length of queue and e, f and b are semaphore, init : e : = N; f = 0; b : = 1;
Which of the following statements is/are true?
1. The purpose of semaphore f is to ensure that dequeue is not executed on an empty queue.
2. The purpose of semaphore e is to ensure that deadlock does not occur.
3. The purpose of semaphore b is to provide mutual exclusion for queue operations.
Consider the following :
int numreader = 0;
mutex = semaphore (1);
room empty (1);
The above code is a proposed solution of the Readers/Writer problem.
Consider which of the following statements is/are true?
1. The code allow several writers to execute in the writers critical area at the same time
2. The code allow several readers to execute in the readers critical area at the same time.
Processes P1 and P2 use critical_flag in the following routine to achieve mutual exclusion. Assume that critical_flag is initialized to FALSE in the main program:
Consider the follow ing statements:
1. It is possible for both P1 and P2 to access critical_region concurrently.
2. This may lead to a deadlock.
Which of the following holds?
The following is a code with two threads, producer and consumer, that can run parallel. Further, S and Q are binary semaphore equipped with the standards P and V operations,
semaphore S - 1, Q = 0
integer x;
Which of the following is TRUE about the program above?
Let R1, R2, R3 be reader processes and let W1 and W2 be writer processes requesting shared data. If R1 is selected for access. Which of the statement is/are correct?
1. Mutual exclusion is necessary for R2 and R3.
2. No mutual exclusion is necessary for R2 and R3.
3. Mutual exclusion must be there for W1 and W2.
4. No mutual exclusion must be there for W1 and W2.
Assume that 'C' is counting semaphore. Consider the following program segment:
C= 10;
P(C);
V(C);
P(C);
P(C);
P(C);
V(C);
P(C);
P(C);
What is the value of 'C' at the end of the above program execution?
At a particular time of ocmputation the value of a counting semaphore is 7. Then 20 P operations and 15 V operation were completed on this semaphore. The resulting value of the semaphore is
55 docs|215 tests
|
55 docs|215 tests
|