Python Threads and the GIL
Posted by: Gustavo Felisberto in Ciência/Tecnologia, Gentoo, tags: gil, python, threadsThe Global Interpreter Lock is python’s way of solving the issues of multiple threads running on multiple cpu’s thrashing common data.
What happens is that only one thread runs at any time.
In the last week I’ve been implementing some search algorithms that would greatly benefit from multiple threads on multiple cpu’s. Some of you might say:
If you are using Unix or Cygwin you can use os.fork()
Yes I can, but I’m not even going to delve into the issues around Threads VS Fork in terms of the time it will take to spawn a thread or spawn another process.
In the work I was doing I would use threads to do very small (as in time) tasks, but spawning many threads in a small amount of time. Seems I’ll have to re-think the approach…..

Entries (RSS)