Control Transfer in Operating System Kernels

MSR-TR-94-06 |

Control transfer is the fundamental activity in an operating system kernel. The resource management functionality and application programmer interfaces of an operating system may be delegated to other system components, but the kernel must manage control transfer. The current trend towards increased modularity in operating systems only increases the importance of control transfer. My thesis is that a programming language abstraction, continuations, can be adapted for use in operating system kernels to achieve increased flexibility and performance for control transfer. The flexibility that continuations provide allows the kernel designer when necessary to choose implementation performance over convenience, without affecting the design of the rest of the kernel. The continuation abstraction generalizes existing operating system control transfer optimizations. This dissertation also makes two practical contributions, an interface for machine-independent control transfer management inside the kernel and a recipe for converting an existing operating system kernel to use continuations. The control transfer interface exposes enough functionality to let continuation-using code be machine-independent without sacrificing performance. It provides more functionality than the current state of the art, while still hiding the machine-dependent details of control transfer, such as switching register state and changing address spaces. The recipe provides a set of techniques and advice for converting existing code and writing new code with continuations. Taken together, these contributions form a blueprint for putting continuations into practice. I have implemented continuations in the Mach 3.0 kernel from Carnegie Mellon University. This dissertation reports the performance improvements observed in that environment.