Say I have the Main processes and 2 additional processes A and B. In this program A is supposed to send data to B. If we have some code like this:
from multiprocessing import Process, Queue
def process_a(iterable, q):
for x in iterable:
q.put(x)
def process_b(q):
while some_condition():
x = q.get()
iterable = some_iterable()
q = Queue()
pa = Process(target=process_a, args=(iterable, q))
pb = Process(target=process_b, args=(q,))
pa.start()
pb.start()
pa.join()
pb.join()
given that the Queue q was created in the Main process, does the data flow like this?
A => Main => B
If so, is there a way to have a Queue initialized on B and passed to A such that data goes directly from A to B skipping Main?