Why the processing is locked after excuting Queue().put and Queue().get in multiprocessing? And if the array is small like np.ones((2, 2)), the program works well. It looks weird. How to solve it when the array is large?
import multiprocessing as mp
import numpy as np
def solve(queue):
for i in range(3):
queue.put(np.ones((20, 20)))
print('put')
def func():
jobs = []
queue = mp.Queue()
for i in range(5):
p = mp.Process(target=solve, args=(queue,))
jobs.append(p)
p.start()
print('start')
for j in jobs:
j.join()
print('end')
if __name__ == '__main__':
func()