A virtual memory has a page size of 1K words. There are eight pages and four…

2015

A virtual memory has a page size of 1K words. There are eight pages and four blocks. The associative memory page table contains the following entries :

Which of the following list of virtual addresses (in decimal) will not cause any page fault if referenced by the CPU?

  1. A.

    1024,3072,4096,6144

  2. B.

    1234,4012,5000,6200

  3. C.

    1020,3012,6120,8100

  4. D.

    2021,4050,5112,7100

Attempted by 125 students.

Show answer & explanation

Correct answer: C

Given: page size = 1K words (1024). Associative page table shows resident pages: 0 → block 3, 2 → block 1, 5 → block 2, 7 → block 0 (so pages 0, 2, 5, 7 are present).

Rule: the page number for an address = floor(address / 1024). If the page number is one of 0, 2, 5, 7 there is no page fault; otherwise there is a page fault.

  • For the list 1024, 3072, 4096, 6144: page numbers are 1, 3, 4, 6. Page 1 is not resident, so a page fault occurs (on 1024).

  • For the list 1234, 4012, 5000, 6200: page numbers are 1, 3, 4, 6. Page 1 is not resident, so a page fault occurs (on 1234).

  • For the list 1020, 3012, 6120, 8100: page numbers are 0, 2, 5, 7. All these pages are present in memory, so none of these addresses will cause a page fault.

  • For the list 2021, 4050, 5112, 7100: page numbers are 1, 3, 4, 6. Page 1 is not resident, so a page fault occurs (on 2021).

Conclusion: the only list that will not cause any page fault is 1020, 3012, 6120, 8100 because all addresses map to pages that are resident (pages 0, 2, 5, 7).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor