Preemptive scheduling behavior

Preemptive scheduling is based primarily on parameters specified at the queue level: some queues are eligible for preemption, others are not. Once a hierarchy of queues has been established, other factors, such as queue priority and preferred preemption order, determine which jobs from a queue should be preempted.

There are three ways to establish which queues should be preempted:

  • Based on queue priority: the PREEMPTION parameter defines a queue as preemptive or pre-emptable and preemption is based on queue priority, where jobs from higher-priority queues can preempt jobs from lower-priority queues
  • Based on a preferred order: the PREEMPTION parameter defines queues that can preempt other queues, in a preferred order
  • Explicitly, by specific queues: the PREEMPTION parameter defines queues that can be preempted, and by which queues

Preemption configuration Behavior
Preemption is not enabled—no queue is defined as preemptable, and no queue is defined as preemptive High-priority jobs do not preempt jobs that are already running
A queue is defined as preemptable, but no specific queues are listed that can preempt it Jobs from this queue can be preempted by jobs from any queue with a higher value for priority
A queue is defined as preemptable, and one or more queues are specified that can preempt it Jobs from this queue can be preempted only by jobs from the specified queues
A queue is defined as preemptive, but no specific queues are listed that it can preempt
  • Jobs from this queue preempt jobs from all queues with a lower value for priority
  • Jobs are preempted from the least-loaded host
A queue is defined as preemptive, and one or more specific queues are listed that it can preempt, but no queue preference is specified
  • Jobs from this queue preempt jobs from any queue in the specified list
  • Jobs are preempted on the least-loaded host first
A queue is defined as preemptive, and one or more queues have a preference number specified, indicating a preferred order of preemption
  • Queues with a preference number are preferred for preemption over queues without a preference number
  • Queues with a higher preference number are preferred for preemption over queues with a lower preference number
  • For queues that have the same preference number, the queue with lowest priority is preferred for preemption over queues with higher priority
  • For queues without a preference number, the queue with lower priority is preferred for preemption over the queue with higher priority
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs with the shortest run time is configured
  • A queue from which to preempt a job is determined based on other parameters as shown above
  • The job that has been running for the shortest period of time is preempted
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs that will finish within a certain time period is prevented
  • A queue from which to preempt a job is determined based on other parameters as shown above
  • A job that has a run limit or a run time specified and that will not finish within the specified time period is preempted
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs with the specified run time is prevented
  • A queue from which to preempt a job is determined based on other parameters as shown above
  • The job that has been running for less than the specified period of time is preempted

Case study: Three queues with varying priority

Consider the case where three queues are defined as follows:
  • Queue A has the highest relative priority, with a value of 99
  • Queue B is both preemptive and preemptable, and has a relative priority of 10
  • Queue C has the lowest relative priority, with the default value of 1
The queues can preempt as follows:
  • A can preempt B because B is preemptable and B has a lower priority than A
  • B can preempt C because B is preemptive and C has a lower priority than B
  • A cannot preempt C, even though A has a higher priority than C, because A is not preemptive, nor is C preemptable

Calculation of job slots in use

The number of job slots in use determines whether preemptive jobs can start. The method in which the number of job slots in use is calculated can be configured to ensure that a preemptive job can start. When a job is preempted, it is suspended. If the suspended job still counts towards the total number of jobs allowed in the system, based on the limits imposed in the lsb.resources file, suspending the job may not be enough to allow the preemptive job to run.

The PREEMPT_FOR parameter is used to change the calculation of job slot usage, ignoring suspended jobs in the calculation. This ensures that if a limit is met, the preempting job can actually run.


Preemption configuration Effect on the calculation of job slots used
Preemption is not enabled
  • Job slot limits are enforced based on the number of job slots taken by both running and suspended jobs.
  • Job slot limits specified at the queue level are enforced for both running and suspended jobs.
Preemption is enabled
  • The total number of jobs at both the host and individual user level is not limited by the number of suspended jobs; only running jobs are considered.
  • The number of running jobs never exceeds the job slot limits. If starting a preemptive job violates a job slot limit, a lower-priority job is suspended to run the preemptive job. If, however, a job slot limit is still violated (that is, the suspended job still counts in the calculation of job slots in use), the preemptive job still cannot start.
  • Job slot limits specified at the queue level are always enforced for both running and suspended jobs.
  • When preemptive scheduling is enabled, suspended jobs never count against the total job slot limit for individual users.
Preemption is enabled, and PREEMPT_FOR=GROUP_JLP Only running jobs are counted when calculating the per-processor job slots in use for a user group, and comparing the result with the limit specified at the user level.
Preemption is enabled, and PREEMPT_FOR=GROUP_MAX Only running jobs are counted when calculating the job slots in use for this user group, and comparing the result with the limit specified at the user level.
Preemption is enabled, and PREEMPT_FOR=HOST_JLU Only running jobs are counted when calculating the total job slots in use for a user group, and comparing the result with the limit specified at the host level. Suspended jobs do not count against the limit for individual users.
Preemption is enabled, and PREEMPT_FOR=USER_JLP Only running jobs are counted when calculating the per-processor job slots in use for an individual user, and comparing the result with the limit specified at the user level.

Preemption of backfill jobs

When a high priority queue is configured to run a job with resource or slot reservations and backfill scheduling is enabled (PREEMPT_JOBTYPE=BACKFILL in lsb.params), backfill jobs may use the reserved job slots. Configuring a low priority queue with a job to preempt a backfill job may delay the start of a job in a high priority queue with resource or slot reservations. LSF allows this configuration but gives a warning message.

The following example shows the resulting behavior with various queue configurations and priorities.
Queue name Configuration Priority Result
queueR With a resource or slot reservation 80 Jobs in these queue reserve resources. If backfill scheduling is enabled, backfill jobs with a defined run limit can use the resources.
queueB As a preemptable backfill queue 50 Jobs in queueB with a defined run limit use job slots reserved by jobs in queueR.
queueP As a preemptive queue 75 Jobs in this queue do not necessarily have a run limit and may take resources from jobs with reservation.

To guarantee a minimum run time for interruptible backfill jobs, LSF suspends them upon preemption. To change this behavior so that LSF terminates interruptible backfill jobs upon preemption, you must define the parameter TERMINATE_WHEN=PREEMPT in lsb.queues.