[MUD-Dev] Introduction

clawrenc at cup.hp.com clawrenc at cup.hp.com
Mon May 12 11:04:26 CEST 1997


In <fxcg1vtmmfx.fsf at phantasm.thekeep.org>, on 05/11/97 
   at 08:26 PM, Dan Root <dar at thekeep.org> said:

>Ling <K.L.Lo-94 at student.lut.ac.uk> writes:

>The other two code bases I was primarily interested in (UnterMUD and
>UberMUD) were quite small as well, with most of the features I
>wanted, but with quirky coding (MJR's code is beautiful... if you can
>understand it) that made modifaction hard.

You bet.  Marcus Ranum's code is flat out gorgeous and damned
efficient.  Its a shame he dropped out of the field.

>(FWIW, someone mentioned that process context switching was
>expensive.  This is true, but your server is going to be switched out
>anyways, as it's unlikely that nothing else is running on the machine
>at all.)

Context switching is cheap if it does not become a significant part of
your total process expense (obviously).  Run a single process, or even
just a couple/few processes and is stays cheap.  Start running one
process for every connection or something else equally silly and of a
sudden context switches start becoming a major fraction of the total
expense of running your system.

Wanna try something?

Write a little program (shell script will do fine) that does nothing
but print out numbers and delay a couple seconds every now and then. 
Run a couple copies.  They'll run very nicely and very rapidly,  The
price of context switching between the simultaneously executing copies
is small.  Watch your CPU utilisation and it should stay quite low.

Now start up 300 instances of this little trivial program and watch
your system crawl into the drain.  Why?  The price of context
switching between your programs suddenly became a significant
percentage of the total work your CPU was doing.  (Graciously ignoring
swap, RAM etc aspects that also chime in here).

--
J C Lawrence                           Internet: claw at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the mud-dev-archive mailing list