[Python-ideas] Concurrency Modules

Sturla Molden sturla.molden at gmail.com
Sat Jul 25 00:19:47 CEST 2015


"Sven R. Kunze" <srkunze at mail.de> wrote:

> To me, all approaches 
> can now be fit into this sort of table. Please, correct me if it's wrong 
> (that is very important):
> 
> # | code lives in | managed by
> --+---------------+-------------
> 1 | processes     | os scheduler
> 2 | threads       | os scheduler
> 3 | tasks         | event loop

In CPython threads are actually managed by a combination of the OS
scheduler and the interpreter (which controls the GIL). Processes on the
other hand are only managed by the scheduler.

Then there is the address space, which is shared for threads and tasks and
private for processes.

1 | processes     | os scheduler
2 | threads       | os scheduler and python interpreter
3 | tasks         | event loop

> Say, we have decided for approach N because of some requirements 
> (examples from here and there, guidelines given by smart people, 
> customer needs etc.) and wrote hundred thousand lines of code.
> What if these requirements change 6 years in the future?

Then you are screwed, which is a PITA for all concurrency code, not just
the one written in Python.


Sturla



More information about the Python-ideas mailing list