[MUD-Dev] Re: Multi-threaded mudding (was a flamefest)

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Fri May 2 19:08:12 New Zealand Standard Time 1997


[Jon L:]
:If OS multi-threading is superior to software time-slicing on your platform
:then it would follow, that a multi-threaded event-driven server would
:outperform a single-threaded event-driven server regardless of 
:how many CPUs your processor has.

I don't see that. The advantage that multiple threads have over multiple
processes is that switching between OS-supported threads takes less CPU
work than switching between full processes. That distinction doesn't
exist if you are running only within one OS thread. In fact, it might
even be the other way - the thread switching you do within one process
costs more than just subroutine calls, as done without threads. Using
threads within one process *can* be beneficial in terms of structuring
(I did that in our user agent program at work, and it would have been
much more painful without the threads), but it is going to cost more
memory (stacks for the threads), and likely more CPU as well. If you
can use OS threads, I'd say do it - you never know when someone is going
to be able to run your system on a big multi-CPU machine.

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the MUD-Dev mailing list