On Sun, 30 Jul 2000, Travis Bemann wrote: > > I've been thinking about using shared circular buffers for IPC in > nfreenetd (which is a multiprocess Freenet node daemon for Unix/Linux > written in C) instead of pipes (which I previously decided to use). > The advantages of using this technique is that it would have *very > little* overhead (you don't have to go through the Unix/Linux kernel > at all), but it has the severe disadvantage of being very difficult to > debug. Do you think that the advantages of this are worth it, or am I > crazy to do something like this? Note that I've already thought out > all the semantics and signaling necessary for this.
You aren't crazy. This is a standard technique for high-performance IPC. Among the desireable properties of ringbuffers as IPC primitives is the fact that no other synchronizing primitive is required: you can write the code in such a way that neither the transmitting nor the receiving end requires a semaphore/monitor/whatever. The ringbuffer is itself a synchronizing primitive. The bottom line is: you don't need any special synchronization. You do need to be able to sleep when your ringbuffer is full (on the transmit side) or empty (on the receive side), and to be woken up by activity on the other side. -- Daniel _______________________________________________ Freenet-dev mailing list Freenet-dev at lists.sourceforge.net http://lists.sourceforge.net/mailman/listinfo/freenet-dev
