FAQ: W4118 Operating System Homework 4

1. How come the scheduler always gets nothing when trying to find the next RUNNABLE process in scheduler()?

One possible reason is that in the boot procedure, the scheduler experiences a non-trivial period when there's no process in RUNNABLE state. It is because the scheduler() starts running before userinit(), when the first user process is initialized and set to be RUNNABLE. So, don't worry too much if you see a lot of “no process found” in the scheduler at the beginning.

However, this could also be your implmentation defect, for example, a process is expected to be added in the scheduler queue somewhere but it never happens.

2. Why I got error for building xv6 with the codes not modified at all?

The testing programs require system calls mentioned in the homework description. But those system calls are not implemented yet, the building errors should disappear when you have implemented the new system calls.

3. System calls like getaffinity return -1 as either a valid value (no affinity) or failure. How to distinguish the two cases?

You don't need to distinguish the two cases in homework 4. Just do what you're told in the assignment and let the grading script take care your points.

4. Why I failed “make grade” while all the tests were passed in “make qemu-nox”?

The reason is mostly like to be you are running the tests on a slow machine and the testing script sets an execution time limit for each test.

To fix this issue, you can edit “grade-hw4.sh” to modify the execution time limit. Don't worry about this on the final grading test.

Also, make sure you are on the lastest code by running “git pull” in xv6 directory.

5. Affinity of child process in fork function.

It's not specified in the homework description, but we'd suggest you to set the affinity of child process to be the inherited from paranet process in fork function. If you didn't do this, there will be chance to obtain non-deterministic result for hw4-test-aff and hw4-test-ast.