from multiprocessing import Process,Lockdef f(l,i): l.acquire() print('hello world',i) l.release()if __name__ == '__main__': lock = Lock() for i in range(100): p = Process(target=f,args=(lock,i)) p.start()