[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Re: An alternative thread system?
From: |
Alaric Snell-Pym |
Subject: |
Re: [Chicken-users] Re: An alternative thread system? |
Date: |
Tue, 12 Aug 2008 10:30:14 +0100 |
-----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-----
- Re: [Chicken-users] Re: An alternative thread system?, (continued)
- Re: [Chicken-users] Re: An alternative thread system?, Elf, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, john, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Aleksej Saushev, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Elf, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Shawn Rutledge, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Elf, 2008/08/11
- [Chicken-users] Re: An alternative thread system?, Aleksej Saushev, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Elf, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Shawn Rutledge, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Ivan Raikov, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?,
Alaric Snell-Pym <=
- Re: [Chicken-users] Re: An alternative thread system?, Aleksej Saushev, 2008/08/13
- Re: [Chicken-users] Re: An alternative thread system?, Alaric Snell-Pym, 2008/08/13
- Re: [Chicken-users] Re: An alternative thread system?, Ivan Raikov, 2008/08/13
- Re: [Chicken-users] Re: An alternative thread system?, Aleksej Saushev, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, John Cowan, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Elf, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, Alaric Snell-Pym, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, F. Wittenberger, 2008/08/11
- Re: [Chicken-users] Re: An alternative thread system?, F. Wittenberger, 2008/08/11