[MUD-Dev] Multi-threaded mud server.

Ross Nicoll rnicoll at lostics.demon.co.uk
Sun May 16 20:42:02 CEST 1999


A friend and I are trying to write a new mud server in C++, mostly as a
learning excercise. We would like to make it multi-threaded, and I've hit
a few problems/questions. The design is this:

The MUD creates as many threads as processors, and then allocates players
and computer characters in such a way that load on each processor should
be roughly equal. This should keep context switching to a minimum.

The database is a binary search tree of objects, where each object can
have various attributes set on it.

Now, the tricky bit is making sure that the database is not being modified
and read from at the same time (modifying the tree during a read could be
seriously bad), and also that any particular object is not being modified
and read from at the same time.

Semaphores were the original plan, but as I understand it, this would
require a new semaphore for each object. As we're looking at 10,000+
objects, that's a _lot_ of semaphores.

The only other idea I've had is making the original process act as a
database server, which the threads can send read/write requests to. It
isn't quite as tidy as semaphores, but might work better.

I'm wondering how everyone else does this?



_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev




More information about the mud-dev-archive mailing list