📝 Page size in Virtual Memory (11 MCQs)
Choosing the Size of Virtual Memory Pages
Page size is the number of bytes contained in one virtual page and its corresponding physical frame. Virtual-memory systems commonly use fixed-size pages, with hardware determining supported sizes and translation formats. Page size influences address division, page-table structure, fragmentation, TLB efficiency, and storage-transfer behaviour. Operating systems and processors may support multiple page sizes to accommodate different application requirements.
Why Page Size Creates Memory and Translation Trade-Offs
Small pages reduce unused space when processes allocate limited memory regions but increase the number of page-table entries required for large address spaces. Larger pages reduce mapping counts and can improve translation coverage, but may waste more memory and increase the amount transferred for an individual fault. Selecting page size therefore involves balancing internal fragmentation against mapping and translation overhead.
Page Offset Bits and Address Division
For a page size of 2 raised to n bytes, the lowest n address bits represent the page offset. The remaining virtual-address bits identify the virtual page number. For example, 4 KB pages require a 12-bit offset because 4096 equals 2 raised to 12. The MMU replaces the page number with a physical frame number while preserving those offset bits.
Comparing Small and Large Page Allocations
Consider a 4 MB memory region. With 4 KB pages, it requires 1024 page mappings. With 2 MB pages, it requires only two mappings, assuming aligned addresses and supported large-page operation. The larger pages reduce mapping overhead, but an allocation containing only a small portion of a 2 MB region can leave substantial unused internal space.
TLB Coverage, Fragmentation and Storage Performance
Larger pages increase the amount of virtual memory represented by each TLB entry and can improve performance for large contiguous workloads. Smaller pages provide more precise allocation and can reduce wasted memory for scattered data. Fault handling and storage transfers may also differ according to page size and implementation. Large pages require suitable alignment, contiguous backing resources, and hardware support.
Common Errors About Page Dimensions
'The page offset changes when a page is translated' is incorrect because translation preserves the offset. 'Larger pages always improve memory utilisation' is incorrect because they can increase internal fragmentation. 'Every operating system uses one universal page size' is incorrect because supported sizes and allocation policies depend on processor architecture and system configuration.
Exam Focus: Offset Bits and Page-Count Calculations
Calculate the number of offset bits using log base 2 of the page size. Determine page counts by dividing memory-region size by page size, and compare page-table entry requirements. Practise identifying the effect of page size on internal fragmentation and TLB coverage. Check alignment and supported large-page conditions when interpreting address-translation examples.
Key Terms of Page Size
- Page size - Bytes contained in one page.
- Page offset - Position inside a page.
- Virtual page - Fixed-size logical memory block.
- Physical frame - Corresponding RAM block.
- Large page - Page larger than the standard size.
- Alignment - Required address-boundary positioning.
📝 All Page size in Virtual Memory MCQs
Q1. What is the definition of page size in a virtual memory system?
📖 Explanation: The correct answer is the fixed‑length block of virtual memory that corresponds to a physical frame because page size determines how memory is divided into equal chunks for paging. Option A describes kernel memory, not paging. Option C confuses page size with swap space size. Option D refers to multitasking capacity, which is unrelated. Understanding this definition helps students see why page size matters when designing memory‑management policies.
Q2. Why does over‑allocation of memory often lead to the need for page replacement?
📖 Explanation: When all frames are occupied, a new page fault cannot be satisfied by a free frame, so the OS must choose a resident page to evict. Option A is opposite; more free frames would lower fault rates. Option B is a possible but undesirable response, not the typical mechanism. Option D misstates the effect of over‑allocation. Recognizing this chain clarifies why page replacement is essential for maintaining system responsiveness.
Q3. How does a larger page size affect internal fragmentation within a process?
📖 Explanation: A larger page size means each allocated page can hold more data, so the leftover space at the end of a process’s address space is typically smaller, reducing wasted memory. Option B incorrectly claims the opposite; while the final page may be partially filled, the overall waste tends to drop as page size grows. Option C is false because fragmentation still exists, and Option D ignores the relationship. This concept helps students balance page‑size choices against memory efficiency.
Q4. A process requires 10 KB of memory and the system uses a 4 KB page size. How many pages must be allocated for the process?
📖 Explanation: The process needs enough pages to cover 10 KB, so two full 4 KB pages (8 KB) plus a third page for the remaining 2 KB, totaling three pages. Option A would only provide 8 KB, insufficient. Option C would allocate 12 KB, more than necessary, and Option D even more. Calculating the number of pages is a routine step when mapping a process’s memory requirements to the paging architecture.
Q5. If the page size is doubled while the working set size of a program remains unchanged, what is the most likely impact on the number of page faults?
📖 Explanation: Doubling the page size reduces the total number of pages needed to represent the same working set, so the system has fewer pages to replace, leading to fewer page faults. Option A suggests the opposite trend, which contradicts the relationship between page count and fault frequency. Option C ignores the effect of page size on page count. Option D is unnecessary because the working set size is given. Understanding this effect guides designers when selecting an optimal page size.
Q6. A computer has 8 GB of total memory, and the operating system reserves 20 % of it for I/O buffers. How much memory is allocated to I/O buffers?
📖 Explanation: Twenty percent of 8 GB equals GB, so the I/O subsystem receives 1.6 GB. Option A (2 GB) corresponds to 25 %, not 20 %. Option B (1 GB) reflects 12.5 %. Option D (2.4 GB) would be 30 %. Converting percentages to actual memory sizes is a common task when configuring system resources.
Q7. Which page‑replacement algorithm is most effective at reducing thrashing in a heavily loaded system?
📖 Explanation: LRU replaces the page that has not been used for the longest time, which tends to keep frequently accessed pages in memory and thus cuts down on repeated page faults that cause thrashing. FIFO (Option A) can evict pages still in use, leading to higher fault rates. Random replacement (Option B) lacks any strategy, and the clock algorithm (Option C) approximates LRU but can still suffer more thrashing than true LRU. Knowing the strengths of each algorithm helps administrators choose the best fit for high‑load environments.
Q8. Why is demand paging expected to be transparent to the user?
📖 Explanation: Demand paging aims to keep the CPU busy by loading pages only when needed, so users experience smoother performance without noticing the underlying swaps. Option B contradicts the goal of hiding latency. Option C incorrectly assigns responsibility to the user. Option D limits the technique to a niche class of OSes. Recognizing transparency explains why modern OSes can run large applications on limited physical memory.
Q9. Two systems run the same workload: System X reserves a fixed 10 % of memory for I/O buffers, while System Y lets user processes and I/O compete for all memory. Which system is more likely to achieve higher throughput under heavy I/O demand?
📖 Explanation: When I/O demand is high, allowing the I/O subsystem to draw from the entire memory pool (System Y) gives it more flexibility to allocate larger buffers, reducing wait times and increasing data transfer rates. Fixed allocation (System X) may starve I/O if the preset 10 % is insufficient. Option C ignores the impact of allocation strategy, and Option D misattributes throughput solely to CPU performance. This scenario illustrates trade‑offs in memory‑allocation policies.
Q10. Which page‑replacement algorithm explicitly replaces the page that has not been used for the longest period of time?
📖 Explanation: The LRU algorithm tracks usage history and evicts the page whose last reference occurred furthest in the past, matching the description. The Clock algorithm approximates LRU but uses a reference bit, not the exact longest‑unused criterion. FIFO removes pages in arrival order regardless of recent use. NRU groups pages by recent reference but does not guarantee the longest‑unused page is chosen. Understanding LRU helps students grasp why it often yields fewer page faults.
Q11. A system has a memory‑access time of 100 ns and a page‑fault service time of 8 ms. If the hit ratio is 0.95, what is the effective memory‑access time?
📖 Explanation: Effective access time = . Converting 8 ms to 8,000,000 ns gives , or about 0.4 ms. Option B (0.5 ms) overestimates, Option C (0.05 ms) underestimates, and Option D (1 ms) is far off. This calculation shows how even a small miss rate can dominate overall performance when page‑fault latency is large.