📝 Fragmentation in contiguous memory allocation (11 MCQs)
📖 From Operating System • 8. Main Memory • 11 questions available
What is Fragmentation in contiguous memory allocation?
Definition:
External fragmentation occurs when free memory exists in small non-contiguous blocks totaling sufficient space but unable to satisfy a single large request.
Example:
Free holes of sizes sum to yet cannot allocate a process requiring contiguous space.
Reason:
Fragmentation degrades memory utilization over time necessitating compaction or migration to non-contiguous schemes like paging.
📝 All Fragmentation in contiguous memory allocation MCQs
Q1. What information does the limit register store for a process?
📖 Explanation: The limit register holds the length of the contiguous block that a process may use, expressed as a size, not a specific address. It tells the CPU how many bytes beyond the base address are legal. Options A and C describe the base register, while D is unrelated to memory protection. Knowing the limit helps the hardware reject any address that exceeds the allowed range, ensuring each process stays within its own space.
Q2. Why must the CPU hardware, rather than the operating system, enforce memory‑access limits for user programs?
📖 Explanation: The hardware is responsible for immediate protection because it can compare every generated address to the base and limit registers before the memory operation proceeds, preventing illegal accesses without involving the OS. This avoids the performance penalty of trapping to the OS for each check. Option A is partially true but the primary reason is the immediacy of hardware enforcement. Options B and D describe capabilities that are not accurate for this protection mechanism.
Q3. A process has a base register of and a limit register of . Which of the following addresses will be permitted?
📖 Explanation: The legal range runs from the base up to base + limit − 1, i.e., through . Address lies at the upper bound and is allowed. exceeds the limit, is below the base, and is just beyond the highest legal address, so each of those would trigger a protection fault. This illustrates how the hardware uses base/limit to enforce isolation between processes.
Q4. Three processes share memory as follows: P1 base limit ; P2 base limit ; P3 base limit . Which situation most likely indicates external fragmentation?
📖 Explanation: External fragmentation occurs when free memory is split into small, non‑contiguous blocks, causing allocation failures despite enough total free space. Overlapping ranges, as shown in option D, would mean the system cannot place processes in separate contiguous regions, a classic sign of external fragmentation. Options A, B, and C each describe a single process exceeding its own limit, which is a normal protection check, not fragmentation.
Q5. How does internal fragmentation relate to the use of a limit register for a process?
📖 Explanation: Internal fragmentation refers to wasted space inside a region that has been allocated to a process. Because the limit register defines the total size a process may use, any portion of that range that the process does not actually need remains unused, creating internal fragmentation. Option A describes a strategy used by some allocators, not inherent to limit registers. Misalignment (C) can cause external fragmentation, and hardware checks (D) do not remove internal waste.
Q6. If a process's base register is set to and its limit register to , what is the highest legal physical address the process can reference?
📖 Explanation: The highest legal address is computed as base + limit − 1. Substituting the given values: . Therefore option A is correct. Option B adds one too many, option C repeats the correct answer, and option D adds two beyond the allowed maximum. This calculation shows how the hardware determines the upper bound for each process, preventing it from reading or writing outside its assigned memory area.
Q7. Why can't base and limit registers alone prevent all forms of memory fragmentation?
📖 Explanation: Base and limit registers enforce per‑process boundaries but do not manage the overall layout of those blocks in physical memory. Consequently, gaps may appear between allocated blocks (external fragmentation) that the registers cannot eliminate. Overlap protection (A) is actually handled by the OS during allocation, not by the registers. Options B and D mischaracterize the registers' purpose, and C concerns permission bits rather than fragmentation.
Q8. Consider three processes with the following registers: P1 base limit ; P2 base limit ; P3 base limit . Which address will cause a protection fault for P2?
📖 Explanation: P2's legal range spans from to . Any address above is illegal. Therefore (option D) exceeds the limit and triggers a fault. Option A is the highest legal address, option B is just one beyond the limit and also illegal but not the one asked for, and option C is below the base, also illegal but not the highest exceeding address. This scenario emphasizes how hardware checks enforce isolation.
Q9. A simple memory manager uses base/limit pairs for each process and always places a new process at the lowest available address that fits. Which outcome best describes its effect on fragmentation over time?
📖 Explanation: Placing each new process in the lowest fitting hole tends to keep free memory blocks together, lowering external fragmentation. However, because each process receives a block sized to its request, any unused space within that block becomes internal fragmentation. Option A is unrealistic because internal waste remains; option C reverses the effects; option D ignores the allocation strategy's influence.
Q10. How does hardware‑enforced base/limit protection interact with an operating system’s virtual‑memory subsystem?
📖 Explanation: When virtual memory is active, the CPU first translates a virtual address to a physical one using page tables. After translation, the resulting physical address is then compared against the process’s base and limit registers. Thus, the hardware still performs the final protection check, but it does not replace the OS’s translation mechanism. Option A is false; B describes the correct order but the question asks about interaction; D misstates the role of base/limit.
Q11. A system allocates a process with base and limit . The process attempts to write to address . Which of the following best describes the system’s response?
📖 Explanation: The legal range ends at . Since the attempted address equals the highest legal address, it is permitted; however, the question states the process attempts to write to which is exactly the limit boundary, so the write should succeed. Wait, we need correct answer D? Actually correct is that it succeeds, so answer should be A. Let's correct: The correct answer is A, not D. We'll adjust row accordingly.