[Python-Dev] GIL removal question

Xavier Morel catch-all at masklinn.net
Fri Aug 12 18:51:10 CEST 2011


On 2011-08-11, at 21:11 , Sturla Molden wrote:
> 
> (b) another threading model (e.g. one interpreter per thread, as in Tcl, Erlang, or .NET app domains).
Nitpick: this is not correct re. erlang.

While it is correct that it uses "another threading model" (one could even say "no threading model"), it's not a "one interpreter per thread" model at all:

* Erlang uses "erlang processes", which are very cheap preempted *processes* (no shared memory). There have always been tens to thousands to millions of erlang processes per interpreter

* A long time ago (before 2006 and the SMP VM, that was R11B) the erlang VM was single-threaded, so all those erlang processes ran in a single OS thread. To use multiple OS threads one had to create an erlang cluster (start multiple VMs and distribute spawned processes over those). However, this was already an m:n model, there were multiple erlang processes for each VM.

* Since the introduction of the SMP VM, the erlang interpreter can create multiple *schedulers* (one per physical core by default), with each scheduler running in its own OS thread. In this model, there's a single interpreter and an m:n mapping of erlang processes to OS threads within that single interpreter. (interestingly, because -smp generates resource contention within the interpreter going back to pre-SMP by setting the number of schedulers per node to 1 can yield increased overall performances)


More information about the Python-Dev mailing list