|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.Scheduler
javax.realtime.PriorityScheduler
public class PriorityScheduler
Jamaica Real-Time Specification for Java class PriorityScheduler.
This is the default scheduler used for schedulable objects RealtimeThread and AbstractAsyncEventHandler.
Scheduling is fixed-priority preemptive. A schedulable object that is preempted by a higher priority thread will be placed into the queue of eligible schedule objects for its active priority. The position within this queue depends on the underlying RTOS, please refer to the documentation of the RTOS for this information. Typically, it will be placed at the end of this queue.
By default, there is no round-robin scheduling for schedulable objects of equal priorities. I.e., if two schedulable objects of equal priority are read to run, one of them will receive the CPU and the other one will remain eligibly until the running one blocks or is preempted by the release of a higher priority schedulable object. Explicit calls to Thread.yield() are required to permit a threads switch to another schedulable object of the same priority.
To permit regular switches between schedulable objects of the same
priority, a synchronization thread is required. See the
documentation of option "-timeSlice=
On non-real-time platforms like Linux, the synchronization thread is enabled by default. It can be disabled on these platforms by setting "-timeSlice=0".
Field Summary | |
---|---|
static int |
MAX_PRIORITY
Deprecated. use PriorityScheduler.instance().getMaxPriority() instead. |
static int |
MIN_PRIORITY
Deprecated. use PriorityScheduler.instance().getMinPriority() instead. |
Constructor Summary | |
---|---|
protected |
PriorityScheduler()
Constructor to create an instance of PriorityScheduler. |
Method Summary | |
---|---|
protected boolean |
addToFeasibility(Schedulable schedulable)
addToFeasibility adds the provided schedulable object to the set of schedulable objects that take part in feasibility analysis. |
void |
fireSchedulable(Schedulable schedulable)
Fire a release for the given schedulable object. |
int |
getMaxPriority()
getMaxPriority returns the maximum allowed priority value for PriorityParameters. |
static int |
getMaxPriority(Thread thread)
getMaxPriority returns the maximum priority allowed for a thread. |
int |
getMinPriority()
getMinPriority returns the minimum allowed priority value for PriorityParameters. |
static int |
getMinPriority(Thread thread)
getMinPriority returns the minimum priority allowed for a thread. |
int |
getNormPriority()
getNormPriority returns the default priority for PriorityParameters. |
static int |
getNormPriority(Thread thread)
getNormPriority returns the normal priority for a thread. |
String |
getPolicyName()
getPolicyName returns the name of this scheduling policy. |
static PriorityScheduler |
instance()
instance returns the instance of default PriorityScheduler. |
boolean |
isFeasible()
isFeasible checks if the current set of schedulable objects that take part in feasibility analysis form a feasible set |
protected boolean |
removeFromFeasibility(Schedulable schedulable)
removeFromFeasibility removes the provided schedulable object from the set of schedulable objects that take part in feasibility analysis. |
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters release,
MemoryParameters memory)
setIfFeasible first performs a feasibility analysis using the new release and memory parameters for schedulable. |
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
setIfFeasible first performs a feasibility analysis using the new release, memory, and group parameters for schedulable. |
boolean |
setIfFeasible(Schedulable schedulable,
SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
setIfFeasible first performs a feasibility analysis using the new scheduling, release, memory, and group parameters for schedulable. |
Methods inherited from class javax.realtime.Scheduler |
---|
getDefaultScheduler, setDefaultScheduler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_PRIORITY
public static final int MIN_PRIORITY
Constructor Detail |
---|
protected PriorityScheduler()
Method Detail |
---|
public static PriorityScheduler instance()
public boolean isFeasible()
isFeasible
in class Scheduler
protected boolean addToFeasibility(Schedulable schedulable)
addToFeasibility
in class Scheduler
schedulable
- A schedulable object, must not be null.
IllegalArgumentException
- if schedulable is null or
schedulable is neither RealtimeThread nor AbstractAsyncEventHandler.protected boolean removeFromFeasibility(Schedulable schedulable)
removeFromFeasibility
in class Scheduler
schedulable
- A schedulable object, must not be null.
IllegalArgumentException
- if schedulable is null or
schedulable is neither RealtimeThread nor AbstractAsyncEventHandler.public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory)
setIfFeasible
in class Scheduler
schedulable
- A schedulable object whose parameters should
be changed.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.
IllegalArgumentException
- if schedulable is null, release
is null or the parameter values are not compatible with the
scheduler associated to schedulable.
IllegalAssignmentError
- if release or memory and
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).
IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
setIfFeasible
in class Scheduler
schedulable
- A schedulable object whose parameters should
be changed. Must not be null.release
- the new release parameters. Must not be null.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used. The
default value for PriorityScheduler is null.
IllegalArgumentException
- if schedulable is null, release
is null or the parameter values are not compatible with the
scheduler associated to schedulable.
IllegalAssignmentError
- if release, memory or group and
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).
IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.public boolean setIfFeasible(Schedulable schedulable, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group) throws IllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
setIfFeasible
in class Scheduler
schedulable
- a schedulable object whose parameters should
be changed. Must not be null.scheduling
- the new scheduling parameters. If null, the default
value of this scheduler will be used. For PriorityScheduler, this
is norm priority.release
- the new release parameters. Must not be null.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used. The
default value for PriorityScheduler is null.
IllegalArgumentException
- if schedulable is null, release
is null or the parameter values are not compatible with the
scheduler associated to schedulable.
IllegalAssignmentError
- if release, memory or group and
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).
IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.public void fireSchedulable(Schedulable schedulable) throws UnsupportedOperationException
fireSchedulable
in class Scheduler
schedulable
- a schedulable object.
UnsupportedOperationException
- is always thrown by
PriorityScheduler.public int getMaxPriority()
public static int getMaxPriority(Thread thread)
instance().getMaxPriority()
is returned. Otherwise,
if thread is a normal Java thread, then Thread.MAX_PRIORITY is
returned. If thread is null, then
instance().getMaxPriority()
is returned,
thread
- A thread or null.
IllegalArgumentException
- if thread is a RealtimeThread
that is not scheduled by this PriorityScheduler.public int getMinPriority()
public static int getMinPriority(Thread thread)
instance().getMinPriority()
is returned. Otherwise,
if thread is a normal Java thread, then Thread.MIN_PRIORITY is
returned. If thread is null, then
instance().getMinPriority()
is returned,
thread
- A thread or null.
IllegalArgumentException
- if thread is a RealtimeThread
that is not scheduled by this PriorityScheduler.public int getNormPriority()
public static int getNormPriority(Thread thread)
instance().getNormPriority()
is returned. Otherwise, if thread is a normal Java thread, then
Thread.NORM_PRIORITY is returned. If thread is null, then
instance().getNormPriority()
is returned,
thread
- A thread or null.
IllegalArgumentException
- if thread is a RealtimeThread
that is not scheduled by this PriorityScheduler.public String getPolicyName()
getPolicyName
in class Scheduler
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |