🎓 BookMCQ
← Back to 8. Main Memory

📝 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 10 KB,20 KB,15 KB10 \text{ KB}, 20 \text{ KB}, 15 \text{ KB} sum to 45 KB45 \text{ KB} yet cannot allocate a 30 KB30 \text{ KB} process requiring contiguous space.

Reason:
Fragmentation degrades memory utilization over time necessitating compaction or migration to non-contiguous schemes like paging.

2
Easy
5
Medium
4
Hard

📝 All Fragmentation in contiguous memory allocation MCQs

Q1. What information does the limit register store for a process?

A.The highest physical address the process can reach
B.The size of the addressable range for the process ✅
C.The starting address of the process in memory
D.A flag indicating read‑only pages
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Because hardware checks are faster and avoid costly context switches ✅
B.Because the OS cannot read physical addresses
C.Because user programs can modify OS code directly
D.Because hardware provides better debugging information
💡 Difficulty: easy | ✅ Correct: A

📖 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 300040300040 and a limit register of 120900120900. Which of the following addresses will be permitted?

A.420939420939
B.421000421000
C.300039300039
D.420940420940
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The legal range runs from the base up to base + limit − 1, i.e., 300040300040 through 300040+1209001=420939300040+120900-1 = 420939. Address 420939420939 lies at the upper bound and is allowed. 421000421000 exceeds the limit, 300039300039 is below the base, and 420940420940 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 100000100000 limit 5000050000; P2 base 150000150000 limit 4000040000; P3 base 200000200000 limit 3000030000. Which situation most likely indicates external fragmentation?

A.P2 cannot access address 190000190000
B.P1 cannot access address 149999149999
C.P3 cannot access address 230000230000
D.All processes have overlapping address ranges ✅
💡 Difficulty: medium | ✅ Correct: D

📖 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?

A.It occurs when the limit register rounds the allocated size up to the nearest power of two ✅
B.It is caused by unused memory within the allocated range that the limit register defines
C.It happens when the base register is misaligned
D.It is eliminated entirely by hardware checks
💡 Difficulty: medium | ✅ Correct: A

📖 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 250000250000 and its limit register to 7500075000, what is the highest legal physical address the process can reference?

A.324999324999
B.325000325000
C.324999324999
D.325001325001
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The highest legal address is computed as base + limit − 1. Substituting the given values: 250000+750001=324999250000 + 75000 - 1 = 324999. 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?

A.They cannot stop the operating system from allocating overlapping regions ✅
B.They only protect address ranges but do not control how those ranges are placed in physical memory
C.They lack the ability to enforce read‑only permissions
D.They are too slow to check each memory access
💡 Difficulty: hard | ✅ Correct: A

📖 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 100000100000 limit 4000040000; P2 base 140000140000 limit 3000030000; P3 base 170000170000 limit 2500025000. Which address will cause a protection fault for P2?

A.169999169999
B.170000170000
C.139999139999
D.170001170001
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: P2's legal range spans from 140000140000 to 140000+300001=169999140000+30000-1 = 169999. Any address above 169999169999 is illegal. Therefore 170001170001 (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?

A.It eliminates both internal and external fragmentation ✅
B.It reduces external fragmentation but may increase internal fragmentation
C.It increases external fragmentation while reducing internal fragmentation
D.It has no impact on fragmentation
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.The hardware replaces virtual memory entirely ✅
B.The OS must translate virtual addresses before the hardware checks base/limit limits
C.The base/limit registers are used only when virtual memory is disabled
D.The hardware checks only physical addresses, ignoring virtual mappings
💡 Difficulty: hard | ✅ Correct: A

📖 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 500000500000 and limit 200000200000. The process attempts to write to address 699999699999. Which of the following best describes the system’s response?

A.The write succeeds because the address is within the limit ✅
B.The write fails because the address exceeds the highest legal address by one
C.The write succeeds but is redirected to a different process’s memory
D.The write triggers a hardware protection fault
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The legal range ends at 500000+2000001=699999500000 + 200000 - 1 = 699999. Since the attempted address equals the highest legal address, it is permitted; however, the question states the process attempts to write to 699999699999 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.

🔗 Related Topics (MCQs)