Queues
Queues are communication channels that are appropriate for one to many, many to one, and many to many communications between cooperating processes. Depending on how they're used, that makes them ideal for posting tasks to a worker process when we don't care which worker ends up doing the task and for collecting the results of multiple worker processes.
Any process can put a picklable object into a queue and any process can remove the next available object from the queue.
Queues are First In First Out (FIFO) data structures, which means that objects are removed from the queue in the same order that they're added. The JoinableQueue class adds a method, which allows a process to wait until the queue has been emptied by other processes. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access