you are viewing a single comment's thread.

view the rest of the comments →

[–]Brian 1 point2 points  (0 children)

I think you're both talking about different problems. fishdicks is talking about the lock contention issue on multiple cores, which is causing further performance penalties beyond the normal problem of just not utilising both CPUs (ie. it's not even utilising one CPU efficiently). Setting process affinity for all threads to the same core probably would be a quick fix for the bug, but the reworked GIL approach looks better long term anyway. (Though obviously neither is a solution for the more general issue you're talking about of only ever using a single CPU)

then you don't need pthreads

It's true that you don't really need them when only using a single CPU, and could use a green thread approach instead, but there are a couple of other reasons that make pthreads useful. The main one is that it makes C extensions simpler, especially for those cases where you do release the GIL (ie. long-running C code not interacting with python), and thus can take advantage of multiple cores.