5.1 What does it mean for a machine to support virtual memory? What four hardware facilities are typically required for a machine to support virtual memory? 5.2 What is the relationship between paging and swapping on a demand-paged virtual-memory system? Explain whether it is desirable to provide both mechanisms in the same system. Can you suggest an alternative to providing both mechanisms? 5.3 What three policies characterize paging systems? 5.4 What is copy-on-write? In most UNIX applications, the fork system call is followed almost immediately by an exec system call. Why does this behavior make it particularly attractive to use copy-on-write in implementing fork? 5.5 Explain why the vfork system call will always be more efficient than a clever implementation of the fork system call. 5.6 When a process exits, all its pages may not be placed immediately on the memory free list. Explain this behavior. 5.7 Why does the kernel have both the traditional malloc() and free() interface and the zone allocator? Explain when each type of interface is useful. 5.8 What is the purpose of page coloring? On what sort of hardware is it needed? 5.9 What purpose does the pageout-daemon process serve in the virtual-memory system? 5.10 What is clustering? Where is it used in the virtual-memory system? 5.11 Why is the historic use of the sticky bit to lock a process image in memory no longer useful in FreeBSD? 5.12 Give two reasons for swapping to be initiated. *5.13 The 4.3BSD virtual-memory system had a text cache that retained the identity of text pages from one execution of a program to the next. How does the caching of vnode objects in FreeBSD improve on the performance of the 4.3BSD text cache? **5.14 FreeBSD reduces the length of shadow chains by checking at each copy-on-write fault whether the object taking the fault completely shadows the object below it in the chain. If it does, a collapse can be done. One alternative would be to calculate the number of live references to a page after each copy-on-write fault and if only one reference remains, to move that page to the object that references it. When the last page is removed, the chain can be collapsed. Implement this algorithm and compare its cost to the current algorithm. **5.15 The pv_entry structures could be replaced by keeping a list associated with each object of all the vm_map_entry structures that reference it. If each vm_map_entry structure had only a single list pointer in it, only the final object would be able to reference it. Shadow objects would have to find their final object to find their referencing vm_map_entry structure. Implement an algorithm to find all the references to the pages of a shadow object using this scheme. Compare its cost with that of the current algorithm using pv_entry structures. **5.16 Port the code from 4.3BSD that would forcibly swap out runnable processes when the paging rate gets too high. Run three or more processes that each have a working set of 40 percent of the available memory. Compare the performance of this benchmark using the 4.3BSD algorithm and the current algorithm. |