473,498 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can python do some kernel stuff?

Hi to all

python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.

So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
Jun 27 '08 #1
20 6897
Jimmy wrote:
Hi to all

python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.

So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?

http://wiki.python.org/moin/elmer

Jun 27 '08 #2
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?

http://wiki.python.org/moin/elmer
well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
Jun 27 '08 #3
Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
>Jimmy wrote:
>>Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer

well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez
Jun 27 '08 #4
Jimmy wrote:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
>Jimmy wrote:
>>Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer

well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
http://docs.python.org/lib/module-curses.html

Unless you are using an ancient piece of hardware -- a terminal is a
pseudo terminal and a key stroke isn't a kernel event at all.

If you were looking for examples of kernel level functions you might
want to consider driver interfaces -- how to program device interfaces
-- that, too, can be done in Python -- but, again, you are always
calling some underlying C function exposed via SWIG or another cross
compilation tool. Python doesn't reinvent system calls! :-)
Jun 27 '08 #5
Diez B. Roggisch wrote:
Jimmy schrieb:
>On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
>>Jimmy wrote:
Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer

well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?

What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez
http://www.kernel-panic.it/programming/py-pf/

Of course you can code kernel routines in Python -- you are just calling
the underlying C interface. The GIL means you have to manage
threadsafety on your own -- it doesn't imply kernel programming can not
be done.

I'm not talking about writing an OS in Python (though a simple DOS-like
OS is very possible). Nor would I suggest writing device drivers in
Python -- but of course you can call kernel routines and manage some
kernel resources effectively. Python's IPC libraries expose kernel
functionality.
Jun 27 '08 #6
Andrew Lee schrieb:
Diez B. Roggisch wrote:
>Jimmy schrieb:
>>On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer

well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?

What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez

http://www.kernel-panic.it/programming/py-pf/

Of course you can code kernel routines in Python -- you are just calling
the underlying C interface. The GIL means you have to manage
threadsafety on your own -- it doesn't imply kernel programming can not
be done.
I understood the OP's question as "can one program kernelspace routines
in python". Which I don't think is possible. And I don't see how py-pf
does that either.

Diez
Jun 27 '08 #7
Diez B. Roggisch wrote:
Andrew Lee schrieb:
>Diez B. Roggisch wrote:
>>Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
>Hi to all
>python now has grown to a versatile language that can
>accomplish tasks for many different purposes. However,
>AFAIK, little is known about its ability of kernel coding.
>So I am wondering if python can do some kernel coding that
>used to be the private garden of C/C++. For example, can python
>intercept the input of keyboard on a system level? someone told me
>it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer

well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?

What has that todo with kernel programming? You can use e.g. pygame
to get keystrokes. Or under linux, read (if you are root) the
keyboard input file - I've done that to support several keyboards
attached to a machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez

http://www.kernel-panic.it/programming/py-pf/

Of course you can code kernel routines in Python -- you are just
calling the underlying C interface. The GIL means you have to manage
threadsafety on your own -- it doesn't imply kernel programming can
not be done.

I understood the OP's question as "can one program kernelspace routines
in python". Which I don't think is possible. And I don't see how py-pf
does that either.

Diez

OP: "I am wondering if python can do some kernel coding that
used to be the private garden of C/C++."

The answer is yes. IPC and py-pf are examples. If you don't think of
packet filtering as kernel coding, I can understand. But clearly the
Python interfaces to fork(), waitpid(), signal(), alarm() and so forth
are forays into the once private garden of C.
Jun 27 '08 #8
>
OP: "I am wondering if python can do some kernel coding that
used to be the private garden of C/C++."
"kernel coding" is pretty clear I'd say - coding a or in the kernel. Not
coding that runs on an OS that happens to have a kernel.
The answer is yes. IPC and py-pf are examples. If you don't think of
packet filtering as kernel coding, I can understand. But clearly the
Python interfaces to fork(), waitpid(), signal(), alarm() and so forth
are forays into the once private garden of C.
Also not "kernel coding" in my book. system-near coding - yes. But not
coding a kernel...

Diez
Jun 27 '08 #9
On May 23, 5:53 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer
well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?

What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez
sorry, my aim is not limited to one particular program. Yes, many
library can
permit you to respond to keyboard event, however, what I want is a
universal
function. as long as a key is pressed, no matter where, my program can
repond.

I am quite strange with this topic. But according to my understanding,
any event, keyboard event
for example, once triggered, will be dilivered by keyboard driver to X
system, and then
any running program can either choose to respond or ignore. So my
question can be translated to:
how to make my program respond ?
Jun 27 '08 #10
On May 23, 11:14 pm, Jimmy <mcknight0...@gmail.comwrote:
On May 23, 5:53 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
>Jimmy wrote:
>>Hi to all
>>python now has grown to a versatile language that can
>>accomplish tasks for many different purposes. However,
>>AFAIK, little is known about its ability of kernel coding.
>>So I am wondering if python can do some kernel coding that
>>used to be the private garden of C/C++. For example, can python
>>intercept the input of keyboard on a system level? someone told me
>>it's a kernel thing, isn't it?
>>http://wiki.python.org/moin/elmer
well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.
And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.
Diez

sorry, my aim is not limited to one particular program. Yes, many
library can
permit you to respond to keyboard event, however, what I want is a
universal
function. as long as a key is pressed, no matter where, my program can
repond.

I am quite strange with this topic. But according to my understanding,
any event, keyboard event
for example, once triggered, will be dilivered by keyboard driver to X
system, and then
any running program can either choose to respond or ignore. So my
question can be translated to:
how to make my program respond ?
maybe I'd better elaborate on my question. Back to my original
question:
intercept keyboard event on a system level. If you are writing program
in
emacs, of course, the keyboard inputs are meant for emacs only. What
I
want is no matter what program you're running, keyboard events can be
anyway caught by my program.

Am I clear with myself? :)
Jun 27 '08 #11
Jimmy schrieb:
On May 23, 11:14 pm, Jimmy <mcknight0...@gmail.comwrote:
>On May 23, 5:53 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
>>Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
>Hi to all
>python now has grown to a versatile language that can
>accomplish tasks for many different purposes. However,
>AFAIK, little is known about its ability of kernel coding.
>So I am wondering if python can do some kernel coding that
>used to be the private garden of C/C++. For example, can python
>intercept the input of keyboard on a system level? someone told me
>it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer
well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.
And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.
Diez
sorry, my aim is not limited to one particular program. Yes, many
library can
permit you to respond to keyboard event, however, what I want is a
universal
function. as long as a key is pressed, no matter where, my program can
repond.

I am quite strange with this topic. But according to my understanding,
any event, keyboard event
for example, once triggered, will be dilivered by keyboard driver to X
system, and then
any running program can either choose to respond or ignore. So my
question can be translated to:
how to make my program respond ?

maybe I'd better elaborate on my question. Back to my original
question:
intercept keyboard event on a system level. If you are writing program
in
emacs, of course, the keyboard inputs are meant for emacs only. What
I
want is no matter what program you're running, keyboard events can be
anyway caught by my program.

Am I clear with myself? :)
Do you want to intercept the call (prevent that it is passed through to
e.g. emacs), or are you merely interested in getting it? If the latter,
you can (as root) access the /dev/input keyboard device and get the
scan-codes.

The former is more complicated - without research I don't know out of my
head how to accomplish that. But it must be possible, as e.g. KDE
observes global key-shortcuts. Most probably a X-server thing.

Diez
Jun 27 '08 #12
On May 24, 12:34 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Jimmy schrieb:
On May 23, 11:14 pm, Jimmy <mcknight0...@gmail.comwrote:
On May 23, 5:53 pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
>Jimmy schrieb:
On May 23, 3:05 pm, Andrew Lee <fiacre.patr...@gmail.comwrote:
Jimmy wrote:
Hi to all
python now has grown to a versatile language that can
accomplish tasks for many different purposes. However,
AFAIK, little is known about its ability of kernel coding.
So I am wondering if python can do some kernel coding that
used to be the private garden of C/C++. For example, can python
intercept the input of keyboard on a system level? someone told me
it's a kernel thing, isn't it?
http://wiki.python.org/moin/elmer
well, straightly speaking, how can I know a key is pressed on a system-
level if
using python?
What has that todo with kernel programming? You can use e.g. pygame to
get keystrokes. Or under linux, read (if you are root) the keyboard
input file - I've done that to support several keyboards attached to a
machine.
And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.
Diez
sorry, my aim is not limited to one particular program. Yes, many
library can
permit you to respond to keyboard event, however, what I want is a
universal
function. as long as a key is pressed, no matter where, my program can
repond.
I am quite strange with this topic. But according to my understanding,
any event, keyboard event
for example, once triggered, will be dilivered by keyboard driver to X
system, and then
any running program can either choose to respond or ignore. So my
question can be translated to:
how to make my program respond ?
maybe I'd better elaborate on my question. Back to my original
question:
intercept keyboard event on a system level. If you are writing program
in
emacs, of course, the keyboard inputs are meant for emacs only. What
I
want is no matter what program you're running, keyboard events can be
anyway caught by my program.
Am I clear with myself? :)

Do you want to intercept the call (prevent that it is passed through to
e.g. emacs), or are you merely interested in getting it? If the latter,
you can (as root) access the /dev/input keyboard device and get the
scan-codes.

The former is more complicated - without research I don't know out of my
head how to accomplish that. But it must be possible, as e.g. KDE
observes global key-shortcuts. Most probably a X-server thing.

Diez
thanks, right now I am content with just knowing a key is pressed.
as you said, I checked /etc/input/event1 which seems the input of
keyboard. Then I got some extremely strange code. however, how can
I just simply know a key is pressed?
Jun 27 '08 #13
On 23 ÍÁÊ, 22:32, Jimmy <mcknight0...@gmail.comwrote:
[...]
however, how can I just simply know a key is pressed?
If you are on Linux, use XLib
http://python-xlib.sourceforge.net/

You need to catch the KeyPress or KeyRelease X events.
while 1:
ev = display.next_event()
if ev.type == X.KeyPress:
key_code = ev.detail
....
....

Ivan

Jun 27 '08 #14
Andrew Lee wrote:
Diez B. Roggisch wrote:
>Andrew Lee schrieb:
>>Diez B. Roggisch wrote:

What has that todo with kernel programming? You can use e.g. pygame
to get keystrokes. Or under linux, read (if you are root) the
keyboard input file - I've done that to support several keyboards
attached to a machine.

And the original question: no, python can't be used as kernel
programming language. Amongst other reasons, performance & the GIL
prevent that.

Diez
http://www.kernel-panic.it/programming/py-pf/

Of course you can code kernel routines in Python -- you are just
calling the underlying C interface. The GIL means you have to
manage threadsafety on your own -- it doesn't imply kernel
programming can not be done.


I understood the OP's question as "can one program kernelspace
routines in python". Which I don't think is possible. And I don't see
how py-pf does that either.

Diez

OP: "I am wondering if python can do some kernel coding that
used to be the private garden of C/C++."

The answer is yes. IPC and py-pf are examples. If you don't think of
packet filtering as kernel coding, I can understand. But clearly the
Python interfaces to fork(), waitpid(), signal(), alarm() and so forth
are forays into the once private garden of C.
Being able to call routines in the kernel is *not* the same as kernel
coding. Calling C routines is *not* the same as kernel coding.
Actually writing the routines that are to be called, and that constitute
the kernel itself, *is* kernel coding. And as wonderful as Python is,
it is *not* for kernel coding.

Having just looked at Py-PF, it is *managing* the firewall, not
implementing it. Again, not kernel coding.
--
Ethan
Jun 27 '08 #15
On Jun 4, 12:41 am, Ethan Furman <et...@stoneleaf.uswrote:
the kernel itself, *is* kernel coding. And as wonderful as Python is,
it is *not* for kernel coding.
Not in its present form, no, it would take some porting. But aside
from that, is there any reason one could not embed a python
interpreter in the kernel?

Jun 27 '08 #16
>The answer is yes. IPC and py-pf are examples. If you don't
>think of packet filtering as kernel coding, I can understand.
But clearly the Python interfaces to fork(), waitpid(),
signal(), alarm() and so forth are forays into the once
private garden of C.
The routines listed above aren't in the kernel. They're in
libc just like routines such as printf, memcpy, etc. The above
libc routines do make system calls into the kernel to perform
the desired functions, but those routines are not in the
kernel, and calling them is certainly not "kernel coding".

Yes, Python provides specific wrappers for many C library
functions.

Yes, the ctypes module provides a generic method for calling
foreign library functions.

No, using those wrappers is not what anybody I know would call
"kernel coding".
Being able to call routines in the kernel is *not* the same as
kernel coding.
As far as I know, Python doesn't provide the user with the
ability to make system calls into the kernel. Even if it did,
that isn't really "kernel coding" either. It's just making
system calls.
Calling C routines is *not* the same as kernel coding.
Actually writing the routines that are to be called, and that
constitute the kernel itself, *is* kernel coding. And as
wonderful as Python is, it is *not* for kernel coding.

Having just looked at Py-PF, it is *managing* the firewall,
not implementing it. Again, not kernel coding.
Didn't somebody once demonstrate how to put a VM into kernel
space so that you could write kernel code in Python? Maybe it
was just a discussion about how it could be done in theory.

There have been a few JVM-in-hardware projects, so I suppose
you could use Jython to write kernel code for those machines.

--
Grant Edwards grante Yow! I have accepted
at Provolone into my life!
visi.com
Jun 27 '08 #17
On Wed, 04 Jun 2008 09:41:07 -0500, Grant Edwards wrote:
>>The answer is yes. IPC and py-pf are examples. If you don't think of
packet filtering as kernel coding, I can understand. But clearly the
Python interfaces to fork(), waitpid(), signal(), alarm() and so forth
are forays into the once private garden of C.

The routines listed above aren't in the kernel. They're in libc just
like routines such as printf, memcpy, etc. The above libc routines do
make system calls into the kernel to perform the desired functions, but
those routines are not in the kernel, and calling them is certainly not
"kernel coding".

Yes, Python provides specific wrappers for many C library functions.

Yes, the ctypes module provides a generic method for calling foreign
library functions.

No, using those wrappers is not what anybody I know would call "kernel
coding".
>Being able to call routines in the kernel is *not* the same as kernel
coding.

As far as I know, Python doesn't provide the user with the ability to
make system calls into the kernel. Even if it did, that isn't really
"kernel coding" either. It's just making system calls.
>Calling C routines is *not* the same as kernel coding. Actually writing
the routines that are to be called, and that constitute the kernel
itself, *is* kernel coding. And as wonderful as Python is, it is *not*
for kernel coding.

Having just looked at Py-PF, it is *managing* the firewall, not
implementing it. Again, not kernel coding.

Didn't somebody once demonstrate how to put a VM into kernel space so
that you could write kernel code in Python? Maybe it was just a
discussion about how it could be done in theory.

There have been a few JVM-in-hardware projects, so I suppose you could
use Jython to write kernel code for those machines.
I can't understand why somebody might want to do kernel stuff in Python.
It's a *high level language*. It's for high level stuff.

OTOH Python can be easily extended to get as close to the kernel as
anyone may ever need.

I decided to change my "hello world" post to use Linux system call
instead of printf.

#include <Python.h>

PyObject*
hello(PyObject* self)
{
#if defined(__GNUC__) && defined(__i386__) && defined(__linux__)
const char * hello_str = "Hello world (Linux system call)!\n";
int hello_len = 33;
asm __volatile__(
"push %%ebx;"
"movl $4, %%eax;" /* The system call for write (sys_write) */
"movl $1, %%ebx;" /* File descriptor 1 - standard output */
"int $0x80;"
"pop %%ebx;"
: /* no outputs */
: "c" (hello_str), "d" (hello_len) /* input */
);
#else
printf("Hello world!\n");
#endif
Py_RETURN_NONE;
}

static PyMethodDef functions[] = {
{"hello", (PyCFunction)hello, METH_NOARGS},
{NULL, NULL, 0, NULL},
};

DL_EXPORT(void)
init_hello(void)
{
Py_InitModule("_hello", functions);
}

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>from _hello import hello
hello()
Hello world (Linux system call)!

I'm in the mood to write "Hello world" programs today ;)

Ivan
Jun 27 '08 #18
On 2008-06-04, Ivan Illarionov <iv*************@gmail.comwrote:
>Didn't somebody once demonstrate how to put a VM into kernel
space so that you could write kernel code in Python? Maybe it
was just a discussion about how it could be done in theory.

There have been a few JVM-in-hardware projects, so I suppose
you could use Jython to write kernel code for those machines.

I can't understand why somebody might want to do kernel stuff
in Python.
we choose to put Python in kernel-space and do the other
things, not because they are easy, but because they are
hard, because that goal will serve to organize and measure
the best of our energies and skills...

;)
It's a *high level language*. It's for high level stuff.
There is a lot of high-level stuff in the kernel. Performance
expectations and resource availability don't make python
and the PVM a very practical choice.
OTOH Python can be easily extended to get as close to the kernel as
anyone may ever need.

I decided to change my "hello world" post to use Linux system call
instead of printf.

#include <Python.h>

PyObject*
hello(PyObject* self)
{
#if defined(__GNUC__) && defined(__i386__) && defined(__linux__)
const char * hello_str = "Hello world (Linux system call)!\n";
int hello_len = 33;
asm __volatile__(
"push %%ebx;"
"movl $4, %%eax;" /* The system call for write (sys_write) */
"movl $1, %%ebx;" /* File descriptor 1 - standard output */
"int $0x80;"
"pop %%ebx;"
: /* no outputs */
: "c" (hello_str), "d" (hello_len) /* input */
);
#else
printf("Hello world!\n");
#endif
Py_RETURN_NONE;
}

static PyMethodDef functions[] = {
{"hello", (PyCFunction)hello, METH_NOARGS},
{NULL, NULL, 0, NULL},
};

DL_EXPORT(void)
init_hello(void)
{
Py_InitModule("_hello", functions);
}

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>from _hello import hello
hello()
Hello world (Linux system call)!

I'm in the mood to write "Hello world" programs today ;)
That's cool. A generic Linux syscall wrapper for Python
wouldn't be hard to do. Though I'm not sure what the practical
uses would be.

--
Grant Edwards grante Yow! OVER the underpass!
at UNDER the overpass!
visi.com Around the FUTURE and
BEYOND REPAIR!!
Jun 27 '08 #19
On Wed, 04 Jun 2008 11:24:11 -0500, Grant Edwards wrote:
>I can't understand why somebody might want to do kernel stuff in
Python.

we choose to put Python in kernel-space and do the other things, not
because they are easy, but because they are hard, because that goal
will serve to organize and measure the best of our energies and
skills...

;)
tinypy rewritten in assembly probably could do the kernel job. CPython is
far too big for the kernel.

Another crazy idea. What about initd/launchd replacement in pure Python?
Python would be the first PID. Isn't it more practical?

Ivan
Jun 27 '08 #20
sturlamolden <st**********@yahoo.nowrote:
>
On Jun 4, 12:41 am, Ethan Furman <et...@stoneleaf.uswrote:
>the kernel itself, *is* kernel coding. And as wonderful as Python is,
it is *not* for kernel coding.

Not in its present form, no, it would take some porting. But aside
from that, is there any reason one could not embed a python
interpreter in the kernel?
Not at all. Microsoft Research has issued a preview release of an
operating system called "Singularity" where the entire kernel and all
drivers are written as managed code. Since Python can now be used to write
managed code (via IronPython), Q.E.D.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 27 '08 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2651
by: Carl | last post by:
I have been using Python for quite some time now and I love it. I use it mainly for explorative computing and numerical prototyping, ie testing and trying out different kinds of algorithms and...
4
1560
by: Camilo Olarte | last post by:
Hi list, I was wondering : If python cgi scripts can be acceletaded by means of mod_python in apache (loading the python interpreter on apache) , then : ?Is there a way of doing the same...
34
5040
by: Maboroshi | last post by:
Hello My question has to do with python and linux - I was interested in finding out what it would take to reimplement the Linux Kernel in python basically just taking the source code from linux...
68
3690
by: Grant Edwards | last post by:
Let's say I use a GPL'd python module (e.g. something installed in site-packages) in an application. Let's also say I use py2exe to package and distribute said application. Is what I'm...
32
9747
by: David Brown | last post by:
Hello. I recently came across a free operating system called Unununium (or something like that) and it was developed in Python and Assembly. Now, I have been looking for a way to make an...
17
3965
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
65
5452
by: Amol Vaidya | last post by:
Hi. I am interested in learning a new programming language, and have been debating whether to learn Ruby or Python. How do these compare and contrast with one another, and what advantages does one...
113
5182
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
0
1341
by: Neal Becker | last post by:
Hi numeric processing fans. I'm pleased to report that you can now have convenient checkpoint/restart, at least if you are running fedora linux. Example: python -i blcr_mod.py <<< this will...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4910
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.