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
0:03 or things that it gives you, it gives you simplified garbage collection.
0:07 It also allows you to avoid none thread safe code with other threads,
0:11 but it has some drawbacks, one is that you can only run
0:14 one native thread at a time on Python.
0:17 So even if you have multiple CPUs on your computer,
0:19 you're only going to be able to take advantage of one of them
0:22 using threading in Python, if you use a library called multiprocessing
0:26 that gets around it by launching multiple processes, Python processes
0:30 and each one of those processes can use the CPU.
0:33 There's a little bit more overhead to that
0:35 because it's got to pass around the information, it can't share it as easily.
0:39 Another minus of the gil is that if you have cpu-bound code
0:42 it's going to be a little bit slower and this sort of relates to the other one
0:46 that we can't parallelize them easily from Python.