This is an old copy of the Python FAQ. The information here may be outdated.

What is the Global Interpreter Lock?

The Global Interpreter Lock (GIL) is used to protect Python objects from being modified from multiple threads at once. Only the thread that has the lock may safely access objects.

To keep multiple threads running, the interpreter automatically releases and reacquires the lock at regular intervals (controlled by the sys.setcheckinterval function). It also does this around potentially slow or blocking low-level operations, such as file and network I/O.

Also see:



CATEGORY: general


A Django site. rendered by a django application. hosted by webfaction.