[MUD-Dev] Multithreaded sockets
Mon Jun 3 11:34:57 New Zealand Standard Time 2002
From: "Draymoor a Vin il'Rogina" <draymoor at cloud9.net>
> I was looking through the archives and came across a post in which
> it was suggested that a thread for game logic and a thread for
> descriptor input would be ideal, on a dual processor machine. Right
> now, I have a thread for each descriptor to recieve input from
> blocking sockets, a thread to accept new descriptors and parse
> input, and a thread for the game logic. I'm running on a single
> processor machine, though hopefully soon it'll be a double
> processor. Is having this many threads a bad idea?
Too many threads = too many context switches under heavy load.
Under light load the blocked socket's thread should enter a fairly
efficient wait-state, but under active load with lots of threads
you're going to lose a good deal of processor time just in context
How big are you planning to go? If you're under, say, 500 users
with medium load you're probably be okay, but you'll notice it. If
you're aiming for 1k+, or 500+ fairly intense users you may
reconsider it. (Assuming P3-500s)
Context switches are small, but they do add up. Dual-proc systems
help a lot though.
Pricewatch has Xeon chips for ~255 for a 2.0G. Intel's got a couple
low-end mobos around 500, so for ~2k you could build up a quad-2Gig.
If you're really hardcore, look into hyperthreading, or running on a
cluster using virtual machines.
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev