[DGD] mp/tls fact check

Mikael Lind elemel at elemel.se
Tue Nov 25 07:41:49 CET 2008


Hello Chris,

2008/11/24 Chris <null.infinite at gmail.com>

> A thread is a single chain of code not broken up by call_outs, which
> originates
> from either a call_out or a user sending a message.
>

I agree with Shentino here, "execution round" is the established term.


> There are three general rules which must be followed to preserve
> multi-threaded
> compatibility.  These rules are listed here below:


s/must be followed to preserve multi-threaded
compatibility/should be followed to improve MP performance


> -There cannot be a private function prototype that is left undefined.


What is the connection to MP here?

 -If a call_other to a different object would change a global variable in
> that
>  object, and the best solution is not to use TLS vars (see below), than one
>  good option is to use a 'relay function'.  A relay function is a function
> with
>  a call_out (usually 0 seconds).  Once the function called with call_out
>  executes, it does so on its own thread, and is no longer breaking this
> rule.
>
>  -If more than one thread can compete to modify an external objects global
>  variable, than whenever these threads are executed simultaneous one of
> them
>  gets rescheduled.  When many threads are doing this, and rescheduling
> becomes
>  rampant, we have created a huge drain on DGD's ability to multi-thread.
>  To
>  avoid this we use TLS-vars.
>

How about:

If two execution rounds attempt to change the same persistent object
at the same time, DGD will roll one of them back and reschedule it
for later. You can reduce the amount of duplicated work introduced by
rescheduled execution rounds by (a) using events or no-delay
callouts to break up execution rounds into a series of smaller
transactions, and (b) using TLS for global variables that do not need
to be shared between execution rounds.

Regards,
Mikael



More information about the DGD mailing list