From: cremes.devlist@... Date: 2006-05-28T03:19:53+09:00 Subject: Re: Ruby Threads... On May 27, 2006, at 10:14 AM, ara.t.howard@noaa.gov wrote: > On Sat, 27 May 2006, ReggW wrote: > >> Francis Cianfrocca wrote: >> >>> It seems to me that Ruby's green-thread implementation is perfectly >>> adequate >>> for most programmers' requirements. >> >> But the problem is that it doesn't take advantage of these new >> multi-core >> processor that are now starting to become the standard machines >> being sold >> (at least for my customers). > > it's a small problem. here is some code which starts two > processes, three if > you count the parent. both run in separate processes using drb as > the ipc > layer to make the communication painless. because the code uses > drb the com is > simple. because it uses multiple processes it allows the kernel to > migrate > them to different cpus. the cost is about 100 lines of pure-ruby > (the slave > lib). notice how easy it is for parent to communicate with child > and for > childrent to communicate with each other: > > harp:~ > cat a.rb > require 'slave' > require 'yaml' > > [snip cool example using 'slave'] cremes$ gem list -b |grep slave slave (0.0.0) slave cremes$ gem install slave Attempting local installation of 'slave' Local gem file not found: slave*.gem Attempting remote installation of 'slave' ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find slave (> 0) in the repository Ruh roh! cr Chuck Remes cremes@mac.com www.familyvideovault.com (not yet live!)