OS Emulation in Keykos

Little thought was originally given to emulation of older application environments when the Keykos kernel was designed. A very few kernel changes were found desirable when we confronted emulation. We needed some programs, such as compilers and editors from the old world. The original ‘old world’ was IBM’s CMS environment which was a slightly enhanced virtual 370. IBM provided a remarkably simple set of subroutines that would enable the common development tools to run on a virtual machine. Protection was provided by the virtual machine technology. CMS files were a figment of the imagination of CMS and lived on ‘mini disks’ which the virtual disks created by simply subdividing real disks.

When Keykos migrated to other systems the legacy software that we needed was available for Unix. Alan Bomberger had an uncanny feeling for what was expected by programs running in a Unix process. He wrote a user mode program that served as the domain keeper of a domain whose address space matched that of a Unix process. When the program in that space executed a Unix system call, the emulator (domain keeper—Alan’s program) would think ‘Unix kernel’ and do the right thing for the program that was designed for Unix. After a remarkably short series of (run the program; see what the next unsupported system call is; implement that call); the C compiler began to compile. All of this without much in the way of grand planning. We even tamed some Unix utilities for which we lacked the source by taking a bit image of the loaded utility. Our X windows came about this way.

One note here is that the Keykos segment concept served well to model the concept of the content of a Unix file. This allowed the input and output of a compilation to map directly to what was natural to Keykos.

That the emulator had access to low-level Keykos primitives which were somewhat like the underlying hardware, facilitated emulation, since the Unix kernel emulator had available functionality like the real Unix kernel.


Alan’s recent expansion on this.