February 2019
Intermediate to advanced
672 pages
16h 50m
English
Before we dive into the example code in Python, first we need to discuss specifically how we use a Queue object in our multiprocessing application. Let's say that we have a worker class that performs heavy computations and does not require significant resource sharing and communication. Yet these worker instances still need to be able to receive information from time to time during their execution.
This is where the use of a queue comes in: when we put all the workers in a queue. At the same time, we will also have a number of initialized processes, each of which will go through that queue and process one worker. If a process has finished executing a worker and there are still other workers in the queue, ...