Hi,

I've been reading around a bit but couldn't find a solution that worked,
so here goes:

I am running ruby 1.8 and want to make full use of a quad core CPU
(64bit, Ubuntu) in a task that lends itself to multithreading/multicore
use.

It's basically an array of objects that are each use in a fairly CPU
intensive job, so I figured I could have 4 of them run at the same time
, one on each CPU.

BUT...

The only reasonably understandably suggestion looked something like:

----
threads = 4
my_array = [something_here]

threads.times do
 Process.fork(a_method(my_array.shift))
end

my_array.each do |object|
 Process.wait(0)
 Process.fork(a_method(object))
end
---

But this still only used one CPU (and looks a bit ugly..). Is that some
limitation of ruby (v 1.8 specifically) or am I doing something wrong?

Cheers,

Marc
-- 
Posted via http://www.ruby-forum.com/.