can python do some kernel stuff?

Diez B. Roggisch deets at nospam.web.de
Fri May 23 06:50:42 EDT 2008


Andrew Lee schrieb:
> Diez B. Roggisch wrote:
>> Jimmy schrieb:
>>> On May 23, 3:05 pm, Andrew Lee <fiacre.patr... at gmail.com> wrote:
>>>> 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



More information about the Python-list mailing list