The address sequence generated by tracing a particular program executing in a…
2007
The address sequence generated by tracing a particular program executing in a pure demand paging system with 100 bytes per page is
0100, 0200, 0430, 0499, 0510, 0530, 0560, 0120, 0220, 0240, 0260, 0320, 0410.
Suppose that the memory can store only one page and if x is the address which causes a page fault then the bytes from addresses x to x + 99 are loaded on to the memory.
How many page faults will occur ?
- A.
0
- B.
4
- C.
7
- D.
8
Attempted by 65 students.
Show answer & explanation
Correct answer: C
Answer: 7 page faults.
Explanation: When an address x causes a page fault, the bytes from x through x+99 are loaded into memory. Memory holds only that loaded 100-byte range until a new fault causes a different range to be loaded.
Reference 0100: not in memory → load 0100–0199 (fault 1)
Reference 0200: not in 0100–0199 → load 0200–0299 (fault 2)
Reference 0430: not in 0200–0299 → load 0430–0529 (fault 3)
References 0499 and 0510: both fall in 0430–0529 → no new faults
Reference 0530: not in 0430–0529 → load 0530–0629 (fault 4)
Reference 0560: falls in 0530–0629 → no new fault
Reference 0120: not in 0530–0629 → load 0120–0219 (fault 5)
Reference 0220: not in 0120–0219 → load 0220–0319 (fault 6)
References 0240 and 0260: both fall in 0220–0319 → no new faults
Reference 0320: not in 0220–0319 → load 0320–0419 (fault 7)
Reference 0410: falls in 0320–0419 → no new fault
Total page faults = 7.