CSE 451 Assignment 0

Due: Thursday at 9:00pm, April 7, 2016

The project is to be done in groups of 2-3. Everyone in the group should be able to answer the questions in this assignment. If you have not formed a group yet, please get started on the assignment anyway, and then compare answers and resolve any questions you may still have.

Overview

The purpose of this assignment is to introduce you to the code you will be using throughout the rest of the course. We will do portions of this assignment in section. Even if you found answers to some of these questions during section, include them in the solution you turn in.

By the time you complete this assignment and the related in-class work, you should be able to:


What You Must Hand In

You must turn in the answers to the code-reading questions via Catalyst.


Getting Started

The baseline code for OS/161 is stored on UW CSE's gitlab:
git clone git@gitlab.cs.washington.edu:syslab/16sp_cse451_os161.git
mv 16sp_cse451_os161 os161

This creates a directory named os161 containing the source code for the operating system and various utilities.

The operating system is written for a cache-coherent MIPS computer named System/161. For this, you will need to use a cross-compiler: a compiler for generating MIPS instructions, along with various other related tools such as a cross-gdb.

You will need to put the following directory in your UNIX path:

/usr/local/os161/tools/bin
In this directory you will find all the necessary tools, such as mips-harvard-os161-gdb and mips-harvard-os161-gcc. You will probably want to set up an alias in your shell so you can use os161gdb instead of the full name.

To use the tools within a VM, follow the following steps (from support@cs):

"The Home VM looks at our local courseware repository, so the packages can also be installed there. For someone who has just downloaded the Home VM, they should first apply all the updates since the home VM was created with "sudo dnf -y update". After that, they can install the toolchain by doing:

sudo dnf -y install bmake os161-environment binutils+os161 gcc+os161 gdb+os161 sys161
After installing, they should log out of the VM and in again to get the toolchain path added to their environment."

Typical practice when developing a new OS is to run it on a machine simulator. The simulator, sys161, is in the same directory as the cross-compile binaries, along with a few other versions like trace161 and stats161 that may be useful later.

You will want a repository for your group to store its code, to share solutions with the TA's, and most importantly, to allow you to pull/merge any changes we make later on.

Go into UW CSE's gitlab and create a new project (typically, one per group). Then follow the instructions under "Existing folder or Git repository" for pushing a clean version of the os161 code into that project. You will also need to enable write access for your partners and read access for the TA's.

Next, tag your repository to indicate that you are beginning assignment 0. In your git repository, issue the following command:

git tag asst0-start

Then push the tag to your shared repository.

git push origin master --tags

Code Reading Questions (24 points)

OS/161 is a simplified skeleton of a modern operating system. It comes with a configurable build system, code for some useful user-level utilities that can be run from within OS/161, and of course code for the operating system itself. To complete the assignments of this course, you will need to get your hands deep in the guts of the OS/161 codebase, and the sooner you become familiar with it, the better. To that end, you should look through the files and begin to internalize how the code is structured, what goes where, and how things work. This applies both to the build system and the codebase itself.

To guide you in this process, please write up and submit to the catalyst course dropbox a file with the answers to the questions below. Make sure to include the names of all project partners.

The questions are designed to encourage code exploration (we tried to avoid questions you could answer simply using grep). The goal is to help you understand key parts of the system. That said, you are not yet expected to understand everything you see (that's what the rest of the course is for!). But you should get the "gist," and your answers should reflect that. Please give function names and full pathnames in the source tree where appropriate. You don't need to explain what every last line of a function does, but your answers should be conceptually complete. Note that some questions may require longer answers than others.

Note: in these questions, and throughout the course of the semester, we will refer to the terms "trap", "interrupt", "exception", and "system call". Following the textbook, they mean the following:

Let's begin with some discussion questions:

Below is a brief overview of the organization of the source tree, and a description of what goes where.

Now that you've perused the source tree, here are two more questions.

Discuss Me! Question 11: Suppose you wanted to add a new system call. List all the places that you would need to modify/add code. Then review your answers to question 7 and state which additional actions you would need to take in order to test the new system call.

Discuss Me! Question 12: Refer to the document Using GDB and run gdb on your kernel. Experiment a bit and follow the execution from the start.S file through the main menu kmain and then to the code that executes some of the commands. Explain the control flow from start.S through the menu and on to other parts of the kernel. There is no need to trace functions called by functions called by kmain, but you should look at those functions to understand what the first level function does.


Finally, upload a file with your answers to Catalyst. Normally we would ask you to tag your repository to let us know you are done, but we don't need that for this assignment.

Congratulations! You're done with assignment 0!