On Sat, Jul 14, 2001 at 09:40:59AM +0200, Rivium wrote:
> But my Main Goal is to speed things -really- up. So i was talking about
> segment of shared memory, on the same machine
> (I love the current Memory prices!)
Shared memory has major problems. Consider the fact that you can't
store any pointers in shared memory nor can you expand the memory once
you have allocated it (with most implementations AFAIK). The reason
that you can't use pointers is that users of the shmem will *not*
receive the memory at the same location in each process. So, about
the only thing you can store is raw text or arrays of known size in
shared memory (like the scoreboard which isn't that big and has known
size at compile-time).
IMHO, you're better off using true IPC mechanisms - especially when
you are concerned about scalability (as you seem to be). Shared
memory doesn't scale. If I'm wrong, please correct me. =) In
your scenario, mmap() *may* provide a better alternative and remains
file-based, and will be significantly faster than plain read()/write()
(as long as you don't run out of address space). -- justin