๐ Protection in Paging (11 MCQs)
๐ From Operating System โข 8. Main Memory โข 11 questions available
What is Protection in Paging?
Definition:
Protection bits in page table entries control read/write/execute permissions per page enforced by MMU on every access preventing unauthorized operations.
Example:
Code page marked allows execution but traps on write attempt protecting against code injection attacks.
Reason:
Fine-grained per-page protection enables secure multitasking and implements W^X policy critical for modern OS security architectures.
๐ All Protection in Paging MCQs
Q1. What is the primary purpose of a limit register in a protected memory system?
๐ Explanation: The limit register defines the upper bound of a processโs logical address space, so any address larger than this limit is invalid. This prevents a process from reading or writing outside its allotted memory. Options A and C describe the relocation (base) register and address translation, while D is unrelated to memory protection. Understanding the limit registerโs role is essential for enforcing isolation between processes.
Q2. A process attempts to read a logical address that exceeds its limit register value. What will the hardware typically do?
๐ Explanation: When a logical address is outside the range defined by the limit register, the MMU detects the violation and signals a fault, usually a segmentation fault. This stops the process from accessing unauthorized memory. Option A ignores the limit check, Option C would break protection guarantees, and Option D is not how modern systems allocate memory dynamically. The fault mechanism safeguards system stability.
Q3. Why are both a relocation (base) register and a limit register needed for effective memory protection?
๐ Explanation: The relocation (base) register translates a processโs logical addresses to physical addresses by adding a constant offset, establishing where the process begins in memory. The limit register then caps the highest logical address the process may use, ensuring it cannot exceed its allocated region. Options A and C misunderstand their distinct roles, and D describes a function not related to basic protection. Together they give both location and bounds, essential for isolating processes.
Q4. Given a relocation register value of 100040 and a limit register of 74600, what physical address corresponds to logical address 50000?
๐ Explanation: The physical address is calculated by adding the relocation base to the logical address: . This translation places the logical address within the processโs allocated memory region. Option B adds the limit incorrectly, Option C ignores the logical offset, and Option D mistakenly uses the limit as the physical address. This simple arithmetic illustrates how base registers map a processโs address space to actual memory locations.
Q5. How does a limit register enforce memory bounds for a running process?
๐ Explanation: Before the MMU translates a logical address, it compares the address with the limit register. If the address exceeds the limit, the access is denied and a fault is raised. This check ensures a process cannot stray beyond its allocated region. Options B and C misrepresent the function of the limit register, and D is unrelated to memory protection. The bound check is a core safeguard in multitasking environments.
Q6. If a system administrator mistakenly sets a processโs limit register to a value larger than its actual memory allocation, what risk does this create?
๐ Explanation: An oversized limit register removes the boundary that isolates a process, allowing it to access physical addresses that belong to other processes or the kernel. This can lead to data corruption, security breaches, or system instability. Options B and C underestimate the security implications, and D is extreme; the OS typically continues running but the protection is compromised. Proper limit settings are vital for safe multitasking.
Q7. What does the acronym MMU stand for in computer architecture?
๐ Explanation: The MMU is the hardware component that handles address translation, mapping logical (virtual) addresses to physical memory locations and enforcing protection checks. Options B, C, and D are plausible-sounding but incorrect expansions. Knowing the correct term is fundamental for discussing how computers isolate processes and manage memory efficiently.
Q8. In a system with several concurrent processes, each process is given its own relocation register value. How does this design help prevent one process from interfering with another's memory?
๐ Explanation: Assigning a distinct base (relocation) value to each process shifts its logical address space to a separate physical region, ensuring that even if two processes use the same logical address, the resulting physical addresses differ. This separation prevents accidental or malicious memory overlap. Options A and C negate the protective effect, while D misunderstands the role of limit registers, which still define each processโs range.
Q9. How does segmentation differ from a simple base/limit (relocation) scheme in terms of protection and flexibility?
๐ Explanation: Segmentation divides a programโs address space into named segments (code, data, stack), each with its own base and limit, allowing different sized regions and independent protection checks. A simple base/limit scheme uses one contiguous range, limiting flexibility. Option A reverses the characteristics, Option B incorrectly claims segmentation lacks protection, and Option D ignores the distinct mechanisms. Segmentation thus enhances both security and adaptability.
Q10. A program attempts to write to a logical address that is exactly one byte beyond its limit register value. Which hardware component will detect this violation?
๐ Explanation: The MMU performs the bound check against the limit register before allowing a write. When the address exceeds the limit, the MMU raises a fault, preventing the illegal write. The ALU processes arithmetic operations, the cache controller manages cached data, and the GPU handles graphics; none are responsible for memory protection checks. This detection is crucial for maintaining process isolation.
Q11. If a programโs base address (relocation register) is changed after it has been loaded into memory, what effect does this have on address translation?
๐ Explanation: Changing the relocation register updates the offset added to every logical address, so each address now maps to a different physical location. This allows the operating system to move a program in memory without altering its internal code. Options B and D contradict the fundamental role of the base register, and C misstates the continued need for a limit to enforce bounds. Properly updating the base ensures continued protection and correct operation.