
Next update: Improving Performance by Running Independent Tasks Concurrently - A Survey | processes | threads | coroutines ---------------+-------------------------+----------------------------+------------------------- purpose | cpu-bound tasks | cpu- & i/o-bound tasks | i/o-bound tasks | | | managed by | os scheduler | os scheduler + interpreter | customizable event loop controllable | no | no | yes | | | parallelism | yes | depends (cf. GIL) | no switching | at any time | after any bytecode | at user-defined points shared state | no | yes | yes | | | startup impact | biggest/medium* | medium | smallest cpu impact** | biggest | medium | smallest memory impact | biggest | medium | smallest | | | pool module | multiprocessing.Pool | multiprocessing.dummy.Pool | asyncio.BaseEventLoop solo module | multiprocessing.Process | threading.Thread | --- * biggest - if spawn (fork+exec) and always on Windows medium - if fork alone ** due to context switching On 26.07.2015 14:18, Paul Moore wrote:
Just as a note - even given the various provisos and "it's not that simple" comments that have been made, I found this table extremely useful. Like any such high-level summary, I expect to have to take it with a pinch of salt, but I don't see that as an issue - anyone who doesn't fully appreciate that there are subtleties, probably wouldn't read a longer explanation anyway.
So many thanks for taking the time to put this together (and for continuing to improve it). You are welcome. :) +1 on something like this ending up in the Python docs somewhere. Not sure how the process for this is but I think the Python gurus will find a way.