If you have a minimal microkernel, which just passes messages between user level processes, then you can probably have a single kernel stack, which just switches between user contexts. Basically, a send message system call would become:Lagor wrote:It took me a few answers from you kind people but I feel I'm getting it now.
Two more questions, is it mandatory to setup a kernel stack for each user process? I think I've heard the some os don't do this but I might be wrong.
If I choose (or have) to have a kernel stack for every user process, does this mean that I need to manage a ESP0 value for each process it its TCB and then update accordingly the value in the only TSS that my system has? If this is the case, I have a few issues picturing the situation in my mind but I'll deal with that later...
Cheers,
F
- Client calls send message system call - switch to kernel mode
- Kernel, on kernel stack, copies message from client user context
- Kernel, on same kernel stack, switches to the server context
- Kernel, delivers message to the server, which has previously executed get message call to get the next message
- Server returns from get message system call, does the work, then sends the message back, repeating the above steps.
You can also do lightweight concurrency on a single stack using something like protothreads, as used in the contiki OS. But I think that's more aimed at memory constrained systems where multiple kernel stacks is not practical.