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?
- A. 10
- B. 11
- C. 9
- 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
- Shared x = y = 0. Thread 1: x = 1; y = 1. Thread 2: r1 = y; r2 = x. Thread 3: x = 2; r3 = x. Under sequential consistency, how many…
- A Unix file system contains only these names: directories /, /a, /a/b and /c, a regular file /a/f, and /c/g, which is a hard link to /a/f…
- A user-mode process accesses virtual pages with page-table entries (present, writable, user-accessible): page 0 (1,1,1), page 1 (1,0,1)…
- Locks are ordered L1 < L2 < L3 < L4 and every thread must acquire locks in increasing order. A thread acquires locks in the following…
- Memory (in KB, from address 0): OS 100, process A 150, hole 60, B 200, hole 90, C 120, hole 80, D 100, hole 100. Compaction slides every…
- A 100 MB process is swapped out and later swapped back in on a disk that transfers 50 MB/s with an 8 ms latency per transfer. Swap-out…