public class ContextBoundingSchedulerFactory extends DefaultSchedulerFactory
SchedulerFactory that limits the search by imposing a maximum number of
thread preemptions (i.e., preempting context switches) that can occur per execution
path. This factory internally creates
ContextBoundingThreadChoiceFromSet choice generators.
Configuration parameters:
vm.scheduler_factory.class=gov.nasa.jpf.vm.ContextBoundingSchedulerFactory
setting scheduler factory class to this class
cg.max_number_of_preemptions=N
where N is the number of allowed preemptions per execution path
The idea of context bounding is based on the PLDI 2007 paper
"Iterative Context Bounding for Systematic Testing of Multithreaded Programs"
by Madanlal Musuvathi and Shaz Qadeer
This factory does not implement the paper's iterative context-bounding
algorithm, i.e., the specific order of states that get explored. (For that,
one needs to use a search strategy.) This factory simply provides a limit on
the number of preemptions that are allowed and can be used with various
search strategies, including DFS, BFS, heuristics, etc.
ss, vmBEGIN_ATOMIC, END_ATOMIC, MONITOR_ENTER, MONITOR_EXIT, NOTIFY, NOTIFY_ALL, PARK, SHARED_ARRAY_ACCESS, SHARED_FIELD_ACCESS, SHARED_OBJECT_EXPOSURE, SYNC_METHOD_ENTER, SYNC_METHOD_EXIT, THREAD_INTERRUPT, THREAD_RESUME, THREAD_SLEEP, THREAD_START, THREAD_STOP, THREAD_SUSPEND, THREAD_TERMINATE, THREAD_YIELD, UNPARK, WAIT| Constructor and Description |
|---|
ContextBoundingSchedulerFactory(Config config,
VM vm,
SystemState ss) |
| Modifier and Type | Method and Description |
|---|---|
ChoiceGenerator<ThreadInfo> |
createMonitorEnterCG(ElementInfo ei,
ThreadInfo ti) |
ChoiceGenerator<ThreadInfo> |
createNotifyCG(ElementInfo ei,
ThreadInfo ti) |
ChoiceGenerator<ThreadInfo> |
createThreadTerminateCG(ThreadInfo terminateThread) |
ChoiceGenerator<ThreadInfo> |
createWaitCG(ElementInfo ei,
ThreadInfo ti,
long timeOut) |
protected ThreadInfo[] |
filter(ThreadInfo[] list)
post process a list of choices.
|
protected ChoiceGenerator<ThreadInfo> |
getRunnableCG(String id,
ThreadInfo ti) |
createBeginAtomicCG, createEndAtomicCG, createEnterCG, createExitCG, createInterruptCG, createMonitorExitCG, createNotifyAllCG, createParkCG, createSharedArrayAccessCG, createSharedFieldAccessCG, createSharedObjectExposureCG, createSyncMethodEnterCG, createSyncMethodExitCG, createThreadResumeCG, createThreadSleepCG, createThreadStartCG, createThreadStopCG, createThreadSuspendCG, createThreadYieldCG, createUnparkCG, getRunnables, getRunnablesIfChoices, getRunnablesWith, getRunnablesWithout, getSyncCGpublic ContextBoundingSchedulerFactory(Config config, VM vm, SystemState ss)
protected ThreadInfo[] filter(ThreadInfo[] list)
DefaultSchedulerFactoryfilter in class DefaultSchedulerFactoryprotected ChoiceGenerator<ThreadInfo> getRunnableCG(String id, ThreadInfo ti)
getRunnableCG in class DefaultSchedulerFactorypublic ChoiceGenerator<ThreadInfo> createMonitorEnterCG(ElementInfo ei, ThreadInfo ti)
createMonitorEnterCG in interface SchedulerFactorycreateMonitorEnterCG in class DefaultSchedulerFactorypublic ChoiceGenerator<ThreadInfo> createWaitCG(ElementInfo ei, ThreadInfo ti, long timeOut)
createWaitCG in interface SchedulerFactorycreateWaitCG in class DefaultSchedulerFactorypublic ChoiceGenerator<ThreadInfo> createNotifyCG(ElementInfo ei, ThreadInfo ti)
createNotifyCG in interface SchedulerFactorycreateNotifyCG in class DefaultSchedulerFactorypublic ChoiceGenerator<ThreadInfo> createThreadTerminateCG(ThreadInfo terminateThread)
createThreadTerminateCG in interface SchedulerFactorycreateThreadTerminateCG in class DefaultSchedulerFactory