▲ | ashf023 2 days ago | |||||||
Interesting that very few people in that thread seem to understand Go's model, especially the author of this proposal. If you don't allow preemption, you still have a sort of coloring because most non async functions aren't safe to call in a virtual thread - they may block the executor. If you call C code, you need to swap out stacks and deal with blocking by potentially spawning more OS threads - that's what CGo does. Maybe preemption is harder in Python, but that's not clearly expressed - it's just rejected as obviously unwanted. Ultimately Python already has function coloring, and libraries are forced into that. This proposal seems poorly thought out, and also too little too late. | ||||||||
▲ | rsyring 2 days ago | parent | next [-] | |||||||
I can't speak to the more technical aspects you bring up b/c I'm not that well versed in the underlying implementations and tradeoffs. > and also too little too late. I think it very likely that Python will still be around and popular 10 years from now. Probably 20 years from now. And maybe 30 years from now. I think that's plenty of time for a new and good idea that addresses significant pain points to take root and become a predominant paradigm in the ecosystem. So I don't agree that it's too little too late. But whether or not a Virtual Threads implementation can/will be developed and be good enough to gain wide adoption, I just can't speak to. If it's possible to create a better devx than async and get multi-core performance and usage, I'm all for the effort. | ||||||||
| ||||||||
▲ | Dagonfly 2 days ago | parent | prev [-] | |||||||
I'm also surprised how often the preemptive vs. cooperative angle gets ignored in favor of the stackful vs stackless debate. If you choose a non-preemptive system, you naturally need yield points for cooperation. Those can either be explicit (await) or implicit (e.g. every function call). But you can get away with a minimal runtime and a stackless design. Meanwhile, in a preemptive system you need a runtime that can interrupt other units of work. And it pushes you towards a stackful design. All those decisions are downstream of the preemptive vs. cooperative. In either case, you always need to be able to interface with CPU-heavy work. Either through preemption, or by isolating the CPU-heavy work. |