CS FundamentalsModerateHCL · Tech Mahindra pattern
A counting semaphore S is initialised to 5. Then 7 wait (P) operations and 3 signal (V) operations are performed on it in some order. What is the final value of S (using the definition where S may go negative)?
- A. −2
- B. 2
- C. 15
- D. 1
Correct answer: D. 1
Each P subtracts 1 and each V adds 1: 5 − 7 + 3 = 1. The order affects which processes block on the way, not the final value.
More Operating Systems questions
- A process of size 13,000 bytes is loaded with paging, page size 4,096 bytes. How much internal fragmentation is there in its last page?
- Processes: P1 (arrival 0, burst 7), P2 (arrival 2, burst 4), P3 (arrival 4, burst 1), P4 (arrival 5, burst 4) (ms). Using non-preemptive…
- A child process has terminated, but its parent has not yet called wait() to read its exit status. The child is now a:
- In a many-to-one thread model (many user-level threads mapped to one kernel thread), what happens when one thread makes a blocking system…
- Which disadvantage applies to linked file allocation but NOT to indexed allocation?
- A disk has cylinders 0–199 and the head is at cylinder 72. The request queue, in arrival order, is 110, 25, 160, 47, 130, 8, 95, 185. What…