Minix on Bochs users anyone?

suryad

Veteran
Hi I just started using Minix for my OS class at the university. Wondering if there were any Minix users as the title states. A little background info for the uninitiated...Minix is another OS but its a very good little tool to learn Kernel programming on. Was the base kernel Linus used to base Linux off of. Since I have XP on my laptop and I decided it was too much hassle to install the OS for just one quarter I downloaded bochs which is an x86 emulator and so that I can run Minix on top of bochs without having had to partition or reformat etc etc etc my hard drive. So if there were any members familiar to this setup, I would like to pose a question. Have any one of you been able to enable networking on Minix and if anyone of you figured out how to increase the size of the Minix window that bochs opens. I tried to configure bochs but it didnt seem like there were any options. See the Minix command line opens up in a new window (duh) but its very small and since most of the kernel code files are rather long it becomes a massive pain in the rear to be having to scroll constantly to get access to the code. Thanks a lot for any suggestions or input. Cheers :D
 
If your school is part of the MS academic alliance, I think you can get a free copy of Virtual PC, which might be substaintially better for you.
 
Hey thanks for the reply. I will take a look in to what you suggested. It is quiet probable that they prob have the alliance that you mentioned of. Problem is that my TAs have been using bochs and so I have to make sure whatever changes I make in the kernel on Minix running on Virtual PC will have to run fine on Minix running on bochs. Dont think that should be a prblem though since I am modding the kernel regardless of the underlying layers. I am looking forward to this class but our first assignment seems tough though. Thanks a lot for the reply. Cheers
 
Well basically the idea is that we have to get to know the task scheduler and thread priority management system in the OS really well. what the prof would like us to do in a nutshell is to modify the Minix kernel such that the users can set different priority levels to different user processes. There are 3 different kinds of processes and so that we dont crash the system for now we are to only mod the user level threads. Values for the priority levels range between 0 - 255 with 0 being highest priority. I hope that answers your question :D
 
Ah that's neat. So in Minix you have three levels for process, taking a guess here, user, kernel and realtime?

Fun stuff, that's a fair number of priority queues. I never quite liked the idea of having such a huge priority range, but I'm hardly an expert in scheduling so what the hell do I know?

What sort of scheduling discplne are you trying/supposed to have?

I'm trying my hand at this stuff, personally, so this stuff is really interesting to me at the moment.
 
Sorry for being out of the loop there Saem. See I have no idea as of yet what kind of scheduling discipline I am going to have to implement. I have been busy writing microcode and desginging a CPU for my architecture class. And yes you are right about the 3 different processes, kernel, user and the server process. So the basic idea is that the kernel process is something you dont want to mess with that. Then since Minix is a microkernel, most of the systems like memory management and file management, all those modules are pushed outside the kernel and those processes are known as the server processes. And then on top of that are the user processes. So whenever the user process makes a system call something known as a trap takes place which is sort of an interrupt to the kernel and then the kernel processes the request and so on and so forth. Yes this stuff, kernel hacking, I mean is very interesting. I am enjoying it very much but as of yet I have given no though to the on the fly changing of process priorities. Havent had the time yet hahaha :rolleyes: :oops:
 
Wondering if anybody had any ideas on how to start..just chitchat about the general idea of how to implement thread priority on the fly.
 
Thread priority on the fly? Do you mean dynamic priorities?

The simplest way would be to have a new thread start at the max priority possible, then each time it runs drop it's priority by one. Give the lower priority threads larger quantas (multiples of a base unit). THe latter increase can be linear or quadratic.

Starvation is rare with the above, but if you really wanna be careful, you might wanna also have threads which have been at a low priority get bumped up again.

You can get really creative, by raising the priority whenever a thread blocks for IO and drop the priority if it runs out of its timeslice. Windows does this but goes further for interactive I/O (KB/Mouse and so on).
 
For future reference, what Saem is referring to (correct me if I'm wrong) is a multilevel feedback queue. My first OS class required me to implement this as a scheduling algorithm (though not in Minix). It worked rather well and the implementation details were relatively painless. FWIW, something like this doesn't seem like what the professor is asking for. This seems a bit overkill, but being a hopeless geek, I'd do it anyway.

pabst.
 
I'm not sure about the name you're using. I've seen them being called simply feedback scheduler and far more exhausting names. ;)

Though, a feedback algorithm would have to be multi-level, since, AFAIK, every priority level has it's own queue, so that might be redundant/expected. Otherwise, feedback is useless.
 
Saem I see what you are saying and thanks for the inputs you guys. Thats a very efficient way of dealing with threads. But there are a few caveats. The professor wants the priority level to range from 0-255 with 0 being highest and 255 lowest and the default being 127. Also the user can get to set the priority of the threads in question. I guess what is going to happen is that the priority scheduling will be only in the user process level so that even if we run the process at priority 0 then it wont interfere with the Minix kernel level processes and stuff. What I was thinking of doing and this is just giving 5 minutes thought till date because of my other classes is to put into the process queue the higher priority processes first and that way they get to be executed first in comparison to the lower priority processes. I dont think that the processes will be asked to execute some very complex calculations or anything of the sort hence starvation and aging might not be required to implement. I think our TAs will write up some code that will create random processes with random priority levels and have them print a certain output to the screen and if that matches with our output then we are golden. So nothing computationally intensive is being done by the processes. However though my idea will not be an efficient one at all in terms of real world scenarios and I believe that is where Saem's implementation comes in. But I would go more towards a round-robin approach with threads of higher priority getting larger time quanta from the processor...if that makes sense. Thanks for all the input once again
 
First off, the starting priority. That doesn't really matter. You can start at any point and if you upgrade on IO, then you're okay. If the user sets the priority, either keep it set or give each thread a "default" priority. This will be the user assigned one otherwise it can go as high or low as you like. If you want, if default priority is anything but 127 then simply stay withing range of it [+0,-x] or some other range, find out from your prof, what he wants there. Chances are he doesn't care as long as it's "reasonable".

A round robin scheme with variable size quanta relative to a processes priority should work out fine, though it will hiccup on very intensive processes.
 
I was talking to another professor about the whole project and he said the implementation is very similar to the implementation of the nice command which is present in Unix operating systems I believe. He pretty much said that nice allows the user to run processes in the background. And that there is an option as a superuser to do a negative nice and actually increase the process priority on the fly. So that is basicaly what we are attempting to do. Compiling the Minix kernel is a pain though because it takes an impressive amount of time. I think the source code is around 50 mb and so after tweaking the files and writing some code and then recompiling the entire kernel to see if it works repeatedly, will be the most time consuming part. Takes around 2.5 minutes on my 3.4 ghz Inspiron XPS. I think it is attributable mostly to the bochs emulator that we are using to run minix off of. There is another one out called qemu which is apparently 67 times faster than the bochs implementation of the x86 architecture ut the windows version is right now in alpha stage so I am hesitant of using it. Would speed up development time greatly me thinks but oh well. Anyway I am gonna start on the project tomorrow and so I will post once in a while and let you guys know what I am doing and how i am doing! :D Thanks for the responses by the way.
 
Back
Top