Frequently-asked questions for CS3231

Path management

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

The kernel won't change!

Did you run make install to install your new kernel?

Volatile variables

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.

Submission too big

You have made a mistake in creating your diff file. None of the assignments will require code in excess of 200kB. If you're submitting a diff, then make sure that you run 'make clean' before you create it. Also check that you haven't accidently put something extra in your source tree (like a second copy of the source tree).

Out of Memory?

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 avoid this problem. Note: Our automarker only runs one test at a time, so this won't affect your assignment results.

Debugging init file

unix: unknown host
unix:.sockets/gdb: No such file or directory.
This error is generated by gdb. You need to be running os161-gdb. You may need to fix your path.

GDB Error?

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:

Implicit Declarations?

Testing compilation ..../../SOMEFILE.C: In function 'function_name': ../../SOMEFILE.C:132:warning: implicit declaration of function 'some_function'

GCC is complaining because you have not declared a function prototype for some_function() before you call it. This is bad style and you will probably lose marks for having this warning in your submitted code.

If you add one then the warning will go away. If you do this by making a new header file and #include-ing it, then make sure you remember to run 'make depend' before re-running 'make'.

Build number?

The build number (shown below as an X)version 0 (ASST0 #X)is incremented each time you build your kernel. You do NOT have to match this with the number shown in the sample output. We will ignore it for testing purposes.

Sync Functions

You can use any of the OS/161 provided semaphores, locks, and condition variables. They were covered extensively in the lectures. They are also described in the header file src/kern/include/synch.h. They are already implemented, you can simply use them.

You should NOT use interrupt (dis)enabling.

How do I get my marked assignment?

You can see how you did in the autotesting, as well as reading markers comments, and ratings by runnning the following command:

$ ~cs3231/bin/classrun -collect asst1

where asst1 is the name of the assignment.