IAE Academy

GATE 2024 CS2 Q.24: solution and answer

GATE 2024 · CS2Q.24 · 1 mark · MSQ

Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?

  1. (A)

    Allocate a new page table for a newly created process

  2. (B)

    Translate a virtual address to a physical address using the page table

  3. (C)

    Raise a trap when a virtual address is not found in the page table

  4. (D)

    Raise a trap when a process tries to write to a page marked with read-only permission in the page table

See the question in the paper

Answer and solution

ANSWER

The MMU translates addresses (B), traps on a missing translation (C) and traps on a protection violation (D). Allocating a page table (A) is the OS's job.

Official answer: B, C, DSource: Official answer key, GATE 2024 CS2 (IISc Bengaluru)

  1. The MMU is the hardware between the CPU and memory. On every memory reference it does the work that must happen at hardware speed. Decisions about what to allocate belong to the operating system.

  2. (A) Allocating a page table for a new process is done by the OS kernel when it creates the process. The MMU only reads the table, through the page-table base register. So (A) is not an MMU task.

  3. (B) Translation is the core MMU function. It splits the virtual address into a page number and an offset, finds the frame (through the TLB or a page-table walk) and forms the physical address. So (B) is an MMU task.

  4. (C) If the page-table entry for the page is absent or its valid bit is 0, the MMU detects this during translation and raises a page-fault trap. The OS then handles the fault. Detecting the problem and raising the trap are done by the MMU, so (C) is an MMU task.

  5. (D) Each page-table entry carries protection bits (read, write, execute). The MMU checks them on every access. A write to a read-only page raises a protection-fault trap. So (D) is an MMU task.

  6. Correct options: B, C and D.

KEY IDEA

The MMU is hardware. It translates addresses and checks the valid and permission bits in the page-table entry, trapping to the OS on a violation. The OS does all allocation and policy work.

WATCH OUT FOR

Counting the creation of a page table as an MMU task. The MMU only uses the table. The kernel builds it, and the kernel handles the trap the MMU raises.

From the GATE 2024 CS2 paper. Every question of this paper · Download the full paper · All 10 Memory management questions, with notes

More Memory management questions