How can I integrate PyPy with the Linux Kernel for my OS project?
Asked by
!try the side entrance
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.
Answers
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.
Reply to this answer
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!
Reply to this answer
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.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions