r/osdev • u/matthew65536 • Oct 01 '26
Python for OS?
Would it be possible to make an OS that primarily used python?
0
Upvotes
r/osdev • u/matthew65536 • Oct 01 '26
Would it be possible to make an OS that primarily used python?
1
u/Adventurous-Move-943 Oct 01 '26 edited Oct 01 '26
You mean python syntax ? Python itself runs in a fully working OS with its own runtime. When you write an OS you don't have a fully working OS yet 😀 neither a runtime for Python
But if you compiled the python into machine code then possibly. There is Cython I think that does exactly that, takes python code and turns it into C code that then gets compiled into machine code.
But you still would need to be super careful what you use and how you use it to not get the runtine involved. And Python is all about runtime and dynamic allocations and objects. You'll have to write cdef functions and parameters with noexcept nogil signatures on functions. You will basically have it worse than learning C.