CS FundamentalsVery hardGATE CS (PYQ pattern)
A process owns 100 private writable pages. It calls fork() and both processes use copy-on-write. Before either exits, the child writes to 30 distinct pages and the parent writes to 20 distinct pages, 10 of which are also among the child's 30. When a write finds the page shared by only one process the kernel simply makes it writable again without copying. How many new physical pages are allocated by these writes?
- A. 40
- B. 50
- C. 30
- D. 60
Correct answer: A. 40
A page is copied only by the FIRST writer; after that the other process is the sole owner and writes in place. So the copies equal the union of written pages: 30 + 20 - 10 = 40. 50 counts the shared 10 twice.
More Operating Systems questions
- A RAID 5 array has 6 disks, each able to do 150 random I/O operations per second. A small RAID 5 write costs 4 disk I/Os (read old data…
- A 512 x 512 matrix of 4-byte integers is stored row-major, starting at a page boundary, with 4 KB pages (so two rows per page). The code…
- With 3 frames, initially empty, the reference string is 4, 2, 1, 5, 2, 1, 3, 2, 4, 3, 1, 3, 2, 2, 5, 4, 5, 1, 3, 2, 4, 4. How many MORE…
- A 32-bit machine uses two-level paging with 4 KB pages, 4-byte entries and 10 + 10 + 12 address bits, so each page-table page maps 4 MB. A…
- Deadlock detection (multiple instances of 3 resource types) with 6 processes. Allocation: P0 (2,0,2), P1 (1,2,1), P2 (1,0,1), P3 (1,0,0)…
- Three processes all arrive at time 0 in the order A, B, C and are scheduled FCFS (non-preemptive on the CPU). Each alternates CPU burst…