*** warning: Java real-time priorities >=11 not usable, using priority 10 (cause: Operation not permitted)
currently trying out a project that come out with this error message.
using Xfce environment in Vmware, eclipse ide and jamaica vm
what is actually wrong with this? The error state that the java real-time priorities is bigger than 11 when the system priority is 10, how can I set the priority higher?
my code
package realtime;
import javax.realtime.*;
class seconds extends RealtimeThread{
int secs = 0;
int mins = 0;
int hours=0;
public seconds(SchedulingParameters sched, ReleaseParameters rel)
{
super(sched,rel);
}
public void run() {
while(true) {
secs++;
System.out.println("seconds" + secs);
if(secs>58) {
mins ++;
secs = 0;
}
boolean ok = waitForNextPeriod();
}
}
}
class minutes extends RealtimeThread{
private minutes min = null;
private seconds sec = null;
int mins = 0;
int hours = 0;
public minutes(SchedulingParameters sched, ReleaseParameters rel)
{
super(sched,rel);
}
public void run() {
while(true) {
mins++;
System.out.println("minutes" + mins);
if(mins>58) {
hours ++;
mins = 0;
}
boolean ok = waitForNextPeriod();
}
}
}
class hours extends RealtimeThread{
private minutes min = null;
private seconds sec = null;
private hours hour=null;
int mins = 0;
int hours = 0;
int day =0;
public hours(SchedulingParameters sched, ReleaseParameters rel)
{
super(sched,rel);
}
public void run() {
while(true) {
mins++;
System.out.println("hours" + hours);
if(hours>24) {
day ++;
hours= 0;
}
boolean ok = waitForNextPeriod();
}
}
}
public class Q1 {
private minutes min = null;
private seconds sec = null;
private hours hour = null;
Q1(){
PriorityParameters hoursched = new PriorityParameters(PriorityScheduler.instance().getMaxPriority());
ReleaseParameters hoursrel = new PeriodicParameters(new RelativeTime(59*59*1000,1000));
PriorityParameters minsched = new PriorityParameters(PriorityScheduler.instance().getMinPriority());
ReleaseParameters minrel = new PeriodicParameters(new RelativeTime(59000,1000));
PriorityParameters secsched = new PriorityParameters(PriorityScheduler.instance().getMaxPriority());
ReleaseParameters secrel = new PeriodicParameters(new RelativeTime(1000,0));
hour = new hours(hoursched,hoursrel);
min = new minutes(minsched, minrel);
sec = new seconds(secsched, secrel);
hour.start();
min.start();
sec.start();
}
public static void main(String[] args) {
Q1 t = new Q1();
}
}
This is an FAQ in the JamaicaVM Manual:
The answer says:
"The creation of a thread with real-time priority was not permitted by the operating system. Instead JamaicaVM created a thread with normal priority. This means that real-time scheduling is not available, and that the application will likely not work properly.
On off-the-shelf Linux systems, use of real-time priorities requires super-user privileges. That is, starting the application with
sudo
will resolve the issue. Alternatively, the priority limits for particular users or groups may be changed by editing/etc/security/limits.conf
and settingrtprio
to the maximum native priority used. For the default priority map used by JamaicaVM on Linux, setting thertprio
limit to80
is sufficient."