|
|
|
|
|
by samsquire
1274 days ago
|
|
Yes I like Go but I am yet to do any professional development in it. Go is a M:N scheduler with M kernel threads and N lightweight threads I wrote a 1:M:N lightweight scheduler which preempts hot loops. I don't know when Golang preempt goroutines outside of a channel send - I believe it's in stack growth or in other words when a method is called. My userspace scheduler preempts while true and for loops by setting the looping variable to the limit. I wrote it in Java, C and Rust. https://GitHub.com/samsquire/preemptible-thread Does anybody know if Nim loop variables can be easily mutated from another thread? It looks they cannot |
|
Its possible to write your own async engine, or you could use the iterator yourself if you really wanted. It's actually not too hard.
Checkout: https://github.com/status-im/nim-taskpools
Edit: also Nim compiles to C, so its possible to do whatever you can do in C with a bit of fiddling. Also theres coro https://nim-lang.org/docs/coro.html