CS307
Final exam
Due on paper 5:00 PM, Monday, November 21, 2005

While taking this exam, you may use books, computers, the Internet, your own brain, and divine inspiration (if any is available to you). Don't talk to people other than me about the content of the exam.

Have fun.

  1. (12 points) We have encountered several operating system services that require some help from the processor. For this exercise, I would like you to research the Intel 80x86 processor family to identify how these processors support two such services: IPC primitives and paged virtual memory. In particular, I would like to know about the relevant machine/assembly instructions, and about hardware structures (e.g. a translation look-aside buffer?). Give me a detailed summary of the relevant information, with references as appropriate. Keep your discussion under 2 pages.

  2. (12 points) Write a description of what happens when you type the name of a simple executable program in response to a Unix prompt. Tell the story of the program from the moment the shell receives your command line to the moment the shell prints the prompt again (assume the program is running in the foreground). Your story should discuss (briefly) the relevant file system, virtual memory, and process control actions. This story could hundreds of pages long, but you should keep it under two pages.

  3. (12 points) Using the POSIX threads library, write a 2-thread program for Linux. Once the thread spawning is done, the first thread (T1) should wait for user input. T1 should produce no output, but should shut down the whole process once the user types a q or a Q. T2 should take no input, but should generate a list of prime numbers starting at 2 and going as high as it can in the time allowed. From the user point of view, this program will generate primes until told to quit. From the source code point of view, there will be two independent pieces of code, each nearly trivial, and each with a separate responsibility.

    POSIX threads, also known as pthreads, are available on our Linux systems. They are documented to one degree or another in lots of places, though I have yet to find a web site that strikes me as the authoritative home of pthreads. Here's a threads example that you may find helpful. You can get a list of man page topics with the command "apropos pthread". I also like the tutorial Getting Started With POSIX Threads, by Tom Wagner and Don Towsley. If you need more ideas, search the web and let me know if you find something good.

    The quality of your prime number generation is immaterial. Make it correct, but don't worry about making it fast.

  4. (2 points) I've been asking people lately to tell me the coolest or most impressive or most amazing thing they've seen computer technology do. Now it's your turn.

  5. (10 points) The Therac-25 incident is one of the worst disasters in the history of software. You can learn all about it in An Investigation of the Therac-25 Accidents, Nancy Leveson and Clark S. Turner, IEEE Computer, Vol. 26, No. 7, July 1993, pp. 18-41. (Here's another link to the same paper.) If you wish, you may also look for other information on Therac-25 in books or on the Web.