A processor uses 2-level page tables for virtual to physical address…

2003

A processor uses 2-level page tables for virtual to physical address translation. Page tables for both levels are stored in the main memory. Virtual and physical addresses are both 32 bits wide. The memory is byte addressable. For virtual to physical address translation, the 10 most significant bits of the virtual address are used as index into the first level page table while the next 10 bits are used as index into the second level page table. The 12 least significant bits of the virtual address are used as offset within the page. Assume that the page table entries in both levels of page tables are 4 bytes wide. Further, the processor has a translation look-aside buffer (TLB), with a hit rate of 96%. The TLB caches recently used virtual page numbers and the corresponding physical page numbers. The processor also has a physically addressed cache with a hit rate of 90%. Main memory access time is 10 ns, cache access time is 1 ns, and TLB access time is also 1 ns. Suppose a process has only the following pages in its virtual address space: two contiguous code pages starting at virtual address 0x00000000, two contiguous data pages starting at virtual address 0×00400000, and a stack page starting at virtual address 0×FFFFF000. The amount of memory required for storing the page tables of this process is:

Answer: C. 16 KBAnswer: 16 KB Explanation and calculation: Page size = 2^12 bytes = 4 KB. Each page-table entry = 4 bytes. First-level table entries = 2^10 = 1024. Size of…

  1. A.

    8 KB

  2. B.

    12 KB

  3. C.

    16 KB

  4. D.

    20 KB

Attempted by 3 students.

Show answer & explanation

Correct answer: C

Answer: 16 KB

Explanation and calculation:

  • Page size = 2^12 bytes = 4 KB. Each page-table entry = 4 bytes.

  • First-level table entries = 2^10 = 1024. Size of first-level table = 1024 × 4 B = 4096 B = 4 KB.

  • Each second-level table has 2^10 = 1024 entries, so each second-level table size = 1024 × 4 B = 4096 B = 4 KB.

  • Determine how many second-level tables are actually needed for the listed pages:

    • Two code pages starting at 0x00000000 occupy virtual page numbers 0 and 1; both map under first-level index 0 → 1 second-level table.

    • Two data pages starting at 0x00400000 correspond to virtual page numbers 1024 and 1025; both map under first-level index 1 → 1 second-level table.

    • Stack page at 0xFFFFF000 corresponds to virtual page number 0xFFFFF and maps under first-level index 1023 → 1 second-level table.

  • Total second-level tables needed = 3 → 3 × 4 KB = 12 KB.

  • Total memory for page tables = first-level table (4 KB) + second-level tables (12 KB) = 16 KB.

Explore the full course: Wipro Preparation

Loading lesson…