Message Handling Model
Posted: Thu Aug 24, 2006 8:21 am
I am thinking of making my operating system message-based, but I am worried that I missunderstood the term Message-based. When I became a programmer I was programing software for the infamous windows platform so I was fairly familiar with the Win32 API so when I designed my message handling model I based it off of the Win32 API getMessage(); dispatchMessage(); and CALLBACK WndProc(){} functions.
In Windows the getMessage() function gets the message and returns a 1 when successful, a 0 when WM_QUIT is sent, and -1 when unsuccessful (even though getMessage's return data type is BOOL).
The despatchMessage(); calls the WndProc() function and processes the message.
The following is my message handling model for AOS:
The kernel, when loaded, sends a message saying that it has loaded, then it goes to a while loop:
when MSG_SHUTDOWN is sent the checkMsg() will return a 0 and the kernel will go through a shutdown process. Otherwise it will return a 1 and the procMsg() will process the message.
My questions are:
Is this a bad model for an operating system (I did model it off an API)?
My goal is to make my OS multitasking, is this model disadvantageous for multitasking?
Thanks,
Kenneth
In Windows the getMessage() function gets the message and returns a 1 when successful, a 0 when WM_QUIT is sent, and -1 when unsuccessful (even though getMessage's return data type is BOOL).
The despatchMessage(); calls the WndProc() function and processes the message.
The following is my message handling model for AOS:
The kernel, when loaded, sends a message saying that it has loaded, then it goes to a while loop:
Code: Select all
while(checkMsg()!=0) {
procMsg();
}
My questions are:
Is this a bad model for an operating system (I did model it off an API)?
My goal is to make my OS multitasking, is this model disadvantageous for multitasking?
Thanks,
Kenneth