1 / 14

Planning and Scheduling

Planning and Scheduling. Chapter 3 Jennifer Holland February 2, 2010. Scheduling Tasks. Processors Anything that can perform a task Humans, robots, or machines Machine-Scheduling Problem Deciding how to assign task to various processors Want to achieve earliest completion as possible

keisha
Télécharger la présentation

Planning and Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Planning and Scheduling Chapter 3 Jennifer Holland February 2, 2010

  2. Scheduling Tasks • Processors • Anything that can perform a task • Humans, robots, or machines • Machine-Scheduling Problem • Deciding how to assign task to various processors • Want to achieve earliest completion as possible • Tasks must then be prioritized • Rules must be in place in cases of “ties” in importance

  3. Examples of Prioritizing Visiting an emergency room • Man with a broke leg • Child who will not open one of his eyes • Woman with severe pains in her abdomen • Child with a fever

  4. Assumptions and Goals • Once a task has begun, the processor will continue with the task until has been complete. • If there is an idle processor and a task to be completed, the processor will immediately begin work on the task. • Ordering of tasks must as be taken into consideration. • In addition to the order of tasks must be done, there is also a priority list which is independent of the first list.

  5. Building a House • Priority List • Prep site for digging • Dig for foundation • Lay Foundation • Order-requirement digraph 5 7 5 3 T7 T8 T5 T6 8 6 T1 T2 9 4 T3 T4

  6. List-Processing Algorithm Part I and Ready Task • A task is ready if all its predecessors (from digraph) have been completed at that time. • At a given time, assign to the lowest-numbered free processor the first task on the priority list that is ready at that time and hasn’t already been assigned to another processor Part II • Priority list is scanned from left to right. • If no task can be assigned at that time, one or more processors will remain idle until there is a task ready.

  7. Using List-Processing Algorithm • Order-requirement digraph • Priority List: T8, T7, T6, T5, T4, T3, T2, T1 Idle time 5 7 5 3 Machine 1 T7 T8 T5 T6 8 6 T1 T2 9 4 0 5 7 13 19 24 27 28 32 Machine 2 T3 T4 Note: Different Priority Lists will produce different schedules with different end times.

  8. When is a Schedule Optimal? 5 7 • An optimal schedule will have the least amount of idle time. • The shortest completion time is made up of the path with the longest distance through the order-requirement digraph; T1, T2, T3, T4 with a length of 27 • This distance must be at least as large as the total task times divided by the number of processors—47/2 = 23.5 (actually 24 because the tasks are integer times so the solution must also be integer. 5 3 T7 T8 T5 T6 8 6 T1 T2 9 4 T3 T4

  9. Critical-Path Schedules • Before the priority list was given. • Now the question is whether or not there is a systematic way of choosing a priority list which will yield an optimal solution

  10. How to Obtain Priority List L • Find a task that heads a critical (longest) path in the order-requirement digraph. If there is a tie, choose the task with the lower number. • Place the task found in step 1 next on the list L. (The first time through the process this task will head the list.) • Remove the task found in step 1 and the edges attached to it from the current order-requirement digraph, obtaining a new (modified) order-requirement digraph. • If there are no vertices left in the new order-requirement digraph, the procedure is complete; if there are vertices left, go back to step 1. This procedure will terminate when all the tasks in the original order-requirement digraph have been placed on the list L.

  11. Priority List L T1 T1T2T3 and T1T4T3 are both critical paths of length 64. Machine 2 T5 T6 T8 T4 T9 T7 T10 Machine 1 T1 T2 T3 T2 14 14 36 T3 T4 14 6 16 T6 T7 4 4 4 16 T5 T1 T2 T3 T8 T9 T10 T5 T6 T8 T4 T9 T7 T10

  12. Bin Packing • Anytime you want to arrange objects of various shape or size, bin-packing heuristics can be applied. Worst-Fit (WF)If we are keeping track of how much room remains in open bins, we can put the next item to be packed into the bin that currently has the most room available. Next-Fit (NF)place the weights into the first bin until the next weight will not fit, then move on to next bin. First-Fit (FF)put the next weight into the first bin already opened that has room for this weight. If no such bin exists, start a new bin. Note: All these methods can be carried out quickly but cannot be guaranteed to produce optimal results.

  13. More Bin Packing Decreasing-Time Heuristics • These are used to address the issue of larger weight items showing up later on in the packing list. • First step is to sort the items to be packed in order of decreasing size—assuming that all items are known in advance. Next-Fit Decreasing (NFD) Worst-Fit Decreasing (WFD) First-Fit Decreasing (FFD)

  14. Class Exercises For these exercises, our bins will be able to hold 10 pounds (length of 10) Next-Fit (NF)place the weights into the first bin until the next weight will not fit, then move on to next bin. First-Fit Decreasing (FFD) put the next weight into the first bin already opened that has room for this weight. If no such bin exists, start a new bin. Worst-Fit (WF)If we are keeping track of how much room remains in open bins, we can put the next item to be packed into the bin that currently has the most room available. Our list of 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7, 7, 5, 5, 8, 8, 4, 4, 5 becomes: 8, 8, 7, 7, 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7, 7, 5, 5, 8, 8, 4, 4, 5 6, 6, 5, 5, 5, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 7, 7, 5, 5, 8, 8, 4, 4, 5 Homework problems: 6a-c; 49

More Related