Question
Easy

In context of semaphores choose the option with valid codes for wait() and signal() functions:

1
Wait (s) { while (s) <= 0; s++ } and signal (s) { s--; }
2
Wait (s) { while (s) <= 0; s--} and signal (s) {s++; }
3
Wait (s) {s--;} and signal (s) { while (s) <= 0; s++ }
4
Wait (s) { s++; } and signal (s) { while (s) <= 0; s--; }
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Operating Systems & Software Concepts
Topic: MS Window
Correct Answer
Option B
Explanation

The correct option is (2): The classical definition of a semaphore’s operations, particularly for a counting semaphore, involves two atomic operations: wait (also called P) and signal (also called V). The function of the wait() operation is to attempt to acquire a resource. It must first check if the resource is available, and if not, it must block or busy-wait. Option 2’s Wait (s) { while (s) <= 0; s--}…Read More

In context of semaphores - HTET Level 3 | Clear Cutoff