Operations and Supply Chain: Learn It 4

Scheduling Cont.

Adding an algorithm

Up until now, we have been creating schedules by guess-and-check, which works well enough for small schedules, but would not work well with dozens or hundreds of tasks. To create a more procedural approach, we might begin by somehow creating a priority list. Once we have a priority list, we can begin scheduling using that list and the list processing algorithm.

priority list

A priority list is a list of tasks given in the order in which we desire them to be completed.

 

The List Processing Algorithm turns a priority list into a schedule.

How To: List Processing Algorithm

  1. On the digraph or priority list, circle all tasks that are ready, meaning that all prerequisite tasks have been completed.
  2. Assign to each available processor, in order, the first ready task. Mark the task as in progress, perhaps by putting a single line through the task.
  3. Move forward in time until a task is completed. Mark the task as completed, perhaps by crossing out the task. If any new tasks become ready, mark them as such.
  4. Repeat until all tasks have been scheduled.
A complete digraph for our car conversion depicts nine tasks labeled T1 through T9. Tasks T1, T3, T4, and T5 are starting points with arrows leading out, T6, T7, and T8 are intermediate points, and T9 is an endpoint with arrows only leading into it. Each task has a duration or weight indicated in parentheses, and arrows represent the flow or sequence between these tasks.

 

Using our complete digraph for the car conversion we found earlier, let’s schedule the tasks using the priority list below:

[latex]\mathrm{T}_{1}, \mathrm{T}_{3}, \mathrm{T}_{4}, \mathrm{T}_{5}, \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, \mathrm{T}_{2}, \mathrm{T}_{9}[/latex]

Time 0: Mark ready tasks.

Priority list: [latex]({\mathrm{T}_{1}}), (\mathrm{T}_{3}), (\mathrm{T}_{4}), (\mathrm{T}_{5}), \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, \mathrm{T}_{2}, \mathrm{T}_{9}[/latex]

We assign the first task, [latex]\mathrm{T}_{1}[/latex] to the first processor, [latex]\mathrm{P}_{1}[/latex], and the second ready task, [latex]\mathrm{T}_{3}[/latex], to the second processor. Making those assignments, we mark those tasks as in progress:

Priority list: [latex]\cancel{(\mathrm{T}_{1})}, \cancel{(\mathrm{T}_{3})}, (\mathrm{T}_{4}), (\mathrm{T}_{5}), \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, \mathrm{T}_{2}, \mathrm{T}_{9}[/latex]

Schedule up to here:

A time-based diagram with two processes, P1 and P2, represented vertically. The time is marked from 0 to 10 on the horizontal axis. P1 has only task T1 (from time 0-2). P2 has task T3 (from time 0-2).

 

We jump to the time when the next task completes, which is at time [latex]2[/latex].

Time 2: Both processors complete their tasks. We mark those tasks as complete. With Task [latex]1[/latex] complete, Task [latex]2[/latex] becomes ready:

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, (\mathrm{T}_{4}), (\mathrm{T}_{5}), \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, (\mathrm{T}_{2}), \mathrm{T}_{9}[/latex]

We assign the next ready task on the list, [latex]\mathrm{T}_{4}[/latex] to [latex]\mathrm{P}_{1}[/latex], and [latex]\mathrm{T}_{5}[/latex] to [latex]\mathrm{P}_{2}[/latex].

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \cancel{(\mathrm{T}_{4})}, \cancel{(\mathrm{T}_{5})}, \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, (\mathrm{T}_{2}), \mathrm{T}_{9}[/latex]

Timeline chart from 0 to 10 showing task executions for processes P1 and P2. P1 executes tasks T1 from 0-2, T4 from 2-3, and T2 from 3-5. P2 executes task T3 from 0-2 and T5 from 2-4.

 

Time 3: Processor 1 has completed [latex]\mathrm{T}_{4}[/latex]. Completing [latex]\mathrm{T}_{4}[/latex] does not make any other tasks ready (note that all the rest require that [latex]\mathrm{T}_{2}[/latex] be completed first).

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \xcancel{(\mathrm{T}_{4})}, \cancel{(\mathrm{T}_{5})}, \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, (\mathrm{T}_{2}), \mathrm{T}_{9}[/latex]

Since the next three tasks are not yet ready, we assign the next ready task, [latex]\mathrm{T}_{2}[/latex] to [latex]\mathrm{P}_{1}[/latex].

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \xcancel{(\mathrm{T}_{4})}, \xcancel{(\mathrm{T}_{5})}, \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, \cancel{(\mathrm{T}_{2})}, \mathrm{T}_{9}[/latex]

Timeline chart from 0 to 10 with task executions for processes P1 and P2. P1 executes tasks T1 at time 0-2, T4 at 2-3, T2 at 3-3.5. P2 runs task T3 at time 0-22 and T5 at 2-4.

 

Time 3.5: Processor [latex]1[/latex] has completed [latex]\mathrm{T}_{2}[/latex]. Completing [latex]\mathrm{T}_{2}[/latex] causes [latex]\mathrm{T}_{6}[/latex] and [latex]\mathrm{T}_{7}[/latex] to become ready. We assign [latex]\mathrm{T}_{6}[/latex] to [latex]\mathrm{P}_{1}[/latex].

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \xcancel{(\mathrm{T}_{4})}, \xcancel{(\mathrm{T}_{5})}, \cancel{(\mathrm{T}_{6})}, (\mathrm{T}_{7}), \mathrm{T}_{8}, \xcancel{(\mathrm{T}_{2})}, \mathrm{T}_{9}[/latex]

Timeline chart from 0 to 10 with task executions for processes P1 and P2. P1 executes tasks T1 at time 0-2, T4 at 2-3, T2 at 3-3.5, T6 at 3.5-4. P2 runs task T3 at time 0-2, T5 at 2-4

 

Time 4: Both processors complete their tasks. The completion of [latex]\mathrm{T}_{5}[/latex] allows [latex]\mathrm{T}_{8}[/latex] to become ready. We assign [latex]\mathrm{T}_{7}[/latex] to [latex]\mathrm{P}_{1}[/latex] and [latex]\mathrm{T}_{8}[/latex] to [latex]\mathrm{P}_{2}[/latex].

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \xcancel{(\mathrm{T}_{4})}, \xcancel{(\mathrm{T}_{5})}, \xcancel{(\mathrm{T}_{6})}, \cancel{(\mathrm{T}_{7})}, \cancel{(\mathrm{T}_{8})}, \xcancel{(\mathrm{T}_{2})}, \mathrm{T}_{9}[/latex]

Timeline chart from 0 to 10 with task executions for processes P1 and P2. P1 executes tasks T1 at time 0-2, T4 at 2-3, T2 at 3-3.5, T6 at 3.5-4, and T7 at 4-4.5. P2 runs task T3 at time 0-2, T5 at 2-4, and T8 at 4-4.5..

 

Time 4.5: Both processors complete their tasks. [latex]\mathrm{T}_{9}[/latex] becomes ready, and is assigned to [latex]\mathrm{P}_{1}[/latex]. There is no ready task for [latex]\mathrm{P}_{2}[/latex] to work on, so [latex]\mathrm{P}_{2}[/latex] idles.

Priority list: [latex]\xcancel{(\mathrm{T}_{1})}, \xcancel{(\mathrm{T}_{3})}, \xcancel{(\mathrm{T}_{4})}, \xcancel{(\mathrm{T}_{5})}, \xcancel{(\mathrm{T}_{6})}, \xcancel{(\mathrm{T}_{7})}, \xcancel{(\mathrm{T}_{8})}, \xcancel{(\mathrm{T}_{2})}, \cancel{(\mathrm{T}_{9})}[/latex]

Timeline chart from 0 to 10 with task executions for processes P1 and P2. P1 executes tasks T1 at time 0-2, T4 at 2-3, T2 at 3-3.5, T6 at 3.5-4, T7 at 4-4.5, and T9 at 4-5. P2 runs task T3 at time 0-2, T5 at 2-4, and T8 at 4-4.5..

 

With the last task completed, we have a completed schedule, with finishing time [latex]5.5[/latex] days.

Using the digraph below, create a schedule using the priority list with two processors:

[latex]\mathrm{T}_{1}, \mathrm{T}_{2}, \mathrm{T}_{3}, \mathrm{T}_{4}, \mathrm{T}_{5}, \mathrm{T}_{6}, \mathrm{T}_{7}, \mathrm{T}_{8}, \mathrm{T}_{9}[/latex]

Diagram showing nine tasks with their durations. T1(10) starts from a circle and points to T2(7). T2(7) then points to T3(4) and T6(4). T4(9) points to T5(5) and T8(4). T5(5) points to T6(4) and T3(4). T8(4) points to T9(6). T7(13)  points to T5(5) and T8(4).

There are other algorithms that can be used to create the priority list including, the decreasing time algorithm, the critical path algorithm, and the backflow algorithm. We will explore these algorithms in the Apply It section.