[MUD-Dev] Multi-threaded mud server.

Jon A. Lambert jlsysinc at ix.netcom.com
Wed May 19 08:15:05 CEST 1999


On 17 May 99,, Jo Dillon wrote:
> 
>   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?
> 

Any pre-emptive multi-tasking operating system will do a context switch 
between processes/threads every couple dozen micro-seconds or so.  That's 
the nature of the beast.  Either the process/thread runs out of time or 
goes into a wait.  At any given time an OS has dozens of ripe 
processes/threads waiting for execution, even if it's lightly loaded.  So 
even a single-threaded server will be context-switched by the OS hundreds 
or thousands of times every half hour.  So, I let my operating system 
worry about processor cache, and I let it worry about picking which 
processor to use.  I tune the operating system to use the hardware 
efficiently, and I tune the application to use the operating system 
efficiently.

--
--*     Jon A. Lambert - TychoMUD Email:jlsysinc at ix.netcom.com             *--
--*     Mud Server Developer's Page <http://pw1.netcom.com/~jlsysinc>      *--
--* To fight the empire is to be infected by its derangement. Whosoever    *--
--* defeats part of the empire becomes the empire; it proliferates like a  *--
--* a virus... thereby it becomes its enemies." -- P.K. Dick               *--


_______________________________________________
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