On 16 Jun 2000, at 21:11, Adrian Chadd <adrian@creative.net.au> wrote:
> Ok. As I said before, lets go with seperate processes using SYSVSHM to
> communicate. I've been thinking about it a bit and if we do this right,
> porting it to a threaded setup later shouldn't be that difficult, as
> you pointed out.
just wondering, some OS'es implement sysvshm by using mmap. wonder if
mmap is more portable and/or may give any added possibilities.
> If you have one network IO process per CPU to get SMP performance,
> you still need :
>
> * a common way of accessing statistics
..
> sure about the mechanism to do this. If we put the stats inside a SHM
> segment, don't we have to wrap access with semaphores? I'm not entirely
> sure whether var++; is atomic enough here to not need a semaphore so
> someone clueful please give me some guidance here.
Its not atomic. Reserve a stats struct per thread to avoid write contention.
If reading for stats can tolerate inconsistencies, then you can do without
any locks, otherwise you'd need reader-writer locks.
------------------------------------
Andres Kroonmaa <andre@online.ee>
Network Development Manager
Delfi Online
Tel: 6501 731, Fax: 6501 708
Pärnu mnt. 158, Tallinn,
11317 Estonia
Received on Fri Jun 16 2000 - 11:20:30 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:30 MST