Home Schedule Reading Projects People

HINTS on Project 4: Scheduler - MUFiX


For long-running user processes to test with, you might want to use a simple counting program to consume CPU while you watch your queues. There is a great one posted here and onother here is another on here . Or write one yourself. Login to Minix as root. Open another virtual terminal in Minix (Alt F1) (Alt F2) (Alt F3), login as your user, and run the counter programs in the others, maybe compile them twice and call them counter1 counter2 or something.

To see your current Minix boot images:

You names may look like this (think of a naming scheme):
3.1.4ar09 3.1.4ar10 3.1.4ar11 3.1.4ar12
Where 3.1.4 is the MINIX version, and ar10, ar11, and ar12 are the latest kernel builds created by make install.
When you boot, it boots from here: /dev/c0d0p0s0:/boot/image/3.1.4arX, where it loads the latest kernel image. In my case it would load 3.1.4ar12 on boot.
A side note: c0d0p0s0

A side note: Unix typically partitions its hard drive space something like this:

Modify and rebuild the kernel: You can also do the the same thing from here: Later you may also need to rebuild some commands if you changed the proc struct in proc.h. This is needed so you can use things like "top" command, otherwise top will crash.

Depending on the hardware, structures sometimes require byte alignment. So they will usually be aligned on 4 byte boundaries. If you add an int to the proc struct in proc.h, that should be fine. If you add a char, the compiler will probably add extra "padding" of 3 more bytes (chars), or you can just at 3 extra chars called something like pad1 pad2 pad3 yourself. If you look at the proc struct you will see there are 4 chars declared in a row there, probably for this reason. And using 4 ints (4*4 bytes) would have wasted space, so they used 4 chars (4*1 byte). See page 254 and also page 252 here for a reference on that. You should probably just add your variables to the end of the proc struct, and you may not even need to pad them to 4 byte boundaries, but its a good idea.

You can use kprintf in the kernel. This is the kernel version of printf, and the syntax is the same. Reference kernel/kprintf.c
But you should not or cannot use/print floats in the kernel. They can a long time for calculations, and they take some work to print. That could slow things down in your kernel. To see messages in the kernel, they may print to the root's login terminal, or more correctly you can look at the sys messages: