CS FundamentalsModerateGATE CS (PYQ pattern)
Two processes bounce a 1-byte message through a pair of pipes: 100,000 round trips take 1.2 s, and each round trip contains two context switches plus the same pipe system calls that a single process performs when it writes and reads its own pipe 100,000 times, which alone takes 0.4 s. What is the cost of one context switch?
- A. 6 microseconds
- B. 4 microseconds
- C. 8 microseconds
- D. 2 microseconds
Correct answer: B. 4 microseconds
Switching time = 1.2 - 0.4 = 0.8 s over 2 x 100,000 = 200,000 switches = 4 microseconds each. Ignoring the system-call time gives 6; dividing by 100,000 instead of 200,000 gives 8.
More Operating Systems questions
- MFU replacement with 3 frames (initially empty): the victim is the resident page with the LARGEST reference count since it was loaded…
- FIFO page replacement is run on the string 6, 1, 7, 2, 7, 2, 1, 5, 1, 1, 7, 5, 3, 1, 1, 7, 4, 5, 3, 4 (memory initially empty) with each…
- The clock algorithm uses 3 frames (initially empty); the reference bit is set when a page is loaded and on every hit. On a fault the hand…
- A counting semaphore S starts at 3 and is implemented so that wait() decrements S and blocks the caller if S becomes negative, while…
- A 16-core machine must unmap a page that all cores have in their TLBs. The initiating core sends an inter-processor interrupt to each of…
- Two periodic tasks with deadline = period and zero release offset: T1 (C=2, P=5) and T2 (C=4, P=7). Total utilisation is 2/5 + 4/7 ≈…