CSR: Small: Operating Systems Kernels in High-Level Languages
Massachusetts Institute Of Technology, Cambridge MA
Investigators
Abstract
Most software depends on the correctness and efficiency of the underlying operating system kernel, since the kernel mediates access to resources such as storage, network, and memory. Kernels are typically implemented in low-level languages, for example, the Linux kernel is written in the C language; such languages are efficient but difficult to use correctly. In contrast, implementing kernels in high-level languages could in principle result in both reduced programmer effort and reduced incidence of bugs. This research will explore the costs and benefits of implementing kernels in high-level languages. The main reason kernels use C is performance. C allows a kernel to define its own high-performance mechanisms for memory management, thread scheduling, interrupts, etc. In contrast, high-level languages tend to prescribe specific particular mechanisms in these areas, which are difficult to change. One potential problem is that high-level languages are often garbage-collected to improve safety, but garbage collection is widely viewed as too slow to use in kernels. This project will first investigate performance: whether a kernel written in a high-level language can be as fast as a kernel written in C. The project will implement a kernel using the Go language, a type-safe, garbage-collected language with good support for threads. Then, the plan is to compare performance with existing C kernels such as Linux, OpenBSD, and FreeBSD. It is expected there will be a need to face efficiency and functionality challenges, particularly in the use of garbage collection for large kernel data structures such as file and page caches. The project's second area of focus will be to exploit the high-level language to achieve multi-core in-kernel parallelism in situations that are not practical when using C. C impedes flexible use of transient threads, since the programmer must supply the logic to decide when the last thread has finished using each shared object, which can then be freed. Extensive use of threads is much easier when a garbage collector automates this task. The plan is to exploit Go's garbage collection by implementing complex system calls such as fork and exec using internal worker threads on multiple cores. The team will evaluate whether the resulting performance and scalability improvement can be made to outweigh the costs of garbage collection and thread overhead. Intellectual merit. This work will shed quantitative light on the effect of language choice on kernel performance, a question that is currently understood mostly anecdotally. The interaction of garbage collection with the specific ways kernels use memory is particularly worth understanding. The investigation of in-kernel parallelism will exploit high-level language support to harness techniques that are impractical in C kernels. Broader impacts. The work has the potential for broad impact because most software depends critically on services provided by the operating system kernel. Using a better language for the kernel would likely reduce the prevalence of bugs and increase the ease with which kernel developers can provide desirable new features. Providing solid evidence to support an eventual switch to language technology which ought to make kernels more reliable and easier to develop is the intended outcome.
View original record on NSF Award Search →