3 ms·
They do allow you to do parallelism, though. There are just some things they can't parallelize because of the GIL. Green threads also allow for parallelism, if
by zbentley 7y ago
They do allow you to do parallelism, though. There are just some things they can't parallelize because of the GIL.
Green threads also allow for parallelism, if they're scheduled onto more than one executor.
- anaphor 7y agoThat's true, behind the scenes they can be running on multiple CPUs, which is the definition of parallelism. I think threads are a bad abstraction for doing parallelism personally, though. Programs designed to run in parallel should be deterministic, unless they need concurrency for some other reason. I think trying to shoehorn parallel programming into Python's threads isn't necessarily the best approach. As far as I'm concerned, if I'm using threads and they happen to get scheduled on to multiple cores, then that's a nice optimization, but isn't necessary for what I use threads for.