Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95601 > unrolled thread

Re: asyncio, coroutines, etc. and simultaneous execution

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2015-08-23 18:26 -0400
Last post2015-08-23 18:26 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: asyncio, coroutines, etc. and simultaneous execution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-23 18:26 -0400

#95601 — Re: asyncio, coroutines, etc. and simultaneous execution

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-08-23 18:26 -0400
SubjectRe: asyncio, coroutines, etc. and simultaneous execution
Message-ID<mailman.40.1440368823.17298.python-list@python.org>
On Sun, 23 Aug 2015 14:43:50 -0700, Charles Hixson
<charleshixsn@earthlink.net> declaimed the following:

>If I understand correctly asyncio, coroutines, etc. (and, of course, 
>Threads) are not simultaneously executed, and that if one wants that one 
>must still use multiprocessing.  But I'm not sure.  The note is still 
>there at the start of threading, so I'm pretty sure about that one.
>

	<snip>


	Is there a question somewhere in all that?

	Coroutines, by classic definition, are routines that cooperate in
switching off execution -- remember, for half the existence of electronic
digital computing, something like a multi-core computer was very rare
(vectorized super-computers, et al). 

	Where multiple processors were found, they were not general purpose...
The Sigma-6 (and most of the SDS/XDS Sigma line) had the main "computer"
and a collection of SIOP and MIOP to handle I/O transfers from between
memory and peripherals (it also had a 4-bank, 4-port interleaved memory so
the IOPs and main processor could chase each other without wait states; the
Amiga had two banks, but only CHIP RAM was 2-port, and the banks were not
interleaved, so CHIP access could block main processor)

	In common Python, the GIL affects things like number crunching (CPU
bound) algorithms, in that only the thread holding the GIL can perform
meaningful work -- so a thread in another core, not holding the GIL, is
blocked. Nothing different than a single core processor. But I/O bound
algorithms -- since the I/O library releases the GIL before blocking on
system I/O calls -- work fine with GIL and multiple cores.

	The multiprocessing module trades off the fast creation of threads
limited by the GIL for slower process startup (especially on Windows) by
giving each process its own, well, system process and Python interpreter
with its own GIL. But sharing state between these processes becomes more
complex -- you don't really have shared global objects that can be tested.

	Can't speak for asyncio -- my mind just doesn't work that way. For
asynchronous I/O, threads/Queue work for me (or VMS style non-blocking QIO
with event flags that can be tested and waited for later in the process...
ASTs if one wants something that behaves closer to an interrupt handler).
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web