Re:The CPython Bytecode Compiler Is Dumb
by bakery2k on Monday February 25, 2019 @02:56AM
(#19243866)
On the contrary, the Global Interpreter Lock provides many thread-safety guarantees. These are based on the fact that threads can only be interrupted between, not within, byte code instructions.
For example, a single list can safely be extended (as in `l += [1]`) concurrently from several threads.
Re:The CPython Bytecode Compiler Is Dumb
by grandinj on Monday February 25, 2019 @03:01AM
(#19243890)
Ah, you are correct, it's the non-threadedness of the interpreter itself I was thinking of.
Re:The CPython Bytecode Compiler Is Dumb
by FartyMcFarter on Monday February 25, 2019 @04:11AM
(#19244178)
On the contrary. For example, each python thread you create results in the creation of a POSIX thread in the interpreter, when you're running CPython on Linux.
The GIL just means that only one of those threads will be executing pure-Python code at any time. But they're still normal threads.
Re:The CPython Bytecode Compiler Is Dumb
by FartyMcFarter on Monday February 25, 2019 @07:07AM
(#19245034)
If you want to details about the GIL and Python threads, this is a nice presentation:
The default python interpreter does absolutely nothing to make it's execution thread-safe, and that appears to be a deliberate decision on their part to keep the complexity of the interpreter down.