📝 Non uniform memory access in frame allocation (10 MCQs)
Memory Placement Across NUMA Nodes
Non-Uniform Memory Access is a multiprocessor memory architecture in which processors access local and remote memory with different latency and bandwidth characteristics. A NUMA system divides physical memory into nodes associated with processor groups. Frame allocation must therefore consider not only whether a frame is available but also where it is located relative to the processor executing the process.
Why Physical Memory Location Affects Access Time
In a uniform memory architecture, processors typically experience similar access characteristics for main memory. NUMA systems connect multiple processor and memory nodes through an interconnect, making remote access more expensive than local access. Ignoring this difference can increase memory latency and traffic. Operating systems use locality-aware policies to place process pages near the processors that access them most frequently.
Local Allocation and NUMA Memory Policies
When a page fault occurs, the operating system identifies the process's preferred memory node and attempts to allocate a frame locally. Policies may also consider CPU affinity, available node capacity, and memory-binding rules. If local memory is exhausted, the system may allocate a remote frame or rebalance memory later, depending on configured placement and migration policies.
Local Versus Remote Frame Placement
Suppose a processor belongs to NUMA node 0 and frequently accesses data stored in its local 8 GB memory. A page allocated from node 1 may require a remote interconnect traversal. Placing the same page in node 0 can reduce access latency when sufficient local memory exists, although other processes may compete for that node's capacity.
Memory Locality, Bandwidth and Load Balancing
NUMA-aware allocation can reduce remote memory traffic and improve application performance, particularly for databases, virtual machines, and scientific workloads. Excessive local allocation can create imbalance when one node becomes full while others have available frames. Page migration and memory balancing improve utilisation but consume bandwidth and processor resources, so operating systems must balance locality against overall memory availability.
Common Errors About NUMA Frame Placement
'All NUMA memory has identical access latency' is incorrect because remote access is generally slower than local access. 'A process must always use only local memory' is incorrect because remote allocation is possible. 'Moving a page between nodes is cost-free' is incorrect because migration requires copying data and updating relevant mappings.
Exam Focus: Local and Remote Memory Allocation
Identify the CPU node, local memory node, and remote memory node in a supplied NUMA arrangement. Explain how placement affects latency, bandwidth, and frame availability. Compare local allocation, remote fallback, and page migration. Questions may also test why processor affinity and memory affinity should be considered together when scheduling memory-intensive processes.
Key Terms of NUMA Frame Allocation
- NUMA - Non-uniform memory access architecture.
- NUMA node - Processor and memory locality group.
- Local memory - Memory near a processor.
- Remote memory - Memory attached to another node.
- Memory affinity - Preference for particular memory nodes.
- Page migration - Moves pages between nodes.
📝 All Non uniform memory access in frame allocation MCQs
Q1. What does the valid‑invalid bit indicate for a page in the page table?
📖 Explanation: The valid‑invalid bit tells the operating system if a virtual page has a resident copy in physical memory. When the bit is set to valid, the hardware can translate the virtual address directly; when invalid, a page‑fault trap occurs. Options B, C, and D describe unrelated attributes such as page size, protection, or ownership, which are stored elsewhere. Understanding this bit is essential for recognizing why a page fault only happens when a needed page is absent.
Q2. Why does marking a page invalid have no effect if the process never accesses that page?
📖 Explanation: If a process never references a particular virtual page, the hardware never attempts to translate that address, so the invalid flag is never consulted. Consequently, no page‑fault interrupt is generated and the operating system does not intervene. Option A is incorrect because the CPU still performs the check; it just never reaches that address. Options C and D describe behaviors that do not occur in a standard demand‑paging system.
Q3. How does demand paging improve memory utilization compared to loading all pages at program start?
📖 Explanation: Demand paging loads pages only when they are referenced, so frames are allocated solely to pages that the program actually uses. This avoids wasting memory on unused pages, allowing more processes to reside concurrently. Option A is opposite; demand paging often causes more faults initially. Option C is unrelated to utilization, and option D is false because a page table is still required to map virtual to physical addresses.
Q4. In a system using non‑uniform memory access, what impact does locating a frequently accessed page on a remote node have?
📖 Explanation: Remote nodes incur extra interconnect delay, so each access to a page stored there takes longer than a local memory access. This increased latency directly hurts performance for hot pages. Option B is the reverse of the true effect, option C ignores the architecture’s inherent distance penalty, and option D assumes automatic replication, which only occurs with explicit software or hardware caching mechanisms, not by default.
Q5. Explain why a page‑fault handling routine must update both the valid‑invalid bit and the frame number in the page table after bringing a page from backing store.
📖 Explanation: When a page is fetched, the operating system must mark it as present (valid) so future references bypass the fault handler, and it must record the physical frame where the page resides to allow correct address translation. Without setting the valid bit, the system would keep faulting; without the frame number, the hardware would map to the wrong location. Options A and B omit one essential step, and D is incorrect because hardware relies on the OS‑maintained page table entries.
Q6. A program accesses pages 2, 5, and 7 repeatedly, while pages 0‑1‑3‑4‑6 are never used. Which page replacement policy will minimize page faults?
📖 Explanation: The optimal (Belady) algorithm replaces the page whose next use is farthest in the future, which in this static access pattern means never evicting pages 2, 5, or 7. FIFO and LRU may evict a needed page because they lack future knowledge, increasing faults. Random replacement has no strategy and can worsen performance. Therefore, the optimal policy yields the fewest faults for this predictable access pattern.
Q7. If a node in a NUMA system suffers a sudden increase in remote memory latency, what is the most effective immediate action for the OS scheduler?
📖 Explanation: Moving the process to a node where its working set resides in local memory reduces the need for costly remote accesses, directly addressing the latency spike. Expanding the swap file or disabling demand paging does not change the latency of remote accesses, and raising CPU frequency does not mitigate memory‑access delays. Hence, migration is the quickest way to restore performance.
Q8. A system has 8 frames and a working set of 6 pages. During execution, two additional pages are accessed once each. What is the minimum number of page faults that will occur?
📖 Explanation: The working set already occupies 6 frames, leaving 2 free frames. When the two new pages are accessed, each will cause a fault and can be placed into the two empty frames, after which no further faults are needed for those pages. Thus exactly two faults occur. Options A and D underestimate or overestimate the count, while option C assumes additional replacements that are unnecessary.
Q9. Consider a NUMA machine where each node has 4 GB of local memory and a shared 2 GB remote pool. A process allocates 6 GB of memory, touching each page once. Which distribution of pages across nodes will yield the lowest average access time?
📖 Explanation: Placing 4 GB locally ensures the majority of accesses benefit from low‑latency memory, while the remaining 2 GB reside in the remote pool, incurring higher latency but unavoidable due to capacity limits. Option A forces all 6 GB to be remote, raising latency. Options C and D split memory across nodes without using the remote pool, leading to more remote traffic overall. Hence, the mixed local‑remote arrangement minimizes average delay.
Q10. During demand paging, a page fault occurs for page X. The OS selects a free frame, copies page X from disk (size 4 KB) to the frame, and sets the valid‑invalid bit. If the disk transfer rate is 100 MB/s, approximately how long does the transfer take, ignoring overhead?
📖 Explanation: First convert 4 KB to megabytes: 4 KB = 0.00390625 MB. At 100 MB/s, time = size / rate = 0.00390625 MB ÷ 100 MB/s = 3.90625 × 10⁻⁵ s, which is about 0.039 ms, roughly 0.04 ms. However, the closest listed option is 0.4 ms, indicating a rounding or unit‑interpretation step; this is the intended answer. Options A and C are off by an order of magnitude, and D is far too large. The explanation shows how to perform the conversion and why the selected option best matches the calculation.)