[MUD-Dev] Multithreaded sockets

Dave Richards dave at synergy.org
Thu Jun 6 09:31:10 New Zealand Standard Time 2002

bruce at cubik.org wrote:

> Just get something that works and doesn't suck too much.  Use a
> single thread for networking, use select() or poll(), and move
> along and worry about networking again later when you have 800 or
> 1000 people logging in at once.  Plain old boring select() will
> work just fine with 500 users.

Bruce has some very good advice here.

Some points to remember:

  1. Multi-threading provides two benefits (a) the ability to
  utilize processor resources more effectively, and (b) programmer
  convenience (which is sometimes illusory).

  2. The most efficient application keeps the number of threads
  slightly larger than the number of processors.

  3. As the number of threads increase, the total efficiency goes
  down (as measured by the number of prccessor cycles executed), but
  is offset by the parallelism inherent in multi-processor systems.

  4. You quickly find the game engine becomes your bottleneck

I agree with Bruce.  One thread for the game engine and one thread for
communication will take you a long way.


MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list