Practice Midterms
Your midterm will be Monday, July 23, from 7pm-9pm, in Hewlett 201.
The exam is closed book, closed note, closed electronic device. I will provide you with all of the C function prototypes and C++ classes that might be relevant to a particular problem, and you can always ask a CS110 staff member during the exam if you want to use a core C function or C++ class that we didn’t provide. Caveat: You are permitted to populate both sides of a single 8.5” x 11” sheet of paper with as much material as you can cram into it.
The primary emphasis of the exam is on multiprocessing. There will be some questions regarding multithreading, but I will not ask you to write any multithreaded code.
Details for SCPD and registered remote students
If you are not an SCPD student but still want to take the exam remotely, make sure I know about it ASAP. I’ll be sending emails to everyone individually within the next few days to confirm your exam arrangements.
You can take the exam on the day it’s given (July 23) or the day afterwards (July 24). I prefer you take it on the day afterwards, because I’m able to edit the exam wording to make any clarifications that came up during the normal exam session, but of course, I’ll also allow you to take it the day of. If this time window doesn’t work for you, email me ASAP and we can arrange something.
Material
Here’s the impressive list of topics you should be familiar with:
- You should understand the UNIX v6 file system concepts, data structures, and layers you coded against for Assignment 1.
- You should be familiar with the basic concepts of layering and naming in computer systems.
- You should understand how
open
,read
,write
,close
,dup
,dup2
,stat
, andlstat
all work. - You should understand file descriptor tables, the file entry table, the vnode table, and what type of information is stored in each.
- You should be familiar with process ids,
fork
,waitpid
, all of the various waitpid status macros,execvp
,signal
, signal handlers, signal blocking and unblocking,sigsuspend
,kill
,pipe
, and pipes. - You should be familiar with the various concurrency issues that can come up as a result of a single code base controlling multiple processes.
- You should have a basic understanding of how virtual-to-physical memory mapping works and how it’s used to allow all processes to operate under the illusion that each owns its full virtual address space.
- You should have a basic understanding of how the OS scheduler works (with an understanding of what the ready queue and blocked set are).
- You should understand your implementations of
pipeline
,subprocess
, andfarm
from Assignment 2. - You should understand what race conditions and critical regions are and how to identify them.
- You should understand the C++
thread
class, how to instantiate one, and how to use itsjoin
method. - You should be familiar with the
mutex
,condition_variable_any
, andlock_guard
classes. - You should understand the notion of a semaphore and how we implement it in
terms of
mutex
es andcondition_variable_any
s - You should understand how to effectively use
mutex
es andsemaphore
s to protect against race conditions, protect against senseless busy waiting, protect against deadlock, and minimize the amount of processor time wasted by athread
unable to do any meaningful work. - You should understand all of the various thread synchronization patterns discussed in lecture through Wednesday, 7/18.
I will not test you on Assignment 3, but it would be a good idea to complete that assignment before the midterm. Assignment 3 will give you excellent practice with more multiprocessing material.
Also, since lab was optional this quarter, I won’t test you on lab material. However, it’s a good idea to review material in the lab handouts. Many of those questions were previous exam questions.
I will explicitly not test you on anything regarding tools. You don’t need to
know how to use gdb
, valgrind
, g++
, etc.
Practice Midterms
These midterms are actual exams that were given in previous quarters. Because of differences in scheduling, our midterm will cover threads (at a conceptual level) whereas these midterms do not cover threads. If you would like practice with threads, you can look at the practice finals below.
Understand that I’m under no obligation to replicate the structure of these practice midterms while writing yours, as I’m only trying to give you a sense of what some CS110 midterm problems have looked like in the past. The first two of the four practice midterms are closer in length to the midterm you will take. The latter two are shorter, since they were designed to fit in an 80-minute time slot. Some of the problems from the practice exams have been cannibalized to contribute to your lab handouts. But that’s fine, because I should be able to ask you any of those questions again and hold you responsible for their answers.
I highly recommend struggling with each midterm before looking at the answers. Even if you stare at a problem and don’t know the answer, it’s better to spend some time with it first and possibly look through your notes before looking at the answer key. This class isn’t about memorizing answers; it’s about figuring out how to derive those answers when no answer is immediately apparent.
- Practice Midterm 1 [Solution]
- Practice Midterm 2 [Solution]
- Practice Midterm 3 [Solution]
- Practice Midterm 4 [Solution]
Practice Finals
Again, the above practice midterms do not cover threading/concurrency. Next week’s lab will give you more practice with these topics. If you want even more practice, you can select problems from the practice finals below. However, these are the same practice finals that I’ll give you when our final rolls around. If you want to be able to work through mock exams in a mock exam setting (under time pressure) when studying for the final, you should save these for the future.