CS FundamentalsVery hardGATE CS (PYQ pattern)

Process P0 has 4 pages, each in its own frame. Copy-on-write fork is used (a frame is copied only when written while shared; a written frame with a single owner is simply made writable). Operations in order: P0 forks P1; P1 writes page 1; P1 forks P2; P0 writes page 1; P2 writes page 1; P2 writes page 3; P0 forks P3; P3 writes page 0; P0 writes page 0; P1 writes page 1; P2 writes page 2. How many distinct physical frames are in use at the end?

  1. A. 10
  2. B. 11
  3. C. 9
  4. D. 12

Correct answer: A. 10

Tracking page-to-frame mappings and reference counts through each fork and write gives 10 frames in use; writes to frames with one owner (such as P1's second write to page 1) allocate nothing.

More Operating Systems questions

Exams that ask this topic