1 / 29

8 The Mathematics of Scheduling

8 The Mathematics of Scheduling. 8.1 The Basic Elements of Scheduling 8.2 Directed Graphs (Digraphs) 8.3 Scheduling with Priority Lists 8.4 The Decreasing-Time Algorithm 8.5 Critical Paths 8.6 The Critical-Path Algorithm 8.7 Scheduling with Independent Tasks.

penney
Télécharger la présentation

8 The Mathematics of 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. 8 The Mathematics of Scheduling 8.1 The Basic Elements of Scheduling 8.2 Directed Graphs (Digraphs) 8.3 Scheduling with Priority Lists 8.4 The Decreasing-Time Algorithm 8.5 Critical Paths 8.6 The Critical-Path Algorithm 8.7 Scheduling with Independent Tasks

  2. Principal Characters in Scheduling The processors. Every job requires workers. We will use the termprocessors to describe the “workers” who carry out the work. Processors need not be humanbeings. In scheduling, a processor could just as well be a robot, a computer, an automated teller machine, and so on. We will use N to represent the number of processorsand P1, P2, P3,…, PN to denote the processors themselves. We willassume throughout the chapter that N ≥ 2.

  3. Principal Characters in Scheduling The tasks. In every complex project there are individual pieces of work, often called “jobs” or “tasks.” We will define a task as an indivisible unitof work that (either by nature or by choice) cannot be broken up into smallerunits. Thus, by definition a task cannot be shared–it is always carried out bya single processor. In general, we will use capital letters A, B, C, …, to represent the tasks, although in specific situations it is convenient to use abbreviations (such as WE for “wiring the electrical system”).

  4. Principal Characters in Scheduling At a particular moment in time a task can be in one of four possiblestates: (1) ineligible (the task cannot be started because some of the prerequisites for the task have not yet been completed), (2) ready (the task has notbeen started but could be started at this time), (3) in execution (the task isbeing carried out by one of the processors), (4) completed.

  5. Principal Characters in Scheduling The processing times. The processing time of a given task X is the amount oftime, without interruption, required by one processorto execute X. Whendealing with human processors, there are many variables (ability, attitude,work ethic, etc.) that can affect the processing time of a task, and this addsanother layer of complexity to an already complex situation.

  6. Principal Characters in Scheduling On the otherhand, if we assume a “robotic” interpretation of the processors (eitherbecause they are indeed machines or because they are human beings trainedto work in a very standardized and uniform way), then scheduling becomessomewhat more manageable.

  7. Principal Characters in Scheduling To keep things simple we will work under the following three assumptions: ■Any processor can execute any task (call this the versatility assumption). ■The processing time for a task is the same regardless of which processor isexecuting the task (call this the uniformity assumption). ■Once a processor starts a task, it will complete it without interruption (callthis the perseverance assumption).

  8. Principal Characters in Scheduling Under the preceding assumptions, the concept of processing time for a task(we will sometimes call it the P-time) makes good sense–and we can conveniently incorporate this information by including it inside parentheses next to thename of the task. Thus, the notation tells us that the task called X(5) has a processing time of 5 units (be it minutes, hours, days, or any other unit of time)regardless of which processor is assigned to execute the task.

  9. Principal Characters in Scheduling The precedence relations. Precedence relations are formal restrictions on theorder in which the tasks can be executed, much like those course prerequisites in the school catalog that tell you that you can’t take course Y until youhave completed course X. In the case of tasks, these prerequisites are calledprecedence relations. A typical precedence relation is of the form task X precedes task Y (we also say X is precedentto Y), and it means that task Y cannot be started until task X has been completed.

  10. Principal Characters in Scheduling A precedence relation canbe conveniently abbreviated by writing XgY,or described graphically asshown. A single scheduling problem can have hundreds or eventhousands of precedence relations, each adding another restriction on thescheduler’s freedom.

  11. Principal Characters in Scheduling It also happens fairly often that there are no restrictions on the order of execution between two tasks in a project. When a pairof tasks X and Y have no precedence requirements between them (neitherX g Y nor Y g X), we say that the tasks are independent; either one can be started before the other one, or they canboth be started at the same time. Graphically, we can tell that two tasks are independent if there are no arrowsconnecting them.

  12. Principal Characters in Scheduling Precedence relations are transitive:If X g Y and Y g Z then it must betrue that X g Z. We willmake a distinction between two types of precedence relations:basic andimplicit. Basic precedence relations are the ones that come with the problemand that we must follow in the process of creating a schedule. If we do this,the implicit precedence relations will be taken care of automatically.

  13. Principal Characters in Scheduling We cannot have a set of precedence relationsthat form a cycle! Imagine having to schedule the tasks shown: X precedes Y, which precedes Z, which precedes W, which in turn precedesX. Clearly, this is logically impossible. From here on, we will assume thatthere are no cycles of precedence relations among the tasks.

  14. Principal Characters in Scheduling Processors, tasks, processing times, and precedence relations are the basic ingredients that make up a scheduling problem. They constitute, in a manner ofspeaking, the hand that is dealt to us. But how do we play such a hand? To get asmall inkling of what’s to come, let’s look at the following simple example.

  15. Example 8.1 Repairing a Wreck Imagine that you just wrecked your car, but thank heavens you are OK, and theinsurance company will pick up the tab. You take the car to the best garage intown, operated by the Tappet brothers Click and Clack(we’ll just call them P1 and P2). The repairs onthe car can be broken into four differenttasks: (A) exterior body work (4 hours),(B) engine repairs (5 hours), (C) paintingand exterior finish work (7 hours), and (D)transmission repair (3 hours).

  16. Example 8.1 Repairing a Wreck The onlyprecedence relation for this set of tasks isthat the painting and exterior finish workcannot be started until the exterior body work has beencompleted AgC. The two brothers always work together on a repair project, but each takes on a different task (so they won’t argue with each other).Under these assumptions, how should the different tasks be scheduled? Whoshould do what and when?

  17. Example 8.1 Repairing a Wreck Below is a schedule that is very inefficient. All the short tasks are assigned to one processor (P1) and all the long tasks to the other processor (P2) –obviously not a very clever strategy. Under this schedule, the project finishing time(the duration of the project from the start of the first task to the completion of thelast task) is 12 hours.

  18. Example 8.1 Repairing a Wreck We will use Fin to denote the project finishing time, forthis project we write Fin = 12 hours. Here’s what looks like a much better schedule, but it violates theprecedence relation AgC (as much as we would love to, we cannot start task Cuntil task A is completed).

  19. Example 8.1 Repairing a Wreck On the other hand, if we force P2 to be idle for one hour, waiting for the green light to start task C, we get a perfectly good schedule. Under this schedule the finishing time of the project is Fin = 11hours.

  20. Example 8.1 Repairing a Wreck That schedule is an improvement over the first schedule.Can we do even better? No! No matter how clever we are and no matter how manyprocessors we have at our disposal, the precedence relation A(4) gC(7) impliesthat 11 hours is a minimum barrier that we cannot break–it takes 4 hours to complete A, 7 hours to complete C, and we cannot start C until A is completed!

  21. Example 8.1 Repairing a Wreck Thus, thatschedule is an optimal schedule and the finishing time of Fin = 11hours is the optimal finishing time. (Use Opt in place of Fin.) Here’s adifferent optimal schedule with finishing time hours Opt=11.

  22. Two Useful Lessons As scheduling problems go, Example 8.1 was a fairly simple one. But evenfrom this simple example, we can draw some useful lessons. First, notice thateven though we had only four tasks and two processors,we were able to createseveral different schedules. In looking for agood, or even an optimal, schedule, we are going to need a systematic way to sortthrough the many possibilities. In other words, we are going to need some goodscheduling algorithms.

  23. Two Useful Lessons Second, there is an absolute minimum time that no schedule can break, no matter how good an algorithm we use or how many processorswe put to work. Every project, no matter how simple or complicated, has such an absolute minimum (called the critical time) that dependson the processing times and precedence relations for the tasks and not on thenumber of processors used.

  24. Example 8.2 Building That Dream Home on Mars It is the year 2050, and several human colonies have already been established onMars. Imagine that you accept a job offer to work in one of these colonies. Whatwill you do about housing?Like everyone else on Mars, you will be provided with a living pod called a Martian Habitat Unit (MHU). MHUs are shipped to Mars in the form of prefabricatedkits that have to be assembled on the spot – an elaborate and unpleasant job if youare going to do it yourself.

  25. Example 8.2 Building That Dream Home on Mars A better option is to use specialized “construction” robotsthat can do all the assembly tasks much more efficiently than human beings can.These construction robots can be rented by the hour at the local Rent-a-Robotoutlet.The assembly of an MHU consists of 15 separate tasks, and there are 17 different precedence relations among these tasks that must be followed. The tasks,their respective processing times, and their precedent tasks are all shown next.

  26. Example 8.2 Building That Dream Home on Mars

  27. Example 8.2 Building That Dream Home on Mars

  28. Example 8.2 Building That Dream Home on Mars Here are some of the basic questions we will want to address: How can weget your MHU built quickly? How many robots should you rent to do the job?How do we create a suitable work schedule that will get the job done? (A robotwill do whatever it is told, but someone has to tell it what to do and when.)These are all tough questions to answer, but we will be able to do it later in thechapter.

More Related