Introduce to a new co-routine language
github.com
github.com
Some notes on the preemption mechanism would be cool too. One of the classic problems with a purely cooperative multitasking system is that the coroutines can become starved in hot loops. Iirc go fixed this by adding preemption using a timer. I've seen some applications use interrupts for this in embedded, but those are expensive too.
My understanding is that in Lua and JS coroutines are cooperative, and in Melang, preemptive: this is the key advantage.
for (i = 0; i < 100; ++i) {
eval('processor.mln', i);
}
Can we not reference a programmatic construct?The scheduler preempts the kernel threads and lightweight threads to switch processing between them and uses timeslices.
I wonder if I can integrate coroutine support as I'm not sure what the difference between a coroutine and a lightweight thread is.
How does it preempt?
I set the for loops and while loops to their limit from the scheduler thread! This ends hot loops!
https://melang.org/coroutine.html
Are there benefits to this approach?