I'm a little bit stuck on design & implementing my message passing ipc. Currently I've got
* send(): Send a message to a specific process
* peek(): get one of the messages send to the process. If there is none return with errorcode
* get(): Same as peek, but get() is blocking if there is no message available
* next on the agenda: waitOnMsg(), which waits for a specific message
syscalls. I have to mention, that I want a microkernel and I want it to support multithreading (which it already does). So my e.g. virtual filesystem will be a server. The requests to and the replies from these servers are messages. So e.g. opening a file would go like this (only schematic, C++ code):
Code: Select all
/* Send OPEN_FILE message to the vfs server */
sendMsg(VFS_SERVER, OPEN_FILE);
unsigned long handle;
/* Wait for the reply from the vfs server and get the handle */
waitOnMsg(VFS_SERVER, OPEN_FILE, handle);
Code: Select all
unsigned long pid;
unsigned long id
unsigned long param1;
/* Waiting for any message */
while(getMsg(pid, id, param1))
{
switch(id)
{
case GUI_DRAW_WINDOW:
/*Do whatever you do*/
break;
}
}
So, what I wanted to ask now: How do/did you design your message passing in a microkernel, so that no thread could take away the messages, which were meant for another thread?


