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?

  1. A. 6 microseconds
  2. B. 4 microseconds
  3. C. 8 microseconds
  4. 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

Exams that ask this topic