Preemption Plans

Preemption plans are the building blocks of preemption methods and allow the implementation of custom, complex multi-step preemption sequences.

Preemption plans are defined in the SWD/policy.tcl file, using the following configuration command:
vtk_preemptionplan_set <METHOD-NAME> <PREEMPTION-PLAN>

A preemption plan is a space-separated list of instructions. Each instruction consists of 3 colon-separated fields: TIME, STATE, and ACTION

TIME can be:
  • * = any time
  • N = N seconds after start of preemption has begun. More specifically, this is the longest time we would wait for the job to reach the required state. If the specified time has elapsed and the job is not in the required state, the preemption plan is considered to have failed.
STATE can be:
  • * = any state
  • SUSPENDED = the job is known to be in a suspended state
  • RETRACING = the job is known to be still retracing (orange)
  • RUNNING = the job is known to be still running (yellow)
  • WITHDRAWN = the job has been killed by preemption
  • LMREMOVED = the job has the property PREEMPT_LMREMOVED
  • WAIT = enter a wait state for the specified number of seconds in the TIME field
  • SSRSUSPENDED = the job has the property SSR_STATUS (SmartSuspend integration) (OBSOLETE)
ACTION can be:
  • NOP = No operation, mainly used for no-op wait states
  • SUSPEND = Suspend job (SIGSTOP)
  • SIGTSTP or TSTP = Send SIGTSTP
  • SIGUSR1 or USR1 = Send SIGUSR1
  • SIGUSR2 or USR2 = Send SIGUSR2
  • EXT,<SIG>[,includeRx][,excludeRx] = Send a signal using the EXTernal method
  • LMREMOVE = Remove licenses using vovlmremove
  • NOLMREMOVE = Do not call the utility vovlmremove on the preempted job. This is essentially the same as NOP
  • DONE = Similar to NOP but also signifies the end of preemption the plan
  • RESUBMIT = Resubmit a withdrawn job (not yet implemented)
The legacy method MODELSIM is essentially a one-step preemption plan of the form *:*:EXT,TSTP,vish, which means "at any time, in any state, send the signal TSTP to the vish process.
Note: The preemption will fail if the time has passed and an expected state have not been attained. In the following example, if the job is not suspended at 10 seconds, or if the license is not removed at 20 seconds, the preemption will fail.
*:*:SUSPEND 10:SUSPENDED:LMREMOVE  20:LMREMOVED:DONE

Examples

Below are some examples of 3-step preemption plans:
*:RETRACING:TSTP  10:WAIT:SUSPEND  15:SUSPENDED:DONE 
  1. At the beginning, if the job is RETRACING, send its process tree the TSTP (temporary stop) signal.
  2. Wait at least 10 seconds from preemption start and send the SUSPEND signal.
  3. Up to 15 seconds from preemption start, if the state is SUSPENDED, the preemption is done. Otherwise, preemption fails.
*:*:SUSPEND  10:SUSPENDED:LMREMOVE  20:LMREMOVED:DONE
  1. At any time, in any state SUSPEND a job.
  2. At any time up to 10 seconds from preemption start, if the job is SUSPENDED, remove license(s) from the job.
  3. At any time up to 20 seconds from preemption start, if the licenses have been removed, preemption is done. Otherwise, preemption fails.
*:*:EXT,HUP,licd  10:*:EXT,TSTP,licd  20:SUSPENDED:LMREMOVE
  1. At any time, in any state, use the external method to send the HUP (hangup) signal to the licd process.
  2. At any time up to 10 seconds from preemption start, whether or not the previous step (HUP) was successful, use the external method to send the TSTP signal to the licd process.
  3. At any time up to 20 seconds from preemption start, if the job is SUSPENDED, remove license(s) from the job.