Steven W McDougall wrote:
>
> Thread1 Thread2
> $a = $b; $b = $a;
>
> preemptive threading requires
> - mutexes to protect $a and $b
> - a robust deadlock avoidance strategy
I think a robust deadl. avd. strat. is something like:
1: make a list of all variables referenced w/in expression
2: obtain global mutex-setting sceptre (block for this)
3: block until allowed to set mutexes on entire list in 1
4: release sceptre
5: run expression
6: release all mutexes when leaving it for
any reason (and redoing 2 through 4 on reentry)
Does that not take care of
sub setb {$b = $a};
$a += setb() called in two threads at the same time?
The problem is, as long as expressions can be within each other,
and include terms that are multiple expressions, a robust deadlock
avoidance strategy is required even with cooperative threading.
Or you can just pass the buck to the programmer, and make them use
explict mutexes and deadlocks while they learn.
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
safety first: Republicans for Nader in 2000
- Are Perl6 threads preemptive or cooperative? Steven W McDougall
- Re: Are Perl6 threads preemptive or cooperative? Dan Sugalski
- Re: Are Perl6 threads preemptive or cooperativ... David L. Nicol
- Re: Are Perl6 threads preemptive or cooper... Dan Sugalski
- Re: Are Perl6 threads preemptive or co... Markus Peter
- Re: Are Perl6 threads preemptive or co... Steven W McDougall
- Re: Are Perl6 threads preemptive ... Glenn Linderman
- Re: Are Perl6 threads preemptive ... David L. Nicol
- Re: Are Perl6 threads preempt... Steven W McDougall
- Re: Are Perl6 threads pre... Markus Peter
- Re: Are Perl6 threads pre... Chaim Frenkel
- Re: Are Perl6 threads pre... Steven W McDougall
- Re: Are Perl6 threads pre... Chaim Frenkel
- Re: Are Perl6 threads pre... Steven W McDougall
- Re: Are Perl6 threads preemptive or cooperative? Markus Peter
- Re: Are Perl6 threads preemptive or cooperative? Markus Peter
- Re: Are Perl6 threads preemptive or cooperativ... David L. Nicol
- Re: Are Perl6 threads preemptive or cooper... Bryan C . Warnock
