Posted on August 21, 2017 by Gabriel Parmer
This course covers the fundamental concepts of operating systems, focusing on resource management and abstraction. This includes OS structure, processes and thread management, communication with peripherals (I/O), synchronization, deadlocks, memory management, Virtual Machines, cloud infrastructures, and abstractions for cloud computation. The workload for this class is heavy and programming intensive.
You should immediately fill out the course survey (which requires you to make/have a github
account):
Objectives - In completing this class, students will…
Structure - This class is broken into two main activities: lectures and lab.
Each semester, you’re expected to spend at least:
Prerequisites:
Responsibilities - Students must
Topic | xv6 Book Chapters/Additional Reading1 |
Silberschatz Chapters2 |
---|---|---|
OS Fundamentals: Hardware and Structure | 0, 1, 3 and this post | 1, 2 |
Processes, IPC, Threads, Isolation | this post | 3, 4 |
Scheduling and Critical Sections | 5, 4 | 5, 6, 19 |
Mutexes, Condition Vars, Deadlock | N/A | 6, 7 |
Midterm | all of the things… | |
Memory Management and Allocation | N/A | 8 |
Memory Protection | 2 | 9 |
File Systems and Storage | 6 | 10, 11, 12, 13 |
Wildcard | N/A | N/A |
Final | all of the things… |
You can find the lectures on Piazza after they are delivered. For your reference, all of the lecture’s pdf
s are on the following topics:
Encouraged (but optional) Text:
If you have trouble understanding the xv6 source code, I recommend the following resources:
make print
)You can fork the xv6 source on github. When you do, test that you can run it with make
, and make qemu
.
In the end, you have to get comfortable walking through the code, and understanding it. Using a code indexing system will make this easier. ggtags
or ctags
for emacs does great, but there are corresponding technologies for nearly all editors.
If you’re having trouble with C, here is a list of references:
cdecl
command, or, if it isn’t installed, you can use the cdecl
webpage.It is your responsibility to quickly get up to speed in C, so please use these resources.
All of your homeworks for this class will be submitted via github
. The last commit that you make to the repo will be graded, and the lateness penalties of that commit (see “Late Policy” below) will apply. Please do not make push
es to your repo after the version you want graded. Please also not that it is necessary to issue a git pull
up to the github
repo for submission. Local commits to your own repo do not update github
, thus cannot be counted as submission.
Grades will be assigned with the following proportions:
Homeworks include smaller programming assignment, written responses, and a long final programming project.
Participation will be graded not only on attendance, but also on interactivity and involvement during class and lab.
If needs be, there will be short quizzes at the beginning of classes. These will only happen if people make it a habit of not coming to class, or coming late.
Late Policy:
Because homeworks are due every week or every other week, it is too harmful to get behind on them. Thus the late policy is quite strict to discourage procrastination.
Just as you can do a google search for code online, it is trivial for us to do the same. We have caught numerous people cheating in the past in this way. If you feel pressured about an assignment, please come see me instead of cheating.
You are not allowed to collaborate on the homeworks and the lab assignments. The group projects require collaboration within each group, but no collaboration between teams is permitted. Please refer to the academic integrity policy linked from the course web page. This policy will be strictly enforced. If you’re having significant trouble with an assignment, please contact me. If you have not signed the academic integrity statement for homework 0, you will not receive a passing grade for the class.
To run xv6
, you need qemu
installed. If you aren’t running Linux, then you might execute Linux in a virtual machine (e.g. using Virtual Box or VMWare Workstation), and qemu
within Linux. I believe others have gotten qemu
executing in OSX as well (but it takes installing a cross-compiled ELF-version of gcc
), so discuss on Piazza if you’re interested in that.
$ git clone https://github.com/gparmer/gwu-xv6.git xv6
$ cd xv6
$ make qemu
Simple!
Note that the xv6
book has a great overview of the design of the entire system. Please use it as a resource if you need it. Note that since you don’t own this repo, you cannot git push
to it. You have to fork it on github
to become the owner of your own fork. For this class, all assignments will be completed on repos that we provide for you.
Some hints for understanding the code-base. All code that runs in user-level is in the files that correspond to the entries of UPROGS
, and all of the header files that they include. The rest of the code executes in the kernel. Thus to add a new program, you only need to provide the .c
file, and add it in a similar manner to UPROGS
.
When you’re looking at a .c
or .h
file, always make sure you understand if it is executing in user-space (thus must make a system call to enter the kernel), or is in the kernel (thus can directly call functions within the kernel). Using a code indexing system will make it easier to walk through the source code. ggtags
or ctags
for emacs does great, but there are corresponding technologies for nearly all editors.
git
and github
Using github
. github
provides a wonderful set of repository management features online. You can go through the github
bootcamp if you don’t know how to use it.
You can use github
to coordinate between team members in many different ways. I’d strongly recommend that when working in a team, you use the feature branch workflow pattern of interaction. At the highest-level, this means that each team member will be working on their features on separate branches, and will integrate them into the mainline to coordinate with everyone else.
A few of the ways to interact with github
:
git pull
and git push
are you main means of pulling your repo off of github
, and to update the version on github
. If you’re working in a group, these are the only ways that you synchronize your work between team members. If you want to submit an assignment, git push
is the only means to do so.git pull
when another team member has previously made changes to the repo. You have to go through your code looking for any place that git
has inserted text like “HEAD”, “>>>”, “<<<”, and “—” that indicate where you’ve made changes that conflict with the github
repo.github
on PRs! See the software engineering guide for some information on code reviews and PRs. However, it is more advanced, so make sure you understand the simpler method, above, and get some practice using it before moving on to PRs.Using git
. I’m not going to do a deep dive into using git
here, and expect that you can figure out the main features online. Some quick git tips can be found at the bottom of software engineering guide. An incomplete list of commands that you can use with git include:
git diff
, git diff --stat
, and git status
which all let you understand at different granularities what changes have been made. Before you commit code, you should likely execute all of these commands. You do this for two reasons. First, you want to make sure that only code modifications that you want in the commit, are in it. Each commit should be relatively focused, so it is important to catch this. Second, it is a good way to remind yourself what the commit contains so that you can better summarize it in the commit message. It is also useful to know that you can execute diff
on ranges of commits to see what changed (see git log
to see the list of commits).git commit -a
, obviously. Do not, do not, use the m
flag. You should write a “full form” message, not a single line. The focus of your message should be on 1. summarizing the commit in a single-line (which is displayed along with the commit in github
), and 2. an explanation of the details of the commit. The latter should explain the intention, and often includes an itemized list of the main aspects of the commit. @
s should be used to reference any issues it addresses.git branch <b>
and git co <b>
to use and manage your branches. Get used to using branches. Branches are useful for when you’re trying to debug a problem, or implement a new feature. To see how they’re useful, it is important to realize that it is not uncommon to get distracted, and have to redirect your attention to another feature or bug. Without branches (and the ability to roll-back to before your work on the feature), you end up with a commit history of half-finished features intertwined with bug fixes and other features. This makes your Pull Requests schizophrenic and difficult to review. So by default, you should always be developing on a non-mainline branch. When you go fix a bug, or work on a new feature, ask yourself if it deserves its own branch.git stash
is an acknowledgment that we mess up with our branches. If you find that you’re somewhat accidentally developing a new feature, or fixing a new bug, but have a bunch of unstaged changes on the current branch, you can stash
them, create a new branch, stash pop
the changes into the new branch. I’m sure there are other ways to do this, but this example at the very least demonstrates how stash
can be used to delay a current set of changes.git rebase
enables you to update a branch to an updated master, and to “squash” multiple commits, and clean up your commit history. When the master progresses beyond the point where your branch split from it, you generally want to fast-forward merge your changes onto the new master. git rebase master
is your friend here. It is generally superior to git merge
as it maintains a cleaner (linear) history. git rebase -i
allows you to rewrite history by combining different commits. This is very useful as it enables you to have a set of commits that tell a story, and don’t have a number of “in progress” commits. My suggestion is that you label your commits that you’ll likely want to get rid of in the future with TODO
as a header on the title line. More information about this can be found here and here.Please document in your repository (e.g. in the README.md
) which coding style you’re using. By default, the xv6
repo we use is formatted in accordance with the Composite Style Guide. See that description to understand why style is important, and why we choose the style we do.
It is important, when you’re working on a team to use a consistent style. It is more important to choose one and stick with it, than to choose the “perfect style”. You can find many different styles online, including
Though not relevant for this class, many modern languages have prescribed styles such as go, and Rust.