230 likes | 402 Views
Optimal Algorithms for Task Scheduling. Implemented by Ala Al-Nawaiseh Khaled Mahmud. Outline. Introduction. Algorithms. In-Forest/Out-Forest by Hu Interval Order by Papadimitriou & Yannakakis Two Processor by Coffman & Graham. Program Design. Results. Introduction. Scheduling
E N D
Optimal Algorithms for Task Scheduling Implemented by Ala Al-Nawaiseh Khaled Mahmud
Outline • Introduction. • Algorithms. • In-Forest/Out-Forest by Hu • Interval Order by Papadimitriou & Yannakakis • Two Processor by Coffman & Graham. • Program Design. • Results
Introduction • Scheduling • Set of resources (Processors) and set of consumers (Tasks) • Gantt Chart.
Introduction • Tasks are represented using Graph, hence the concept Task Graph is used. • Graph G=(T,E), • Where T=Task, and E= Directed edges. • The Graph should be a DAG • D: Directed • A: Acyclic • G: Graph
Allowed DAG Types • In-Forest : for the Hu and Coffman algorithms • Out-Forest: for the Hu and Coffman algorithms • Interval Order: for Papadimitriou and Coffman algorithms
Scheduling DAGs without Considering Communication • Scheduling In-Forests/Out-Forests Task Graphs. • Introduced by Hu. • Algorithm 1 • In-Forest Level=Longest path from a node to a Terminal node. • Out_Forest Level= Longest path from a node to a start node. • Assign the highest ready task to any available processor.
14 1 12 1 13 1 11 1 10 1 9 1 8 1 7 1 6 1 5 1 3 1 2 1 4 1 1 1 Scheduling In-Forests/Out-Forests Task Graphs
Scheduling DAGs without Considering Communication • Scheduling Interval Ordered Tasks • Introduced by Papadimitriou & Yannakakis. • Algorithm 2 • Level=The number of all successors. • Assign the highest ready task to any available processor.
4 1 3 1 5 1 1 1 2 1 6 1 Scheduling Interval-Ordered Tasks
Scheduling DAGs without Considering Communication • Two processor Scheduling • Introduced by Coffman & Graham. • Assign 1 to one of the terminal tasks. • Let labels 1,2,...,j-1 have been assigned. Let S be the set of unassigned tasks with no unlabeled successors. We next select an element of S to be assigned label j. For each node x in S define l(x) as follows: Let y1, y2, ...,yk be the immediate successors of x. Then l(x) is the decreasing sequence of integers formed by ordering the set {L(y1), L(y2),..., L(yk)}. Let x be an element of S such that for all x' in S, l(x) ≤ l(x') (lexicographically). Define L(x) to be j.
Scheduling DAGs without Considering Communication • Use L(v) as the priority of task v and ties are broken arbitrary. • Whenever a processor becomes available, assign it the unexecuted ready task with the highest priority. Ties are broken arbitrarily.
2 1 1 1 3 1 6 1 8 1 4 1 5 1 7 1 • 1 1 1 1 • 1 1 Scheduling Trees on Two processors
Program Design • We represented the DAG Graphs using Adjacency Matrix. • A representation of a directed graph with n vertices using an n × n matrix, where the entry at (i,j) is 1 if there is an edge from vertex i to vertex j; otherwise the entry is 0.
Main Read Input File Build Node Informationm No Alg = "Hu" || Alg ="IntervalOrder" || Alg="Coffman" Error MEssage Hu Coffman End Alg = ? Interval Order No Graph =In/Out forest Graph =DAG Assign Level Sort By Level Schedu It Output Assign Level Sort By Level Schedu It Output Graph =Interval Order No Assign Level Sort By Level Schedu It Output Error MEssage End Program Flow Chart
a b c d e f g h i j k l m Results • In-Forest Scheduling on four processors using Hu algorithm
a b c d e f g h i j k l m Results • Out-Forest Scheduling on four processors using Hu algorithm
a b c d e f g h i j k Results DAG using Coffman Algorithm
Sample input file and output Input File ====== 11 14 a b c d e f g h i j k 0 2 1 3 2 4 2 5 3 5 3 6 4 7 4 9 5 7 5 8 6 8 7 9 7 10 8 10
Reference • Advanced Computer Architecture and Parallel Processing • By • Hesham El-Rewini • Mostafa Abd-El-Bar