threading 123456789101112131415161718192021# multi_threaded.pyimport timefrom threading import ThreadCOUNT = 50000000def countdown(n): while n>0: n -= 1t1 = Thread(target=countdown, args=(COUNT//2,))t2 = Thread(target=countdown, args=(COUNT//2,))start = time.time()t1.start()t2.start()t1.join()t2.join()end = time.time()print('Time taken in seconds -', end - start) multiprocessing 1234567891011121314151617from multiprocessing import Poolimport timeCOUNT = 50000000def countdown(n): while n>0: n -= 1if __name__ == '__main__': pool = Pool(processes=2) start = time.time() r1 = pool.apply_async(countdown, [COUNT//2]) r2 = pool.apply_async(countdown, [COUNT//2]) pool.close() pool.join() end = time.time() print('Time taken in seconds -', end - start) GIL