Linux kernel modules C and Java [message #137225] |
Wed, 02 February 2005 09:14  |
Eclipse User |
|
|
|
Hi,
On Linux (Intel), is it possible to call Java from a loadable kernel module
written in C? I guess I'm not asking about JVM invocation API or JNI but
whether the environment in which such a module executes (kernel space etc)
makes it possible to use invocation API and JNI.
Thanks/Mikael
|
|
|
|
|
Re: Linux kernel modules C and Java [message #137475 is a reply to message #137370] |
Thu, 03 February 2005 17:17  |
Eclipse User |
|
|
|
Mikael Hakman wrote:
> Many thanks, Scott!
>
> So, the problem is that JVM does not run in kernel space. Any hope that we
> will get such a JVM? Perhaps one of those embedded, micro or nano JVMs?
Kernel dynamic memory allocation is not the same as user space dynamic
memory allocation; it's a critical piece of code where you don't want
memory fragmentation if you can avoid it. You could port a micro or nano
JVM into the kernel, but you'll have to cope with a lot of manual memory
management (i.e., allocating slabs of memory, doing GC within those
slabs.) It's not like you can just go off and malloc() a few bytes.
Basically, given the pain of the actual undertaking, I really doubt that
anyone except someone who's trying to rack up geek points and no social
life would do it. In other words, it'll probably be done next week by
some really enterprising hacker. But not me, since I think I understand
the complexity of the problem and I have other things to do in life.
> Another question, AFAIK gcc is able to compile Java into native code (with
> some restrictions of what the code can do). Would such a code be usable in
> kernel space? Or would run-time library that this code needs be a problem?
If you look at the compiler's output, it's C++. Can you put C++ into a
mainline Linux kernel? IIRC, there's also the gcj runtime. And then you
have to cope with code that hasn't been compiled and is still JVM byte
codes... taking you back to step one.
|
|
|
Powered by
FUDForum. Page generated in 0.07136 seconds