keid-lang / keid

Central repository for the Keid programming language
0 stars 1 forks source link

Add basic foundational support for microthreads #52

Open lucasbaizer2 opened 1 year ago

lucasbaizer2 commented 1 year ago

Microthreads are Keid's equivalent to Goroutines in Golang. They are very lightweight and are either executed asynchronously in the same kernel thread as other microthreads, or pooled in a kernel thread pool along with other microthreads. Asynchronous operations function as a state machine, similar to IEnumerator<T> in C#. The Keid runtime receives events either to block a microthread or to resume it, which is all performed without any actual thread halts or locking; other resources are given priority until an interrupt event to the Keid runtime is received that being executing the next state of the microthread state machine.