[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 19991229.003] perl 5.005_03 core dumps -- singal



At 09:28 PM 1/11/00 -0500, Ilya Zakharevich wrote:
>On Tue, Jan 11, 2000 at 05:22:20PM -0500, Dan Sugalski wrote:
> > >Why do you thing it is not going to be waiting on a blocking system
> > >call most of the time?  For many threading paradigms this is exactly
> > >what happens.
> >
> > So we have sync system calls instead spawn off a thread to do the call
> > while the spawning thread cond_waits on something. To wake the thread you
> > kill the thread doing the syscall and pop a cond_signal to the waiting
> > thread. There are other ways, too, of course.
>
>You still think that you can wake something which cond_wait()s from
>another thread.  And you make things extremely complicated and
>extremely unefficient.

Yes I do, and no it isn't. Perl code does a cond_wait. The cond_wait code 
stores the condition in the thread structure and waits. Something needs to 
wake the thread, so it sets the condition and wakes it. No Big Deal.

And yes, a new thread for long syscalls is inefficient. (And a completely 
different topic than cond_waits) Thread pools make it cheaper (or at least 
amortize the costs) and if the call is likely to block for a while anyway 
the real expense is essentially non-existant.

> > >What made you thingk cond_wait() is not a blocking system call?
> >
> > What makes you think the cond_wait that I'm thinking of is the one you're
> > thinking of? And what makes you think I'm not considering tracking the
> > condition and signalling it?
>
>Waking *all* the thread which wait on this?

Yeah, and....? The underlying code for the other threads (assuming that 
other threads are even waiting on the same thing) see the condition wasn't 
for them and re-wait. Spurious wakeups are a part of life, aren't that 
common, and handling them is cheap.

Yes, it does mean a bit of extra code in the core, but it's not code that's 
in any sort of critical performance path.



					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Follow-Ups from:
Ilya Zakharevich <ilya@math.ohio-state.edu>
References to:
Dan Sugalski <dan@sidhe.org>
Dan Sugalski <dan@sidhe.org>
Larry Wall <larry@wall.org>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Ilya Zakharevich <ilya@math.ohio-state.edu>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]