COMP450 Minix Memory Assignment
Minix uses the “First fit” algorithm to allocate memory for programs and processes. For this programming assignment, you are to modify the Minix operating system to use a different memory allocation algorithm. You can implement:
0. Best fit
1. Worst fit
2. Most Recent
3. Next fit
· Buddy system
· Randomly choose any space that fits
· Any memory allocation algorithm you define (except first fit)
This is a team project using the same team you used for the Minix installation assignment. Add the last two digits of your social security number to the last two digits of your team mate’s social security number. (If you are doing the project by yourself, just use the last two digits of your social security number.) Divide this number by 4 and save the remainder (mod function). If the remainder is 0, implement Best fit, if 1 implement Worst fit, if 2 implement Most Recent and if 3 implement Next fit. For challenge points, you can implement the Buddy system or the random selection instead. You can also define a new allocation algorithm, different from any of the above, and implement that.
You will need to modify the file alloc.c of the Minix operating system. In general, this is the only file you will have to modify to complete this assignment. You can find this file on the Minix system in /usr/src/alloc.c Be sure to change the Minix version number in /usr/include/minix/config.h every time you make a change. Then you can be sure that you are running your updated version.
To build a new version of Minix on the floppy drive:
When the make program will asks which floppy drive to use, just press enter to accept the default. This will write the kernel of the operating system to a diskette. After shutting down the system, you can boot the diskette from the boot monitor. Programming mistakes are not likely to be subtle. If you make an error in the memory allocation code, the system will probably crash while booting. If you can run a few programs, your memory allocation algorithm is probably working. If the system crashes, you can remove the floppy with the faulty operating system and boot the original system.
This assignment is due on Monday, February 24, 2003 at the beginning of class.
Email a copy of your source code to your instructor at email@example.com. Please be sure to include the machine number and partition number of the computer in the Graham Hall room 8 lab where your algorithm is implemented.
You may find it advantageous to implement the mtools program on your Minix system. Documentation on implementing mtools can be found at http://williams.comp.ncat.edu/mtoolsDoc.htm This program will allow you to read and write DOS or Windows formatted diskettes from Minix.
If you want to edit and test compile your version of alloc.c on a Unix or Windows platform, you can use the dummy mm.h header file from http://williams.comp.ncat.edu/comp450/HW/mm.h You must comment out the #include <minix/com.h> for testing. (Remember to uncomment it on Minix!)