Coroutines are safer for two reasons. The first is that synchronization is in the programmer's head, while with threads and processes synchronization is done by the operating system. With coroutines you have no deadlocks or race conditions to worry about because you get to explicitly choose your synchronization points.

But the main point is that coroutines are written for a single processor world. They emulate parallelism inside a single process. That's what really make them safer. But this is not helpful in a world of multiple cores. One still have to choose between threads and processes for large scale multiprocessing.

On Mon, Apr 21, 2008 at 7:06 PM, Frank Barknecht <> wrote:
Oleg Broytmann hat gesagt: // Oleg Broytmann wrote:

> On Mon, Apr 21, 2008 at 07:38:55PM +0200, Frank Barknecht wrote:
> > Coroutines are more lightweight than processes and don't need special
> > synchronisation efforts as only one Coroutine is running at any given
> > time.

Yep, that's what I mean. It's often easier and saver to program with
coroutines that with threads.

In Lua COPAS would be an equivalent to Cogen:

Frank Barknecht

This email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.;198757673;13503038;p?
sqlobject-discuss mailing list

Carlos Ribeiro
Consultoria em Projetos