codegram / futuroscope

Yet another Futures implementation in Ruby
MIT License
210 stars 13 forks source link

Feature/process pool #2

Closed 50541b17-99bc-ed9b-8a10-738bffa6b2ca closed 11 years ago

50541b17-99bc-ed9b-8a10-738bffa6b2ca commented 11 years ago

Works around the GIL issue.

josepjaume commented 11 years ago

Thanks for the suggestion!

I don't think it is possible to send ruby code across processes as easy as it is across threads (don't share memory). Still the GIL thing is not such an issue because in most of futuroscope's use cases you will be issuing an interruption (network, database...).

And you always have JRuby and Rubinius, of course.

50541b17-99bc-ed9b-8a10-738bffa6b2ca commented 11 years ago

True, not as easy. You could look for inspiration here though https://github.com/grosser/parallel/blob/master/lib/parallel.rb

That library allows one to easily switch between the two.

josepjaume commented 11 years ago

Problem here is we're not dealing with a worker - job scenario. In order for a future block to be executed in the pool, it must live in the same memory space than the one who emitted it. I believe there isn't any trick (marshalling) that would work here.

Any ideas?

50541b17-99bc-ed9b-8a10-738bffa6b2ca commented 11 years ago

Not yet. :)