Re:Cooperative Threading
by yellowapple on Wednesday November 13, 2019 @06:36PM
(#21531017)
If you're implementing a VM, it's straightforward to do this by counting the number of virtual instructions executed for a given "process" and switching to the next one after so many executions. This is, in fact, how Erlang's VM works, and how it's able to achieve preemptive multitasking entirely in userspace (and therefore avoiding the userspace<>kernelspace context switches).
[ Parent
| on HN ]
There are no comments on this comment yet.