|
15-410 Homework 2This homework assignment is due Friday, April 30th at 23:59:59. As we intend to make solutions available on the web site immediately thereafter, . Homework must be submitted (online) in either PostScript or PDF format (not:
Microsoft Word, Word Perfect, Apple Works, LaTeX, XyWriter, WordStar,
etc.). Except as otherwise directed (in the crypto question), turn
in your answers as either
As usual, you may discuss this assignment with others, but you must then go off by yourself to write up the solution. While we hope you think through all the questions, for full credit on this assignment you need turn in only Question 1 and either Question 2 or Question 3. Question 1 - Public Key PracticumThis question is not hard, but it does take some time to do it right. Please don't leave this question to the last minute. Follow the directions in pgp.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 - Being nice to usersConsider what happens in your kernel if physical memory is exhausted and a thread calls new_pages(). Hopefully, it should receive an error code and continue to run. But what if instead the thread had tried to grow its automatic stack region (by, for example, a PUSHL instruction)? There is no way to "return an error" for stack growth, nor can the thread continue user-mode execution before the stack has grown. What should your kernel do in this case? One simple and popular solution would be to kill the "offending" thread. Aside from being easy, this might result in physical memory being freed, thus making the system less likely to kill other threads in the future. Now consider a kernel architect who wishes to improve the service given to user programs, and decides to pursue the approach of temporarily suspending the execution of any thread which needs more automatic-stack memory until some memory becomes available. Part ABriefly but convincingly explain a horrible disaster that could result from a simplistic implementation of this approach. Part BWhat do you think should be done to address the issue of automatic stack growth when the system is out of memory? Briefly outline two options and then argue for one. Three medium-sized paragraphs should suffice. Question 3 - O_APPENDIf you examine the documentation for the Unix open() system call, you will observe that there is an optional flag called O_APPEND which modifies the behavior of all write() system calls applied to the file descriptor returned by the open() call. Append-mode opens are often used when multiple programs wish to add records to system log file. Part AImagine you were porting a program which was designed to use O_APPEND to a version of Unix which does not support that flag. Briefly sketch the implementation of a C function append_write() which has the same signature as write() (i.e., takes a file descriptor, buffer address, and length, and returns a length), and which simulates, to some degree, the behavior of write() applied to a file descriptor obtained via an O_APPEND call to open(). There are at least two reasonable answers to this question. Part BOf the concurrency control primitives you implemented for Project 2, which one(s) do you think a Unix-like kernel is most likely to employ internally while implementing O_APPEND? Explain, using a few sentences (or, if you wish, a few paragraphs, but a long answer should not be necessary). Helpful HintBy the way, if you think you are having AFS permission problems,
try running the program located at
| |||||||||||
[Last modified Sunday April 25, 2004] |