Cooperative multitasking was the staple of early operating systems – as were system lockups due to poorly programmed applications not yielding control of the processor. While modern systems instead implement preemptive multitasking to sidestep these issues, cooperative multitasking still shines in certain applications.
A common task for most system services is to export a set of actions that do something. Until now, this meant loads of manual boilerplate code, error-prone request serialization, not quite consistent C++ interfaces, and lots of subtle (and blatant…) bugs. So I set out to find an RPC framework for use in kush-os to handle all of this for me.
I recently found myself needing reference counting semantics for arbitrary objects in kernel space. C++ libraries include std::shared_ptr and friends, but we don’t have the luxury of using that in a kernel. Thankfully, building a discount reference counting smart pointer isn’t actually all that hard.