Shortest Processing Time
Shortest Processing Time Rule
When several jobs need the same machine or worker, you need a rule for deciding which job goes next. The Shortest Processing Time Rule uses the time each job requires on that resource. You encounter it in settings such as printing, equipment repair, and document processing, where several independent jobs share one resource.
Build the sequence
The Shortest Processing Time Rule, usually abbreviated SPT, selects the available job with the smallest processing time whenever the resource becomes free. Processing time is the time needed to perform the entire job on that resource; time already spent waiting is excluded.
If all jobs are available at the start, arrange their processing times in ascending order:
Here, p(k) is the processing time of the job placed in position k, and n is the number of jobs. For example, a job requiring fewer minutes goes before a job requiring more minutes, regardless of their names or queue positions.
Use this procedure:
- Identify the jobs that are ready to start.
- Compare their processing times using the same units.
- Select the smallest processing time.
- Complete that job, remove it from the waiting list, and repeat.
If two jobs have equal processing times, SPT alone does not determine their relative order. Apply a stated secondary rule, such as alphabetical job ID or earlier arrival. Swapping equal-duration jobs does not change the total completion time under the basic assumptions below.
Why short jobs go first
A short job placed behind a long job waits through the long job's entire processing time. Putting the short job first lets it finish sooner while delaying the long job by only the short job's duration.
Consider two adjacent jobs requiring x and y minutes, where x<y. If the longer job goes first, the first completion occurs after y minutes. If the shorter job goes first, the first completion occurs after x minutes. In either order, both jobs finish after x+y minutes. The shorter-first order therefore reduces the sum of their completion times by y−x minutes without delaying subsequent jobs.
For independent jobs that are all available initially, SPT minimizes the sum of completion times on one continuously available resource when processing times are known, jobs have equal weight, and setup times are absent or already included without depending on sequence. With a common arrival time, this also minimizes the average time jobs spend waiting and being processed.
Apply the rule within its limits
The convention here is nonpreemptive processing: once a job starts, it continues until completion. A newly arriving shorter job joins the waiting list; it does not interrupt the running job. When the resource becomes free, compare the jobs then available.
Situation | How SPT applies |
|---|---|
All jobs are ready initially | Sort the complete list by increasing processing time. |
Two ready jobs have equal times | Use the stated secondary rule. |
A shorter job arrives during processing | Finish the running job, then reconsider the ready list. |
A long job has an urgent deadline | Processing time still determines SPT priority. |
SPT's completion-time guarantee does not automatically extend to settings with different arrival times, multiple resources, sequence-dependent setups, or unequal job weights. With continuing arrivals, long jobs can also face extended waits as shorter jobs repeatedly receive priority.
What to remember
- Choose the shortest whole-job processing time among ready jobs.
- State how equal processing times are resolved.
- Under nonpreemptive processing, finish the running job before choosing again.
- Check the operating assumptions before claiming an optimal schedule.
Example: Sequence jobs at a print shop
A print shop has one printer and four independent jobs ready at time zero. The processing times below include all required work; there are no additional setup times. The printer operates continuously and uses the nonpreemptive Shortest Processing Time Rule.
Job | Processing time |
|---|---|
P | 9 min |
Q | 4 min |
R | 7 min |
S | 2 min |
Treat all times as exact.
a) Determine the initial SPT sequence.
All four jobs are available, so compare their processing times directly. Sort the durations from smallest to largest:
These times belong to S, Q, R, and P, respectively. The initial sequence is therefore S, Q, R, P. There are no equal processing times, so a secondary rule is unnecessary.
b) Find each job's start and finish times under this initial schedule.
The first job starts at time zero. With no gaps or setup times, each later job starts when the previous job finishes. Add its processing time to obtain its finish time:
The processing intervals are:
- S: starts at 0 min and finishes at 2 min.
- Q: starts at 2 min and finishes at 6 min.
- R: starts at 6 min and finishes at 13 min.
- P: starts at 13 min and finishes at 22 min.
The final finish time is 22 min. As a check, the total required processing time is 2+4+7+9=22 min, which matches the timeline because the printer never sits idle.
c) Now suppose a new job T, requiring 1 min, becomes ready at minute 8. No other jobs arrive. Determine what happens at minute 8 and give the revised schedule from that point onward.
At minute 8, R is already running: it started at minute 6 and is scheduled to finish at minute 13. Nonpreemptive processing means T does not interrupt R. R has 13−8=5 min remaining and continues until minute 13.
When R finishes, the ready jobs are P, requiring ________ min, and T, requiring ________ min. SPT selects T because 1<9. The remaining finish times are:
The revised schedule keeps R running until minute 13, runs T from minute 13 to minute 14, and runs P from minute 14 to minute 23. The new job adds 1 min of work, so the last finish changes from minute 22 to minute 23. This applies SPT to the available jobs at each decision point; it does not claim an optimality guarantee for every setting with new arrivals.
Four print jobs are ready when a printer becomes available. Their processing times are D: 4 min, E: 4 min, F: 9 min, and G: 2 min. The printer uses the nonpreemptive Shortest Processing Time Rule, with alphabetical job ID used to break ties. What is the complete processing sequence?
A testing station uses nonpreemptive Shortest Processing Time sequencing without deliberately leaving the station idle. Job H starts at 09:00 and requires 12 min. Job I, requiring 8 min, is already waiting. Job J, requiring 3 min, becomes ready at 09:05. Job K, requiring 1 min, will become ready at 09:13. There are no setup times. What should the station do when H finishes?