0

I read today a bit about unikernels, from what I understand it is an operating system that runs only one application.

I would like to know if it's possible to run a specific android application in an unikernel on raspberry pi.

Fuseteam
  • 103
  • 4

1 Answers1

1

I'll expand a bit on my initial comment on the question by dividing this into two distinct approaches:

  1. Implementing a unikernal which runs an application that mimics or duplicates exactly, and would be interoperable with, an existing Android application, is almost certainly possible. A caveat here is that if the app depends on network connectivity to a proprietary service, that is a major and possibly insurmountable obstacle.

  2. Implementing a unikernel which actually runs an existing Android app is probably possible, if you need to deal with the caveat just mentioned, or want to keep updates of the app in step. However, it will not save you any labour, since implementing such a unikernel environment will be much more work than implementing one that duplicates the functionality of the app (this approach likely stretches the definition of "unikernel" a bit, and would be a task much better suited to a normal OS).

By "much more work", I mean something on the scale of renting some space, hiring a team of five or ten software engineers, and being prepared to pay them full time for a year or so. That may be optimistic.

However, I'd at best qualify as "junior code monkey" on such a project, so for a more informed opinion you may want to dig deeper, as in, do some more research about the requirements and find the right place to look for more informed opinions. I think my guesstimate is reasonably close to the mark, however, so if this sounds like it is way beyond the resources you have at your disposal, it probably is.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • I see and yes it is part my resources, it was more of an inquiry. I didn't consider keeping the app up to date.i was thinking of the scenario of running a single existing android on a smart TV using raspberry pi – Fuseteam Jun 15 '16 at 18:14
  • It's a big job. Programming is a skill and it is often easy to guess where other people stand based on the questions they ask and the way they ask them, so I am not trying to belittle you (not everybody can be a master of everything), but: If this is something you were thinking of as a current project, stop now. If you are interested in bare metal or systems programming, work on your C, read appropriate textbooks, etc. Like any form of engineering (or, say, surgery, or mountain climbing), it can take the smartest of people many years applying themselves full time to achieve difficult goals. – goldilocks Jun 15 '16 at 18:29
  • Yes I understood that from your answer, it's an entire albeit minimal operating system of course it's a big job, like I said it was a simple inquiry nothing more nothing less, thanks for detailed answer and your considerate advice.i really appreciate it – Fuseteam Jun 15 '16 at 18:33
  • Oh just for the record I mean android application not android nevertheless I'll heed your advice – Fuseteam Jun 15 '16 at 21:43
  • I understood (I refer to an "Android application" above). This is mostly why I believe it would be much simpler to create a unikernel running an application that "mimics or duplicates" an app than a unikernel within which you could run the exact same app made from the source as used on an Android device. Those apps are relatively easy to create (I've done a bit of Android programming, and am comfortable with Java) because they rely on a lot of pre-existing infrastructure that is much more complex than the app itself -- so creating a compatible environment of that sort would be a monster. – goldilocks Jun 15 '16 at 22:58
  • I didn't know that even a simple library app relies on a lot of pre-existing infrastructure, I see, i see now even more clearer what you meant – Fuseteam Jun 15 '16 at 23:02
  • Have a look here and here to get a better idea of what I am talking about. "Java" is really an application that runs an application within itself; on Android that's actually Dalvik/ART (from the second link). So this fits in with the idea of a unikernel, which would either have to provide an interface for ART or an interface like ART. The first option is probably easier, but it still amounts to the entire standard C library, plus platform I/O stuff left out of that. – goldilocks Jun 15 '16 at 23:16
  • Of course you would want to do this by integrating an existing C lib implementation, but doing that is going to be no simple feat either -- in the end what you are really talking about is a normal operating system with a kind of oddball design (the unikernel); I don't think that's what the intended advantage of using a unikernel is. You (honestly) should find a university level textbook somewhere on operating systems; it will take you a few months to work though it (it does for univesity students) but it will give you the "big picture" of how software runs on hardware. – goldilocks Jun 15 '16 at 23:26
  • I have an general understanding of how software runs one hardware, not extensive but I get there gist of it. But I do have a question you said first it would be easier to create an unikernel to run an application that mimics an other app rather than one that runs it out if the box. But than you say it easier for an unikernel to provide an interface to ART(albeit it amounting to an entire standard c library), wouldn't that amount to an unikernel that runs the app out of the box or am I misunderstanding something? – Fuseteam Jun 15 '16 at 23:34
  • I think the easiest way would be something that just mimics the app, because chances are the one app doesn't really need all that infrastructure. The problem with running the actual app is it needs to run in the Java/ART "virtual machine", and that VM is a lot of infrastructure in itself, and expects a lot of infrastructure (it's a middle-top layer of a software "stack"). So the second easiest way would be an environment that will allow you to run ART, which runs the app. The hardest way would be something that runs the actual app itself by imitating ART. – goldilocks Jun 15 '16 at 23:54
  • Oh i see so what I imagined was the second easiest way, which of course is more difficult than I can imagine right now. Though I was more thinking along the lines getting ART to run raspberry pi that is probably more difficult. Btw if I'm not mistaken dalvikVM is indeed a virtual machine but wasn't ART suppose to run the applications natively? Yes I know how Java works with a virtual machine but I remember reading something like that – Fuseteam Jun 16 '16 at 00:00
  • Yes, it sounds like ART is less of a VM than Java/Dalvik (this is all news to me BTW since the last Android programming I did was still on 4.4) and more of a straight compiler -- which means it still has to serve as a layer between the java bytecode and native machine code. Someone who knows more about the ins and outs of that could tell you what the possibilities are for only implementing parts of it -- I would assume its not totally impossible, but I think all that stuff is pretty tight knit. Anyway, a lot of things to think about! – goldilocks Jun 16 '16 at 00:04
  • That's true heck is just as possible as getting android apps to run on computers, just difficult and time consuming. But definitely possible. Here is something else to think about i read that Microsoft project astoria was cancelled because the android apps ran without any modifications using the runtime from the android open source project. Oh and I only ever programmed once on Android 4.4 myself. – Fuseteam Jun 16 '16 at 00:41
  • welp finally have enough rep to upvote your answer, just reread our thread and i get quite a different perspective now haha, especially with things like anbox out now and after following what is neccesary to run android alternatives on android android – Fuseteam Sep 16 '20 at 15:37