Reimplenting Linux Kernel in Python
Grant Edwards
grante at visi.com
Wed Oct 13 21:44:29 EDT 2004
On 2004-10-14, Carlos Ribeiro <carribeiro at gmail.com> wrote:
>>> Besides that, Linux is Posix compliant and emulates Unix
>>> system calls to a large extend, and that also makes C a
>>> natural choice.
>>
>> Not sure I follow on that point. Any low level language that
>> can deal with a C "struct" and byte-addressible memory would be
>> fine.
>
> Well, Unix itself was written in C,
Originally it wasn't, but recent versions are.
> and a good part of the C standard library maps naturally to
> (or at least helps to implement) functions that are mandatory
> in a Posix-compliant OS.
True, but that has nothing to do with writing a kernel. When
working in kernel space, you don't have access to Posix
services or the standard C library. Since you can't use the
standard C library when writing a kernel, it doesn't matter
what language it was designed for. Likewise for any of the
Posix standards that specify the API between an application and
the system libraries.
> 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.
--
Grant Edwards grante Yow! Isn't this my STOP?!
at
visi.com
More information about the Python-list
mailing list