Project

General

Profile

Actions

Bug #270

closed

lazy timer thraed creation

Added by ko1 (Koichi Sasada) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.8.8dev (2010-01-17 revision 26335) [i386-netbsdelf5.0.1]
Backport:
[ruby-dev:35471]

Description

=begin
 ささだです.

 現在,1.9 では timer thread というものを起動時に作って,以下の用途
に利用しています.

a) スレッドスイッチの契機
b) signal の集約
c) sampling profiling

 (a) は SIGVTALRM の代わりに,select で polling して,定期的に ruby
threads に対してスレッド切り替えを促します.

 (b) は,一度 signal を timer thread に集約して,その後 ruby thread
に signal の情報を渡すように実装しています.

 (c) は,あまり活用されていませんが,sampling profiler として利用す
ることができます.今後の拡張用です.

 ただ,最近のFreeBSDやNetBSDは,一度 pthread を作ると,後始末をして
も fork 後,pthread を作ろうとすると刺さるので,必ず timer thread を
作る 1.9 では fork が出来ません.そこで,最初に Thread.new するま
で,つまり,マルチスレッド実行を行うまで timer thread の遅延を遅らせ
るような提案を受けています.

 (b) に関しては実装についてケアが必要で(これまで,ruby thread で
signal を受ける心配をする必要がなかった),(c) についてはあきらめな
ければなりませんが,FreeBSD, NetBSD などの広く利用されている OS で
fork が動かないのはまずかろう,という意見です.

 fork をこれ以上使うな,という意見もあるかとは思いますが,この提案
については前向きに検討していきます.

 忘れないように redmine に登録しておきます.

 ご意見募集中です.

// SASADA Koichi at atdot dot net
=end


Related issues 9 (0 open9 closed)

Related to Ruby master - Bug #2097: fork NotImplementedError on FreeBSDThird Party's Issue09/14/2009Actions
Related to Ruby 1.8 - Bug #1872: [ruby_1_8] Kernel#system doesn't work in forked processClosednobu (Nobuyoshi Nakada)08/04/2009Actions
Related to Backport187 - Backport #2603: NetBSD 5.0以降でpthreadの処理に由来する不具合Closedshyouhei (Shyouhei Urabe)01/14/2010Actions
Related to Ruby 1.8 - Bug #2648: Mac OS X 10.6/10.5で--enable-pthreadのときtest-allでSEGVするClosed01/23/2010Actions
Related to Backport187 - Backport #2659: Problem when building with pthreads enabledClosedshyouhei (Shyouhei Urabe)01/26/2010Actions
Related to Backport187 - Backport #2663: Hard hang (needs -9 to kill) in 1.8.7 build 248Closed01/27/2010Actions
Related to Ruby 1.8 - Bug #1402: test_cookie(TestCookie)でtest-allが止まるClosed04/24/2009Actions
Related to Ruby master - Bug #2724: fork from other than the main thread causes wrong pthread condition on NetBSDThird Party's Issue02/09/2010Actions
Related to Ruby master - Bug #6341: SIGSEGV: Thread.new { fork { GC.start } }.joinThird Party's Issue04/22/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0