3 ms·
Python threads, aren't they just single threaded execution?!
by wbsun 12y ago
Python threads, aren't they just single threaded execution?!
- sitkack 12y agoYes, they are concurrent but not parallel.
- deathanatos 12y agoSee other replies to the post you've replied to: threads in Python can be "parallel", if one of the threads releases the GIL. This can happen during calls to I/O, or more generally, any C call that decides to release the GIL. Most of the time, you're doing I/O anyways, so it suffices. If you're not (you're truly doing computation), then there is multiprocessing.
- dangoldin 12y agoYea - decent approach if you're doing a lot of IO but for computation you're limited by the GIL.
- sitkack 12y agoPeople don't seem to understand this. If you are doing lots of IO Python threads are fully performant and the GIL isn't an issue at all.