[concurrency-interest] Real-time task scheduling

Jean Morissette jean.morissette at gmail.com
Tue May 19 09:33:51 EDT 2009

Giving a task with an execution cost of sub-microsecond and a period
in the order of 10 microseconds, I would like to schedule periodically
this task with hard real-time behaviour on the Java SE platform.

I take as granted the following assumptions:
(1) All objects in the program are allocated at the start and reused
such that the GC does not pause the program.
(2) All classes are loaded and compiled at the start (by example
running in interpreted mode using -Xint JVM option or using AOT
compiler like Excelsior JET) avoiding pause from JIT compiler.
(3) No other user-program is running on the OS.
(4) The number of threads created by the program is lower than the
number of CPU, avoiding context-switching.
(5) Concurrency is performed using lock-free data structures.
(6) OS independance is not a requirement.

Considering those assumptions are valid, one issue remaining is the
unpredictability of the OS, which could use the CPU for its own needs
at any moment, stoping the Java worker thread long enough to make the
task miss its deadline. Is-it possible to resolve this issue?

By example, assuming that the program run on a Real-Time OS, do the OS
threads associated with the Java threads will have the same priority
than the Java program? Otherwise, is-it possible to create a JNI call
to change the OS thread priority associated with the current Java
thread such that it cant be preempted? Or is-it possible to configure
the OS to set an upper bound on thread pause time?

Thanks for your help,
Jean Morissette

More information about the Concurrency-interest mailing list