4 ms·
>synchronization points are explicit Hmmm, I'd have just called it cooperative threading/multitasking then. Or do you think that would be wrong?
by _0ffh 7y ago
>synchronization points are explicit
Hmmm, I'd have just called it cooperative threading/multitasking then. Or do you think that would be wrong?
- ghusbands 7y agoCoroutines and cooperative threading/multitasking are indeed threading. I assume they meant to say that it was neither preemptive nor parallel, which makes it somewhat limited. Some people think a system has to be one or both of those to be called threading.
- Jasper_ 7y agoFor me, and for a vast majority of people I'd say, the word "threading" in common parlance implies pre-emptive scheduling with implicit synchronization points.
- TeMPOraL 7y agoIt wouldn't. That's literally what coroutines are. In-process, lightweight, cooperative multitasking, built in as a language feature (or at least close enough to it).
- DagAgren 7y agoIt is not. Coroutines are a much more fundamental feature. They can be used to implement cooperative multitasking, and since that is such a common use case, they have gotten confused with the concept of cooperative multitasking. Actual coroutines are a lot more flexible and interesting than just cooperative multitasking, though.
- _0ffh 7y agoErm, I'm pretty sure I can implement coroutines using cooperative multitasking. Also, the other way around. So I'd say they're equivalent in that sense.
- DagAgren 7y agoCooperative multitasking usually involves a scheduler. Coroutines are called explicitly, which you can't do through a scheduler.
- _0ffh 7y agoNow you're really just making claims about implementation details. That doesn't make one concept more "fundamental" or "flexible" than the other, while "interesting" is just a subjective judgement.
- DagAgren 7y agoI'm not. The scheduler decides what code to execute next, the caller does not. With coroutines, the caller explicitly decides what code to execute next. That's a fundamental difference.
- _0ffh 7y agoExplicitly selecting what code to execute next can be trivially achieved in a cooperative multitasking system. Naturally, the details work out differently. That's because both concepts are equivalent, just not the same.
- DagAgren 7y agoSure, you could implement some kind of anti-scheduler, but that is just plain silly, and really doesn't affect the point at all. You can do anything in any Turing-complete language, but that doesn't mean that Brainfuck is equivalent to Prolog in any way that is actually useful or interesting.
- _0ffh 7y agoThat's like saying that implementing a scheduler using coroutines is silly. Yet people do it all the time. * You may keep moving the goal posts all you want, your original claims were wrong and they stay wrong. Can't you just say something like "I like coroutines more, they are so minimalist and elegant, and yet they are equivalent in power to cooperative multitasking!". I'd actually subscribe to that notion. But not your overblown claims of objective superiority. * One has to wonder why so many people crave a scheduler, when they already have coroutines? Maybe because having a scheduler makes certain things easier than naked coroutines?
- gpderetta 7y agocooperative threading is just coroutines plus a scheduler.