Forum: Ruby-core [ruby-trunk - Bug #7560][Open] Process.kill incurs 100ms cost when threads exist

Posted by tmm1 (Aman Gupta) (Guest)
on 2012-12-14 14:22
(Received via mailing list)
Issue #7560 has been reported by tmm1 (Aman Gupta).

----------------------------------------
Bug #7560: Process.kill incurs 100ms cost when threads exist
https://bugs.ruby-lang.org/issues/7560

Author: tmm1 (Aman Gupta)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-12-14 trunk 38379) [x86_64-darwin12.2.0]


  % ruby -rbenchmark -e' puts Benchmark.measure{ Process.kill(0, 
Process.pid) } '
  0.000000   0.000000   0.000000 (  0.000011)

  % ruby -rbenchmark -e' Thread.new{sleep}; puts Benchmark.measure{ 
Process.kill(0, Process.pid) } '
  0.000000   0.000000   0.000000 (  0.101127)
Posted by Eric Wong (Guest)
on 2012-12-14 18:40
(Received via mailing list)
"tmm1 (Aman Gupta)" <ruby@tmm1.net> wrote:
> Category:
> Target version:
> ruby -v: ruby 2.0.0dev (2012-12-14 trunk 38379) [x86_64-darwin12.2.0]
>
>
>   % ruby -rbenchmark -e' puts Benchmark.measure{ Process.kill(0, Process.pid) } 
'
>   0.000000   0.000000   0.000000 (  0.000011)
>
>   % ruby -rbenchmark -e' Thread.new{sleep}; puts Benchmark.measure{ 
Process.kill(0, Process.pid) } '
>   0.000000   0.000000   0.000000 (  0.101127)

This is the call to rb_thread_polling().

That said, I do not understand why rb_thread_polling() exists.

It was probably only for green threads in 1.8 and got carried over.
If so, I think all calls to it can be removed and the function can
be made a no-op.

kosaki/ko1: what do you guys think?
Posted by kosaki (Motohiro KOSAKI) (Guest)
on 2012-12-14 20:21
(Received via mailing list)
Issue #7560 has been updated by kosaki (Motohiro KOSAKI).


@normalperson: I agree. I removed rb_thread_polling() today then. :)


----------------------------------------
Bug #7560: Process.kill incurs 100ms cost when threads exist
https://bugs.ruby-lang.org/issues/7560#change-34748

Author: tmm1 (Aman Gupta)
Status: Closed
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-12-14 trunk 38379) [x86_64-darwin12.2.0]


  % ruby -rbenchmark -e' puts Benchmark.measure{ Process.kill(0, 
Process.pid) } '
  0.000000   0.000000   0.000000 (  0.000011)

  % ruby -rbenchmark -e' Thread.new{sleep}; puts Benchmark.measure{ 
Process.kill(0, Process.pid) } '
  0.000000   0.000000   0.000000 (  0.101127)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.