[Python-ideas] Concurrency Modules

Nick Coghlan ncoghlan at gmail.com
Sun Jul 26 16:28:35 CEST 2015


On 26 July 2015 at 21:44, Sven R. Kunze <srkunze at mail.de> wrote:
> If I read the documentation of
> https://docs.python.org/2/library/multiprocessing.html#module-multiprocessing.pool
> for instance, I do not see a way to specify my choice.

The Python 2.7 multiprocessing module API is ~5 years old at this
point, Andrew's referring to the API in Python 3.4+:
https://docs.python.org/2/library/multiprocessing.html#module-multiprocessing.pool

As far as the other benefits of asyncio go, one of the perks is that
you can stop all processing smoothly just by stopping the event loop,
and then they'll all resume together later. This gives you a *lot*
more predictability than using threads or processes, which genuinely
execute in parallel.

After the previous discussion, I wrote
http://www.curiousefficiency.org/posts/2015/07/asyncio-tcp-echo-server.html
to attempt to convey some of the *practical* benefits of using asyncio
to manage interleaved network operations within a single thread. While
in the blog post I'm just playing with TCP clients and echo servers at
the interactive prompt, it wouldn't be too hard to adapt those
techniques to running network client and server testing code as part
of a synchronous test suite.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list