Message Passing Tutorial: Difference between revisions

m
[unchecked revision][unchecked revision]
Line 113:
Most OS use some primitive messaging to implement more sophisticated IPC like [[pipe]]s or [[socket]]s. Reading and writing from [[file]]s is also worked out by sending messages between the vfs process and the disk driver.
==Pitfalls==
This may seem to be easy, but don't forget it's only a tutorial. In the real world, you'll have to work a lot before your messaging code can became useful. Some ideassuggestions:
* check ifthe receiver isactually truly wantwants to receive from the sender.
* always check for loops: process A waiting for B to send, C waiting for A. Now it would be a disaster if B also waits for C.
* you should implement an alarm for sending. If delivering fails within a timeout, you should check the reasonsreason(s), and maybe resendingresend.
* you should have an unique id in every message to detect retransmission.
* normally userspace applications never have to receive messages without sending an acknowledge. So it's a good idea to tie asynchronous messaging to a capability flag or something similar.
* you should have a matrix of process ids recording who is allowed to send messagemessages to who. An application should never send messagemessages to a driver process directly (only through a library or system call).
 
==See Also==
 
Anonymous user