[Home] [Groups] - Message: [Prev in Group] [Next in Group]
10215: Re: [MUD-Dev] Multi-threaded mud server.
[Full Header] [Plain Text]
From: "Jon A. Lambert" <jlsysinc@ix.netcom.com>
Newsgroups: nu.kanga.list.mud-dev
Date: Wed, 19 May 1999 08:15:05 -5
References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] <-newest
Organization: Kanga.Nu
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@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@kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev