-
Book Overview & Buying
-
Table Of Contents
Advanced Python Programming - Second Edition
By :
A race condition occurs when two or more threads/processes access and alter a shared resource simultaneously, resulting in mishandled and corrupted data. Race conditions also have significant implications in real-life applications, such as security, operating systems, and networking.
In this chapter, we learned how to isolate the execution of different threads/processes to tackle many forms of race conditions. We have examined how to use locks to turn a shared resource into a critical section to protect the integrity of its data. Additionally, we have discussed a number of practical disadvantages when it comes to using locks.
In the next chapter, we will consider one of the biggest problems in Python concurrent programming: the infamous Global Interpreter Lock (GIL). You will learn about the basic idea behind the GIL, its purposes, and how to effectively work with it in concurrent Python applications.