230 likes | 416 Views
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.
E N D
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 ALGORITHM • 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 • 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 applies • If there is a ready task repeat step 1. • If there are no ready tasks bunt not every task has been completed, the idle processor remains idle until more tasks are completed. • 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
T1-10 T4-22 T3-7 T2-18 T5-29 P1
EXAMPLE: • What is the completion time for the job shown in the digraph below using the priority list using two processors?
T2-15 T3-7 T5-22 P1 P2 IDLE-7 T1-3 T4-11 IDLE-15 IDLE-22
Making Fajitas • Tortillas • Chicken • 1 onion • Seasoning • Tomatoes • Cilantro T1: slice chicken & onions – 5 min T2: Cook chicken – 10 min T3: Cook onions – 5 min T4: Add seasoning – 1 min T5: Chop tomato – 4 min T6: Mix tomato and cilantro – 2 min T7: Warm tortillas – 1 min T8: Serve – 1 min Priority list: ,,
, , T7-28 T2-21 T3-26 T5-4 T6-6 T1-11 P1 T4-27 T8-29
, , T8-22 T4-21 T7-7 IDLE P1 T3-20 T5-4 T6-6 P2 IDLE T2-15 T1-5 IDLE
IDLE T3-14 T10-18 T8-10 T1-1 T5-5 P1 T4-15 IDLE T6-9 P2 IDLE T9-17 T7-7 IDLE T2-12
T8-10 T4-13 T10-16 T3-12 P1 T6-9 T1-1 T5-5 P2 T7-7 IDLE IDLE T9-15 P3 T2-10 IDLE IDLE
Critical Path Schedules • Find a task that heads a critical (longest) path in the order-requirement digraph • Place the task found in step 1 next in the priority list • Remove the task found in step 1 from the digraph • If all tasks have been removed, the list is completed. If tasks remain return to step one.
Critical path T5-12 T6-10 T3-7 P1 T8-16 P2 T4-10 T1-5 T2-8 T7-11
T9-15 T10-16 T1-1 T5-5 P1 T3-12 T2-10 P2 IDLE T6-9 T7-11 IDLE T4-13 T8-12
Critical path algorithm on 3 processors T10-16 P1 T1-1 T3-12 T9-15 T5-5 T2-10 P2 T4-13 T6-9 IDLE T8-10 P3 T7-7 IDLE IDLE
List process algorithm on 3 processors T8-10 T4-13 T10-16 T3-12 P1 T6-9 T1-1 T5-5 P2 T7-7 IDLE IDLE T9-15 P3 T2-10 IDLE IDLE
Critical path algorithm on 2 processors T9-15 T10-16 T1-1 T5-5 P1 T3-12 T2-10 P2 IDLE T6-9 T7-11 IDLE T4-13 T8-12
Critical path algorithm on 3 processors T10-16 P1 T1-1 T3-12 T9-15 T5-5 T2-10 P2 T4-13 T6-9 IDLE T8-10 P3 T7-7 IDLE IDLE