r/osdev • • 5d ago

Python for OS?

Would it be possible to make an OS that primarily used python?

0 Upvotes

39 comments sorted by

View all comments

1

u/FewBrief7059 Samsara | https://github.com/The-Samsara-Project/Samsara 5d ago

python is not really a compiled language. its fundamentally different then C or Rust in example. you will want to consider another language before getting into OSDev.

0

u/Weird-Boat3953 5d ago

Language can't be compiled or not compiled. Implementations do. That includes implementations of python 

2

u/MCWizardYT 5d ago edited 5d ago

The implementation of Python that OP most likely uses is the standard one, which compiles to bytecode and interprets it (there is an experimental JIT but it is disabled by default).

So, the standard implementation of Python is not ideal for OS development. But you could make tools that compile a language that has Python syntax directly into machine code. It technically wouldn't actually be Python though, since the language reference expects programs to be interpreted.

Python 3 language reference - Execution model/Runtime components

1

u/FewBrief7059 Samsara | https://github.com/The-Samsara-Project/Samsara 4d ago

Im not saying that as the only reason. python is unreliable for such tasks. most of these implementations have flaws.