""" Exemple d'utilisation de multiprocessing documentation https://docs.python.org/3/library/multiprocessing.html Exemple de 2 processus qui tournent en parallèle sans communiquer. """ import os from multiprocessing import Process from time import sleep def first_processus(): print('first process:', os.getppid()) a = 0 while 1: sleep(1) a += 1 print("a =", a) def second_processus(): print('second process:', os.getppid()) b = 0 while 1: sleep(2) b += 5 print("b =", b) def main(): p = Process(target=second_processus) p.start() first_processus() if __name__ == '__main__': main()