Here is a general outline of the key concepts (arranged by topic) that you should know for the Midterm.
The exam will have the following format:
Definitions: Briefly define terms using one or two sentences.
Short Answers:
System Calls
Processes
Context Switch
Scheduling
Concurrency
Events vs Threads
Locks, Condition Variables
Semaphores
Bugs
The exam is completely offline. This means there will not be any need for a computer. Furthermore, the test is closed book, closed notes, but open mind.
This check list is meant to be representative, rather than exhaustive (ie. there may be questions that show up on the exam that are not shown below).
What is an operating system?
What are the three main themes in operating systems?
What are different types of operating systems?
How does a computer start the operating system?
What is a system call?
What is a trap/interrupt?
What happens during a system call?
What are common system calls?
What is a process?
How do we coordinate multiple processes?
How do we switch from one process to another?
What system calls can we use with processes?
What states can a process be in?
What do we want mechanisms for inter-process communication (IPC)?
What are some different forms of IPC and when would we use them?
What is the purpose of a scheduler?
When does a scheduler execute?
How do we evaluate a scheduling policy?
How would FIFO schedule a sequence of processes?
How would RDRN schedule a sequence of processes?
How would MLFQ schedule a sequence of processes?
What are the strengths and weaknesses of each scheduling policy?
What exactly is concurrency? parallelism?
How do we overlap I/O and compute within a single process?
What are the pros and cons of event-based concurrency versus threads?
Why do we need locks?
When should we use locks?
How does a lock work?
How do we use locks to synchronize access to shared data?
Why do we need condition variables?
How do we use condition variables to solve the producer / consumer problem?
What is a semaphore?
What operations does a semaphore provide?
How do we use semaphores to synchronize threads?
What are some common concurrency bugs?
What are some ways to prevent or avoid such bugs?
Here are a few selected sample questions:
Recently, the Firefox web browser underwent Project Electrolysis and transitioned from their old "thread-per-tab" model to the "process-per-tab" model introduced by Chrome. The reason for this transition is:
The two major advantages of this model are security and performance. Security improvements are accomplished through security sandboxing, performance improvements are born out of the fact that multiple processes better leverage available client computing power.
As with anything in Computer Science, the decision to use processes over threads is a trade-off.
Consider a single-CPU, a timeslice of 10 ms, and the following processes:
Process Arrival Time Run Time A 0 ms 30 ms B 10 ms 20 ms C 20 ms 10 ms
A. Sketch out exactly when each process runs, and for how long given the FIFO scheduling policy.
B. Sketch out exactly when each process runs, and for how long given the RDRN scheduling policy.
C. Sketch out exactly when each process runs, and for how long given the MLFQ scheduling policy. You may assume that Q0 has a timeslice of 10 ms, Q1 has a timeslice of 20 ms, and Q2 has a timeslice of 40 ms.
Note: You should record the processes in the priority levels Q0, Q1, and Q2 in addition to sketching which process is running at the particular time step.
Suppose you and your friends are going slacklining. Unfortunately, the slackline can only support up to three people1 on it at a time.
Assuming each person performs the following procedure:
get_on() // Get on slackline if there is enough room do_slack_line() // Attempt to walk across slackline get_off() // Get off of slackline
A. Solve this concurrency problem using semaphores. State any semaphores or global variables needed and write the code for each person:
Global Variables Code for get_on() Code for get_off()
B. Solve this concurrency problem using locks and condition variables. State any locks, condition variables, or global variables needed and write the code for each person:
Global Variables Code for get_on() Code for get_off()
Suppose you and your friends are going to Salsa night hosted by our beloved Ramzi2. You are willing to dance, but only after at least 2 of your friends have started dancing.
A. Solve this concurrency problem using locks and condition variables. State any locks, condition variables, or global variables needed and write the code for you and your N friends:
Global Variables Code for you_dance() Code for friend_dance(f)
B. Solve this concurrency problem using semaphores. State any semaphores or global variables needed and write the code for you and your N friends:
Global Variables Code for you_dance() Code for friend_dance(f)
I know, you are only suppose to have one person at a time. I just needed an example withe some queuing... ↩
Just dance... ↩