operating-systems hardware

Definition

Memory Protection

Memory protection is a mechanism to control memory access rights on a computer. The goal is to prevent a process from accessing memory that has not been allocated to it, thereby ensuring system stability and security.

Mechanisms

Modern hardware supports several methods for enforcing protection:

Segmentation / Bounds

The hardware uses base and bound registers to ensure a process’s logical address is within its legal range.

Page Table Bits

Each entry in a page table contains control bits that specify the allowed operations:

  • Read/Write/Execute: Defines the permission level.
  • User/Kernel: Restricts access to sensitive pages to code running in Kernel Mode.

Protection Keys

A more granular approach where unique keys are assigned to memory regions:

  • Frame-based: Each physical frame has a key. The process’s current key must match the frame’s key to allow access.
  • TLB-based: Each TLB entry has a key (or Access ID). The CPU compares this with a set of Protection Key Registers assigned to the process. If no match is found, an exception is generated.