3 ms·
Generally cooperative multitasking systems like these (anything based on greenlets, I think) mean that you are running concurrent tasks in a single process, wit
by ianb 16y ago
Generally cooperative multitasking systems like these (anything based on greenlets, I think) mean that you are running concurrent tasks in a single process, with a single set of shared data. It's basically the same as threads, only you can't have multiple tasks literally accessing the same data at the same time (though with the GIL I guess technically that's true with threads too ;).
- euccastro 16y agoJust don't access the same data? Threads, greenlets, tasklets, etc. allow you to share state, but don't force you to. Greenlets/tasklets are game changing with respect to OS threads not because they introduce new ways of working, but because their performance and scalability afford you ways of working that would be theoretically possible but impractical with threads. The GIL only widens that gap.
- jamwt 16y agoWell, it's only shared if you share it! I guess it boils down to "don't use mutable globals". That's as true in threaded environments as it is in async ones. If your requirement is that there must be system-enforced safety rather than safe practices and idioms, I'd say Python isn't the right tool (Haskell is) to begin with. As you know, Python is all about practices, idioms, and discipline.