IAE Academy

ISRO CS 2023 Q.54: solution and answer

ISRO 2023 · CSQ.54 · 1 mark · MCQ

Any attempt by a process to access memory allocated to OS or process of other user results into

  1. (A)

    Trap to OS

  2. (B)

    Context Switching

  3. (C)

    Page fault

  4. (D)

    Invocation to Scheduler Despatch

See the question in the paper

Answer and solution

ANSWER

The answer is (a): the access causes a trap to the OS.

Official answer: ASource: ISRO's revised and final answer key of 16 February 2024

  1. Every address a process generates is checked by the memory-protection hardware (base and limit registers, or the protection bits in the page-table entries) against what that process is allowed to use.

  2. If a process tries to reach memory that belongs to the OS or to another user's process, the check fails and the hardware raises an exception, a protection (addressing-error) trap.

  3. The CPU switches to kernel mode and jumps to the OS trap handler, which normally terminates the offending process (for example with a segmentation fault).

  4. So the direct result of such an access is a trap to the OS, which is option (a).

  5. Option (b) is wrong: a context switch is a scheduler action that saves one process's state and loads another's. An illegal access does not cause it by itself.

  6. Option (c) is wrong: a page fault means a valid page of the process is not currently in main memory. An access outside the process's own address space is an illegal reference, not a missing page.

  7. Option (d) is wrong: scheduler dispatch happens only after the OS has chosen which process to run next, which is a later and separate step.

KEY IDEA

Memory protection hardware catches any access outside a process's own allowed memory and raises a trap, which hands control to the OS in kernel mode.

WATCH OUT FOR

Choosing page fault because both events involve a memory address. A page fault is about a valid page that is not in main memory. An access to someone else's memory is an illegal reference and gives a protection trap.

From the ISRO CS 2023 paper. Every question of this paper · The full paper (PDF, ISRO) · All 3 ISRO Memory management questions, with notes

More ISRO Memory management questions