IPC - messageQueues and shared memory
Posted: Fri Mar 24, 2006 6:56 pm
I'm currently looking into an IPC method for a microkernel based OS.
All processes, drivers, etc, are running in userspace and mapped to the same linear address (0x0).
I would absolutely love it if userProcessA could send a message to userProcessB without actually envoking a context switch/swap to supervisor mode to facilitate delivery of the message.
One method to do this, I thought, would be to use shared memory. Message queues would be mapped into every processes memory space and so userspace code could perform the messageQueue receive/send and the OS would only need to be envoked if a receive was called on an empty queue (or, potentially, on a send to a full queue).
I can see a couple problems to this approach, right off the bat:
1. any user app can access (and potentially overwrite and destroy) every message queue.
2. a special area of memory must be devoted to each apps linear address space, whether it uses IPC or not (takes away from memory the app could otherwise use).
I'd like to know, however, if there are more blantant holes to this approach, and if there are suggests on how to overcome these limitations?
Is it even feasable to try to make a fully userspace IPC solution?
I suppose the queue could be specifically mapped only into the address spaces that are interested in it. This would require each app to manually map it into their space via some shared memory Id, I would imagine.
Any ideas on this would be greatly appreciated.
--Jeff
All processes, drivers, etc, are running in userspace and mapped to the same linear address (0x0).
I would absolutely love it if userProcessA could send a message to userProcessB without actually envoking a context switch/swap to supervisor mode to facilitate delivery of the message.
One method to do this, I thought, would be to use shared memory. Message queues would be mapped into every processes memory space and so userspace code could perform the messageQueue receive/send and the OS would only need to be envoked if a receive was called on an empty queue (or, potentially, on a send to a full queue).
I can see a couple problems to this approach, right off the bat:
1. any user app can access (and potentially overwrite and destroy) every message queue.
2. a special area of memory must be devoted to each apps linear address space, whether it uses IPC or not (takes away from memory the app could otherwise use).
I'd like to know, however, if there are more blantant holes to this approach, and if there are suggests on how to overcome these limitations?
Is it even feasable to try to make a fully userspace IPC solution?
I suppose the queue could be specifically mapped only into the address spaces that are interested in it. This would require each app to manually map it into their space via some shared memory Id, I would imagine.
Any ideas on this would be greatly appreciated.
--Jeff