Chapter 8: Virtual Memory Flashcards
Which of the following is a benefit of allowing a program that is only partially in memory to execute?
A) Programs can be written to use more memory than is available in physical memory.
B) CPU utilization and throughput is increased.
C) Less I/O is needed to load or swap each user program into memory.
D) All of the above
D- ALL OF THE ABOVE
In systems that support virtual memory, ____.
A) virtual memory is separated from logical memory.
B) virtual memory is separated from physical memory.
C) physical memory is separated from secondary storage.
D) physical memory is separated from logical memory.
D- PHYSICAL MEMORY IS SEPARATED FROM LOGICAL MEMORY
The vfork() system call in UNIX ____.
A) allows the child process to use the address space of the parent
B) uses copy-on-write with the fork() call
C) is not intended to be used when the child process calls exec() immediately after creation
D) duplicates all pages that are modified by the child process
A- ALLOWS THE CHILD PROCESS TO USE THE ADDRESS SPACE OF THE PARENT
Belady’s Anomaly states that ____.
A) giving more memory to a process will improve its performance
B) as the number of allocated frames increases, the page-fault rate may decrease for all page replacement algorithms
C) for some page replacement algorithms, the page-fault rate may decrease as the number of allocated frames increase
D) for some page replacement algorithms, the page-fault rate may increase as the number of allocated frames increases
D- FOR SOME PAGE REPLACEMENT ALGORITHMS, THE PAGE FAULT RATE MAY INCREASE AS THE NUMBER OF ALLOCATED FRAMES INCREASES
Optimal page replacement ____.
A) is the page-replacement algorithm most often implemented.
B) is used mostly for comparison with other page-replacement schemes.
C) can suffer from Belady’s anomaly.
D) requires that the system keep track of previously used pages.
B- IS USED MOSTLY FOR COMPARISON WITH OTHER PAGE-REPLACEMENT SCHEMES
In the enhanced second chance algorithm, which of the following ordered pairs represents a page that would be the best choice for replacement?
A) (0,0) B) (0,1) C) (1,0) D) (1,1)
A
The \_\_\_\_\_ allocation algorithm allocates available memory to each process according to its size. A) equal B) global C) proportional D) slab
C- PROPORTIONAL
The \_\_\_\_ is the number of entries in the TLB multiplied by the page size. A) TLB cache B) page resolution C) TLB reach D) hit ratio
C- TLB REACH
What is the benefit of using sparse addresses in virtual memory?
Virtual address spaces that include holes between the heap and stack are known as sparse address spaces. Using a sparse address space is beneficial because the holes can be filled as the stack or heap segments grow or if we wish to dynamically link libraries (or possibly other shared objects) during program execution.
Compare a demand paging system with a paging system with swapping.
A demand-paging system is similar to a paging system with swapping where processes reside in secondary memory. With demand paging, when we want to execute a process, we swap it into memory. Rather than swapping the entire process into memory, however, we use a lazy swapper. A lazy swapper never swaps a page into memory unless that page will be needed. So a swapper manipulates entire processes, whereas a demand pager is concerned with the individual pages of a process.
Explain the sequence of events that happen when a page-fault trap occurs.
When the operating system cannot load the desired page into memory, the page-fault trap occurs. First, the memory reference is checked for validity. In the case of an invalid request, the program will be terminated. If the request was valid, a free frame is located. A disk operation is then scheduled to read the page into the frame just found and use the page accordingly.
How is the effective access time computed for a demand-paged memory system?
In order to compute the effective access time, we need to know the average memory access time of the system, the probability of a page fault, and the time necessary to service a page fault. The effective access time can then be computed using the formula: effective access time = (1-probability of page fault) * memory access time + probability of page fault * page fault time.
. How does the second-chance algorithm for page replacement differ from the FIFO page replacement algorithm?
The second-chance algorithm is based on the FIFO replacement algorithm and even degenerates to FIFO in its worst case scenario. In this algorithm, a FIFO replacement is implemented along with a reference bit. If the reference bit is set, then we clear the bit, the page’s arrival time is set to the current time, and we move along in a similar fashion through the pages until a page with a cleared reference bit is found and subsequently replaced.
Explain the concept behind prepaging.
Paging schemes such as pure demand paging result in large amounts of initial page faults as the process is started. Prepaging is an attempt to prevent this high level of initial paging by bringing into memory, at one time, all of the pages that will be needed by the process
Why doesn’t a local replacement algorithm solve the problem of thrashing entirely?
With local replacement, if one process starts thrashing, it cannot steal frames from another process and cause the latter to thrash as well. However, if processes are thrashing, they will be in the queue for the paging device most of the time. The average service time for a page fault will increase because of the longer average queue for the paging device. Thus, the effective access time will increase even for a process that is not thrashing.
Explain the difference between programmed I/O (PIO) and interrupt driven I/O.
To send out a long string of bytes through a memory-mapped serial port, the CPU writes one data byte to the data register to signal that it is ready for the next byte. If the CPU uses polling to watch the control bit, constantly looping to see whether the device is ready, this method of operation is called programmer I/O. If the CPU does not poll the control bit, but instead receives an interrupt when the device is ready for the next byte, the data transfer is said to be interrupt driven.
What are the benefits of using slab allocation to allocate kernel memory?
The slab allocator provides two main benefits. First, no memory is wasted due to fragmentation. When the kernel requests memory for an object, the slab allocator returns the exact amount of memory required to represent the object. Second, memory requests can be satisfied quickly. Objects are created in advance and can be quickly allocated. Also, released objects are returned to the cache and marked as free, thus making them immediately available for subsequent requests.
How are lock bits useful in I/O requests?
A lock bit is associated with every frame. If a frame is locked, it cannot be selected for replacement. To write a block on tape, we lock into memory the pages containing the block. The system then continues as usual with other processes if the I/O request is in a queue for that I/O device. This avoids the replacement of the pages for other processes and the possible unavailability of those pages when the I/O request advances to the head of the device queue. When the I/O is complete, the pages are unlocked.