CS FundamentalsVery hardGATE CS (PYQ pattern)

A CFS-like scheduler picks the runnable task with the smallest virtual runtime and runs it for a 4 ms slice, then adds 4 x 1024 / weight to its vruntime. Tasks A, B, C have weights 1024, 2048 and 512, all vruntimes start at 0 and ties go to the earlier task. How many of the first 28 slices does B get?

  1. A. 8
  2. B. 4
  3. C. 16
  4. D. 18

Correct answer: C. 16

Slice counts over 28 picks are A 8, B 16, C 4: exactly the weight ratio 2 : 4 : 1 over 28 picks; B advances its vruntime slowest, so it is picked most often.

More Operating Systems questions

Exams that ask this topic