4 ms·
I wrote a preemptive 1:M:N scheduler in C, Rust and Java. https://github.com/samsquire/preemptible-thread https://github.com/samsquire/preemptible-thread It i
by samsquire 4y ago
I wrote a preemptive 1:M:N scheduler in C, Rust and Java.
https://github.com/samsquire/preemptible-thread https://github.com/samsquire/preemptible-thread
It is a 1:M:N scheduler where there is one scheduler thread, M kernel threads and N lightweight threads. I take advantage that loop indexes can be structures and can be modified by other threads. So we can set the thread's looping variable to the limit to end the current loop and pause it and then schedule another thread.