Reimplenting Linux Kernel in Python

Carlos Ribeiro carribeiro at gmail.com
Thu Oct 14 18:25:57 CEST 2004


On 14 Oct 2004 01:44:29 GMT, Grant Edwards <grante at visi.com> wrote:
> > This does not meant that other languages cant be used; it only
> > means that C is a natural choice.
> 
> I still don't see why.
> 
> > Of course, you can provide a C-like interface for a Python program
> > (for example). But a OS written in pure Python would make a much
> > better use of the language if it provides a Pythonic interface. I
> > believe we can agree on this point, dont you think?
> 
> Not really -- the interace between the kernel and user-space
> isn't particulary C-oriented.  IIRC on the x86 platform, you
> make a system call by loading values into registers and
> executing an interrupt instruction.  You can't even make a
> Linux system call on Linux using standard C.  You have to use
> assembly language wrappers that convert between the system call
> API and the C API.  It would be just as easy to make those
> assembly language wrappers convert to a Pascal or Python API.

Now I see your point. It remembers me a little bit about the
discussions between GNU/Stallman and Linux/Linus on what makes a OS.
The kernel is one thing, the OS is another beast. I still think that a
language such as Python can be used to write the OS -- in the sense
where the name Linux is usually called upon (even if technically
incorrect, as the GNU/Stallman camp would quickly point out); it
includes high level APIs, much above the low-level kernel calls . But
the kernel itself is the hard part for a high level language.

As for C being a natural choice as far as the kernel part is
concerned... it may be because it compiles to efficient code, or
because it facilitates integration with assembler, or because it can
efficiently uses registers... Who knows? But the main reason is
probably simple: it's because everyone is just used to it.

-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list