Mill Computing, Inc. Forums The Mill Architecture coroutines & greenlets in Mill Reply To: coroutines & greenlets in Mill

Ivan Godard
Keymaster
Post count: 689

We know about co-routines 🙂 And light-weight processes for that matter, which are greenlets by another name.

The good news is that the Mill supports co-routines and microthreads in hardware. The bad news is that it’s all NYF. Expect a talk on the subject at some point.

Even without the NYF stuff, the hardware threads described in the Security talk can be used as greenlets. It ‘s a policy decision whether a given thread spawn produces an OS-known thread (and hence subject to preemptive multitasking, or does not and produces a greenlet that does voluntary multitasking. An OS swap-out saves the relevant specRegs in the current TCB. If the TCB is bound to a particular thread id then you have heavy-weight tasking. If the TCB saves (and eventually restores) the current thread id whatever it is then you have a greenlet group. The OS task switch code needs to be aware of the possibility of greenlets, but it makes no difference to the hardware.

At that level at least. There’s more, deeper, but NYF. Sorry.