O'Reilly logo

Python Parallel Programming Cookbook by Giancarlo Zaccone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to synchronize processes

Multiple processes can work together to perform a given task. Usually, they share data. It is important that the access to shared data by various processes does not produce inconsistent data. Processes that cooperate by sharing data must therefore act in an orderly manner in order to access that data. Synchronization primitives are quite similar to those encountered for the library and threading.

They are as follows:

  • Lock: This object can be in one of the states: locked and unlocked. A lock object has two methods, acquire() and release(), to manage the access to a shared resource.
  • Event: This realizes simple communication between processes, one process signals an event and the other processes wait for it. An Event object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required