How can I integrate PyPy with the Linux Kernel for my OS project?

0
1
Asked By CuriousCoder92 On

I'm working on a project to create an Operating System primarily in Python. The idea is to use the Linux kernel (I've found one suitable for my target hardware) with a Python interpreter running at the highest process priority, and then build the rest of the OS—like the shell and GUI—using Python. I chose PyPy over CPython because it's reportedly 3-4 times faster, though it only supports libraries written for the Python Standard Library. I'm curious about the best way to set this up.

3 Answers

Answered By KernelWhisperer77 On

Just a note, you're mixing some OS layers here. PyPy can't run directly atop the Linux kernel since it operates in user space. A better approach would be to boot Linux and set PyPy as your main user space runtime through init. That way, everything that's running above can be done in Python. Just keep in mind, the kernel will still be responsible for handling drivers, scheduling, and memory management, while PyPy operates at the application level. If you're looking to prototype the higher-level stuff like the shell or UI, something like Runable could help speed up your iterations before you settle on a design.

Answered By MicroPythonFan23 On

You know, there’s already a bare metal Python implementation out there called MicroPython, which doesn’t need a Linux kernel at all. You might want to check that out!

Answered By CodeCrafterX On

If you’re set on using the Linux kernel, consider making your init program a Python one. This way, you can still take advantage of the kernel's features while running your higher-level routines in Python.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.