[ruby-core:32775] Re: [Ruby 1.9-Feature#3436] Spawn the timer thread lazily

From: SASADA Koichi <ko1@...>
Date: 2010-10-13 14:40:52 UTC
List: ruby-core #32775
(2010/10/13 15:18), Mark Somerville wrote:
> How can I move this patch forward? Are there any objections to it being
> merged? If so, I'd love to try to fix them.

Yes, I have.  Two reasons.


(1) You missed signal problem which cause critical timing bug.  Please
read thread_timer() on the thread_pthread.c.  It is tough for me to
describe the behavior in English.

In short, we need to repeat sending a signal to wake-up the target ruby
thread completely.

ex) How to wake up the thread?

    check_signal();
      <- receive signal at this timing
    select(..., infinitely);

The thread never wake-up.  Generally, to avoid this timing issue,
pselect(2) is provided.  However, select(2) is not only blocking system
calls on the Ruby's case.


(2) Performance issue.  Your patch start/kill the timer thread.  In
general, the native thread creation/deletion cause some performance issue.

----

I understand your issue.  In fact, I'm considering this problem and
seeking the solution in recent months.

Could you wait for some days?  I may show the another idea.

BTW, recent python solve with some clever (complex, for me) method.
http://www.dabeaz.com/python/UnderstandingGIL.pdf

-- 
// SASADA Koichi at atdot dot net

In This Thread