Monday, April 9, 2012

Pintos- implementing the mlfqs scheduler

Hi, Its been a while since my last post on pintos, as I have been quite busy at work. As promised in the last post, here is the link to my pintos repository :  https://github.com/sup3rcod3r/pintos. You can watch it to keep up with the developments.
A quick way to clean and compile any code changes is to run
$make clean && make check
from the project/build folder. This compiles the kernel and starts running all the tests.
In the next exercise, I skipped the priority donation part, and jumped on to implementing the mlfqs scheduler. It was quite a fun exercise, getting to learn about fixed-point arithmetic, and its use in the pintos kernel, where float numbers aren't supported. An important point to remember is that you have to consider the idle thread while calculating load-avg and recent-cpu values. Since it doesn't contribute to these values, it is good to check for it in the get functions, and return if true. After I got this bit right, nearly all of the scheduler tests passed.
Output as of now :

pass tests/threads/alarm-single
pass tests/threads/alarm-multiple
FAIL tests/threads/alarm-simultaneous
pass tests/threads/alarm-priority
pass tests/threads/alarm-zero
pass tests/threads/alarm-negative
FAIL tests/threads/priority-change
FAIL tests/threads/priority-donate-one
FAIL tests/threads/priority-donate-multiple
FAIL tests/threads/priority-donate-multiple2
FAIL tests/threads/priority-donate-nest
FAIL tests/threads/priority-donate-sema
FAIL tests/threads/priority-donate-lower
FAIL tests/threads/priority-fifo
FAIL tests/threads/priority-preempt
FAIL tests/threads/priority-sema
FAIL tests/threads/priority-condvar
FAIL tests/threads/priority-donate-chain
pass tests/threads/mlfqs-load-1
pass tests/threads/mlfqs-load-60
pass tests/threads/mlfqs-load-avg
pass tests/threads/mlfqs-recent-1
pass tests/threads/mlfqs-fair-2
pass tests/threads/mlfqs-fair-20
pass tests/threads/mlfqs-nice-2
FAIL tests/threads/mlfqs-nice-10
FAIL tests/threads/mlfqs-block

Follow the requirements closely, as they contain most of the clues to finishing the exercise.

Friday, March 2, 2012

pintos init

The following post is for those looking to setup a working environment to start work on pintos project. I am documenting ways to overcome some difficulties at start, as my hard-disk is reporting "crash imminent" and I may need to do this again later.


Started working on a new hobby project pintos last weekend.
The intro can be found here: http://www.scs.stanford.edu/10wi-cs140/pintos/pintos.html.
I started with setting up the environment by following steps given here: http://www.scs.stanford.edu/10wi-cs140/pintos/pintos_12.html#SEC166
While I was breezing past the first 3 points (bochs installed, setting path to add gdbmacros,src/utils), I hung up on the 4th i.e. Compile the remaining Pintos utilities by typing make in src/utils. The problem when I invoked make is that make file generates commands like 
$gcc -lm squish-pty.c
which resulted into error with my version of gcc, as -lm . So, had to ignore makefile, and ran those commands individually:
$gcc squish-pty.c -o squish-pty -lm
then, copied each generated executable into PATH directory.


A second problem that was lurking was, bochs didn't install correctly and would crash, when running the pintos command. Downloading a prepatched version of bochs from http://cit.dixie.edu/cs/3400/pintos-install.php, helped.


In the next post, I will give the git url for this project, and provide new ideas and materials to learn from to complete the project.