title: Running ruby scripts in parallel
body: <p>Let's say I've got two ruby scripts - a.rb and b.rb. Both are web-scrapers used for different pages. They can work for many, many hours and I would like to run them simultaneously. In order to do that I've tried to run them by third script using 'promise' gem with the following code:</p>
  
  <pre><code>def method_1
  require 'path to my file\a'
  end
  def method_2
  require 'path to my file\b'
  end
  require 'future'
  x=future{method_1}
  y=future{method_2}
  x+y
  </code></pre>
  
  <p>However this solution throws an error(below) and only one script is executed.</p>
  
  <pre><code>An operation was attempted on something that is not a socket. 
  (Errno::ENOTSOCK)
  </code></pre>
  
  <p>I also tried playing with Thread class:</p>
  
  <pre><code>def method_one
  require 'path to my file\a'
  end
  
  def method_two
  require 'path to my file\b'
  end
  
  x = Thread.new{method_one}
  y = Thread.new{method_two}
  
  x.join
  y.join
  </code></pre>
  
  <p>And it gives me the same error as for 'promise' gem.</p>
  
  <p>I've also run those scripts in separate shells- then they work at the same time, but the performance is much worse (aprox. about 50% slower).
  Is it any way to run them at the same time and keep high performance?</p>