Critical Path Analysis & List Processing Algorithm

Preview:

DESCRIPTION

Critical Path Analysis & List Processing Algorithm. Scheduling Tasks. A processor is a person, machine, computer, or robot etc., which works on a task. To solve a scheduling problem typically the tasks are scheduled to minimize completion times. - PowerPoint PPT Presentation

Citation preview

Critical Path Analysis&

List Processing Algorithm

Scheduling Tasks• A processor is a person, machine, computer, or

robot etc., which works on a task.

• To solve a scheduling problem typically the tasks are scheduled to minimize completion times.

 • Make sure to consider importance of a task, does

one task need to be completed before another task.

ASSUMPTIONS AND RULES• If a processor starts working on a task, the

work will continue until that task is complete.• No processor stays idle if there is a task to

be done.• The CPA has an associated order-

requirement digraph.• The tasks are arranged in a priority list that

is independent of the digraph.

Goals of CPA• Minimize the completion time for a given

number of processors• Minimize processor idle time• Minimize the number of processors

needed to complete the job in a specified time.

A task is considered ready if all its predecessors (prerequisite tasks) in the digraph have been completed.

LIST PROCESSING ALGORITHM1. Assignment of Processors: The lowest numbered

idle processor is assigned to the highest priority ready task until either all processors are assigned or all ready tasks are being worked on

2. Status Check: When a processor completes a task, that processor becomes idle. Check for ready tasks and tasks not yet completed and determine which of the following appliesa) If there is a ready task repeat step 1.b) If there are no ready tasks bunt not every task has been

completed, the idle processor remains idle until more tasks are completed.

c) If all tasks are completed, the job is done.

EXAMPLE: • What is the completion time for the job shown

in the digraph below using the priority list using one processor

T13

T28

T37

T44

T57

𝑇 3 ,𝑇 2 ,𝑇1 ,𝑇 4 ,𝑇 5T13

T28

T37

T44

T57

P1T1-10 T5-29T4-22T2-18T3-7

EXAMPLE: • What is the completion time for the job shown

in the digraph below using the priority list using two processors?

T13

T28

T37

T44

T57

𝑇 3 ,𝑇 2 ,𝑇1 ,𝑇 4 ,𝑇 5T13

T28

T37

T44

T57

P1T1-3

T5-22

T4-11

T2-15T3-7

P2 IDLE-7 IDLE-15IDLE-22

Making Fajitas

• Tortillas• Chicken• 1 onion• Seasoning• Tomatoes• Cilantro

T1: slice chicken & onions – 5 minT2: Cook chicken – 10 minT3: Cook onions – 5 minT4: Add seasoning – 1 minT5: Chop tomato – 4 minT6: Mix tomato and cilantro – 2 minT7: Warm tortillas – 1 minT8: Serve – 1 min

Priority list: , ,

, ,

T210

T35

T41

T54

T15

T62

T71

T81

P1T1-11T6-6T5-4

T4-27

T2-21 T3-26T7-28

T8-29

, ,

T210

T35

T41

T54

T15

T62

T71

T81

P1 T5-4

P2 T1-5

T6-6T7-7 T4-21

T2-15

T3-20T8-22

IDLE

IDLE IDLE

You Try

P1P2

T5-5T1-1

IDLE

T8-10

T7-7 T2-12

T6-9 IDLET3-14

T4-15

IDLE T9-17

IDLE T10-18

P1P2

T5-5T1-1

IDLE

T8-10

T7-7

T2-10

T6-9T3-12

T4-13

IDLE

T9-15

T10-16

P3IDLE IDLE

Critical Path Schedules1. Find a task that heads a critical (longest)

path in the order-requirement digraph2. Place the task found in step 1 next in the

priority list3. Remove the task found in step 1 from the

digraph4. If all tasks have been removed, the list is

completed. If tasks remain return to step one.

Critical pathT15

T23

T37

T42

T52

T63

T71

T84

P1P2

T8-16

T7-11

T3-7

T1-5 T2-8

T6-10

T4-10

T5-12

You Try using 2 and 3 processors using critical path

P1P2

T5-5T1-1

IDLE

T8-12

T7-11

T2-10

T6-9

T3-12

T4-13

IDLE

T9-15 T10-16

P1P2

T5-5T1-1

IDLE

T8-10

T7-7

T2-10

T6-9

T3-12

T4-13

IDLE

T9-15T10-16

P3

Critical path algorithm on 3 processors

IDLE

P1P2

T5-5T1-1

IDLE

T8-10

T7-7

T2-10

T6-9T3-12

T4-13

IDLE

T9-15

T10-16

P3IDLE IDLE

List process algorithm on 3 processors

P1P2

T5-5T1-1

IDLE

T8-12

T7-11

T2-10

T6-9

T3-12

T4-13

IDLE

T9-15 T10-16

Critical path algorithm on 2 processors

P1P2

T5-5T1-1

IDLE

T8-10

T7-7

T2-10

T6-9

T3-12

T4-13

IDLE

T9-15T10-16

P3

Critical path algorithm on 3 processors

IDLE

Recommended