-1

I recently read the paper "Making Android run on time", by Yin Yan et al. To fully understand the topic, I also read something about the Real-Time Specification for Java (RTSJ) and about lots of real-time virtual machines, garbage collectors and so on. Nevertheless, I still have a doubt. A RTSJ-compliant virtual machine uses priority inheritance for preventing priority inversion, but I know this algorithm does not prevent deadlocks. Since threads have no way to control the resource acquisition order, there is the possibility to circular wait, that actually can lead to a deadlock.

So, in the light of this, is it really safe to use Java as a programming language for real-time purposes, included desktop and mobile applications?

My question isn't about the use of either Java, Android or Linux as-is. My question is about the algorithm choosen by the RTSJ (priority inheritance), as it doesn't prevent deadlocks to occur.

madipi
  • 355
  • 2
  • 11

1 Answers1

1

What do you want- realtime, or desktop/mobile? Realtime is for things like a pacemaker- it means that if the computer can't promise a job will finish by time X, it won't even attempt to run it. Its only suitable for systems where the execution time of all tasks is known. Computers (including PCs, Macs, and Linux) are not realtime. As Linux is not realtime, nothing on Android is.

As for realtime Java in general- no. Nothing that has non-deterministic garbage collection can be used for realtime programming.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • I know what real-time means (all the stuff about deadlines, predictability and so on), and I am not asking if it's possible or not. Out there there's a huge amount of works addressing this problem (like the one I cited, but there's much more). There are lots of real-time applications written in Java (and even running on a -of course- more real-time Android's version), but I am not sure that priority inheritance is the right way to handle resource allocation. – madipi Jul 05 '17 at 22:44
  • Linux is not a real time os. That means android isn't. Which means no app on it can be real time. Nor can any app with garbage collection that apps the world. Which is every android app – Gabe Sechan Jul 05 '17 at 22:45
  • Yes, sure. Of course I'm not asking about Java as is. Indeed the RTSJ-compliant VMs have to use a non-blocking garbage collector. There is a number of such algorithms, just check out for Immix or Metronome, as well as there is a number of RT VMs. My question was like: "provided that we can substitute non RT components with RT ones (such as Fiji VM and LinuxRT), is the algorithm choosen by the RTSJ (priority inheritance) safe to use, as it doesn't prevent deadlocks?" – madipi Jul 06 '17 at 07:34