3 ms·
(author here) Yes, the principles described here could easily be applied to a full Linux kernel. In fact, one of the hacks on my TODO list is to statically li
by avsm 16y ago
(author here)
Yes, the principles described here could easily be applied to a full Linux kernel. In fact, one of the hacks on my TODO list is to statically link a Mirage application against a Linux kernel (without a userspace) to run them on the bare metal.
The point of defining a single address space and the smallest possible C runtime is to start from the other end: rather than stripping away 14 million lines of C code, I preferred writing a few thousand lines and jumping straight into my runtime. It is an awful lot easier to experiment with something like http://github.com/avsm/mirage/tree/master/runtime/xen/kernelthan http://github.com/avsm/mirage/tree/master/runtime/xen/kernel... the full Linux kernel by quite a long way. Note that the current tree isn't finished yet; I'm pulling out dietlibc entirely at the moment, so the final kernel binaries float around the ~200KB mark for a typical webserver. Then, also consider hypervisor-only features like live migration or PV suspend/resume that can be further optimised heavily and more easily in a minios instead of Linux. Or that Mirage is single-vCPU and event-driven only (no interrupts), and it starts to look quite different from Linux.
The Mirage IO library is also very portable; an application which uses only TCP/UDP (instead of the lower level Ethernet) will compile on Linux/*BSD using select/epoll/kqueue sockets to be "just" a high performance webserver. The cool thing is that by using these APIs, we can also build applications that compile to small specialised operating systems, while developing them as usual on UNIX.
For a final entertaining hack, they are also portable enough to run directly in the browser as Javascript applications thanks to Jake Donham's ocamljs project. We're still integrating the Websocket code in to make this properly finished, but it's a fine side experiment into portability :-)
- wmf 16y agoFor the specific problem of a contiguous heap, I don't even think kernel modifications are necessary; the VM should be able to look at /proc/self/maps and find the appropriate address space. In general I realize that y'all are looking for rationalizations for an exokernel-style design, but IMO they need to be fundamental issues and not bugs.
- avsm 16y agoI think you missed the bit of my reply where I explained how this could all work on Linux too. And you seemed to have also missed the other bit where I explained why a microkernel is nicer (hint: concurrency, no need for multiple processes or user space context switches, etc).