Updating Repository and General Setup
As we have chosen our patch for locks and condition variables, you will no longer need your code from Assignment 3. But in the first week of the assignment, you will only be reading OS/161 code, so it doesn't matter which codebase you examine.
Cloning the Repository
After accepting the assignment on GitHub Classroom, you'll need to clone the repository to your CS 134 server account. Here's how you do it:
- Go to your repository on GitHub.
- Click the green button that says .
- You'll see a URL; copy that URL (the easiest way is to click the button that looks like two overlapping rectangles (i.e., select_window_2)).
- Open VS Code.
- Click on the button in the lower-left corner. In the pop-up menu, select and enter
for the host (whereusername @cs134.cs.hmc.eduusername is replaced by your CS 134 server username from Homework 1). When prompted, enter your server password. - On the sidebar of your VS Code window, click the “Explorer” icon (looks like two overlapping pieces of paper) or the “Source Control” icon (looks like three circles connected by two lines).
- Click .
- In the text box at the top of the window, paste the URL you copied from GitHub.
- Now edit the path to choose a place to save the cloned repo. We recommend using the
cs134directory that is already in your home directory. - VS Code will download the repository and ask if you want to open the repository. Say yes!
Selecting OS/161 Mode in VS Code
In the bottom right corner of your VS Code window (directly to the left of the bell icon notifications ) there is a “C/C++ Configuration” button, which will probably say “Linux”. Click that button, and a drop-down menu from the Command Palette will allow you to select a configuration. Choose “OS/161”, and the C/C++ Configuration button should change to read “OS/161”. VS Code's “IntelliSense” should now work properly with the OS/161 code.
Building the OS/161 User-Space Tools
As you did with HW 3, you'll need to build OS/161's user-space tools and kernel.
Run
./setup
to build the user-space tools.
Running ./setup can take a few moments depending on how busy the server is. Remember that you can skip ahead to do some of the reading parts of the assignment while you are waiting for some code to compile.
The build process should finish with a message like
Base system installed in /home/username /cs134/repo-name /root
Now you need to configure and build the kernel.
where
Building the OS/161 Kernel
For this assignment, you will configure the build using the SYSCALLS configuration file. Make sure that your current directory is ~/cs134/, and then run
cd src/kern/conf
./config SYSCALLS
and then build the kernel with
cd ../compile/SYSCALLS
bmake depend
bmake && bmake install
Testing the Kernel
Once it's built, you can test it by changing your directory to your virtual root directory and run the kernel with
cd ../../../../root
sys161 kernel
(You can also do cd ~/cs134/ (where
Checking the “Hardware”
This assignment includes an additional program, /testbin/hw4test. After you've built the kernel, running hwtest4 (using the p command from the menu) will yield the following results:
cpu0: MIPS/161 (System/161 2.x) features 0x0
OS/161 kernel [? for menu]: p /testbin/hw4test
Operation took 0.000125640 seconds
OS/161 kernel [? for menu]: Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 45
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 55
Unknown syscall 3
Fatal user mode trap 4 sig 10 (Address error on load, epc 0x400734, vaddr 0xeeeee00f)
panic: I don't know how to handle this
sys161: trace: software-requested debugger stop
sys161: Waiting for debugger connection...
When your assignment is complete, the results will be much more satisfying; something like
OS/161 kernel [? for menu]: p /testbin/hw4test
**********
* File Tester
**********
* write() works for stdout
**********
* write() works for stderr
**********
* opening new file "test.file"
* open() got fd 3
* writing test string
* wrote 45 bytes
* writing test string again
* wrote 45 bytes
* closing file
**********
* opening old file "test.file"
* open() got fd 3
* reading entire file into buffer
* attemping read of 500 bytes
* read 90 bytes
* attemping read of 410 bytes
* read 0 bytes
* reading complete
* file content okay
**********
* testing lseek
* reading 10 bytes of file into buffer
* attemping read of 10 bytes
* read 10 bytes
* reading complete
* file lseek okay
* closing file
**********
* testing getpid
* getpid() returned 1
**********
* testing fork (parent waits)
* Forked, in parent
* Forked, in child
* Child (pid 2) exited with status 42 (claimed as pid=2)
**********
* testing fork (child finishes first)
* Forked, in child
* Forked, in parent
* Child (pid 3) exited with status 54 (claimed as pid=3)
Program exited with status 0.
Operation took 2.377299249 seconds
OS/161 kernel [? for menu]: q
Shutting down.
The system is halted.
sys161: 250529661 cycles (92476012 run, 158053649 global-idle)
sys161: cpu0: 16278024 kern, 221221 user, 0 idle; 25262 ll, 25262/0 sc, 132451 sync
sys161: 1824 irqs 8208 exns 0r/0w disk 21r/1745w console 13r/2w/7m emufs 0r/0w net
sys161: Elapsed real time: 6.452868 seconds (38.8245 mhz)
sys161: Elapsed virtual time: 10.025476805 seconds (25 mhz)
(There are other test programs you'll be able to run besides hw4test, but we'll discuss those later on.)
(When logged in, completion status appears here.)