Reimplenting Linux Kernel in Python

Bengt Richter bokr at
Sun Oct 17 23:29:14 CEST 2004

On Fri, 15 Oct 2004 02:07:52 GMT, bokr at (Bengt Richter) wrote:
[... maybe misleading lack of mention of benefits of compatibility with existing stuff ;-) ...]
>Anyway, CPU instructions are just bytes. As a start, it might be interesting to try to build
>a dll extension in an mmap array and import it (be prepared for lots of crashes ;-).
>Obviously mmap etc depend on the OS, but if you had prepared a suitable bootable OS
>with a primitive file system and mmap functionality, and a userland python VM, ... well,
>it's involved, but you can get there. I'd bet pypy will eventually be at the center of
>something like that, with maybe a monolithic boot image in flash, and BIOS to boot it.
>At some point, on a suitable platform, it will be able to self-host its own development, I'd bet.
An OS in the larger sense is of course more than a kernel and some primitives, and even if it
is feasible to re-implement all kinds of utility functions in a new language, it is not very
practical[1] replace a lot of stuff except as a slow migration, happening in cases where someone
would rather rebuild than remodel. So then you wind up asking how to make your bootstrapped OS
able to run legacy binaries, or relink legacy object files with your newly-implemented primitive
libraries, and then whose linker you want to have do that, and how to execute *that* etc. So you
will probably either adopt a standard existing ABI or build some adaptation layer for your kernel
that provides it. Anyway, I just wanted to mention that I think there is enormous mass and inertia
in the way legacy tools and applications are represented in various format files, and it takes
a long time for something new to take hold. And a kludge that works to accomplish a money-making-critical
task today pretty much beats any vision for tomorrow, until someone has a new today thing ready
to compete in the tomorrow. Even then, the tendency is for the new to contain a 1401 emulator or such ;-/
[1] Of course, practicality may beat purity, but fun beats practicality ;-)

Bengt Richter

More information about the Python-list mailing list