[MUD-Dev] Multi-threaded mud server.
Travis S. Casey
efindel at io.com
Tue May 18 14:34:12 CEST 1999
On Mon, 17 May 1999, Jo Dillon wrote:
> Jon A. Lambert (jlsysinc at ix.netcom.com) spake thusly:
> > There exists a 400 mhz Pentium II single-processor with 64 Mb of memory
> > running Redhat Linux. Running on the server is ftpd, httpd, telnetd,
> > smptd, dns, a stock Diku mud server, a DGD LP mud server, and a ColdMUD
> > server. The server is probably underloaded.
> >
> > Is there context switching going on here? YES! Loads and loads of the
> > "expensive" process-level context switching.
> >
> > <rant>
> > Now suppose I wish to redesign and multi-thread that Diku mud server.
> > Why would I WORRY about the overhead of "cheaper" thread-level context
> > switching?
> > Why should I CARE at the application-level how many processors are
> > present on the friggin box!?!@#!??
> > </rant>
>
> Isn't the point that every time you context switch you invalidate the
> cache (since the new thread of execution will be in a different chunk of
> memory to the old one), and therefore if you have more threads than
> processors you context-switch <bignum> times a second, therefore constantly
> invalidating your cache and giving yourself a big speed hit?
Watch out for that term "the cache." Systems and OS's have many different
caches and things that can be considered caches.
In this case, there are two caches that are likely to be invalidated --
the TLB and the processor's instruction cache. However, how much of an
impact this will have depends on what your machine's memory access time is
relative to the CPU speed (which may depend on what other caches there
are) and the amount of time you spend in each thread.
It also depends on the design of the processor -- some processors have
multiple sets of registers to help with context switching. I don't know
off-hand if any have multiple instruction caches and/or TLBs, but I don't
see any reason why those wouldn't be possible.
In practical terms, the speed hit may not be very big, especially
considering that most muds are going to spend a lot of their time waiting
on the network. Ultimately, though, the only way you can really know what
effect it will have on a given machine is to try it and see.
--
|\ _,,,---,,_ Travis S. Casey <efindel at io.com>
ZZzz /,`.-'`' -. ;-;;,_ No one agrees with me. Not even me.
|,4- ) )-,_..;\ ( `'-'
'---''(_/--' `-'\_)
_______________________________________________
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