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

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
主站蜘蛛池模板: 含山县| 丰顺县| 连南| 璧山县| 南投县| 丘北县| 二连浩特市| 赤城县| 浑源县| 青河县| 迭部县| 化隆| 皋兰县| 靖州| 丰原市| 柳林县| 萨迦县| 蓬安县| 永泰县| 龙川县| 台湾省| 深水埗区| 商丘市| 营山县| 个旧市| 合作市| 嫩江县| 桑植县| 故城县| 渝北区| 神池县| 剑阁县| 易门县| 洛南县| 海淀区| 泰兴市| 余江县| 镇雄县| 贞丰县| 旅游| 台北市|