title: Ruby only creating 3 threads at a time
body: <p>I am trying to run 500 clients that send some request to the server simultaneously for load testing purpose. The client is a ruby program again. Sounds trivial. But I am facing weird problem with ruby threads. My code looks like this - </p>
  
  <pre><code>n = 10
  
  n.times do
    Thread.new do
      `calc`
    end
  end
  </code></pre>
  
  <p>The code is a sample. I'm just trying to run <code>calc</code> command from command line (If you are trying this code on platform other than windows please replace it with some command that works on your command line or shell). This will later be replaced by '<code>ruby my_client.rb</code>' and also the value of n will be set to 500 (or whatever).</p>
  
  <p>The problem that I am facing here is that regardless the number of threads I want to create, only <strong>3</strong> threads are created at a time. That is only 3 calc windows are opened simultaneously. The remaining threads just wait in a queue waiting for termination of these 3 threads. May be it has something to do with blocking and non-blocking calls. But I tried Java-equivalent of the same program and it worked perfectly. Its an old saying that threads in ruby are not recommended. Is it true that this is a problem with Ruby's threads or am I doing something wrong?</p>