CS FundamentalsHardGATE CS (PYQ pattern)

A machine with 4 KB pages and demand paging has a 6-byte memory-to-memory MOVE instruction stored at virtual address 0x0FFC. It copies 300 bytes from source address 0x1F80 to destination address 0x2F80, and it can only complete once every byte it touches (instruction, source and destination) is resident at the same time. What is the minimum number of frames the process must be allocated so that this instruction can ever complete?

  1. A. 6
  2. B. 3
  3. C. 4
  4. D. 5

Correct answer: C. 4

Instruction bytes 0x0FFC-0x1001 span pages 0 and 1. Source 0x1F80-0x20AB spans pages 1 and 2. Destination 0x2F80-0x30AB spans pages 2 and 3. The union is {0, 1, 2, 3}: 4 frames. Adding 2 + 2 + 2 = 6 double-counts the shared pages 1 and 2; 3 forgets that the instruction itself straddles a page boundary.

More Operating Systems questions

Exams that ask this topic