Hi,
I'm not a Menuet developer, just an intruder/observer, but I think you may want to at least consider what I have to say....
Basically, as far as I can tell, the existing MenuetOS kernel is crap. It has design flaws that will need to be fixed before MenuetOS can become anything more than a hobby/toy OS.
I'll list the design flaws I've found (and the alternatives), so that you can see what I'm talking about and make an informed decision.
Before I start I should point out that these observations are derived from the latest 32 bit kernel source code taken from sourceforge (the "kernel source" link at
http://www.menuetos.org/download.html). I haven't looked at the Russian version (Kolibri).
Also, I haven't studied this source code for a long time - I may have missed things, I may be wrong (I am human). If you think I am wrong, please double check and reply. Of course it's also likely that I've missed other design flaws, so if anyone has anything to add...
THE SCHEDULER
As far as I can tell, the scheduler is a simple round-robin scheduler without wait states or task priorities.
No wait states means that if there's 100 tasks that are waiting for something and only one that needs the CPU, then all 100 tasks waste CPU time with polling. Normally, if a task needs to wait for something it sets a flag and the scheduler never switches to that task until the flag is cleared. For example, most OS's have a "sleep()" function where the task is placed on a timer queue and it's "waiting for timer" scheduler flag is set. Sooner or later (when the time expires) the timer IRQ handler will remove the task from the sleep queue and clear this flag to wake the task up when the time is right.
For task priorities, one example is if the user is typing a text document while the computer is doing heavy processing. Normally, the text editor's task would be given a higher priority than the task doing heavy processing, so that the OS doesn't become "unresponsive".
The way it uses hardware task switching would also limit the OS to less than 8190 tasks. This isn't so great. For example the Linux kernel has no fixed limit - it will run over 4 billion processes (if memory doesn't run out first, which is the real limit).
THE IPC
The IPC system is mostly broken due to the scheduler's problems. Consider this code (cut & pasted from "KERNEL.ASM"):
sys_waitforevent:
call get_event_for_app
test eax,eax
jne eventoccur
newwait:
call change_task
call get_event_for_app
test eax,eax
je newwait
eventoccur:
mov [esp+36],eax
ret
While a task is waiting for an event, the CPU is constantly switching to that task, checking for an event and then switching to the next task. This is one of the ways scheduler wait states are used. Instead of the polling above, this function should set a "waiting for event" scheduler flag so that the task does not get any CPU time until an event arrives. Normally (for a scheduler that supports task priorities), when the "waiting for event" scheduler flag is cleared the kernel checks if the currently running task has a lower priority than the task that received the event, and immediately does a task switch to the task that received the event if it has a higher priority.
This means that (for example), as soon as the user presses a key the keyboard IRQ handler sends an event, and this event causes the receiver of the keypress to get CPU time immediately. For the current kernel, the user may have to wait for the currently running task to finish it's time slice and for all other tasks to finish their time slices before the receiver of the keypress gets any CPU time. This could be a long long time if there's a lot of tasks doing heavy processing, and in general makes the GUI look like crap.
MEMORY MANAGER
To be honest, I couldn't find it. It looks like it's spread all over the place, doesn't support paging well (if at all), and doesn't even ask the BIOS which areas can be safely used as RAM (does it still ask the user????). Adding support for memory mapped files, allocation on demand or even swap space will be a nightmare.
KERNEL API
For most OSs there's an API entry point (a software interrupt, call gate, SYSCALL and/or SYSENTER) that does a "call
", where the selected function executes and then returns to the caller.
I must have missed something here, but it looks like the kernel API is tied in with the scheduler somehow. When a task calls the kernel API it sticks some values somewhere and ends it's time slice, and the kernel searches for a new task to run and then, when the calling task gets CPU time again the kernel function is called. This would result in a huge number of unnecessary (and slow) task switches for a lot of simple kernel API functions.
This is entirely insane (which is why I'm assuming that I missed something - there's no other explanation).
SOURCE CODE
This is a joke. There's barely any comments, there's no structure and there's no documentation. For example, while trying to find the memory manager (and giving up) I was wading though sound card initialization code and video code. What the <insert expletive here> is this doing in "KERNEL.ASM"? Wouldn't it make sense to have one file for everything to do with the scheduler, one file for everything to do with memory management, on file for video code, etc? The other thing is the lack of documentation - this has nothing to do with the source code files themselves, but should be a seperate set of files (perhaps in HTML) that describe how things are meant to work.
The chance of anyone maintaining this mess for an extended period of time is close to none (especially if your brave enough to modify it or add features to it).
CONCLUSION
Do you really want to spend years developing an OS with this kernel as your foundation? My advice (unless the Russian version "Kolibri" fixes ALL of this) is to dump it fast and either rewrite the kernel completely or start with a good kernel from anywhere else.
Cheers,
Brendan