From: Rajinder Yadav Date: 2009-10-31T00:46:37+09:00 Subject: Re: Using multicore CPUs in parallel tasks On Fri, Oct 30, 2009 at 11:07 AM, James M. Lawrence wrote: > Robert Klemme wrote: >> processes = 4 >> count = 0 >> >> my_array.each do |task| >>    if count == processes >>      Process.wait >>      count -= 1 >>    end >> >>    fork do >>      a_method(task) >>    end >>    count += 1 >> end >> >> Process.waitall > > Another option, > > Tiamat.open_local(4) { >  pure do >    fun_map :result => my_array do |elem| >      a_method(elem) >    end >  end.compute.result > } > > This lets you distribute across N physical machines without a change to > the code. This is just elegant =) ... it's funny how I observer something then more of what I observer comes in to the fold! Was hoping you would reply to the thread ;) > -- > Posted via http://www.ruby-forum.com/. > > -- Kind Regards, Rajinder Yadav http://DevMentor.org Do Good! - Share Freely, Enrich and Empower people to Transform their lives.