[MUD-Dev] Re: TECH: Distributed Muds

Chris Gray cg at ami-cg.GraySage.COM
Fri Apr 27 20:28:36 New Zealand Standard Time 2001

> From: J C Lawrence <claw at 2wire.com>

> There are three FIFOs (in, out, heap), so there are three mutexes.
> I handle these with counting semaphores.

OK, I grok. If you have a limit on the number of FIFO entries, or you
can handle the producer blocking, you can get rid of the mutexes using
the usual circular buffers, where the producer tests against the head
pointer and updates the tail pointer, and the consumer tests against
the tail pointer and updates the head pointer. I've used this sort of
thing in SMP environments, and its quite safe. You do have a limit on
the number of slots in your circular buffer, however.

Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg at ami-cg.GraySage.COM
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list