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 <fbar@footils.org> wrote:
Hallo,
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.
>
> http://pypi.python.org/pypi/cogen/

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:
http://www.keplerproject.org/copas/

Ciao
--
Frank Barknecht

-------------------------------------------------------------------------
This SF.net 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.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss



--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro@gmail.com
mail: carribeiro@yahoo.com