CS 161: Operating Systems

Tuesday/Thursday 1:00-2:30

Pierce 301

Home Syllabus Assignments Resources Piazza

CS161 Assignment 0

Due: Tuesday, February 3, 5:00pm


The purpose of this assignment is to introduce you to the code you will be using throughout the rest of the course. You have already completed significant portions of this assignment in class and in your web work -- setting up your virtual machine, cloning the code repository, learning how to configure and build kernels -- these are all different aspects of becoming familiar with the system you'll be using. You also spent time in class reading code and answering questions. Those questions are a subset of the ones in this assignment. Even if you found the answers during class time, include them here in your answers to hand 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 hand in answers to the code-reading questions. The answers should be placed in a file named asst0-answers.txt that resides in the directory ~cs161/os161/submit/asst0, or more generally in the submit/asst0 subdirectory of your cloned repository. (You will need to create this directory.)

Getting Started

Let's start by tagging your repository to indicate that you are beginning assignment 0. In ~/cs161/os161, issue the following commands:
% git tag asst0-start
% git push origin master --tags

Code Reading Questions (HAND ME IN)

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 hand in answers to the questions found below in this section. Put them in a text file asst0-answers.txt in the submit/asst0 subdirectory of your OS/161 repository.

The questions are designed to encourage code exploration. (We've tried to avoid questions that can be answered 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 be as detailed as possible, giving 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.

Let's begin with some discussion questions for the in-class part of this assignment.

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 last questions.

Discuss Me! Question 14: Imagine that 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 questions 7-9 and note which of those actions you need to take in order to test the new system call.

Discuss Me! Question 15: 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.

Submitting your Assignment

You should review the document How to Submit CS161 Assignments for detailed submission directions.

As noted above, you should put the answers to the code reading questions in a new file in your source tree, submit/asst0/asst0-answers.txt. Make your git repository aware of the new file using git add:

% cd ~/cs161/os161/submit/asst0
% git add asst0-answers.txt

Next, commit your changes to your local repository using git commit:

% git commit

Git will provide you the opportunity to add a comment to the commit. Add an appropriate comment to the commit (like "adding assignment 0 code reading answers") and save the temporary file.

Note that while you have committed the change to your local repository, you have not yet published them anywhere (and thus you have not yet submitted your completed assignment!). To do so, you need to push your repository back to code.seas:

% cd ~/cs161/os161
% git push origin master

Finally, you should tag your repository to tell us that you have finished the assignment.

% git tag asst0-submit
% git push origin master --tags

Congratulations! You're done with assignment 0!