;D In fact I'm glad that I thought about it at all!Colonel Kernel wrote: LOL... isn't that the first question you should be asking, before all the implementation details?
I had a similar discussion with Legend some time ago - I was not yet able to decide. From the functional point of view, a sendAndWaitForReply() action would be quite the same as a remote procedure call with migration - as long as you manage to transfer priority attributes along with the message. That's what I wanted to address with my post about 'thread slots' and 'thread schedules' above (far above). You could see a thread as a stack, that holds local data and the call history, which is only valid within one address space - but you could also see it from a higher level perspective, as a an entry in the scheduler's queue, that gets a timeslice and runs code - independent from the address space (the scheduler doesn't need to know about this).Colonel Kernel wrote: ... -- what's the difference between this scheme, and an OS that uses synchronous IPC with priority inheritance?
But maybe it's better to stick with the traditional (L4-style) messaging system, enhance it with priority inheritance, and build the higher level construct 'the thread schedule' on top of this. I'll think about it.
@Crazed123: To be honest - I always thought about thread migration to be accomplished in a 'call'-style. That means:
A thread from context "Hugo" wants to call a procedure in context "Oscar". The thread then migrates to "Oscar", but its full stack and data in "Hugo" is still preserved. When the procedure is finished, it returns from "Oscar", all the stack in "Oscar" is disposed, and the thread returns to "Hugo" again, where it gets it old stack back.
What you propose here - let the thread permanently stay in context "Oscar" - would mean a 'jump'-style migration. I honestly don't think that this is needed that often, I would implement it on top of the above, 'call'-style, migration scheme. Instead of returning, the migrated thread would do a system call that tells the system explicitly to remove all the stack and data in context "Hugo", as well as the return information, since it doesn't want to return.
But you could also implement this scheme on top of messaging, like Colonel Kernel proposed. The server thread, who received the message, could do a system call, that lets the system destroy the client thread - while it is still in blocked state.
Anyway, thx for the replies!
cheers Joe