Maximum of thread and platform

Hello,

Here some measures of how many thread ruby an create.
There are many differences between platform.

Is there a reason (Ruby compilation, kernel tuning…) ?

================ Windows

windows>ruby -e “loop { Thread.new { sleep } rescue puts “Error at
count
#{Thread.list.size} : #{$!} // RUBY-#{RUBY_VERSION}” }”

Error at count 681 : can’t create Thread (12) // RUBY-2.0.0

================ Linux Ubuntu 12

linux>ruby -e ‘loop { Thread.new { sleep } rescue puts “Error at count
#{Thread.list.size} : #{$!} // RUBY-#{RUBY_VERSION}” }’

Error at count 15696 : can’t create Thread (11) // RUBY-1.9.3

================== Linux Ubuntu 14

linux> ruby -e ‘loop { Thread.new { sleep } rescue puts “Error at count
#{Thread.list.size} : #{$!} // RUBY-#{RUBY_VERSION}” }’

Error at count 2989 : can’t create Thread: Resource temporarily
unavailable // RUBY-2.1.2

linux>uname -a
Linux regis-VirtualBox 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13
19:37:48 UTC 2015 i686 i686 i686 GNU/Linux

linux>cat /proc/sys/kernel/threads-max
31947

Did you made lot of rounds of this test to see if there’s a patern? I
mean, example: does Windows always stop on 681?

Damián M. González wrote in post #1168066:

Did you made lot of rounds of this test to see if there’s a patern? I
mean, example: does Windows always stop on 681?

Yes, always at 681 threads, on Windows 7

On Windows server/ ruby 2.1.5 : always at 768 threads.