Chapter 4. Multithreaded Programming

> With Python you can start a thread, but you can’t stop it. > Sorry. You’ll have to wait until it reaches the end of execution. So, just the same as [comp.lang.python], then?

—Cliff Wells, Steve Holden(and Timothy Delaney), February 2002

In this chapter...

Introduction/Motivation

Threads and Processes

Threads and Python

The thread Module

The threading Module

Comparing Single vs. Multithreaded Execution

Multithreading in Practice

Producer-Consumer Problem and the Queue/queue Module

Alternative Considerations to Threads

Related Modules

In this section, we will explore the different ways by which you can achieve more parallelism in your code. We will begin by differentiating between processes ...

Get Core Python Applications Programming, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.