CS 134

Configuring, Building, and Running the OS/161 Kernel

In the last part, you built the user space tools for OS/161. Now you'll build and run the kernel!

Configure the Kernel

The build process is identical to the one you used for the user space tools, except that you will configure the build using the SYNCH configuration file. Make sure that your current directory is ~/cs134/hw3, and then run

cd src/kern/conf
./config SYNCH

Build the Kernel

Once the kernel is configured, you can build it by typing

cd ../compile/SYNCH
bmake depend
bmake
bmake install

Once it's built, you can test it by changing your directory to your virtual root directory as follows:

cd ../../../../root
sys161 kernel

(You can also use cd ~/cs134/repo-name/root) where repo-name is the name of the repository you cloned.)

(The differences in configuration between this assignment and Homework 1 are (1) the timer interrupt happens more frequently and (2) sys161.conf in the root directory gives the machine more RAM (2 MB).)

sys161: System/161 release 2.0.3, compiled Jul 25 2024 16:47:30

OS/161 base system version 2.0.3
Copyright (c) 2000, 2001-2005, 2008-2011, 2013, 2014
   President and Fellows of Harvard College.  All rights reserved.

Our work-in-progress OS/161 system version 0 (SYNCH #1)

1888k 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
lhd0 at lamebus0
lhd1 at lamebus0
lser0 at lamebus0
con0 at lser0

cpu0: MIPS/161 (System/161 2.x) features 0x0
OS/161 kernel [? for menu]:

If at the menu, you type ?, you'll now see something like

OS/161 kernel [? for menu]: ?

OS/161 kernel menu
    [?o] Operations menu                [kh] Kernel heap stats
    [?t] Tests menu                     [khgen] Next kernel heap generation
    [sp1] Cat/mouse with semaphores     [khdump] Dump kernel heap
    [sp2] Cat/mouse with locks and CVs  [q] Quit and shut down

Operation took 0.605959240 seconds

Notice that there are now some additional options, sp1 and sp2. These are the cat/mouse synchronization problems that you will be working on later in this assignment. You can run them by typing sp1 or sp2 at the menu prompt.

If you run the kernel and choose the menu option sp1, you should see output roughly as follows:

OS/161 kernel [? for menu]: sp1
There are 6 cats, 2 mouses, and 2 bowls.
CAlalt MhCdi aomcrniMrle CCie !CcColkac
panic: Assertion failed: active_animals == 0, at ../../synchprobs/catsem.c:205 (catmousesem)
sys161: trace: software-requested debugger stop
sys161: Waiting for debugger connection...

You can press Ctrl-C to stop the kernel return to the shell prompt.

There are two things to notice in this output. First, there was some garbled output (yours will likely look different, or perhaps even just say All done!); second, the kernel panicked because of a failed assertion in the cat/mouse synchronization problem. These issues occur because

  • You haven't yet implemented locks and condition variables in the kernel (causing the garbled output).
  • You haven't solved the synchronization problem yet (causing the panic).

To Complete This Part of the Assignment…

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)