Final Exam (Dec 5, 2005) 2-5pm OS Course (K. Gopinath) 0[5]: A reference count is used to make sure that an object is not deallocated when there are multiple clients for the object but each of the clients may have ability to modify the object. Give an example of this in Unix where this is used. In what ways is this different from a lock? 1[20]: a) [5] On SVR4, exec is implemented by holding a reference to the vnode of the executable instead of locking it. What problems can arise due to this? b) [10] What are the plausible reasons for the above? c) [5] Debuggers may have to set breakpoints in code. How can the same text be used for execution by others while it is being debugged? 2[20]: a) [8] Given that one can access a file thru 2 interfaces (what are these?), what is the consistency problem? In older Linuxes, to solve this problem, "all writes go thru buf cache and later the page cache is upd". Explain this solution, and how it could be implemented. What are the disadvantages? Give a plausible solution which does not have this problem. b) [7] How is a file kept consistent in SVR4? c) [5] List the advantages and disadvantages of the 2 interfaces. 3[10]: Explain the need for the pselect syscall. Give an outline of your solution for pselect in the Linux kernel 2.6. Why is the pselect support in the kernel not there? 4[15]: a) [5] What are the I/O schedulers in Linux 2.6? When would you recommend use of each of them? b) [5] Instead of a disk, say we have a "drum". Which of the above schedulers will still work well? Assume that there is one head per track of the drum. What modifications of these schedulers or new ones would you recommend for good performance? c) [3] Say we have 2 disks for swap. How can I exploit it? d) [2] There is a possibility of a deadlock in SVR4. How? 5[30]: Consider 4.3BSD VM on the VAX architecture. It has a 4GB AS with a 512B page. Each page table entry (PTE) is 4B. There is a single system page table (which is contiguous in physical memory: why?) that maps kernel text and data (1GB). Each user process has 2 user page tables (contiguous in virtual memory) to map its P0 (text and data; 1GB) and P1 (user stack, kernel stack, u area; also 1 GB) regions. Note that data can begin just after text in P0. These user page tables are continguous entries in the system page table with each such entry pointing to one page of the PTEs of the user AS. Hence it is a 2-level mapping scheme compared to the 1-level mapping scheme for the KAS. User page maps are therefore allocated in units of pages. (The remaining 1GB AS is not used.) a) [2] How much physical memory is reqd for mapping the full 1GB of KAS? b) [2] How can you reduce the amount of physical memory in a) given that the full 1GB of KAS may not be utilized? c) [2] How much user addr space does one page map? d) [3] Why is text and data together in P0? Why not seperate them? e) [5] Explain how a user addr is translated to get a physical addr. Specify the faults that can happen and how fixed. f) [2] Suppose 2 instances of emacs are running on the machine. Draw the translation diagrams of each. g) [5] Can the 2 emacs processes share the page tables for the emacs text? What is the limiting factor? h) [2] There is no COW but debugging is possible. How? i) [2] The VM stores the disk block number in the PTE for non-resident pages. What difficulties are caused by this? Hint: think of NFS. j) [5] How does SVR4 solve the above problems? List the differences and say which solution is better.