title: How to launch in Ruby commands in parallel
body: <p>I am writing a terminal program using ruby as a launcher for a set of program written in C++ and Java which should be executed in a distributed system.</p>
  
  <p>I would like to translate this instruction in ruby:
  </p>
  
  <pre><code>for i in {1..40}; do
    ssh node$i program &amp; #note &amp; so that that process is detached
  done
  </code></pre>
  
  <p>This is my ruby code:
  </p>
  
  <pre><code>class Launcher
     # Other method that we can ignore
     def order(command)
       @nodelist.each {#Do something here}
     end 
  end 
  </code></pre>
  
  <p>I though about creating a pool of thread and each thread execute that command. Is it the appropriate way? As I studied threads can not execute "exec" since threads share the same memory address.</p>