官术网_书友最值得收藏!

Working with Threads in Python

In Chapter 1Advanced Introduction to Concurrent and Parallel Programming, you saw an example of threads being used in concurrent and parallel programming. In this chapter, you will be introduced to the formal definition of a thread, as well as the threading module in Python. We will cover a number of ways to work with threads in a Python program, including activities such as creating new threads, synchronizing threads, and working with multithreaded priority queues, via specific examples. We will also discuss the concept of a lock in thread synchronization, and we will implement a lock-based multithreaded application, in order to better understand the benefits of thread synchronization.

The following topics will be covered in this chapter:

  • The concept of a thread in the context of concurrent programming in computer science
  • The basic API of the threading module in Python
  • How to create a new thread via the threading module
  • The concept of a lock and how to use different locking mechanisms to synchronize threads
  • The concept of a queue in the context of concurrent programming, and how to use the Queue module to work with queue objects in Python
主站蜘蛛池模板: 集安市| 葵青区| 大名县| 武安市| 九江市| 凯里市| 突泉县| 长泰县| 沈丘县| 霍州市| 安康市| 东辽县| 息烽县| 九台市| 濉溪县| 夏邑县| 西乌| 吉隆县| 玉门市| 藁城市| 梨树县| 苏州市| 霞浦县| 浦东新区| 许昌市| 太康县| 福清市| 舒兰市| 微博| 时尚| 青海省| 闵行区| 新和县| 贞丰县| 双鸭山市| 永昌县| 安徽省| 洛隆县| 东丰县| 加查县| 宿迁市|