CS 161: Operating Systems (2016)

Tuesday/Thursday 1:00-2:30

Pierce 301

Home Syllabus Assignments Resources Piazza

Setting up the Course Appliance


For this course, we will be using virtual machines (namely the CS50 appliance) for working on and submitting problem sets. Thanks to CS50, CS51, and CS61 for the content below. If for some reason, you need an environment other than the virtual machines, please contact the course staff.

If you took CS61 this past Fall, then you already have the correct appliance installed, so you can skip directly to Installing the CS161 tools.

Installing the Appliance

Please follow these directions to obtain the appropriate version of the appliance. Note: If you wish to ssh to your appliance, you should do so as user ubuntu:
ssh ubuntu@

Install CS161 Tools

In addition to the tools that come pre-installed with the CS50 appliance, you'll need some CS161-specific tools. We have packaged these tools up in a Personal Package Archive (PPA), which you can easily install. In a terminal window, at the command-line prompt, type:

	% sudo add-apt-repository ppa:cs161/sp2016
	% sudo apt-get update
	% sudo apt-get install os161-toolchain

You may be wondering what you just installed. We're glad you asked!

It should come as no surprise to you that we expect that you will need to use a debugger to complete assignments in this course. The good news is that just about everything you've learned about using gdb will apply to debugging OS/161. However, you may be wondering exactly how this is going to work since you will be building an operating system for something resembling a MIPS processor and you will be running on an Intel-based system.

We use a specially compiled version of gcc (and its associated tools) designed to produce code runnable on System/161. Thus, we have our own version of gcc (available as os161-gcc) and, among other things, our own version of gdb (available as os161-gdb).

For the most part, debugging your kernel will be no different from debugging any other program with gdb. There is a small caveat, however. Consider the following: the program that is actually running on your virtual machine will be System/161 (the executable will be called sys161). You don't want to debug System/161. You want to debug what is being run on System/161. Thus, a little cleverness is required.

You will have gdb communicate with System/161 through a Unix socket in order to send and receive debugging information. Thus, debugging your kernel generally takes three steps (after you've built your kernel (which we will do in class on Thursday), give this a try):

  1. In your installation root directory (~/cs161/root/), launch System/161 but have it wait for a debugger connection:
    % sys161 -w kernel
  2. In a different terminal window, again in your installation root directory, launch os161-gdb, giving it the binary that you want to debug:
    % os161-gdb kernel
  3. Once in gdb, instruct gdb to connect to System/161:
    (gdb) target remote unix:.sockets/gdb

The handout Debugging with GDB provides a brief introduction to gdb and detailed instructions on how to debug your operating system with it.