Optimal Algorithms for Task Scheduling Implemented by Ala Al-Nawaiseh Khaled Mahmud
Outline Introduction. Introduction. Algorithms. Algorithms. In-Forest/Out-Forest by Hu In-Forest/Out-Forest by Hu Interval Order by Papadimitriou & Yannakakis Interval Order by Papadimitriou & Yannakakis Two Processor by Coffman & Graham. Two Processor by Coffman & Graham. Program Design. Program Design. Results Results
Introduction Scheduling Scheduling Set of resources (Processors) and set of consumers (Tasks) Set of resources (Processors) and set of consumers (Tasks) Gantt Chart. Gantt Chart.
Introduction Tasks are represented using Graph, hence the concept Task Graph is used. Tasks are represented using Graph, hence the concept Task Graph is used. Graph G=(T,E), Graph G=(T,E), Where T=Task, and E= Directed edges. Where T=Task, and E= Directed edges. The Graph should be a DAG The Graph should be a DAG D: Directed D: Directed A: Acyclic A: Acyclic G: Graph G: Graph
Allowed DAG Types In-Forest : for the Hu and Coffman algorithms In-Forest : for the Hu and Coffman algorithms Out-Forest: for the Hu and Coffman algorithms Out-Forest: for the Hu and Coffman algorithms Interval Order: for Papadimitriou and Coffman algorithms Interval Order: for Papadimitriou and Coffman algorithms
Scheduling DAGs without Considering Communication Scheduling In-Forests/Out-Forests Task Graphs. Scheduling In-Forests/Out-Forests Task Graphs. Introduced by Hu. Introduced by Hu. Algorithm 1 Algorithm 1 In-Forest Level=Longest path from a node to a Terminal node. In-Forest Level=Longest path from a node to a Terminal node. Out_Forest Level= Longest path from a node to a start node. Out_Forest Level= Longest path from a node to a start node. Assign the highest ready task to any available processor. Assign the highest ready task to any available processor.
Scheduling In-Forests/Out-Forests Task Graphs P1P2P Task Level
Scheduling DAGs without Considering Communication Scheduling Interval Ordered Tasks Scheduling Interval Ordered Tasks Introduced by Papadimitriou & Yannakakis. Introduced by Papadimitriou & Yannakakis. Algorithm 2 Algorithm 2 Level=The number of all successors. Level=The number of all successors. Assign the highest ready task to any available processor. Assign the highest ready task to any available processor.
Scheduling Interval-Ordered Tasks P1P2P
Scheduling DAGs without Considering Communication Two processor Scheduling Two processor Scheduling Introduced by Coffman & Graham. Introduced by Coffman & Graham. 1. Assign 1 to one of the terminal tasks. 2. 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 3. Use L(v) as the priority of task v and ties are broken arbitrary. 4. Whenever a processor becomes available, assign it the unexecuted ready task with the highest priority. Ties are broken arbitrarily.
Scheduling Trees on Two processors P1P
Program Design We represented the DAG Graphs using Adjacency Matrix. 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. 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.directed graphverticesmatrixedgedirected graphverticesmatrixedge
Program Flow Chart Read Input File Build Node Informationm No Error MEssage Main Alg = "Hu" || Alg ="IntervalOrder" || Alg="Coffman" End Alg = ? Hu Interval Order Coffman Graph =In/Out forest Graph =Interval Order Graph =DAG Error MEssage No Assign Level Sort By Level Schedu It Output Assign Level Sort By Level Schedu It Output Assign Level Sort By Level Schedu It Output End
Results abc def hij kl m g 4 Processors P4P3P2P1 ecba hgfd lji k m In-Forest Scheduling on four processors using Hu algorithm In-Forest Scheduling on four processors using Hu algorithm
Results Out-Forest Scheduling on four processors using Hu algorithm Out-Forest Scheduling on four processors using Hu algorithm abc def hij kl m g 4 Processors P4P3P2P1 m lk jih gfed cba
Interval Order using Papadimitriou s algorithm Results
Results ab cd efg hi jk 2 Processors P2P1 ba dc ef hg ji k DAG using Coffman Algorithm
Sample input file and output Input File ====== a b c d e f g h i j k
Reference Advanced Computer Architecture and Parallel Processing Advanced Computer Architecture and Parallel Processing By By Hesham El-Rewini Hesham El-Rewini Mostafa Abd-El-Bar Mostafa Abd-El-Bar
Thank You