[DGD] Multi Threading

Felix A. Croes felix at dworkin.nl
Sun May 11 00:33:05 CEST 2003


"Ben Chambers" <bjchamb at bellsouth.net> wrote:

> When the multi-threaded version is released, how exactly will it deal with
> multithreading?  Will it be possible to create a message queue and set a
> thread to iterate over that and do some processing?  What about setting a
> thread to listen for connections to a webserver and run a webserver
> independently of the the main thread.  Will these types of things be
> handleable?

A "thread" in LPC (thread is not a very good description of what it is,
actually) runs only for a <very> short time, and never concurrently
with another thread.  There is no such thing as a main thread.  Instead,
the normal running of the server consists of many brief threads running
in sequence.

DGD/MP will be multi-threaded internally, but on the LPC level it will
appear to work the same as before.  The difference is that DGD/MP will
sneakily, and invisibly to the LPC level, run some LPC threads
concurrently, while still giving the appearance of running them in
sequence.  It does this by letting each LPC thread run on a personal
copy of all objects it affects, and only committing its changes to the
actual objects when those objects have not been modified by other
threads in the meanwhile.  A thread which fails to commit is rescheduled.

This means that the n-processor version of DGD/MP will not run n times
as fast, since some threads will be rescheduled.  In the worst case,
with every thread except one failing to commit at all times, it will
run as fast as if it were only using a single processor.  Actual
speed will vary, between 1 and n times that of a single-processor
version.

To avoid confusion, I do not call DGD/MP a multi-threaded server,
even though it is multi-threaded internally.  Instead, I call it
multi-processor.  There really is no point in using it, unless you
run it on a machine with multiple processors.

Regards,
Dworkin
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list