Question
Download Solution PDFAt a particular time of computation, the value of a counting semaphore is 10. Then 12 P operations and “x” V operations were performed on this semaphore. If the final value of semaphore is 7, x will be:
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFConcept:
A semaphore S is an integer variable that apart from initialization is accessed only through two atomic operations: wait and signal. These are termed as wait (P) and signal (V).
Semaphore operation
Wait(S): S.value = S. value – 1;
If S. value < 0,
then add this process to S.L and block;
End;
Signal (S): S. value = S. value + 1;
If S. value = 0, then begin
remove process from S.L;
Wakeup(P);
End;
Explanation:
counting semaphore: 10
12 P operations are performed, value will be decreased by 1 with each P operation.
x V operations are performed, value will be increased by 1 with each V operation.
Final value of semaphore = 7
So, 10 – 12 + x = 7
-2 + x = 7
x = 7 + 2 = 9
it means 9 V operations are performed on this semaphore.Last updated on Jul 6, 2025
-> The UGC NET Answer Key 2025 June was released on the official website ugcnet.nta.ac.in on 06th July 2025.
-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.
-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.
-> The exam is conducted bi-annually - in June and December cycles.
-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions.
-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.