1. The Core Allocation Dilemma in Multiprogramming
When multiple processes run concurrently in a virtual memory operating system, physical RAM must be divided among them. If a running process suffers a page fault and all physical frames are occupied, the kernel must select a resident page to evict. The foundational policy question is: Should the victim be chosen exclusively from the faulting process's own allocated frames, or from any frame in the entire machine?
2. Local Allocation Policies
A local replacement policy assigns each active process a fixed quota of physical page frames (e.g., determined at process startup based on executable size or dynamic working set estimation). When a page fault occurs, the kernel chooses a replacement victim strictly from the pages owned by that specific process.
- Pros (Isolation): Processes are isolated from one another. A poorly written, thrashing program cannot steal frames from other well-behaved applications.
- Cons (Inflexibility): If a process enters a heavy compute phase requiring more memory, it cannot borrow idle frames from an inactive process, leading to artificial page faults and suboptimal performance.
3. Global Allocation Policies
A global replacement policy treats all physical memory frames in the machine as a unified, shared pool. When any process incurs a page fault, the kernel selects a replacement victim from the entire system-wide population of resident pages, regardless of which process owns them.
- Pros (Adaptability): Highly efficient. If Process A is idle, its resident frames naturally migrate to Process B if B's working set is expanding. Overall system throughput is maximized.
- Cons (Vulnerability): Lack of isolation. A runaway or thrashing program can continuously steal frames from other processes, dragging down system-wide responsiveness.
Part 3: Interactive Multi-Process Allocation Sandbox
Trigger page faults for Process A or Process B under Local vs. Global allocation policies and observe frame ownership.