1import os
2from multiprocessing import current_process, Pool
3
4
5def x(a):
6 p = current_process()
7 print('process counter:', p._identity[0], 'pid:', os.getpid())
8
9
10if __name__ == '__main__':
11 with Pool(2) as p:
12 r = p.map(x, range(4))
13 p.join()