Teaching Aptitude
October 10, 2023Artificial-Intelligence
October 10, 2023Process-Synchronization
Question 62 |
The producer and consumer processes share the following variables:
int n;
Semaphore M=1
Semaphore E=n
Semaphore F=0
The consumer process must execute ______ and before removing an item from buffer.
int n;
Semaphore M=1
Semaphore E=n
Semaphore F=0
The consumer process must execute ______ and before removing an item from buffer.
signal(M), signal(F) | |
signal(M), wait(F) | |
Signal(F), wait(M) | |
wait(F), wait(M) |
Question 62 Explanation:
F is given 0 then no items would be produced
→ Two standard operations, wait and signal are defined on the semaphore.
→ Entry to the critical section is controlled by the wait operation and exit from a critical region is taken care by signal operation.
→ The manipulation of semaphore (S) takes place as following:
→ The wait command P(S) decrements the semaphore value by 1. If the resulting value becomes negative then P command is delayed until the condition is satisfied.
→ The V(S) i.e. signals operation increments the semaphore value by 1.
→ The wait, signal operations are also called P and V operations.
→ Two standard operations, wait and signal are defined on the semaphore.
→ Entry to the critical section is controlled by the wait operation and exit from a critical region is taken care by signal operation.
→ The manipulation of semaphore (S) takes place as following:
→ The wait command P(S) decrements the semaphore value by 1. If the resulting value becomes negative then P command is delayed until the condition is satisfied.
→ The V(S) i.e. signals operation increments the semaphore value by 1.
→ The wait, signal operations are also called P and V operations.
Correct Answer: C
Question 62 Explanation:
F is given 0 then no items would be produced
→ Two standard operations, wait and signal are defined on the semaphore.
→ Entry to the critical section is controlled by the wait operation and exit from a critical region is taken care by signal operation.
→ The manipulation of semaphore (S) takes place as following:
→ The wait command P(S) decrements the semaphore value by 1. If the resulting value becomes negative then P command is delayed until the condition is satisfied.
→ The V(S) i.e. signals operation increments the semaphore value by 1.
→ The wait, signal operations are also called P and V operations.
→ Two standard operations, wait and signal are defined on the semaphore.
→ Entry to the critical section is controlled by the wait operation and exit from a critical region is taken care by signal operation.
→ The manipulation of semaphore (S) takes place as following:
→ The wait command P(S) decrements the semaphore value by 1. If the resulting value becomes negative then P command is delayed until the condition is satisfied.
→ The V(S) i.e. signals operation increments the semaphore value by 1.
→ The wait, signal operations are also called P and V operations.
Subscribe
Login
0 Comments