savo.la

2012-03-20

Concurrency

Concrete has had infrastructure for I/O-driven scheduling of multiple threads of execution since last summer, but an API for actually launching concurrent functions was missing until now. The approach is similar to what Stackless, Eventlet and gevent (without forgetting CIO) do. All internal functions are implemented as continuations the states of which are stored in the portable arena. If the arena moves to another context while a continuation is waiting for I/O, the associated system resources will disappear and the I/O operation will be restarted (like as syscall).

There is no mechanism for Communicating yet, though, so there are just Sequential Processes for now. This green-thread approach (with single-threaded dispatch) may fit well as the method for implementing parallelism in Concrete since pressure is more on regulating than optimizing resource usage.

Timo Savola