15-410 Homework 2
This homework assignment is due Friday, May 3rd at 23:59:59. As we intend to make solutions available on the web site immediately thereafter, . Late days are not available for this assignment.
Homework must be submitted (online) in either PostScript or PDF format (not:
Microsoft Word, Word Perfect, Apple Works, LaTeX,
A plain text file (.text or .txt) is also acceptable, though it must conform to Unix
meaning lines of no more than 120 characters separated by newline characters
(note that this is not the Windows convention,
and MacOS has two different conventions).
Except as otherwise directed (in the crypto question), turn
in your answers as
As usual, you may discuss this assignment with others, but you must then go off by yourself to write up the solution.
Question 1 - Public Key Practicum
As you go through the steps of working on this question, try to think carefully about what each step is accomplishing in terms of underlying cryptography primitives.
Follow the directions in gpg.html to generate
a PGP key ring,
containing public and private keys
for digital signature and encryption purposes.
Do not turn the key ring in to your
Question 2 - Virtual Memory Design
As you know, many operating systems "play tricks" using virtual memory hardware in order to improve performance for certain workloads. One such trick is "copy on write", in which the operating system simulates copying some read/write pages from one address space to another by instead marking the page-table entries read-only and then copying them to the target address space. The result is that both address spaces share the same frames as long as neither one tries to make any changes. The primary data structure necessary to implement copy on write is a reference count per frame: as each address space with a logical copy of some page receives a page fault, it makes a physical copy into a new frame, then decrements the reference count of the shared frame. Eventually there will be zero references to the shared frame and it can be freed. Because the reference count for each frame is much smaller than the frame and may enable the frame to be re-used many times, devoting some amount of RAM to reference counts is often considered to be a reasonable use of space.
Another thing operating systems typically do with virtual memory hardware is implement partial memory residence, i.e., treating RAM as a cache of the set of all pages, with pages which are not currently in RAM being stored on disk. Most VM hardware provides "dirty" and "reference" bits in each page-table entry; a "pager daemon" can inspect the reference bit of each page in each address space to decide when a particular page is no longer important enough to be backed by a RAM frame. If a page is judged to be unimportant, its contents can be stored to a disk frame (storing is non-optional if the "dirty" bit is on), the location of that disk frame can be recorded "somewhere", and the RAM frame can be given up for some more-urgent purpose. Aside from the "dirty" and "reference" bits, the main data structure necessary is a map from non-resident pages to disk locations. In some old-fashioned systems, that map was stored in the page-table entries: if the "present" bit of a page-table entry is off, then the other bits of the PTE can be used to store a disk block number.
Individually, neither the copy-on-write optimization nor paging to disk is particularly challenging. But, as is often the case in the real world, combining features results in non-linear implementation complexity. In this question we will investigate why designing a VM system that handles both copy-on-write and paging to disk might be challenging.
Imagine that we have a system which implements copy-on-write but not paging to disk (this is true of some Pebbles kernels). Imagine that we wish to add a paging daemon to the system. Explain why doing this in a straightforward fashion would undermine the effectiveness of the copy-on-write optimization.
Now imagine that we have a system that implements paging
to disk but does not implement copy-on-write
(imagine for concreteness that disk block numbers
are stored in the unused bits of non-present page-table
In particular, imagine that in this system
By the way, if you think you are having AFS permission problems,
try running the program located at
[Last modified Monday April 29, 2013]