-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12 Aug 2008, at 4:13 am, Ivan Raikov wrote:
Guys, I am glad to see that old flame wars never die ;-) Pipes used to be slow back in the day, around the time when forking and context switching was slow. Nowadays, modern kernels rely extensively on zero-copy techniques, and I am pretty sure that Linux has had zero-copy pipes since at least the 2.4 series. Passing data between threads may be as simple as an assignment, but it almost never is. In practice, you always end up having some complicated synchronization protocol. Why not let the OS handle that for you?
For comparison, a project I worked on a while ago (closed-source, alas) was a fast inter-process communications system that involved all participating processes sharing a memory segment (folks, forget shmget(); everyone mmap() the same file is where it's at these days, not least because you can then hexdump -C the file to see what's going on, preserve it across reboots, more portable OS support, etc) in which a specialist memory manager controls a heap, and the system provides a namespace of caches, FIFOs, and LIFOs. So you can either allocate a shared memory object and serialise stuff into it, or allocate your stuff in a shared memory object in the first place, then use a FIFO or a LIFO to pass it to a server process as a message - or store things in the caches. It's *almost* all implemented in a lock-free manner (using cmpxchg8b and friends on x86, and ll/sc instructions on sparc); there are a couple of locks that the heap manager uses occasionally (but not in the 'main line' of allocations and deallocations), so processes can communicate without *any* syscalls using it. The speed advantages of shared memory *can* coexist with the safe-by- default nature of independent processes.
-Ivan
ABS - -- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/?author=4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkihWCYACgkQRgz/WHNxCGqw1ACfZDaqd2j99Ii5gPy5PYB1Bx15 KmgAnAnenoxCRvW64tcJG7GMUE7XxQBr =XXkR -----END PGP SIGNATURE----- _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
