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.