Open diegor2 opened 7 years ago
This idea came from this blog post, years ago.
https://jvns.ca/blog/2014/03/12/the-rust-os-story/
So you want to write an operating system, let’s say for x86. You need to write this in a programming language!
Can you write your operating system in Python (using CPython, say)? You cannot. This is not being curmudgeonly! It is actually just not possible.
What happens when you write print "Hello!"
in Python?
Well, many things happen. But the last thing that happens is that the CPython interpreter will do something like printf("Hello")
. And you might think, well, maybe I could link against the code for printf
somehow!
But what printf
does is it calls the write()
system call. The write()
system call is implemented IN YOUR KERNEL.
OH WAIT YOU DON’T HAVE A KERNEL YET. YOU ARE WRITING ONE.
This also means that you can’t write a kernel as a “normal” C program which includes C libraries. Any C libraries. All C libraries for Linux are built on top of some version of libc
, which makes calls to the Linux kernel! So if you’re writing a kernel, this doesn’t work.
Simple
hello world
bootable kernel using pypy's RPython.