Assignment 1 FAQ

General

Assignment 1

Code Issues

What happens if a customer makes an invalid order request?
You can assume customers will not submit invalid orders. However, if a staff member's call to the take_order function returns a NULL pointer, then that staff member will go home.

I have got my assignment working with the print_on debugging statements in paintshop_driver.c activated. However, when I turn off debugging, the system just crashes. What's going on?
This sort of thing usually indicates a race condition in your code. The kprintf can alter the timing enough to mask the problem. If you record the random seed on a run when it crashes, you can then set the seed and the timing will be deterministic, hopefully reproducing the crash every time. Then you can use gdb to find out what's going on.

What is colour 0? Is there a bug in the mix() code?
There is no colour 0. 0 represents "no colour requested". This implies there is a bug in the mix() code. It has been corrected in our version, so you can copy it from our source tree.

If you've already modified the file and want to correct it yourself, find the line:
paint_tints[col-1].doses++;
and add some bounds checking, such as:
if (col > 0) {
	paint_tints[col-1].doses++;
}
Well done to those who spotted this.

Spec Clarification

What synchronisation primitives can I use? Do I have to implement semaphores?
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.

Can I use the OS/161 implementations of queues?
Yes, you may use the queue library that OS/161 provides (see src/kern/include/queue.h). Be careful though, as was discussed in tutorials, the library queues are not synchronised.

Configuration

What sys161.conf file are you talking about? I don't have one.
The configuration file in ~/cs3231/root from assignment 0 will work fine, providing you modify it as described in the assignment 1 spec.

If you´ve deleted it, you can download this one.