Virtual Memory Management
- 24Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the primary advantage of using virtual memory?
What is the primary advantage of using virtual memory?
24 questions
- 1
What is the primary advantage of using virtual memory?
- A
Increases the speed of the CPU
- B
Allows programs to execute entirely from backing storage
- C
Eliminates the need for page tables
- D
Enables programs larger than physical memory to run
Correct answer
DEnables programs larger than physical memory to run
Explanation
Virtual memory allows a program to use more memory than physically available by only loading needed pages into physical memory.
- A
- 2
In virtual memory, what is swap space?
- A
A portion of main memory reserved for temporary data
- B
The region of virtual memory where the operating system resides
- C
A special cache in the CPU for page table entries
- D
The area on disk used to store pages not currently in physical memory
Correct answer
DThe area on disk used to store pages not currently in physical memory
Explanation
Swap space is dedicated disk space used to hold pages that are not currently in physical memory, enabling virtual memory.
- A
- 3
What distinguishes virtual memory from physical memory?
- A
Physical memory uses swap space, while virtual memory does not
- B
Virtual memory is a logical abstraction that can exceed physical memory size
- C
Virtual memory is faster than physical memory
- D
Virtual memory is stored on the CPU cache
Correct answer
BVirtual memory is a logical abstraction that can exceed physical memory size
Explanation
Virtual memory is the logical address space seen by processes, which can be much larger than the available physical memory.
- A
- 4
What is demand paging?
- A
Preloading all pages of a process at startup
- B
Loading an entire process into memory before execution
- C
Using a separate disk partition for page storage
- D
Loading only those pages that are actually needed during execution
Correct answer
DLoading only those pages that are actually needed during execution
Explanation
Demand paging loads pages into memory only when they are referenced, rather than loading the entire process.
- A
- 5
What is pure demand paging?
- A
Loading all pages at once and then using page replacement
- B
Using a separate I/O processor for page loading
- C
Loading no pages initially and letting page faults bring them in
- D
Preloading the first page of every process
Correct answer
CLoading no pages initially and letting page faults bring them in
Explanation
Pure demand paging starts a process with no pages in memory, and the first instruction causes a page fault to load the needed page.
- A
- 6
What is a page fault?
- A
A hardware failure in the memory management unit
- B
An error when a program accesses memory beyond its allocated space
- C
An interrupt that occurs when a referenced page is not in memory
- D
A situation where the page table is too large
Correct answer
CAn interrupt that occurs when a referenced page is not in memory
Explanation
A page fault happens when the CPU tries to access a page that is not present in physical memory, triggering the OS to load it from disk.
- A
- 7
Which of the following steps occurs during page fault handling?
- A
The OS updates the page table after loading the page from disk
- B
The CPU directly accesses the disk for the missing page
- C
The page is copied from another process's memory
- D
The process is immediately terminated
Correct answer
AThe OS updates the page table after loading the page from disk
Explanation
After loading the page from disk, the OS updates the page table to mark the page as valid and then restarts the interrupted instruction.
- A
- 8
What is the role of the pager in demand paging?
- A
To handle system calls from user programs
- B
To allocate CPU time to processes
- C
To manage the loading of pages from disk to memory on demand
- D
To schedule page replacement algorithms
Correct answer
CTo manage the loading of pages from disk to memory on demand
Explanation
The pager is responsible for bringing pages into memory when they are needed, handling page faults.
- A
- 9
In the context of page faults, what does 'restart the instruction' mean?
- A
The instruction is skipped to avoid the fault
- B
The CPU re-executes the instruction that caused the page fault
- C
The page fault handler returns without changing the CPU state
- D
The entire process is restarted
Correct answer
BThe CPU re-executes the instruction that caused the page fault
Explanation
After the missing page is loaded, the CPU retries the same instruction, which should now find the page in memory.
- A
- 10
What is the effective access time formula in demand paging?
- A
EAT=extmemoryaccesstime+extpagefaulttime
- B
EAT=(1−p)imesextmemoryaccesstime+pimesextpagefaulttime
- C
EAT=pimesextmemoryaccesstime+(1−p)imesextpagefaulttime
- D
EAT=(extmemoryaccesstime)imes(extpagefaulttime)
Correct answer
BEAT=(1−p)imesextmemoryaccesstime+pimesextpagefaulttime
Explanation
The effective access time is the weighted average of memory access time (probability 1−p) and page fault service time (probability p).
- A
- 11
Why does adding more physical memory typically improve system performance?
- A
It reduces the frequency of page faults by allowing more pages to reside in memory
- B
It speeds up the disk I/O subsystem
- C
It increases the number of page faults
- D
It decreases the size of the page table
Correct answer
AIt reduces the frequency of page faults by allowing more pages to reside in memory
Explanation
More physical memory means more frames available, so fewer page faults occur, reducing the overhead of disk I/O.
- A
- 12
What is thrashing in virtual memory systems?
- A
A hardware error in the memory controller
- B
A condition where the page table becomes corrupted
- C
A process that uses too much CPU time
- D
Excessive paging activity where the system spends more time swapping than executing
Correct answer
DExcessive paging activity where the system spends more time swapping than executing
Explanation
Thrashing occurs when the system is constantly swapping pages in and out, leading to very low CPU utilization and performance degradation.
- A
- 13
What is the working set of a process?
- A
The set of shared pages among multiple processes
- B
The set of pages that the process has recently referenced and is expected to use soon
- C
The total number of pages allocated to the process
- D
The set of pages currently in physical memory
Correct answer
BThe set of pages that the process has recently referenced and is expected to use soon
Explanation
The working set is the collection of pages that a process is actively using, based on recent references, and it should fit in memory to avoid thrashing.
- A
- 14
Which of the following is a page replacement algorithm that can suffer from Belady's anomaly?
- A
Clock Algorithm
- B
Optimal Page Replacement
- C
Least Recently Used (LRU)
- D
First-In-First-Out (FIFO)
Correct answer
DFirst-In-First-Out (FIFO)
Explanation
Belady's anomaly, where more frames can increase page faults, is observed in FIFO and some other algorithms, but not in LRU or optimal.
- A
- 15
How does the FIFO page replacement algorithm work?
- A
It replaces the page that was least recently used
- B
It replaces a random page in memory
- C
It replaces the page that has been in memory the longest
- D
It replaces the page that will not be used for the longest time in the future
Correct answer
CIt replaces the page that has been in memory the longest
Explanation
FIFO selects the page that entered memory first, regardless of its usage pattern.
- A
- 16
What is the optimal page replacement algorithm?
- A
It replaces the page with the smallest frame number
- B
It replaces the page that has been in memory the longest
- C
It replaces the page that will not be used for the longest time in the future
- D
It replaces the page that was least recently used
Correct answer
CIt replaces the page that will not be used for the longest time in the future
Explanation
The optimal algorithm replaces the page that will be referenced farthest in the future, minimizing page faults, but it is theoretical because future references are unknown.
- A
- 17
How does LRU page replacement differ from FIFO?
- A
LRU and FIFO are identical in behavior
- B
LRU replaces the page that has not been used for the longest time, while FIFO replaces the oldest loaded page
- C
LRU replaces the oldest loaded page, while FIFO replaces the least recently used page
- D
LRU is a variant of FIFO with better performance
Correct answer
BLRU replaces the page that has not been used for the longest time, while FIFO replaces the oldest loaded page
Explanation
LRU uses past usage to predict future usage, replacing the page with the longest time since last reference, whereas FIFO ignores usage patterns.
- A
- 18
What hardware support is commonly used to implement LRU?
- A
A special cache for page references
- B
A dedicated page table entry counter
- C
A stack or clock with use bits
- D
An interrupt handler for each memory access
Correct answer
CA stack or clock with use bits
Explanation
LRU can be approximated using a clock algorithm with reference bits, or a stack can maintain the order of page references.
- A
- 19
What is the locality of reference principle?
- A
Programs tend to access only memory in the heap region
- B
Programs tend to access memory locations that are physically close to each other
- C
Programs tend to use only a small set of memory locations over a short period
- D
Programs tend to access memory randomly
Correct answer
CPrograms tend to use only a small set of memory locations over a short period
Explanation
Locality of reference means that processes typically access a small subset of pages repeatedly, which makes demand paging effective.
- A
- 20
How can an operating system prevent thrashing?
- A
By increasing the page size
- B
By using a faster CPU
- C
By disabling demand paging
- D
By suspending one or more processes to reduce memory demand
Correct answer
DBy suspending one or more processes to reduce memory demand
Explanation
If thrashing occurs, the OS can suspend processes to free up frames, allowing the remaining processes to fit their working sets in memory.
- A
- 21
What is page fault frequency (PFF) used for?
- A
To control the degree of multiprogramming by monitoring page fault rates
- B
To determine the size of the page table
- C
To measure the speed of disk I/O
- D
To calculate the optimal page size
Correct answer
ATo control the degree of multiprogramming by monitoring page fault rates
Explanation
If page fault frequency is too high, the OS can suspend processes; if too low, it may add more processes to improve CPU utilization.
- A
- 22
In demand paging, what is clustering?
- A
Grouping multiple processes together to share pages
- B
Loading several consecutive pages around a faulted page to reduce future faults
- C
Using multiple disk drives for page swapping
- D
Storing page table entries in a cluster of memory
Correct answer
BLoading several consecutive pages around a faulted page to reduce future faults
Explanation
Clustering loads a group of pages around the requested page because of locality, reducing the number of future page faults.
- A
- 23
What is the dirty bit used for in page replacement?
- A
To show the age of a page in memory
- B
To indicate that a page is shared between processes
- C
To indicate that a page has been modified and must be written back to disk before replacement
- D
To mark a page as invalid
Correct answer
CTo indicate that a page has been modified and must be written back to disk before replacement
Explanation
The dirty bit (or modified bit) tells the OS whether the page has been written to. If set, the page must be saved to disk when replaced; otherwise, it can be discarded.
- A
- 24
What is Belady's anomaly?
- A
The tendency of page faults to cluster together
- B
The phenomenon where LRU outperforms FIFO
- C
The observation that increasing the number of frames can increase the number of page faults
- D
The fact that optimal page replacement is impossible to implement
Correct answer
CThe observation that increasing the number of frames can increase the number of page faults
Explanation
Belady's anomaly is a counterintuitive effect where adding more frames leads to more page faults, notably in FIFO.
- A

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