True parallelism in Python
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Mysterious Puzzle
--
Chapters
00:00 True Parallelism In Python
00:21 Accepted Answer Score 10
01:32 Answer 2 Score 1
01:46 Thank you
--
Full question
https://stackoverflow.com/questions/3837...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #multiprocessing #gil
#avk47
ACCEPTED ANSWER
Score 10
Python, the language does not necessarily enforce GIL. It's the different implementations of the language which may or may not have GIL.
CPython (the de-facto implementation) has GIL. So you can not have truly parallel threads while you're using it. However, you can use multi processing to gain parallelism. PyPy, another implementation of the language also has GIL now.
There are other implementations of the Python language (Jython & IronPython for example) which do not have GIL and you can use threads to run parallel operations.
Cython has a GIL but you can release it using a with statement.
Links of the projects mentioned:
More resources on this topic:
A question on programming stack exchange: https://softwareengineering.stackexchange.com/questions/186889/why-was-python-written-with-the-gil (Thanks to @Rogalski)
Python Wiki: https://wiki.python.org/moin/GlobalInterpreterLock
David Beazley's talk - https://www.youtube.com/watch?v=Obt-vMVdM8s
Article from Jeff Knupp : https://jeffknupp.com/blog/2013/06/30/pythons-hardest-problem-revisited/
ANSWER 2
Score 1
If you want to learn about the GIL in python, I'd suggest to start reading here:
https://wiki.python.org/moin/GlobalInterpreterLock
See the section Eliminating the GIL for an explanation why python still has the GIL.