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

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
主站蜘蛛池模板: 镇平县| 万盛区| 洛阳市| 会理县| 汉阴县| 牟定县| 常州市| 玉田县| 化州市| 威海市| 静安区| 永清县| 柏乡县| 萨嘎县| 开阳县| 台安县| 喜德县| 平顺县| 加查县| 寻乌县| 通海县| 白河县| 新竹市| 崇明县| 唐河县| 秭归县| 江北区| 两当县| 永春县| 南充市| 德安县| 陆川县| 梁河县| 永寿县| 高清| 铁岭县| 龙山县| 都江堰市| 上思县| 四川省| 咸宁市|