On 1 Oct 2011, at 15:19, SASADA Koichi wrote:
> - Cross thread Fiber migration
- Automatically scheduled coroutines (as featured in Go)
- First-class Channels (thread-independent atomic queues)
> - Non-blocking I/O

For me this is all part of a cohesive package which could revolutionise the way we approach concurrency in Ruby.

We already have channels in Ruby in the form of thread Queues which can be exposed via thread variables, but it's a clunky and fragile approach to "sharing via communication" and judging from the feedback I've had at conferences most Ruby developers aren't even aware of their existence. Indeed I've a horrible feeling I first discovered them by reading the source code...

Likewise Fibers provide a basic abstraction which can be used to implement coroutines, but whilst they're bound to individual threads they need explicit non-blocking I/O calls if they're to interleave cleanly and scale performance.

The existing non-blocking I/O calls are an unnecessary complication which play poorly in concurrent code. This is something which could be handled by the runtime shunting blocking I/O calls to a separate OS thread so that only tasks dependent on that I/O would block and the rest of the system would continue undisturbed.

This all depends though on whether or not pThreads allow such tricks (Go achieves them using the Plan9 thread library), and likewise there may be issues for other implementations.


Ellie

Eleanor McHugh
Games With Brains
http://feyeleanor.tel
----
raise ArgumentError unless @reality.responds_to? :reason