# Excursions in Modern Mathematics, 7e: 8.7 - 1Copyright © 2010 Pearson Education, Inc. Scheduling with Independent Tasks Notes 9 – Section 8.7.

## Presentation on theme: "Excursions in Modern Mathematics, 7e: 8.7 - 1Copyright © 2010 Pearson Education, Inc. Scheduling with Independent Tasks Notes 9 – Section 8.7."— Presentation transcript:

Excursions in Modern Mathematics, 7e: 8.7 - 1Copyright © 2010 Pearson Education, Inc. Scheduling with Independent Tasks Notes 9 – Section 8.7

Excursions in Modern Mathematics, 7e: 8.7 - 2Copyright © 2010 Pearson Education, Inc. Essential Learnings Students will understand and be able to schedule independent tasks.

Excursions in Modern Mathematics, 7e: 8.7 - 3Copyright © 2010 Pearson Education, Inc. We will briefly discuss what happens to scheduling problems in the special case when there are no precedence relations to worry about. This situation arises whenever we are scheduling tasks that are all independent. There are no efficient optimal algorithms known for scheduling, even when the tasks are all independent. Independent Tasks

Excursions in Modern Mathematics, 7e: 8.7 - 4Copyright © 2010 Pearson Education, Inc. The nuts-and-bolts details of creating a schedule using a priority list become tremendously simplified when there are no precedence relations to mess with. In this case, we just assign the tasks to the processors as they become free in exactly the order given by the priority list. Scheduling with Independent Tasks

Excursions in Modern Mathematics, 7e: 8.7 - 5Copyright © 2010 Pearson Education, Inc. Without precedence relations, the critical-path time of a task equals its processing time. This means that the critical-time list and decreasing-time list are exactly the same list, and, thus, the decreasing-time algorithm and the critical-path algorithm become one and the same. Scheduling with Independent Tasks

Excursions in Modern Mathematics, 7e: 8.7 - 6Copyright © 2010 Pearson Education, Inc. Priority list: A(70), B(90), C(100), D(70), E(80), F(20), G(20), H(80), I(10) Since there are no precedence relations, there are no ineligible tasks, and all tasks start out as ready tasks. As soon as a processor is free, it picks up the next available task in the priority list. From the bookkeeping point of view, this is a piece of cake. It is obvious from the figure on the next slide that this is not a very good schedule. Example – Preparing for Lunch

Excursions in Modern Mathematics, 7e: 8.7 - 7Copyright © 2010 Pearson Education, Inc. Example – Preparing for Lunch

Excursions in Modern Mathematics, 7e: 8.7 - 8Copyright © 2010 Pearson Education, Inc. If we use the decreasing-time priority list (which in this case is also the critical-time priority list), we are bound to get a much better schedule. Priority list: C(100), B(90), E(80), H(80), A(70), D(70), F(20), G(20), I(10) Example – Preparing for Lunch

Excursions in Modern Mathematics, 7e: 8.7 - 9Copyright © 2010 Pearson Education, Inc. This is clearly an optimal schedule, since there is no idle time for any of the processors throughout the project. The optimal finishing time for the project is Opt = 180 minutes. Example – Preparing for Lunch

Excursions in Modern Mathematics, 7e: 8.7 - 10Copyright © 2010 Pearson Education, Inc. After the success of your last banquet, you and your two friends are asked to prepare another banquet. This time it will be a seven-course meal. The courses are all independent tasks, and their processing times (in minutes) are A(50), B(30), C(40), D(30), E(50), F(30), and G(40). Example – Preparing for Lunch: Part 2

Excursions in Modern Mathematics, 7e: 8.7 - 11Copyright © 2010 Pearson Education, Inc. The decreasing-time priority list is A(50), E(50), C(40), G(40), B(30), D(30), and F(30). The resulting schedule, has project finishing time Fin = 110 minutes. Example – Preparing for Lunch: Part 2

Excursions in Modern Mathematics, 7e: 8.7 - 12Copyright © 2010 Pearson Education, Inc. An optimal schedule (found using old-fashioned trial and error) with finishing time Opt = 90 minutes is shown. Example – Preparing for Lunch: Part 2

Excursions in Modern Mathematics, 7e: 8.7 - 13Copyright © 2010 Pearson Education, Inc. Knowing the optimal finishing time Opt = 90 minutes allows us to measure how much we were off when we used the decreasing-time priority list. As we did with earlier approximate solutions, we use the relative error. In this case, the relative error is: (110 – 90)/90 = 20/90 ≈ 0.2222 = 22.22%. Example – Preparing for Lunch: Part 2

Excursions in Modern Mathematics, 7e: 8.7 - 14Copyright © 2010 Pearson Education, Inc. For a schedule with finishing time Fin, the relative error (denoted by  ) is given by RELATIVE ERROR OF A SCHEDULE

Excursions in Modern Mathematics, 7e: 8.7 - 15Copyright © 2010 Pearson Education, Inc. In 1969, American mathematician Ron Graham showed that when scheduling independent tasks using the critical-path algorithm with N processors, the relative error is at most (N – 1)/3N. We will call this upper bound for the relative error the Graham bound. Graham Bound

Excursions in Modern Mathematics, 7e: 8.7 - 16Copyright © 2010 Pearson Education, Inc. The Graham bound for the relative error  when scheduling a set of independent tasks with N processors is GRAHAM BOUND

Excursions in Modern Mathematics, 7e: 8.7 - 17Copyright © 2010 Pearson Education, Inc. The table shows the Graham bound for the relative error  for a few small values of N. Graham’s Bound

Excursions in Modern Mathematics, 7e: 8.7 - 18Copyright © 2010 Pearson Education, Inc. The table gives us a good sense of what is happening: As N grows, so does the Graham bound, but the Graham bound tapers off very quickly and will never go past 33 1/3%. Graham’s Bound

Excursions in Modern Mathematics, 7e: 8.7 - 19Copyright © 2010 Pearson Education, Inc. Graham’s bound essentially implies that with independent tasks we can use the critical-path algorithm with the assurance that the relative error is bounded – no matter how many tasks need to be scheduled or how many processors are available to carry them out the finishing time of the project will never be more than 33 1/3% more than the optimal finishing time. Graham’s Bound

Excursions in Modern Mathematics, 7e: 8.7 - 20Copyright © 2010 Pearson Education, Inc. Assignment p. 313: 51, 52, 55, 58, 61, 67, 69