Reputation: 4178
The Real Time Specification for Java indicates that it offers tools for dealing with Priority Inversion cases like the Priority Inheritance and Priority Ceiling protocols.
On POSIX, there is a pthread_mutexattr_getprotocol
that can set the protocol used to solve this
PTHREAD_PRIO_NONE
PTHREAD_PRIO_INHERIT //(PIP)
PTHREAD_PRIO_PROTECT //(PCP)
I am wondering about the equivalance of this on Real Time Java.
Thank you.
Upvotes: 2
Views: 827
Reputation: 46
RTSJ compliant implementations are required to support at least priority inheritance; priority ceiling is optional. IBM WebSphere Real Time, for example, supports priority inheritance and relies on the operating system to provide priority inheritance for all Java locks (which means there is always a pthread mutex associated with any locked object, though we still have ways to make that faster than it would otherwise sound, especially for locks that are not actually contended). Spin locks, which traditional non-real-time JVMs tend to employ to accelerate shortly held locks, cannot be used in real-time JVMs because they introduce livelock issues when you've got threads running at different priority levels (for SCHED_RR / SCHED_FIFO policies, anyway, where higher priority level preempts, period).
Upvotes: 1