CS 160 - Addendum to Project Two



As I was doing this project myself for the first time in two years, I came upon a few issues that could benefit from a little more clarification. Also, I decided to make a couple small changes in the assignment. Please read the original document and this document carefully, and you should be able to make it through this project without too many bumps. But there probably will be bumps, so please get started on this right away. Here are the extra details I observed and the things I want to change:

  1. Be SURE to have the documentation from Project One available to reference for this project.

  2. In project document it says "hd1". Interpret this to mean whatever partition you boot up in ("hd2" in Sheppard).

  3. Work in a partition other than the one that boots up. Leave the partition that boots up alone.

  4. You'll be changing these files in /usr/src/kernel: proc.h, proc.c, main.c, system.c, clock.c, glo.h, so be sure to make backup copies of each before you start making changes. Also, some of these are too big for mined, so you'll need to use either elle or elvis. Check the man pages for these editors for details. Note that in elle you would use ctrl-^, ctrl-K, ctrl-Y to mark the start of a region, cut out a region (after moving cursor to end of it), and paste what you cut out (respectively).

  5. You don't usually need to do a make clean before doing a make hdboot (to rebuild the kernel). This will speed things up for you.

  6. It will help you out if you put some kind of mark at the start of each function definition in the listing of heap.c. Also, take a careful look at the header of each function and the comment that describes the function. Also, look at each of the #define preprocessor statements and the comment that explains it's purpose.

  7. To compile heap.c use cc heap.c -o heap. To execute it, use ./heap.

  8. We're going to do part one of the project exactly as stated in the document, in class. Therefore, I want you to do a variation on this. I want you to change the code at the beginning of main() so that the priorities are set to be the reverse of what is originally there. That is, make the priorities of node 1 be 81, node 2 be 45, node 3 be 13, node 4 be 22, node 5 be 13, node 6 be 81, node 7 be 45, node 8 be 22, and node 9 be 13. Do your analysis and draw your pictures based on this.

  9. Some less than symbols do not appear on the printed listing I gave you for heap.c, due to an "HTML issue". So check the listing using a Minix text editor.

  10. In part two of the project, I recommend declaring init_priority at the bottom of the definition for struct proc. You should know why it would be very bad to put it at the top! Take a look at the code. Also, this include I'm talking about is #include < stdlib.h > (but without the spaces between the angle brackets). Also, insert rpc->.... before the return. Also, put the EXTERN ... business in the region with similar statements.

  11. After you get through the first commenting out and un-commenting out stuff at the beginning of part three, I recommend you try rebuilding the kernel and rebooting. If you didn't make any mistakes, this should go smoothly. If not, you might need to use fix_kernel as discussed in the first project.

  12. In part three, don't store the value returned by whoIsOnTopOfHeap anywhere. Just ignore the returned value, at least for now. Later, in part four, we'll store it in rp.

  13. In part four, it is essential that you appreciate which code pertains to the USER processes' queue and what it does. You must comment out ALL such code, and insert corresponding code that uses the heap in place of the original queue. In unready you should just delete from the heap, and if rp is current process, then call pick_proc (as done originally). Note that the code at the bottom of unready is needed for the other two queues, so don't eliminate it. In ready, only the only code related to the USER queue should be a statement to insert into the heap. In pick_proc, if the heap size is greater than zero, then you should set rp to be the process on the top of the heap (without removing it), and set proc_ptr and bill_ptr to this.

  14. Even if you don't do the bonus, and once you have the priority queue working without debugging messages, I want you to compile and execute children.c (using cc children.c -o children and ./children). You can use ctrl-S to pause the display and ctrl-Q to resume. I want you to execute this in the altered Minix system as well as in the unaltered Minix system (on other partition). The behavior should be quite different, and I want you to EXPLAIN WHY THE BEHAVIOR IS DIFFERENT. (Also, I changed this program slightly.)