General Assignment guidelines
- Changes will be highlighted in
green
- Important notices will be
highlighted in yellow
- Assignments have to be strictly submitted according to guidelines. (will
be put up later)
- Assignments can be done in groups of two. lone wolves will be given some
extra credit.
Assignment on OSkit and Bochs
Part 1 : Porting
- Port Assignment 1 (pthreads part) to run on Bochs with the following changes:
- Replace the track with a 3 lane circuitious lap
- Cars do a busy wait instead of sleep (to notice the effects of scheduling)
- Use the VGA bios functions as detailed instead of ncurses
- Notes on running vga bios
- You MAY also use vga mode (and the svgalib library) to render the screen. note that the standard svgalib does not work. An altered svgalib (cheers! to soumyadeb) and an example C file and Makefile may be downloaded from the link below. NOTE THAT you may need to change some paths to oskit in the Makefile. I have compiled it on chhaya so should be ok in the intel cluster.
vga test
- Also, the followinf list of commands needs to be executed before you run bochs:
- mkdir .fonts
- cd .fonts
- cp /usr/local/bochs-2.0.2/share/bochs/vga.pcf .
- mkfontdir
- xset +fp `pwd`
- xset fp rehash
This would remove errors of the type 'vga font not installed, etc'
- Also make sure you run bochs-2.0* from /usr/local in the cluster
- Use the OSkit threads library and mutexes etc.
- Use the Oskit schedulers : round robin, priority
Part 2 : Concurrent programming
- put in collision detection alongwith some primitive AI in the cars (faster car changes lane to overtake etc. )
- implement your own semaphores (AS SYSTEM CALLS)
Part 3 : Schedulers
- Run the code on your own schedulers : implement the following
- round robin
- Priority Scheduler
- some weird scheduler which schedules the cars in such a way that th no two cars are more than one lap apart (i.e. slower cars are scheduled more frequently etc.)
Background Reading
- Read the documentation of Bochs (a free X86 emulator) and OSKit. Check out
the Bochs and OSKit documentation mirrored locally.
- Soumyadeb's pointers to OsKit
- svgalib tutorial
Tips
- Run the hello world program on bochs first
- Booting from your kernel
Getting the bootable image - You will find the image of a bootable floppy called floppy.img here. The image has a bootloader in it. The bootloader automatically loads the kernel excutable called kernel (what else !!!).
Copying your kernel image onto a floppy -
-
Method 1 : Use dd to get the image onto a floppy. Copy your kernel onto the floppy (naming it 'kernel' of course) and again create an image of the floppy using dd. This image can now be used by BOCHS.
-
Method 2: Mount the image as a loopback device onto say /mnt/floppy using this command mount floppy.img /mnt/floppy -o loop. Now you can access it as a normal floppy and copy your kernel onto it. Check out man mount for more infomation on the loop option.
Working in the intel lab : A setup has been made on some intel machines like sahana, durga
- login to these machines, do a mount /mnt/floppy.img
- cd /mnt/floppy.img
- Replace the kernel file with your own kernel
- umount /mnt/floppy.img
- cp /tmp/floppy.img ~
- Use this floppy.img to run bochs.
REMEMBER to umount the floppy even if you don't need to use it right away. You will be penalised on violation
Alternative assignment : make the bouncing ball setup run on box
Details:
check out the attraction (balls) screensaver present in linux.
Note : this should be sufficiently complex to impress the evaluators.
Last
date for submission:
Part 1: Tuesday,30th Sep. 2003
Part 2: Sunday 12th Oct. 2003
Part 3: Wednesday 29th Oct. 2003
Submission scripts for part 3 are up!!!.
Click here to submit part 3
ppl doing alternative assignment should also submit in three parts keeping in mind the complexity of Part 1, 2, and 3.