import time from multiprocessing import Pool, Value x = Value('i', 0) y = Value('i', 0) def a(): global x while True: time.sleep(.5) with x.get_lock(): x.value += 1 print("x = {}".format(x.value)) def b(): global x, y with y.get_lock(): y.value = x.value y.value += 1 print("y = {}".format(y.value)) if __name__ == "__main__": pool = Pool(processes=2) translate_result = "" pool.apply_async(a) while True: time.sleep(2) pool.apply_async(b)