Package org.mpi_sws.jmc.strategies
Class RandomSchedulingStrategy
java.lang.Object
org.mpi_sws.jmc.strategies.TrackActiveTasksStrategy
org.mpi_sws.jmc.strategies.RandomSchedulingStrategy
- All Implemented Interfaces:
ReplayableSchedulingStrategy,SchedulingStrategy
public class RandomSchedulingStrategy
extends TrackActiveTasksStrategy
implements ReplayableSchedulingStrategy
A random scheduling strategy that selects the next thread to be scheduled randomly.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mpi_sws.jmc.strategies.TrackActiveTasksStrategy
TrackActiveTasksStrategy.Tracker, TrackActiveTasksStrategy.TrackLocks, TrackActiveTasksStrategy.TrackTasks -
Constructor Summary
ConstructorsConstructorDescriptionRandomSchedulingStrategy(Long seed, String reportPath) Constructs a new RandomSchedulingStrategy object. -
Method Summary
Modifier and TypeMethodDescriptionvoidinitIteration(int iteration, JmcModelCheckerReport report) Initializes the strategy for a new iteration.nextTask()Returns the next task to be scheduled.voidRecords the current execution trace of the scheduling strategy.voidReplays the recorded execution trace of the scheduling strategy.voidupdateEvent(JmcRuntimeEvent event) Updates the strategy with the event that has occurred.Methods inherited from class org.mpi_sws.jmc.strategies.TrackActiveTasksStrategy
getActiveTasks, isActive, markActive, markInactive, resetIteration, teardownMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mpi_sws.jmc.strategies.SchedulingStrategy
resetIteration, teardown
-
Constructor Details
-
RandomSchedulingStrategy
Constructs a new RandomSchedulingStrategy object.- Parameters:
seed- the seed for the random number generator
-
-
Method Details
-
initIteration
public void initIteration(int iteration, JmcModelCheckerReport report) throws HaltExecutionException Description copied from interface:SchedulingStrategyInitializes the strategy for a new iteration.- Specified by:
initIterationin interfaceSchedulingStrategy- Overrides:
initIterationin classTrackActiveTasksStrategy- Parameters:
iteration- the number of the iteration.- Throws:
HaltExecutionException
-
nextTask
Returns the next task to be scheduled. The task is picked randomly from the set of active tasks.- Specified by:
nextTaskin interfaceSchedulingStrategy- Returns:
- the next task to be scheduled
-
updateEvent
Description copied from interface:SchedulingStrategyUpdates the strategy with the event that has occurred.May be left empty if unused
- Specified by:
updateEventin interfaceSchedulingStrategy- Overrides:
updateEventin classTrackActiveTasksStrategy- Throws:
HaltTaskExceptionHaltExecutionException
-
recordTrace
Description copied from interface:ReplayableSchedulingStrategyRecords the current execution trace of the scheduling strategy.- Specified by:
recordTracein interfaceReplayableSchedulingStrategy- Throws:
JmcCheckerException
-
replayRecordedTrace
Description copied from interface:ReplayableSchedulingStrategyReplays the recorded execution trace of the scheduling strategy.- Specified by:
replayRecordedTracein interfaceReplayableSchedulingStrategy- Throws:
JmcCheckerException
-