Operating System


Q181.

Consider the following pseudocode, where Sis a semaphore initialized to 5 in line #2 and counter is a shared variable initialized to 0 in line #1. Assume that the increment operation in line #7 is not atomic.1. int counter =0; 2. Semaphore S= init(5); 3. void parop(void) 4. { 5. wait(S); 6. wait(S); 7. counter++; 8. signal(S); 9. signal(S); 10. } If five threads execute the function parop concurrently, which of the following program behavior(s) is/are possible?[MSQ]
GateOverflow

Q182.

Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is N. Three semaphores empty, full and mutex are defined with respective initial values of 0, N and 1. Semaphore empty denotes the number of available slots in the buffer, for the consumer to read from. Semaphore full denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R, and S, in the code below can be assigned either empty or full. The valid semaphore operations are: wait() and signal(). Which one of the following assignments to P, Q, R and S will yield the correct solution?
GateOverflow

Q183.

The hardware implementation which provides mutual exclusion is
GateOverflow

Q184.

Which of the following need not necessarily be saved on a context switch between processes?
GateOverflow

Q185.

Consider the following two-process synchronization solution. The shared variable turn is initialized to zero.Which one of the following is TRUE?
GateOverflow

Q186.

A task in a blocked state
GateOverflow

Q187.

In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state: Now consider the following statements: I. If a process makes a transition D, it would result in another process making transition A immediately. II. A process P2 in blocked state can make transition E while another process P1 is in running state. III. The OS uses preemptive scheduling. IV. The OS uses non-preemptive scheduling. Which of the above statements are TRUE?
GateOverflow

Q188.

There are three processes in the ready queue. When the currently running process requests for I/O how many process switches take place?
GateOverflow

Q189.

Consider the following proposed solution for the critical section problem. There are n processes: P_{0}...P_{n-1} . In the code,function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Which one of the following is TRUE about the above solution?
GateOverflow

Q190.

Special software to create a job queue is called a
GateOverflow