Assignment 0: Warm Up

Contents

  1. Due Dates and Mark Distribution
  2. Introduction
  3. Getting Started
  4. Reading Component
  5. Working with the Kernel
  6. Your Task
  7. Submission

1. Due Dates and Mark Distribution

Due Date: 8am (08:00), Wed March 19th (Week 3)

Marks: Worth 10 marks (of the 100 available for the class mark component of the course)

This assignment is done as an individual.

No bonuses apply for this assignment.


2. Introduction

The aim of Assignment 0 is to have you familiarise yourself with the environment you will be using for the remaining assignments. The assignment consists of two parts, an assessable and a non-assessable component. The non-assessable component consists of a set of directed questions to guide you through the code. The answers to this code reading Q & A component of the assignment will be entered in the wiki (ideally, by you the students). The assessable part of this assignment consists of you making a very minor change to the existing OS. The change is conceptually trivial, so you can view this assignment as us giving away marks as an incentive for you to get the assignment environment up and running early in the session.

Note that this assignment is not indicative of the level of difficulty of the later assignments. The later assignments will be much more challenging.

The OS/161 Environment

This assignment will introduce you to the components of the environment you will use during the semester:

The introduction to the OS/161 system explains how the components of the OS/161 system fit together, and contains important information about using the tools. You should take the time to read it now.

Subversion

Subversion is a source code management system used to track changes to a piece of software. We make use of Subversion in this course to allow you to manage the large code base (compared to most previous assignments you have done), and recover from potential problems. Subversion keeps a recoverable copy of specified versions of all your OS/161 files. It allows you to track the changes you have made, and more importantly, rollback to a known state if things get out of hand.

Subversion also enables you and your partner to work on the same code repository in a coordinated way. You can even work on versions of your code stored at home and at CSE.

Subversion is a large system of which you need to know only a small subset. We will give you directions for the parts you need to know. If you're curious, you can find detailed docs on Subversion at subversion.apache.org, in addtion to the resources indicated on the course web site.


3. Getting Started

Setting up your account

For this assignment, you will be working by yourself (for later assignments, you will work with a partner).

First, you will need to set up various environment variables for you to access the tools needed for the course. Simply run

% 3231
in each new shell you use when working on the assignment. (If you know what you're doing you can add /home/cs3231/bin and /home/cs3231/bin-${ARCH} to your PATH).

Note: You must not have "." (or equivalent) prior to "/bin" in your PATH. The build will fail later if you do. Note: doing this is generally a bad idea for security reasons anyway.

Obtaining and setting up the distribution with Subversion

Subversion is a "centralised" revision control system, which means that you will be checking code out of, and committing code back into, a single repository. In this section, you will be setting up the Subversion (often abbreviated "svn") repositories that you will work on. For this assignment, you will use a repository in your own home directory. For subsequent assignments, you and your partner will share a repository in your group's directory.

You should now have an asst0-src directory to work on.


4. Reading component

Now that you have an OS/161 source tree, read the code walkthrough.

This component of this assignment aims to guide you through the code base to help you comprehend its contents, identify what functionality is implemented where, and be able to make intelligent decisions on how to modify the code base to achieve the goals of the assignments.

Note that while the code reading component is not assessable, we view as the ideal opportunity to get to know your way around the code. You will really struggle with the assignments if you fail to get an understanding of the code base. The code reading component is there to guide you towards acquiring that understanding. Skip it at your own risk.


5. Working with the Kernel

Building a Kernel

Now to the business end of this assignment. You will now build and install a kernel.

Running your Kernel

If you have made it this far, your have built and installed the entire OS. Now it is time to run it.

Using GDB

I cannot stress strongly enough to you the need to learn to use GDB. Read the directions and short tutorial on using GDB with OS/161.

Note: the version of GDB used for these assignments is os161-gdb.

Modifying your Kernel

We will now go through the steps required to modify and rebuild your kernel. We will add a new file to the sources. The file contains a function we will call from existing code. We need to add the file to the kernel configuration, re-config the kernel, and the rebuild again.

Note: If you simply modify a file in an already configed source tree, you can simply run bmake again to rebuild, followed by bmake install. You only need to reconfigure it if you add or remove a file from the config, and you only need to bmake depend if you add (or modify) a #include directive.

Some practice with Subversion

Now we will perform some operations with svn.

Subversion will revert main.c to the most recent committed version.


6. Your Task

Follow the above instructions to add the given file to the operating system. Once you have found (using GDB) and fixed the bugs, you have completed the assignment. Make sure you see the Hello World!!! output just prior to the menu prompt.

sys161: System/161 release 1.99.04, compiled Mar  6 2010 15:32:32

OS/161 base system version 1.99.05
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
   President and Fellows of Harvard College.  All rights reserved.

Put-your-group-name-here's system version 0 (ASST0 #3)

320k physical memory available
Device probe...
lamebus0 (system main bus)
emu0 at lamebus0
ltrace0 at lamebus0
ltimer0 at lamebus0
beep0 at ltimer0
rtclock0 at ltimer0
lrandom0 at lamebus0
random0 at lrandom0
lser0 at lamebus0
con0 at lser0

cpu0: MIPS r3000
Hello World!!!
OS/161 kernel [? for menu]: 
Check your assignment works with the menu choice supplied on the command line as follows.
% sys161 kernel q

This is generally the way we test your submission, so make sure that you have tested using the above method, even if you have also tested interactively.


7. Submission

You will be generating a patch file using svn's built-in "diff" command, by instructing svn to compare the original version of the repository (which we tagged with the name initial) against the latest commit.

% svn diff file:///home/$USER/cs3231/repo/asst0/initial file:///home/$USER/cs3231/repo/asst0/trunk >~/asst0.diff

You should now get a patch in ~/asst0.diff. It is worth examining this patch to see whether it contains what you expect, particularly later on.

Testing Your Submission

When you submit your assignment, your submission is tested and you will be informed if your assignment is correct. (Note: This will not be the case for future assignments!) This means that you can check that you have completed this assignment correctly simply by submitting it.

Note: In this and future assignments, we run basic submission tests when you submit which can take a few minutes. If you see the following when you submit, something is wrong with your patch, and you should investigate.

 Submission test failed. Continue with submission (y/n)?  

See the submission guidelines for how to recreate your submission that failed the submission testing.

Warning! If you make any changes to your assignment, make sure you record the changes (svn commit) and create a new .diff file before resubmitting!

Submitting Your Assignment

Now submit the changeset as your assignment.
% cd ~
% give cs3231 asst0 asst0.diff

You're now done.

Even though the generated patch should represent all the changes you have made to the supplied code, occasionally students do something "ingenious". So always keep your Subversion repository so that we may recover your assignment should something go wrong.