20

yes, not a unix os but rather unix-like, and i want to program all of it on python, is that possible?? even the kernel, i want it all python. i know most kernels use c++ or c* but maybe python has a library to turn c* into python?? i'm still sort of a beginner but thanks and i would appreciate the answers

you are viewing a single comment's thread
view the rest of the comments
[-] ursakhiin@beehaw.org 3 points 1 day ago

I'm not going to tell you you shouldn't do that, I think everybody else has done enough telling others what to do. I'll try to focus more on what you'd need to accomplish and why what you're asking hasn't been done.

Building an OS involves a lot of complex work using very low level calls. The easiest way to think about it, IMO, is that whatever language you use needs to be able to communicate directly with the hardware without any abstraction between the code and the hardware after it's compiled.

Basic Python, out of the box, requires multiple levels of abstraction to run.

(I'm simplifying here) You write code which is run through an interpreter. The interpreter is a compiled application that translates Python into code the operating system can understand. Then the operating system translates that to calls the hardware can understand.

In that process, the python code is translated to byte code, assembly, and machine code. The Python virtual machine handles memory management for you. It also handles some processing concepts for you.

You'd need to start by finding (or inventing) a solution that compiles Python to assembly without the need of an interpreter or OS in between you and the hardware. It's worth noting here that Python itself isn't even fully written in Python and is instead written largely in C because Python isn't a compiled language. You'd then need to extend Python with the ability to completely manage memory and processor threads without the VM. You'd need to do that because that's really the main purpose of an operating system.

Something we learn in programming is choosing the right tool for the job. Python isn't a great option for this type of project because the requirements just to get to where you can start are so high that it's not really considered worth while. Is it possible, yes, in theory. But without the python interpreter and VM, you'd have to ask if you're really developing Python or something else that just uses pythons syntax.

this post was submitted on 09 Jan 2025
20 points (73.8% liked)

Programming

17788 readers
151 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS