Computer Science 161 (2015)
Final Exam
24 hours between May 4, 2015 and May 6, 2015 PM
240 minutes/240 points
Instructions
The points allocated to each problem correspond to how much time
we think the problem should take. Although you have 24 hours in
which to take the exam, we do not recommend that you pull an
all-nighter and spend 24 hours completing the exam.
All questions should be directed to me (Margo) via email. I will
check mail periodically, but do not expect an instant response.
I strongly encourage you to read through the exam and fire off
any questions that immediately come to mind. I will check
mail regularly, but will not be watching constantly. When in
doubt, document assumptions.
Here is my advice on how to complete this exam:
- Read through the entire exam. Send me any questions.
- Go to lunch or dinner or take a walk and think about the exam.
- Spend a couple of hours on the first day/evening writing up answers to the
questions that you know. Sketch our your thoughts about some of the longer
design problems.
- Get a good night's sleep.
- Spend another couple of hours on day 2 working on the remaining
problems and fleshing out the details of your designs.
- Read over your answers.
- Email them to me at margo@eecs.harvard.edu.
- On Wednesday, May 6, show up MD 119 at 7:00 PM
to consume ice cream, pick up your T-shirt,
and optionally iron on a team patch.
Please place your answers:
- in a PLAIN TEXT file, named LASTNAME.txt,
- in 80 character lines,
- with answers labelled clearly so it is obvious what answers correspond to
what questions, and
- with space between each question.
At the bottom of your exam, place the exam policy statement (see below).
Send your completed exam
to margo@eecs.harvard.edu AS AN ATTACHMENT.
I will return the graded exam to you; I tend to engage in a dialog as
much as possible, so there is some educational value in reading more
than just the final number.
This exam is open text book, open source code, and open notes. You
may not use computers (cell phones, PDAs, or any other device that can
talk to a network)
during the exam (other than to record your answers, to view OS/161
or System/161 code, or to examine your notes or the course web site).
Please do not access the Piazza group during the exam.
You must complete the exam on your own.
Exam Policy Statement
Please do not forget to do this!
At the end of your exam, please write the following statement and
then place your name after it, asserting that you have followed the
rules of the exam. "I have neither given nor received help on this exam
and have followed the rules as stated."
If this statement is absent, you will hear from me.
I. Multiple Choice (42 points)
Questions with one answer are worth 3 points; those with the potential
for multiple answers are worth 5.
- (Pick 1) Suppose we have a file system that has 10 direct block pointers
and 5 indirect block pointers. Blocks are 8 KB and a block pointer is
4 bytes. Every file in the
system uses the same block map structure, with unused pointers
directed at null. Eliminating the indirect pointers while supporting
the same maximum file size would be:
- Beneficial - The new block map will save significant space storing small files.
- Beneficial - The new block map will save significant space storing large files.
- Detrimental - The new block map will waste significant space storing small files.
- Detrimental - The new block map will waste significant space storing large files.
- I am not familiar with this terminology / I don't know.
- (Pick as many as you like) On a MIPS or x86 processor,
software running in supervisor mode:
- May be able to execute instructions that software running in user mode cannot.
- Runs faster
- Has exactly the same capabilities as software running in user mode.
- May obtain different behavior from instructions than software running in user mode does.
- Can turn off interrupts.
- Can directly modify registers running on other cores.
- Can change the value of all hardware registers.
- (Pick 1)A Hypervisor is most like
- UNIX
- Linux
- CTSS
- VM/370
- MacOS
- Windows
- (Pick as many as you like) The Operating System may schedule a new process whenever:
- A user program issues an illegal instruction
- An I/O operation completes
- A user program makes a system call
- A timer interrupt occurs
- (Pick as many as you like) Which of the following parts of an operating system
must run in supervisor mode?
- The scheduler
- The virtual memory system
- Process management
- The file system
- (Pick 1) The fundamental difference between a semaphore and a lock is:
- A lock can only be unlocked by the thread that locked it.
- A semaphore can only be V'd by the thread that P'd it.
- A lock provides mutual exclusion.
- A semaphore would not work in conjunction with a condition variable.
- (Pick as many as you like) A system call invocation in OS161 entails:
- A domain crossing
- A process switch
- A thread switch
- A stack switch
- A trap
- An interrupt
- (Pick as many as you like) Which of the following are metrics for which you
might want a process scheduler to optimize?
- Throughput
- Latency
- Fairness
- Synchronization
- Taste
- (Pick 1) Round Robin is (blank1) but has poor (blank2).
- Unfair, latency
- Unfair, throughput
- Fair, latency
- Fair, throughput
- (Pick as many as you like) Virtual memory
- Makes your system run faster
- Lets you run processes that exceed the size of memory.
- Uses your I/O system more efficiently than systems without VM.
- Lets you run more processes than can actually fit in memory.
- Makes your system more predictable.
II. Short Answer (30 points)
Answer each of the following in a sentence or two.
- What is the difference between a wait channel and a condition variable in OS161?
- Give an example of how file system implementation details can affect security.
- Give an example of how virtual machine implementation details can affect security.
- Why is trap.c in the architecture dependent directory?
- Give one argument in support of hardware managed page tables and one argument
in support of software managed page tables.
- Imagine that you have a direct mapped TLB, suggest some things that could be
done to avoid thrashing the TLB. (You cannot change the hardware -- you must suggest
things you can do in software.)
III. Stupid or Clever (50 points)
Each of the following is an example of a design decision made in a real system.
For each one, decide if it's stupid or clever and provide a one or two sentence
explanation to justify your opinion.
- Early versions of Linux ran only on uniprocessors and therefore turned interrupts
off to protect critical sections. Initial work at making Linux multiprocessor capable
did so by introducing a mechanism to turn interrupts off on all processors.
- The Mach virtual memory system, developed in the 80's, was divided into a machine
dependent (pmap) layer and a machine independent layer. The machine independent layer
implements a logical virtual memory system with a logical page size
(that must be a multiple of the physical page size) and the machine dependent layer
translates the logical structure into the physical structures of a particular
machine, updating hardware mappings.
- Barrelfish is a new operating system designed for multiprocessors that treats a
multiprocessor like a distributed system, essentially running a small operating system
on each processor.
- A researcher was building a prototype transaction system and decided to create a
separate log for each different type of data element that needed to be stored in the
log.
- ZFS is a tree-based, no-overwrite storage system such that when you modify a block
in a file, you write a new copy of the block, which requires a new copy of the file
meta-data, which requires writing a new copy of the dataset to which that object belongs,
which requires rewriting all data structures up to the root of the tree (superblock).
IV. File system design for new hardware (38 points)
Researchers in Harvard SEAS have invented a new computer storage device - it's a
quantum drive. It has the following characteristics:
- Reads are infinitely fast, but destructive, which means that when you read
the data, it disappears from the drive.
- The minimum unit you can read/write is 1 MB.
- Due to parallelism in the device, write bandwidth is terrific: 1 TB/second,
but the latency for any individual request is not so great: a 1 MB write takes
100 microseconds.
- The drives have amazing capacity -- a single drive can hold an exabyte (2^60).
In this question, you will be designing a file system for the drive.
The file system should support the workload imposed on a data center
machine that has multiple terabytes of memory and many processors
and supports tens of virtual machines simultaneously (you
might have many more VMs than that, but only tens of them will be
running simultaneously). The VMs are running today's operating
systems with today's file systems, and workloads typical of today's
workloads. Your job will be to design a file system for the hypervisor.
The hypervisor gives each machine its own virtual disk, which will
map to a file on the quantum drive.
- How much parallelism is there in the drive?
- As you begin to think about building a file system for this device, what are three
challenges you will need to address?
- Design a data structure to represent files in your file system (i.e., your inode
structure). Give a brief justification for the structure you selected.
- Describe your allocation policy (not the mechanisms, e.g., bitmaps, but the approach
you will take towards placing data on the drive). Again, give a brief justification for it.
- What will your robustness and recovery strategy be for the file system?
V. Elastic Operating Systems (80 points)
Computer scientists typically publish their research in conferences.
Authors submit papers to a conference, and the program committee
is the group of people who decide which papers will appear in the
conference. Each member of the program committee reviews a subset of
the submitted papers and then the committee together reads all the
reviews and picks the best papers.
You are going to play the role of a program committee member and
write a review of
this paper.
Write your review by filling out this form
(which is pretty typical of the reviewing form used on real committees).
Then, append this form to your exam -- that is, I would like your exam in
one file, with the review form at the end.