ANN: Twisted 1.1.1
Just
just at xs4all.nl
Wed Dec 10 20:03:04 EST 2003
In article <mailman.64.1071139413.9307.python-list at python.org>,
Andrew Bennetts <andrew-pythonlist at puzzling.org> wrote:
> On Wed, Dec 10, 2003 at 11:11:40PM +0100, Just wrote:
> >
> > This ties nicely into the xsdb + stackless discussion:
> >
> > - threads + blocking sockets is attractive since the code can be
> > written in a natural style, yet cause overhead and
> > synchronization headaches.
> >
> > - async sockets are attractive because they avoid threads and
> > therefore avoid overhead and synchronization issues. Yet it
> > is often a bit harder to code, since you need to turn your
> > code inside out, using callbacks.
> >
> > But there is a "perfect" solution: co-routines. With co-routines you can
> > both write the code in a "natural" style, but still using an even-driven
> > core. This is a very pleasant model to work with, so I totally
> > understand that some people (eg. Aaron) choose to use Stackless to make
> > this possible.
>
> co-routines miss one of the features of the threading model, though, which
> is preemptive concurrency. I prefer the async way of working too, but I can
> see that co-routines don't provide the best of both worlds...
True, that is an important difference. However, I believe that people
often pick threads over events not because they need preemptive
concurrency, but because threading appears to be "easier" -- which it
is, at least if you discount synchronization issues. Co-routines largely
fix that particular problem.
Just
More information about the Python-list
mailing list