A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

Discussion Forum

Que. The semaphore variables full, empty and mutex are initialized to 0, n and 1, respectively. Process P1 repeatedly adds one item at a time to a buffer of size n, and process P2 repeatedly removes one item at a time from the same buffer using the programs given below. In the programs, K, L, M and N are unspecified statements.

 P1
while (1) {     K; P(mutex); Add an item to the buffer; V(mutex);     L; } P2 while (1) {    M; P(mutex); Remove an item from the buffer; V(mutex);     N; }

The statements K, L, M and N are respectively
a. P(full), V(empty), P(full), V(empty)
b. P(full), V(empty), P(empty), V(full)
c. P(empty), V(full), P(empty), V(full)
d. P(empty), V(full), P(full), V(empty)
Answer:P(empty), V(full), P(full), V(empty)
Confused About the Answer? Ask for Details Here
Know Explanation? Add it Here

Similar Questions: