OS Kernel in Python?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
JoshuaHornDE

OS Kernel in Python?

Post by JoshuaHornDE »

Hello,

Is it possible to write an OS kernel in Python? If you don't know what Python is, http://www.python.org. (Python & Basic being all that I know) I am unhappy with my current project, which turns to be more of a shell than a real OS kernel.  ???
Ranieri

Re: OS Kernel in Python?

Post by Ranieri »

The problem with kernel code is that it cannot have any dependence on ANYTHING. This means for example it cannot use the standard c library (unless you provide one explicitly).
In the case of python (or perl, or Java) the case is complicated further, as these languages are compiled into bytecode that is later interpreted. This means that you are dependent on the bytecode interpreter.

In a nutshell, python programs can only run if you are on a platform where the python interpreter can run.
If you were to try and make as much as possible in Python you would need to try and make a small kernel in assembler/c or similar that provides enough functionality for the bytecode interpreter to run.

In other words, it's not worth the effort.
Fredrick

Re: OS Kernel in Python?

Post by Fredrick »

So, basically, If a kernel was produced in Python, it would have to have it's interpreter to run.


My prob. is when I'm writing this kinda stuff (kernels) I never know what to do first!
mansonbound

Re: OS Kernel in Python?

Post by mansonbound »

you do that so often?
Charlie

Re: OS Kernel in Python?

Post by Charlie »

Well, if you learnt a bit of assembler (ASM perhaps; the intel processor language base) then you could write a basic interpreter for Python, but that would take quite a while I suspect and quite a bit of expertise.
MiniOS

Re: OS Kernel in Python?

Post by MiniOS »

But, like winzip, it can create the executable code to interprete the code itself.

If we can use Python to create a kernel with the self-interprete code, I think it is possible to use Python to create a kernel.

I can't try. I never try to develop any OS
Post Reply