PyCon 2016 in Portland, Or
hills next to breadcrumb illustration

Wednesday 2:30 p.m.–3 p.m.

Removing Python's GIL: The Gilectomy

Larry Hastings

Audience level:
Experienced
Category:
Python Core (language, stdlib, etc.)

Description

CPython's GIL means your Python code can only run on one CPU core at a time. Can we remove it? Yes, we can... in fact we already have! But is it worth the cost?

Abstract

CPython's "Global Interpreter Lock", or "GIL", was added in 1992. It was an excellent design decision. But 24 years is a long time--today it prevents Python from capitalizing on multiple CPUs. Many people want us to remove the GIL. It turns out, removing the GIL isn't actually that hard. In fact, I already removed it, in my experimental "gilectomy" branch. But the GIL is one reason CPython is so fast! The "gilectomy" makes CPython shockingly slow. This talk will discuss the history of the GIL, how the GIL helps make CPython fast, how the "gilectomy" removed the GIL, and some ways we might be able to make the "gilectomy" version fast enough to be useful.