From: Mark Somerville Date: 2010-10-15T00:45:33+09:00 Subject: [ruby-core:32788] Re: [Ruby 1.9-Feature#3436] Spawn the timer thread lazily --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Koichi, On Wed, Oct 13, 2010 at 11:40:52PM +0900, SASADA Koichi wrote: > It is tough for me to describe the behavior in English. OK. > ex) How to wake up the thread? >=20 > check_signal(); > <- receive signal at this timing > select(..., infinitely); Would this occur if rb_signal_buff_size() > 1 and we process a signal with a handler that calls a blocking function? > (2) Performance issue. Your patch start/kill the timer thread. In > general, the native thread creation/deletion cause some performance issue. I assumed (perhaps incorrectly) that the overhead was small enough and the creation and deletion uncommon enough that it wouldn't be a problem. Perhaps there could be a method of increasing the time the timer thread waits if rb_thread_alone() and creation of a new thread could reduce this again. > I understand your issue. In fact, I'm considering this problem and > seeking the solution in recent months. It seems to me that we are attempting different things. I have been primarily concerned with reducing/removing CPU wakeups in the single-threaded case and falling back to the timer thread when multi-threaded. Assuming, I understand you correcly, you appear to be trying to remove the timer thread completely. If you are trying to remove the timer thread altogether, that's *great* news and I won't bother carrying this patch on! > Could you wait for some days? I may show the another idea. Sure. I'll be interested to see it! =20 > BTW, recent python solve with some clever (complex, for me) method. > http://www.dabeaz.com/python/UnderstandingGIL.pdf Really interesting reading. Thanks a lot, very useful! --5vNYLRcllDrimb99 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAky3Ja8ACgkQFC+QcFj+6g1syACggXcrX3Dy7EQmUUtAF2BDjum2 WHUAn0bH89lBMPswTMAA4eRJQTJsCVcZ =FMv5 -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--