Virtual Memory Explained
- 20Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
In the era of physical addressing, what was the primary problem when running multiple programs simultaneously?
In the era of physical addressing, what was the primary problem when running multiple programs simultaneously?
20 questions
- 1
In the era of physical addressing, what was the primary problem when running multiple programs simultaneously?
- A
The CPU could not execute instructions from different programs at once
- B
Programs would overwrite each other's memory due to lack of protection
- C
The operating system could not allocate enough RAM for both programs
- D
Programs had to be stored as non-contiguous blocks causing fragmentation
Correct answer
BPrograms would overwrite each other's memory due to lack of protection
Explanation
Physical addressing allowed programs to write directly to hardware addresses. Without any abstraction, Program A could overwrite Program B's memory, causing crashes.
- A
- 2
What is external fragmentation?
- A
The loss of memory caused by the operating system's page table overhead
- B
The waste of memory inside allocated pages due to alignment requirements
- C
The inability to load a program because free memory is split into small, non-contiguous gaps
- D
The corruption of data when programs exceed their assigned bounds
Correct answer
CThe inability to load a program because free memory is split into small, non-contiguous gaps
Explanation
External fragmentation occurs when free memory is scattered in small holes that are individually too small to fit a program, even though total free space is sufficient.
- A
- 3
How did the base and bounds system achieve memory protection?
- A
By running each program in a separate virtual machine with isolated hardware
- B
By encrypting all memory accesses with a secret key stored in the base register
- C
By comparing the virtual address against the bound register and blocking illegal accesses
- D
By requiring programs to explicitly request permission for each memory segment
Correct answer
CBy comparing the virtual address against the bound register and blocking illegal accesses
Explanation
The MMU checks if the virtual address is less than the bound register value. If not, a segmentation fault is raised, preventing the program from accessing memory outside its allowed region.
- A
- 4
What is compaction in the context of base and bounds?
- A
The process of moving all running programs together to create a single large free block
- B
The technique of compressing program data to fit into smaller memory regions
- C
The operation of reducing the size of the bound register to save hardware resources
- D
The method of merging multiple small page frames into one larger segment
Correct answer
AThe process of moving all running programs together to create a single large free block
Explanation
Compaction stops all programs, shifts them in RAM to close gaps, creating a contiguous free space. It was slow and wasteful, but necessary when using contiguous allocation.
- A
- 5
Why did base and bounds still suffer from external fragmentation?
- A
Because the bound register could only hold a maximum of 4 KB of memory
- B
Because programs were allowed to have multiple non-contiguous segments
- C
Because the MMU could only translate addresses in multiples of the page size
- D
Because each program had to occupy a single contiguous block of physical memory
Correct answer
DBecause each program had to occupy a single contiguous block of physical memory
Explanation
Base and bounds required programs to be stored as one unbroken chunk. As programs were loaded and removed, gaps formed that were too small for new contiguous allocations.
- A
- 6
How did segmentation improve upon base and bounds?
- A
It eliminated all forms of memory fragmentation by using fixed-size pages
- B
It allowed a program to be divided into multiple independent segments with separate base/bound pairs
- C
It required all segments to be the same size to simplify allocation
- D
It replaced hardware registers with software-only memory management
Correct answer
BIt allowed a program to be divided into multiple independent segments with separate base/bound pairs
Explanation
Segmentation gave each program multiple segments (code, heap, stack) with their own base and bound, allowing non-contiguous placement and better memory utilization.
- A
- 7
What permission is typically assigned to the code segment in a segmentation system?
- A
Execute-only
- B
Read-write
- C
No access
- D
Read-only
Correct answer
DRead-only
Explanation
The code segment contains instructions that should not be modified. Hardware enforces read-only access, preventing bugs from overwriting the program's own code.
- A
- 8
How does segmentation allow multiple instances of the same program to share memory?
- A
By having all instances point to the same physical code segment while having private data segments
- B
By allocating a single segment that is time-shared between all instances
- C
By copying the entire program into separate physical locations and compressing it
- D
By using a shared page table that maps virtual addresses to the same physical frames
Correct answer
ABy having all instances point to the same physical code segment while having private data segments
Explanation
The code segment can be made read-only and shared. All running instances map their virtual code segment to the same physical memory, while each has its own data segment.
- A
- 9
Why did segmentation not eliminate external fragmentation?
- A
Because the operating system always allocates segments in contiguous blocks
- B
Because segments are of variable sizes, leading to non-contiguous free holes
- C
Because the hardware requires all segments to be aligned to 4 KB boundaries
- D
Because segments are automatically compacted by the OS at runtime
Correct answer
BBecause segments are of variable sizes, leading to non-contiguous free holes
Explanation
Segments still have variable sizes. As they are created and destroyed, the remaining free space becomes fragmented into small, non-contiguous gaps.
- A
- 10
How does paging eliminate external fragmentation?
- A
By using a single base register that spans the entire physical memory
- B
By dividing both physical memory and virtual address space into fixed-size units of the same size
- C
By allowing programs to request memory in any size and the OS dynamically compacts it
- D
By requiring all programs to be loaded into contiguous chunks of virtual memory
Correct answer
BBy dividing both physical memory and virtual address space into fixed-size units of the same size
Explanation
Paging chops RAM into fixed-size frames and virtual addresses into same-size pages. Any page can fit into any free frame, so there are no gaps too small to use.
- A
- 11
What is internal fragmentation in a paging system?
- A
The loss of memory due to the TLB not caching all translations
- B
Wasted space within a page when allocated memory is less than page size
- C
The unused space in page frames that are partially filled with swapped-out data
- D
The overhead of storing page tables for each process
Correct answer
BWasted space within a page when allocated memory is less than page size
Explanation
If a program needs only 1 byte, the OS must allocate a full 4 KB page, wasting the remaining space inside that page.
- A
- 12
Why does paging introduce a performance penalty compared to base and bounds?
- A
The TLB miss penalty causes the CPU to stall for thousands of cycles
- B
The page table must be stored on disk, causing frequent I/O
- C
Every memory access requires two RAM trips: one for the page table and one for the data
- D
The MMU must encrypt every address translation
Correct answer
CEvery memory access requires two RAM trips: one for the page table and one for the data
Explanation
Without TLB, each memory access needs to first look up the page table (to find the physical frame) and then access the actual data, doubling memory latency.
- A
- 13
What is the role of the Translation Lookaside Buffer (TLB)?
- A
To manage the allocation of page frames to processes
- B
To compress memory pages before writing them to disk
- C
To cache recent virtual-to-physical address translations for fast access
- D
To store the contents of the most frequently used page frames
Correct answer
CTo cache recent virtual-to-physical address translations for fast access
Explanation
The TLB is a hardware cache that stores recent translations, allowing address resolution without an extra RAM access. A TLB hit avoids the slow page table walk.
- A
- 14
What happens on a TLB miss?
- A
The TLB automatically discards the least recently used entry
- B
The MMU raises a page fault and loads the page from disk
- C
The operating system immediately kills the requesting process
- D
The CPU must perform a page table walk to find the physical address
Correct answer
DThe CPU must perform a page table walk to find the physical address
Explanation
On a TLB miss, the hardware must consult the page table in RAM to translate the address, which takes extra time.
- A
- 15
What is a page fault?
- A
A software interrupt that occurs when free physical memory drops below a threshold
- B
An error caused by writing to a read-only page in the code segment
- C
A hardware exception raised when a program accesses a virtual page marked as not present
- D
A condition where the TLB becomes full and cannot store new translations
Correct answer
CA hardware exception raised when a program accesses a virtual page marked as not present
Explanation
When a program accesses a page whose page table entry has the 'not present' flag, the CPU triggers a page fault, handing control to the OS to load the page.
- A
- 16
What is demand paging?
- A
A method of compressing pages in memory to reduce the number of required frames
- B
The strategy of loading pages into RAM only when they are accessed, rather than loading the entire program
- C
A technique where the OS preloads all pages of a program at startup to avoid page faults
- D
The process of writing dirty pages back to disk when physical memory is full
Correct answer
BThe strategy of loading pages into RAM only when they are accessed, rather than loading the entire program
Explanation
Demand paging lazily loads pages on first access. The OS initially marks most pages as not present and brings them in only when a page fault occurs.
- A
- 17
When physical RAM is full and a new page must be brought in, what does the OS typically do?
- A
It compresses the oldest pages to create more free space
- B
It selects a page to evict using a replacement algorithm like LRU
- C
It immediately crashes the system with an out-of-memory error
- D
It halts all processes and performs compaction
Correct answer
BIt selects a page to evict using a replacement algorithm like LRU
Explanation
The OS must free a frame by evicting a page, often choosing the least recently used (LRU) page to write back to disk.
- A
- 18
What does LRU stand for in page replacement?
- A
Last Requested Unit
- B
Linear Replacement Unit
- C
Lowest Random Utilization
- D
Least Recently Used
Correct answer
DLeast Recently Used
Explanation
LRU (Least Recently Used) is a replacement algorithm that evicts the page that has not been accessed for the longest time, assuming it is less likely to be needed soon.
- A
- 19
What is thrashing?
- A
A condition where the system spends most of its time moving pages between RAM and disk instead of executing programs
- B
The process of continuously increasing the size of the page table
- C
A state where the TLB miss rate exceeds 50%
- D
A hardware failure caused by excessive read/write cycles on the SSD
Correct answer
AA condition where the system spends most of its time moving pages between RAM and disk instead of executing programs
Explanation
Thrashing occurs when the OS is constantly page faulting and swapping pages, leading to very low CPU utilization and severe system slowdown.
- A
- 20
What is a common symptom of thrashing?
- A
The hard drive activity light stays solid and the system becomes sluggish
- B
The screen displays a blue error with memory management information
- C
All applications respond instantly but the fan runs at maximum speed
- D
The operating system prompts the user to close programs
Correct answer
AThe hard drive activity light stays solid and the system becomes sluggish
Explanation
The content mentions that when thrashing occurs, the cursor stutters and the hard drive activity light goes completely solid, indicating heavy disk I/O.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.