Python 3, an Illustrated Tour Transcripts
Chapter: Asynchronous Programming
Lecture: Python's GIL
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Python has what's called gil, and gil has a couple bonuses or things that it gives you, it gives you simplified garbage collection.
0:08 It also allows you to avoid none thread safe code with other threads, but it has some drawbacks, one is that you can only run
0:15 one native thread at a time on Python. So even if you have multiple CPUs on your computer,
0:20 you're only going to be able to take advantage of one of them using threading in Python, if you use a library called multiprocessing
0:27 that gets around it by launching multiple processes, Python processes and each one of those processes can use the CPU.
0:34 There's a little bit more overhead to that because it's got to pass around the information, it can't share it as easily.
0:40 Another minus of the gil is that if you have cpu-bound code it's going to be a little bit slower and this sort of relates to the other one
0:47 that we can't parallelize them easily from Python.