General FAQ

General Questions

How do I change my path?
The short answer: You don't need to. If you use the '3231' command to start a subshell it should add the require elements to your path.

The other short answer: Read the documentation for your shell. Try typing man bash.

The long answer: First find out if you need to. Type the following command into a shell "echo $PATH". If the path printed out has /home/cs3231/bin-pc.i86.linux then your path is already set up for this subject. If not, read on.

If you are using an 'sh'-like shell (if you don't know what that means, then you probably are), then you use the 'export' command:
$ export PATH=$PATH:/home/cs3231/bin-$ARCH
If you are using a 'csh'-type shell, then you use the 'setenv' command:
setenv PATH $PATH\:/home/cs3231/bin-$ARCH

I have started the assignment, but no matter what I do (set seed, modify code), I get the same result. What is wrong?
Did you run make install to install your new kernel, as you learnt in assignment 0?

I am running out of disk space, can I have more?
No, you have been given 20 megabytes of disk space for comp3231. This is more than enough.

Note: You should be very careful with your quota. Quite a few problems that students are having with the build environment are due to their quota being exceeded.

You can check how much space you are using for OS with the following command.

% cd ~
% du -sk cs3231
6455    cs3231
This is less than 7 Meg, and thus there should be at least 13 meg of free quota in this account.

Why is volatile used when declaring a particular variable?
volatile needs to be used to declare variables that can be concurrently modified by something outside the scope of the current thread/function.

e.g. without a volatile count, the following code

while (count == 0) {
 // do something unrelated to count
can be validly transformed by the optimiser into
if (count == 0) {
    while (TRUE) {
        // do something unrelated to count
The second code fragment is logically the same code as the first if count is NOT volatile. However, the second fragment is completely wrong if the intention is that count be volatile.

Questions about Submitting Assignments

When I try to submit my assignment I get the following error. What's wrong?
classrun: maximum submission size exceeded (200 kb)
You have made a mistake in creating your diff file. None of the assignments will require code in excess of 200kB. Make sure that you run 'make clean' before you create the diff. Also check that you haven't accidently put something extra in your source tree (like a second copy of the source tree).

What's all that weird command line stuff about in the submission guidelines?
This just means that you can run menu commands from the command line, and that this is how we do the autotesting.

Here are some examples:

  • sys161 kernel "at;bt;q"
    This is the same as starting up with sys161 kernel, then running "at" at the menu prompt (invoking the array test), then when that finishes running "bt" (bitmap test), then quitting by typing "q".
  • sys161 kernel "q"
    The simplest example. This will start the kernel up, then quit as soon as it's finished booting.
Try it yourself with other menu commands. Remember that the commands must be seperated by semicolons (";").

How do I make sure that the diff I submitted has my latest version?
Follow the Submission Guidelines.

How do I check if my assignment submitted okay?
Run the following command in a 3231 subshell:
classrun -check ass0

Why does 'classrun -check' claim I haven't submitted? I'm sure that I did.
If you've changed tutorial group since submitting, then classrun will get confused, and think you haven't submitted. If this is the case and you really want to confirm you have submitted email the class account and someone will check for you.

My assignment builds and runs correctly on a CSE machine, but I get the following error when I submit. What is wrong?
Running submission through simple test...
Testing patch is valid...Submission test failed. Continue with submission (y/n)?
You probably created the patch from the wrong directory. Carefully read the instructions preceding the "diff" command in the assignment specifications. You could also check the Submission Guidelines.

How do I submit again after already submitting my assignment once?
You can submit as many times as you like, but only your last submission will be marked. Also the calculation of early bonuses and late penalties will only consider your last submission.

OS161 Questions

Why does os161 panic with an "out of memory" error when I run a command a few times from the menu?
The version of OS/161 you are using has an incomplete memory management system, which means that it runs out of memory after a while. Quit the simulator and start again to fix this. See the faq entry above about commandline testing if this is too much effort.

Note: Our automarker only runs one test at a time, so this won't affect your assignment results.

Where can I find more information about os161 structure/functions/syscalls?
Try the os161 man pages.

When I run make I get this error: "make: cs161-gcc: command not found". What do I do?
First make sure you are using a pc.i86.linux machine. Now run the 3231 command as described in Setting up your account. If it still doesn't work, your .bashrc (or similar) is probably overriding the PATH set by the 3231 command. Add ~cs3231/bin and ~cs3231/bin-pc.i86.linux to your PATH manually as described in Setting up your account.

Why won't the os161 user-level utilities compile?
If you get an error when executing 'make' in ~/cs3231/src, then the problem could be your $PATH. If you have '.' before '/bin' then you will have a problem. This can be fixed by moving the '.' to the end of your $PATH or remove it altogether, as it can be a security problem. To find out your path, type "echo $PATH" into the shell you executed 'make' in.

Awk says ‘syntax error.’ What do I do?
The config script may report a syntax error on Solaris machines (like mozart and hummel). Try using a pc.i86.linux machine (like wagner or williams).

Why are there two 5 meg files (DISK1.img and DISK2.img) in ~/cs3231/root? Can I delete them?
These two files are simulated harddisks from sys161. You can delete them, but they will come back each time you run sys161.

They are a little large for our purposes. Edit the sys161.conf file in ~/cs3231/root and change the number of sectors to 2048, instead of the current 10240. Sys161 will create two 1 meg files instead of 5 meg files.

I placed the .gdbinit file in the root directory, but when I start gdb and type asst0, it gives me an error message like this:
unix: unknown host
unix:.sockets/gdb: No such file or directory.
This error is generated by gdb. You need to be running cs161-gdb. You may need to fix your path.

What is wrong with GDB? (I encountered a 'bug')
You might have seen a message from gdb like:
> warning: Hit heuristic-fence-post without finding
> warning: enclosing function for address 0x80000084
> This warning occurs if you are debugging a function without any
> symbols (for example, in a stripped executable).  In that case, you
> may wish to increase the size of the search with the `set
> heuristic-fence-post' command.
> Otherwise, you told GDB there was a function where there isn't one, or
> (more likely) you have encountered a bug in GDB.
don't be alarmed. there is no bug in gdb.

what you should do is:

(gdb) break mips_trap
(gdb) continue
... it breaks in mips_trap
(gdb) clear mips_trap
you can then step through your program in the usual way.

What can cause this:

  1. If you don't have interrupts off, it's quite likely a timer interrupt caused it. to find out, step down until you see that it's gone into the interrupt code.
  2. If you have interrupts off, then there is a bug in your program. The most common bugs are bad pointers; to make sure, if you "continue", it print out the exception code in a user-friendly way.

Questions about installing SYS161

How do I install sys161 on my system?
Read the instructions at on the os161 page. The most important thing is to install them in the correct order. There is plenty of information on how to configure and install in the README file in the tarballs themselves.

In 2003s1 someone created a knoppix iso which apparently includes os161. Knoppix is a bootable linux image on a cd, which should allow you to run os161 without installing it. You can download it from here.

Note: We didn't create this, so we may not be able to help with problems you may have.

Gdb does not build under cygwin. It fails with the following error. How do I fix it?
/root/tmp/cs161-gdb-1.3/gdb-4.18+cs161/sim/mips/sim-main.h:368: unnamed
fields of type other than struct or union are not allowed
make[2]: *** [support.o] Error 1
make[2]: Leaving directory /root/tmp/cs161-gdb-1.3/sim'
make: *** [all-sim] Error 2
The problem is due to a new version of gcc that does not like old code. I have modified gdb to fix this problem and made the new version available on the OS/161 page

cs161-gdb won't compile under gcc 3.3, what's wrong?
This is because the sources contained multiline comments of the form:
These are deprecated in gcc 3.3, and only the following multiline comments are supported:
Mario Bou-Haidar wrote an awk script to convert the unsupportted multilines to the ANSI C format, after which it should compile. Download both fixMultilines.awk and then to use execute:
$ ./ targetDirectory
The files that need to be changed are saved with a .orig extension.

Note: if you have trouble with these scripts email Mario at mbou835 at cse.