Grokking Concurrency in Python
Vote

0% completed

​

Sampling Profilers and GIL Contention

Why would a thread that does almost no work run late as soon as other threads in the same process become busy? On the standard build, the usual answer is the GIL: before the thread can run its next line, it must wait for the running thread to give the lock up. That wait appears in no log line or error.

Waiting for the GIL

GIL contention is the time that threads spend waiting to acquire the GIL instead of running. On the standard build, a thread that runs Python code keeps the GIL until another thread asks for it and the switch interval, 5 milliseconds by default, has passed

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content