Loading topic
threading module or concurrent.futures. You should also know the difference between a process and a thread, and have a rough idea of what a race condition and a lock are. No C knowledge is needed.3 min readthreading or concurrent.futures, and know the difference between a thread and a process. It builds on the previous chapter's description of the Global Interpreter Lock (GIL), the mutex that lets only one thread execute Python b3 min readpython3.13t installed. The previous chapter showed how to detect one. Here you learn how to control whether the GIL is active when that interpreter starts.2 min readthreading module or concurrent.futures, the difference between threads and processes, and the basic idea of a race condition. It builds on the earlier chapters about how the GIL serializes bytecode and how to detect a free-threaded build.2 min readthreading module, what a race condition is, and the difference between a single operation and a sequence of operations. It also assumes you have read the earlier chapters on the free-threaded build.3 min readthreading module, what a race condition is, and the basics of locks. It also assumes you have read the earlier chapters on the GIL and on built-in type thread safety.3 min readthreading module, what a race condition is, and the basic idea of a lock. It builds on the previous chapter, which showed that operations like counter += 1 are not atomic.2 min readthreading module, have read the earlier chapters on data races, and can protect shared state with a Lock. Locks work, but they are easy to forget and easy to get wrong. A better approach is to design programs so threads share little mutable state in the first pl2 min readPYTHON_GIL and -X gil work. It also assumes you have a basic idea of what a compiled extension module is.3 min readcounter += 1 is a data race. It explains the interpreter changes that let threads run bytecode in parallel. You don't need this to write thread-safe code, but it explains the performance numbers and s3 min readthreading module and concurrent.futures. It also assumes you know the basic difference between threads and processes, and why shared mutable state needs locks. You have seen how a free-threaded build lets threads run Python code on several cores. Now you decide 3 min read