if __name__ == '__main__':
    multiprocessing.set_start_method('spawn')
pool = multiprocessing.Pool(4, maxtasksperchild=1)
pool.map(f, [5] * 30, chunksize=1)
multiprocessing.Pool with maxtasksperchild produces equal PIDs