CSC 415 Operating System Principles Unit 07 Part 2
Assuming that pages are 128 integers (words) in size, consider the C program to initialize every element of a 128x128 integer array to zero. int i, j; int [128][128] data; for (j = 0; j < 128; j++) for (i = 0; i < 128; i++) data [i] [j] = 0; There will be blank page faults as a result if there is only one frame available. But, changing the last line to blank will result in only blank page faults. Thus it is important for a programmer to understand how memory is laid out.
16,384 data [j] [i] = 0; 128
Which of the following statements is false with regard to Solaris memory management? A) The speed at which pages are examined (the scanrate) is constant. B) The pageout process only runs if the number of free pages is less than lotsfree. C) An LRU approximation algorithm is employed. D) Pages selected for replacement may be reclaimed before being placed on the free list.
A) The speed at which pages are examined (the scanrate) is constant.
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
Windows uses a local page replacement policy _____. A) when a process exceeds its working set minimum B) when a process exceeds its working set maximum C) when the system undergoes automatic working set trimming D) under all circumstances
B) when a process exceeds its working set maximum
In memory compression, A) compression ratio needs to be balanced with the temporary memory needed for compression. B) compression ratio needs to be balanced with the number of pages to be compressed. C) compression ratio needs to be balanced with the compression time. D) compression ratio needs to be balanced with page size.
C) compression ratio needs to be balanced with the compression time.
In Linux, A) pages in active list may be moved to inactive list. B) pages in inactive list may be moved to active list. C) pages in inactive list are may be reclaimed for the free list. D) All of the above.
D) All of the above.
If the page-fault rate is too high, the process may have too many frames. True False
False
In general, virtual memory decreases the degree of multiprogramming in a system. True False
False
Memory compression is faster than swapping pages to hard disks, but slower than swapping pages to SSDs. True False
False
Non-uniform memory access has little effect on the performance of a virtual memory system. True False
False
On systems that provide it, vfork() should always be used instead of fork(). True False
False
Only a fraction of a process's working set needs to be stored in the TLB. True False
False
Correctly fill in the diagram to show the Linux process memory layout. Linux Process Memory Layout
Kernel Stack || || V Library Mappings /\ || || Heap Uninitialized Data Initialized Data Text Reserved
Correctly label the memory pyramid Top of Pyramid Second layer from tip of Pyramid Second layer from base of Pyramid Bottom of Pyramid
Top of Pyramid → CPU Registers, Second layer from tip of Pyramid → L1, L2, L3, Cache (SRAM), Second layer from base of Pyramid → RAM (DRAM), Bottom of Pyramid → Secondary Storage
Memory compression is commonly used in mobile systems instead of swapping. True False
True
If memory access time is 250 nanoseconds and the average page fault service time is 10 milliseconds, the probability of page faults must be less than _________________ to keep the performance degradation less than 20%. Select one: a. 0.000005 b. 0.000001 c. 0.0000075 d. 0.0000025 e. 0.00001
a. 0.000005
An advantage of virtual memory is that Select one: a. All of the above. b. it provides a way to execute a program that is only partially loaded in memory. c. a program can be much larger than the size of physical memory. d. the programmers can concentrate programming the problem instead of worrying about the amount of physical memory available.
a. All of the above.
In which of the following cases, performance may be improved? Select one: a. All of the above. b. Placing frequently interacting components close to one another. c. Designing array access pattern based on whether the arrays are stored in row major or column major order. d. Avoid placing functions across page boundaries.
a. All of the above.
The working set strategy Select one: a. All of the above. b. keeps the degree of multiprogramming as high as possible while preventing thrashing. c. swaps in a new process if there is enough memory available to accommodate its working set. d. swaps out a process if OS cannot allocate enough pages to accommodate its working set.
a. All of the above.
A reaper starts reclaiming pages as soon as the number of free frames falls below the maximum threshold. Select one: a. False b. True
a. False
Prepaging an executable program is much easier than prepaging a text file. Select one: a. False b. True
a. False
Solaris uses both a local and global page replacement policy. Select one: a. False b. True
a. False
Some operating systems keep a pool of free frames so that the frequency of page faults is lowered. Select one: a. False b. True
a. False
Windows uses both a local and global page replacement policy. Select one: a. False b. True
a. False
_____ is the algorithm implemented on most systems. Select one: a. LRU b. Least frequently used c. Most frequently used d. FIFO
a. LRU
Which of the following is FALSE about reapers? Select one: a. They may swap out pages event when there are ample free frames available. b. They may swap out a page from a process even when that process is not running. c. They may use any page replacement algorithm to swap out pages. d. They implement a global page replacement policy.
a. They may swap out pages event when there are ample free frames available.
Stack algorithms can never exhibit Belady's anomaly. Select one: a. True b. False
a. True
The buddy system for allocating kernel memory is very likely to cause fragmentation within the allocated segments. Select one: a. True b. False
a. True
The instruction that causes a page fault needs to be re-executed after the fault has been handled. Select one: a. True b. False
a. True
On a system with pure demand-paging, a process will experiece a high page fault rate when the process begins execution. Select one: a. True, because no pages are loaded in memory b. False, because the program is already loaded c. False, because it is unknown how much physical memory is available and there might not be a need for paging. d. True, because all programs have a high page fault on loading
a. True, because no pages are loaded in memory
A drawback of equal or proportional allocation is that Select one: a. a high-priority process is treated the same as a low-priority process. b. the allocation varies according to the degree of multiprogramming. c. the processes that arrive earlier get more pages than the processes arriving later. d. they are very expensive to compute.
a. a high-priority process is treated the same as a low-priority process.
The most preferred method of swapping a process is Select one: a. to demand-page from the file system initially but to write the pages to swap space as they are replaced. b. None of the above. c. to swap using the file system. d. to copy an entire file to swap space at process startup and then perform demand paging from the swap space.
a. to demand-page from the file system initially but to write the pages to swap space as they are replaced.
In the enhanced second chance algorithm, which of the following ordered pairs represents a page that would be the best choice for replacement? Select one: a. (1,0) b. (0,0) c. (1,1) d. (0,1)
b. (0,0)
What size segment will be allocated for a 39KB request on a system using the Buddy system for kernel memory allocation? Select one: a. 39 KB b. 64 KB c. 42 KB d. None of the other answers
b. 64 KB
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are three frames within our system. Using the FIFO replacement algorithm, what is the number of page faults for the given reference string? Select one: a. 13 b. 8 c. 10 d. 14
b. 8
Which of the following statements is false with regard to allocating kernel memory? Select one: a. The slab allocator allows memory requests to be satisfied very quickly. b. Because the kernel requests memory of varying sizes, some of which may be quite small, the system does not have to be concerned about wasting memory. c. Slab allocation does not suffer from external fragmentation. d. Adjacent segments can be combined into one larger segment with the buddy system
b. Because the kernel requests memory of varying sizes, some of which may be quite small, the system does not have to be concerned about wasting memory.
Check all those that are true about the minimum number of frames. Select one or more: a. Certain instructions may span more than one page, therefore you must have at least two pages b. Certain instructions may span more than one page, therefore you have to the at least as many pages are required for that instruction to execute successfully. c. Only one frame is needed by any one process. d. The minimum number of frames is determined by the computers architecture.
b. Certain instructions may span more than one page, therefore you have to the at least as many pages are required for that instruction to execute successfully. d. The minimum number of frames is determined by the computers architecture.
In Linux, a slab may only be either full or empty. Select one: a. True b. False
b. False
When an application over allocates memory the application can cause thrashing. Which application is an example of a program that causes thrashing? Select one: a. Firefox b. Google Chrome c. Apple Safari d. Microsoft Edge
b. Google Chrome
__________ occurs when a process spends more time paging than executing. Select one: a. Swapping b. Thrashing c. Memory-mapping d. Demand paging e. Trashing
b. Thrashing
A page fault must be preceded by a TLB miss. Select one: a. False b. True
b. True
Some operating systems provide raw disk, so that special applications can bypass file system when accessing secondary storage. Select one: a. False b. True
b. True
The current best practice to avoid thrashing is to include enough physical memory. Select one: a. False b. True
b. True
The dirty (modify) bit identifies Select one: a. a page that has been corrupted. b. a page that has been modified since it was loaded. c. a page that needs to be reloaded when accessed. d. a page that is shared by multiple processes.
b. a page that has been modified since it was loaded.
A page fault occurs when __________________________ Select one: a. a page table is not large enough to include all page table entries. b. a process tries to access a page that is not loaded in memory. c. the size of a process is larger than the size of physical memory. d. a page in memory gets corrupted.
b. a process tries to access a page that is not loaded in memory.
Memory compression is a useful alternative to paging Select one: a. when the system has slow magnetic disks but not faster SSDs. b. even when the system has faster SSDs. c. when the compression algorithm is can achieve the best possible compression ratio. d. when the speed of the compression algorithm fastest.
b. even when the system has faster SSDs.
Belady's anomaly states that ________________________. Select one: a. as the number of allocated frames increases, the page-fault rate may decrease for all page replacement algorithms b. for some page replacement algorithms, the page-fault rate may increase as the number of allocated frames increases c. for some page replacement algorithms, the page-fault rate may decrease as the number of allocated frames increases d. giving more memory to a process will improve its performance
b. for some page replacement algorithms, the page-fault rate may increase as the number of allocated frames increases
Copy on write is typically associated with which which system call? Select one: a. execvp b. fork c. malloc d. exec e. knife
b. fork
Systems in which memory access times vary significantly are known as ______________. Select one: a. memory-mapped I/O b. non-uniform memory access c. demand-paged memory d. copy-on-write memory
b. non-uniform memory access
The _____ allocation algorithm allocates available memory to each process according to its size. Select one: a. slab b. proportional c. equal d. global
b. proportional
A sign of thrashing is Select one: a. the CPU utilization increases as the degree of multiprogramming is increased. b. the CPU utilization decreases as the degree of multiprogramming is increased. c. the CPU utilization increases as the number of pages allocated to each process is increased. d. the CPU utilization decreases as the number of pages allocated to each process is increased.
b. the CPU utilization decreases as the degree of multiprogramming is increased.
Prepaging can be an advantage, becuase Select one: a. the initial pages a process accesses are typically wel known in advance. b. the cost of using prepaging is less than the cost of servicing the corresponding page faults. c. All of the other answers. d. prepaging starts before a process is scheduled for execution
b. the cost of using prepaging is less than the cost of servicing the corresponding page faults.
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are three frames within our system. Using the FIFO replacement algorithm, what will be the final configuration of the three frames following the execution of the given reference string? Select one: a. 3, 1, 4 b. 4, 1, 3 c. 3, 4, 2 d. 4, 2, 3
c. 3, 4, 2
Which of the following is true about the strategy that uses page fault frequency (PFF) to prevent thrashing? Select one: a. A new page is allocated to a process if PFF is too high. b. A new process may be swapped in if PFF is too low. c. All of the above. d. A page is deallocated from a process if the PFF is too low.
c. All of the above.
Which of the following is a benefit of allowing a program that is only partially in memory to execute? Select one: a. Programs can be written to use more memory than is available in physical memory. b. Less I/O is needed to load or swap each user program into memory. c. All of the other answers. d. CPU Utilization and throughput is increased.
c. All of the other answers.
When an application over allocates memory the application can cause thrashing. Which application is an example of a program that causes thrashing? Select one: a. Microsoft Edge b. Apple Safari c. Google Chrome d. Firefox
c. Google Chrome
Which of the following is true about choosing an appropriate page size? Select one: a. Smaller page size reduces the number of page faults. b. Larger page size results in reducing total I/O. c. Larger page size reduces I/O time. d. Larger page size results in less total allocated memory.
c. Larger page size reduces I/O time.
Which of the following is considered a benefit when using the slab allocator? Select one: a. It allows larger segments to be combined using coalescing. b. It allows kernel code and data to be efficiently paged. c. There is no external memory fragmentation. d. Memory is allocated using a simple power-of-2 allocator.
c. There is no external memory fragmentation.
In demand paging, Select one: a. all pages that a program will access during execution are loaded in memory in the beginning. b. a page loaded in memory may never be accessed. c. a page is loaded in memory only when it is needed during execution. d. a page is loaded in memory just before it is needed.
c. a page is loaded in memory only when it is needed during execution.
Lock bit is NOT used for which of the following cases: Select one: a. some OS pages. b. the page that is being used for I/O. c. a page that belongs to a high priority process. d. a new page that has just been brought in.
c. a page that belongs to a high priority process.
Stack algorithms are a class of page replacement algorithms that Select one: a. are guaranteed to incur the least number of page faults. b. are implemented using stacks. c. do not suffer from Belady's anomaly. d. are guaranteed to incur no more page faults than FIFO page replacement algorithm.
c. do not suffer from Belady's anomaly.
A free-frame list Select one: a. is a set of all frames that are used for stack and heap memory. b. is a set of all frames that are filled with all zeros. c. is a set of all frames that are currently unallocated to any process. d. is a set of all frames that are currently being shared by at least two processes.
c. is a set of all frames that are currently unallocated to any process.
In systems that support virtual memory, _______________________. Select one: a. physical memory is separated from secondary storage b. virtual memory is separated from logical memory c. physical memory is separated from logical memory d. virtual memory is separated from physical memory
c. physical memory is separated from logical memory
Counting based page replacement algorithms are not commonly used, because Select one: a. they only approximate LRU. b. they are expensive to implement, even though they incur the least number of page faults. c. they do not approximate OPT replacement very well and their implementation is expensive. d. they do not approximate OPT replacement very well, even though they are easy to implement.
c. they do not approximate OPT replacement very well and their implementation is expensive.
The _________ is an approximation of a program's locality. Select one: a. locality model b. page fault frequency c. working set d. page replacement algorithm
c. working set
Given the reference string of page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 3 and a system with three page frames, what is the final configuration of the three frames after the OPT algorithm is applied? Select one: a. 1, 3, 4 b. 2, 3, 4 c. 1, 2, 1 d. 1, 2, 3
d. 1, 2, 3
Given the reference string of page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and a system with three page frames, what is the final configuration of the three frames after the LRU algorithm is applied? Select one: a. 4, 1, 2 b. 1, 3, 4 c. 1, 2, 3 d. 3, 1, 4
d. 3, 1, 4
Which of the following does not increase the TLB reach? Select one: a. Provide multiple page sizes. b. Increase the size of TLB. c. Increase page size. d. Decrease the size working set.
d. Decrease the size working set.
Flash Memory makes for good swap space because: Select one: a. Flash memory is faster than magnetic media. b. Flash memory is persistent. c. It has no moving parts, so there is no seek time or latency. d. It does not make for good swap space.
d. It does not make for good swap space.
Simply, what is Virtual Memory? Select one: a. It is using all the memory pyramid b. It is a guarantee of how much memory there is. c. It is memory that does not exist. d. It is an abstraction of the physical memory.
d. It is an abstraction of the physical memory.
The _____ is the number of entries in the TLB multiplied by the page size. Select one: a. hit ratio b. TLB Cache c. page resolution d. TLB reach
d. TLB reach
______________ allows the parent and the child process to initially share the same pages, but when either process modifies a page, a copy of the shared page is created. Select one: a. memory-mapping b. zero-fill-on-demand c. virtual memory fork d. copy-on-write
d. copy-on-write
Optimal page replacement ____. Select one: a. is the page-replacement algorithm most often implemented b. requires that the system keep track of previously used pages c. can suffer from Belady's anomaly d. is used mostly for comparison with other page-replacement schemes
d. is used mostly for comparison with other page-replacement schemes
Anonymous memory of a process refers to Select one: a. the pages associated with the static data of the process. b. the pages associated with the binary executable file of the process. c. the pages that cannot be swapped out of the physical memory. d. the pages not associated with the binary executable file of the process.
d. the pages not associated with the binary executable file of the process.
If an instruction modifies several different locations, a page fault can be handled by Select one: a. loading multiple pages in advance. b. terminating the process. c. incorporating special hardware. d. using temporary registers to hold the values of overwritten locations.
d. using temporary registers to hold the values of overwritten locations.
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are three frames within our system. Using the LRU replacement algorithm, what is the number of page faults for the given reference string? Select one: a. 6 b. 9 c. 14 d. 11 e. 10 f. 7 g. 13 h. 8
h. 8
If an architecture has a move instruction with more than one word and at most one of the two operands may be an indirect memory reference, the minimum number of frames needed to run a process on this architecture is Select one: a. 4 b. 6 c. 3 d. 5
not b
In Additional-Reference-Bits algorithm, Select one: a. None of the above. b. the least-recently used page is identified very efficiently on a page fault. c. a group of pages that have not been used recently are efficiently identified. d. a page that has been referenced most recently is identified.
not d
The Second-Chance algorithm Select one: a. is same as LRU algorithm if none of the pages in memory have been referenced since the last page fault. b. is same as LRU algorithm if all pages in memory have been referenced at least once since the last page fault. c. is same as FIFO algorithm if all pages in memory have been referenced at least once since the last page fault. d. is same as FIFO algorithm if none of the pages in memory have been referenced since the last page fault.
not d