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, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.