[DGD] Multi Threading
Felix A. Croes
felix at dworkin.nl
Sat May 17 11:02:25 CEST 2003
Kris Van Hees <aedil at alchar.org> wrote:
> Not to offer criticism (since I do believe that re-scheduling threads of
> execution is the right way to go - you convinced me of that in 1995 already),
> but isn't the worst case where one or more threads of execution may have to be
> rescheduled multiple times, due to getting undercut by other threads? E.g. if
> all threads need to access a central object during their execution, it could be
> possible that thread n will get rescheduled (n - 1) times because all previous
> threads modifying that single central object? It does of course depend on the
> scheduling algorithm, and it is very easy to guarantee at least completion of
> all threads, but it seems that the possible impact of a high degree of
> collisions in accesses (bad design, but nonetheless) could be quite a bit higher
> than sequential threads on a uni-processor driver.
The system guarantees that of all LPC threads running at any one time,
at least one will complete successfully. Thus the worst case is
equivalent to a single-threaded system which executes LPC threads in
the same order of completion, but sequentially.
It is true that while the system as a whole still progresses, individual
threads may be rescheduled a number of times, and thereby delayed.
Making sure that eventually they do complete is not that hard a problem.
The most simple solution would be to run a thread which has been
rescheduled some given number of times in single-threaded mode. That
would still not affect the worst case for the system as a whole.
Of course, there is some overhead for scheduling, making copies of
objects to work on for each thread, and so on. But if that overhead
were significant, I would be doing a bad job as a programmer.
Regards,
Dworkin
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list