How to? Kernel Server + User-mode communication in Java

36 views
Skip to first unread message

Anders Rundgren

unread,
Nov 9, 2008, 4:16:31 AM11/9/08
to android-platform
Pardon my ignorance of Linux programming but maybe you could give me a
few hints based on the Android source?

I want to create a service that runs as system (kernel) process.
User-mode Java programs will comminicate with this service using a
fairly complex API.

What are the recommended techniques for communication. I don' t think
JNI is the answer since JNI runs in the context of the caller and this
service must also only exists as one shared instance.

Anders

Gergely Kis

unread,
Nov 10, 2008, 3:03:05 AM11/10/08
to android-...@googlegroups.com
Hello,

Please find my comments below.

On Sun, Nov 9, 2008 at 10:16 AM, Anders Rundgren
<anders....@telia.com> wrote:
>
> Pardon my ignorance of Linux programming but maybe you could give me a
> few hints based on the Android source?
>
> I want to create a service that runs as system (kernel) process.

Could you be a bit more specific?
What do you mean by a kernel process? Do you want your service to run
_inside_ the kernel? Or you only mean that it is a native system
service (e.g. written in C/C++, only one instance runs in the
background)

In general, unless you are adding support for a new hardware device,
new filesystem or network protocol, you should run your service as a
normal user space process. And even in the above cases, Android
provides a user space HAL layer to allow the creation of user space
drivers. So there is no need to run your service inside the kernel,
unless it is absolutely necessary.

> User-mode Java programs will comminicate with this service using a
> fairly complex API.

Android includes a nice inter-process communication mechanism called
Binder. Most parts of the system use this method to communicate,
including Java <-> Native Service communication.

>
> What are the recommended techniques for communication. I don' t think
> JNI is the answer since JNI runs in the context of the caller and this
> service must also only exists as one shared instance.

Using JNI and omitting Binder is also an option, but we would need
more information on what you want to achieve in order to give more
specific advice.

There are a few great video presentations from Google I/O here:
http://source.android.com/documentation
These provide a nice overview of how all the parts fit together.

Best Regards,
Gergely

Anders Rundgren

unread,
Nov 10, 2008, 4:06:57 AM11/10/08
to android-platform
http://virtualization.com/news/2008/10/03/open-kernel-labs-hypervisor-embbeded-in-first-android-phone

It would be very nice if somebody from the Android team could elaborate a bit on what this means for
developers of for example security-critical applications. In particular:
Is this rather a feature of the processor, the actual Android G1 implementation, or a part of the
open source plot?

It sounds very cool that you could develop user-level secure containers that relied in some way on a
single kernel-mode driver.

Anders

fred

unread,
Nov 11, 2008, 8:21:28 AM11/11/08
to android-platform

Anders Rundgren

unread,
Nov 11, 2008, 11:07:35 AM11/11/08
to android-platform

David Turner

unread,
Nov 11, 2008, 7:10:12 PM11/11/08
to android-...@googlegroups.com
it doesn't mean anything at the moment since the title of this article is slightly misleading.
Apparently, Open Kernel Labs have a variant of Linux running on top of L4 running on the
same hardware chipset than the G1. But it clearly doesn't mean that it runs on the actual
phone with all its specific hardware (and I doubt they would succeed in doing this).

It looks very similar to L4Linux which is a modified Linux kernel that runs on top of L4.
In theory that could have certain advantages (like the ability to write drivers in separate
processes isolated from the kernel itself, or have hard real-time processes running
parallel to Linux, which doesn't make any real-time guarantees),

however last I read about it, it also meant a slight decrease in performance (Please note
that I'm talking about L4Linux here; I don't know exactly what OKLabs provides, their product
might be different), and some kernel porting work anyway.

David Turner

unread,
Nov 11, 2008, 7:11:04 PM11/11/08
to android-...@googlegroups.com
Of course, feel free to correct me if you have more information.
I don't think the Android team is going to feel concerned by this right now though...

Anders Rundgren

unread,
Nov 12, 2008, 3:40:41 AM11/12/08
to android-platform
Hum, from other sources I have learnt that one of the core features of
this kind of virtualization under Linux is to achieve GPL-isolation...
> > anders.rundg...@telia.com> wrote:
>
> >>http://virtualization.com/news/2008/10/03/open-kernel-labs-hypervisor...
>
> >> It would be very nice if somebody from the Android team could elaborate a
> >> bit on what this means for
> >> developers of for example security-critical applications.  In particular:
> >> Is this rather a feature of the processor, the actual Android G1
> >> implementation, or a part of the
> >> open source plot?
>
> >> It sounds very cool that you could develop user-level secure containers
> >> that relied in some way on a
> >> single kernel-mode driver.
>
> >> Anders- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages