Tek's Domain


Python: Multithreading, Multiprocessing, and the GIL Explained

2020-02-08 3 min read Programming Tech explained Teknikal_Domain Unable to load comment count

One of the many things that make Python such a popular and powerful language is that you can easily divide your code into multiple concurrent threads rather easily, take this for example:

from threading import Thread

def thread_func(n):
    print(f"I'm thread number {n}!")

for t in range(4):
    t = Thread(target=thread_func, args=[t])

4 threads! Easy, right?

Well, not exactly.

Continue reading