Handouts and Other Fun

Missed class? Read below to see how to catch up.

01/19: In class, we talked about my background, the background needed for this class (CS 354, CS 367, plus hopefully some other 500-level classes first), and then started to get into the question: What is an Operating System? To begin to answer this question, we ran and examined a few simple pieces of code: cpu.c, mem.c, threads.v1.c and threads.v2.c, and io.c. The code is available here (it's also linked off the OS book web page next to the Intro chapter). This material corresponds strongly with the following book chapters:

Do note that it is easy to look at the class web page and see which chapters you should read to understand what we will be talking about on a given day -- see the little numbers to the right in the schedule, next to each day's topic?

01/21: We talked about the role of the OS, and then started to get into the virtualization of the CPU from a mechanism standpoint. To catch up on this, read the following chapters from the book:

We skipped the API chapter but will come back to it later.

01/26: We talked about scheduling; the policy in the OS that decides which process to run next. We developed some intuition for this by making some simplifying assumptions, and slowly removed those to get towards a more realistic policy. Some key ideas include: shortest-job first scheduling (SJF) to reduce turnaround time, the notion of round-robin to reduce response time, and the development of a scheduler, known as the multi-level feedback queue (MLFQ), that uses history to predict the future and thus balance the needs of interactive jobs and long-running batch jobs. Read the following book chapters for more info:

01/28: We began our discussion of virtualization of memory. We looked into the notion of address translation, and then started to understand the most simple of techniques, known as base/bounds (or dynamic relocation). Finally, we saw the limits of this basic approach, and then started discussion of a slight generalization, known as segmentation. More info:

02/02: We finished up our discussion of segmentation, including thoughts on why segmentation is not a perfect solution. We then began discussion of our final broad technique for building a virtual memory, known as paging. More info:

02/04: We discussed how basic paging works, assuming a linear page table. How does the hardware find the page table for the currently running process? We then started to dig into the topic of the TLB -- a hardware structure used to make translations fast. For more info:

02/09: We continued our discussion of the TLB, including some focus on the software-managed TLB, where the OS handles the TLB miss. We then began our discussion of the other big problem with paging: big page tables. For more info:

02/11: We continued our discussion of how to make page tables smaller, with two primary approaches discussed. The first was the multi-level page table, probably the most common approach in use today. The second was the idea of combining segmentation with paging, and thus having one page table per segment of the address space. For more info:

02/16: We began our discussion of how to extend paging so as to be able to use more memory than is available physically by adding another level of the memory hierarchy to the picture: the big, slow disk. We learned the mechanisms behind this and then started to discuss policy. More info:

02/18: We ended our discussion of policy, and then did a few practice problems from various chapters. Read:

Then, go to the homework link to learn more about homeworks. In particular, we looked at policy.py, paging-linear-translate.py, and paging-multilevel-translate.py.

02/23: Intro to threads and locks. Video available:

We discuss what a thread is, and why threads lead to hard problems when updating shared data structures. Reading:

02/25: More on basic locking using hardware primitives. Videos available:

We discuss how to use atomic exchange, compare-and-swap, and fetch-and-add to build locks. Reading:

03/01: We discuss OS support for locks (and we did a fair bit of review). We did not (yet) start condition variables. Reading:

We looked at the following (complex) lock via a handout.

03/03: Condition variables introduced. Looked at some basic problems and the general idea behind them and when they are useful.

03/08: Finished up CVs with discussion of producer/consumer problem - it is complicated so make sure you understand how it works. Then introduced semaphores, and showed how we can use them for locking and signaling.

Related handout here.

03/10: Finished up the discussion of semaphores and introduced deadlock. Showed some code examples where deadlock can occur and how to prevent it.