Chapter 2. Thread-based Parallelism

In this chapter, we will cover the following recipes:

  • How to use the Python threading module
  • How to define a thread
  • How to determine the current thread
  • How to use a thread in a subclass
  • Thread synchronization with Lock and RLock
  • Thread synchronization with semaphores
  • Thread synchronization with a condition
  • Thread synchronization with an event
  • How to use the with statement
  • Thread communication using a queue
  • Evaluating the performance of multithread applications
  • The criticality of multithreaded programming

Introduction

Currently, the most widely used programming paradigm for the management of concurrence in software applications is based on multithreading. Generally, an application is made by a single process that is divided ...

Get Python Parallel Programming Cookbook 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.