...
Teaching Aptitude
October 10, 2023
Artificial-Intelligence
October 10, 2023
Teaching Aptitude
October 10, 2023
Artificial-Intelligence
October 10, 2023

Process-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.
A
signal(M), signal(F)
B
signal(M), wait(F)
C
Signal(F), wait(M)
D
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.
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.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!