• 沒有找到結果。

Chapter 3 Software Simulator for Workflow Scheduling

3.2 Classes in the Simulator

In this section, the classes used in the simulator are described including DAG_Generator, EventNode, EventQueue, WaitQueueNode, WaitQueue, WorkflowScheduling and Allocation classes.

DAG_Generator:

DAG_Generator is responsible for generating input workload consisting of a sequence of DAGs in their arrival order. Table 3-1 shows an UML DAG_Generator class. It contains 7 attributes, <Node, Shape, OutDegree, CCR, BRange, WDAG, Cluster>, and 4 operations, <Generator(), ShapeGenerator(Node, Shape), RelationGenerator(Node, OutDegree), CostGenerator(Node, BRange, WDAG, Cluster, CCR)>.

The attributes and operations in DAG_Generator are described as following.

Attributes:

1. Node: the number of tasks in a DAG.

2. Shape: the shape of a DAG.

3. OutDegree: the maximum of out degree of tasks in a DAG.

4. CCR: communication cost to computation cost ratio.

5. BRange (β): distribution range of computation cost of tasks on processors. It is the heterogeneous factor for processor speeds. A high range indicates

Table 3-1 DAG_Generator class

15

significant differences in task’s computation costs among the processors and a low range indicates that the expected execution time of a task is almost the same on each processor.

6. WDAG: the average computation cost of a DAG.

7. Cluster: the number of clusters in a Grid environment.

Operations:

1. Generator(): randomly generates a DAG according to the 7 input parameters mentioned above. It invokes ShapeGenerator(), RelationGenerator(), CostGenerator() in turn.

2. ShapeGenerator(Node, Shape): generates the shape of a DAG using Node and Shape parameters. The height (depth) of a DAG is randomly generated from a uniform distribution with mean value equal to Node

Shape . The width for each level is randomly generated from a uniform distribution with mean value equal to Shape × Node . If 𝑠ℎ𝑎𝑝𝑒 ≫ 1 , it generates a shorter graph with high parallelism degree. Otherwise, if shape ≪ 1, it generates a longer graph with a low parallelism degree.

3. RelationGenerator(Node, OutDegree): generates the connect relation of a DAG according to the input parameters Node and OutDegree defined above. Out degree of each task is randomly generated from a uniform distribution with range [1, OutDegree].

4. CostGenerator(Node, BRange, WDAG, Cluster, CCR): generates the computation cost and the communication cost of a DAG. The average estimated computation cost of each task tx, i.e., w is randomly generated from a x distribution ranged [1, 2 × WDAG]. The estimated computation cost of each

16

task tx on each cluster cy, i.e., wx,y is randomly generated from a uniform distribution with range:

wx

× (1 −BRange

2 ) ≤ wx,y ≤ w × (1 +x BRange 2 )

EventNode:

EventQueue stores a set of EventNodes. Each EventNode contains 6 attributes,

<type, time, jobIndex, dagIndex, *pre, *next>. Table 3-2 shows EventNode class.

Attributes:

1. type: the type of an event. Table 3-3 shows EventType enumeration. There are two kinds of EventType: submit and end. Each event contains the attributes,

<jobIndex, dagIndex> uniquely identifying a job. When a submit event occurs, a job <jobIndex, dagIndex> will be submitted to WaitQueue for scheduling and allocation. When an end event occurs, a job <jobIndex, dagIndex> completes successfully.

Table 3-2 EventNode class

Table 3-3 EventType enumeration

17

2. time: the time that the event happens.

3. jobIndex: the index of a job.

4. dagIndex: the index of a dag.

5. *pre: a link pointing to the preceding EventNode.

6. *next: a link pointing to the next EventNode.

EventQueue:

EventQueue is composed of a sequence of EventNodes. There are 3 attributes,

<*front, *rear, eventQueueCount>, and 3 operations, <enQueue(EventNode), deQueue(), isEmpty()> in EventQueue. Table 3-4 shows EventQueue class.

Attributes:

1. *front: points to the first EventNode in EventQueue.

2. *rear: points to the last EventNode in EventQueue.

Operations:

1. enQueue(EventNode): an operation that inserts an EventNode into EventQueue.

2. deQueue(): an operation that removes and returns the first EventNode in EventQueue.

Table 3-4 EventQueue class

18

3. isEmpty(): an operation that checks whether EventQueue is empty or not. If EventQueue is empty, it returns true. Otherwise, it returns false.

Figure 3-2 shows an example of EventQueue. The EventNodes are sorted according to their arrival time (EventNode.time). *fornt points to the first EventNode, EventNode1, and *rear points to the last EventNode, EventNode5.

Figure 3-2 An example of EventQueue

19

WaitQueueNode:

WaitQueueNode represents the elements stored in WaitQueue. There are 7 attributes, <jobIndex, dagIndex, np, ftown, ftmulti, rank, slowdown> in WaitQueueNode. Table 3-5 shows WaitQueueNode class.

Attributes:

1. jobIndex: the index of a job.

2. dagIndex: the index of a dag.

3. np: the number of processors that the job <jobIndex, dagIndex> needs.

4. ftown: the finish time of the job <jobIndex, dagIndex>, when the DAG has the whole processors for exclusive use. The detail of ftown is described in [20].

5. ftmulti: the finish time of the job <jobIndex, dagIndex>, when the DAG is scheduled onto processors along with other workflow applications. The detail of ftmulti is described in [20].

6. rank: the upward rank value ranku. ranku(ti) means the length of critical path from task ti to the exit task. The detail of ranku is described in Chapter 4.

7. slowdown: the main idea of the slowdown value is defined as ftown / ftmulti. The detail of slowdown is described in [20].

Table 3-5 WaitQueueNode class

20

WaitQueue:

WaitQueue is composed of a sequence of WaitQueueNodes. On a submit event, a new WaitQueueNode is created according to the EventNode, and is submitted to WaitQueue by calling WaitQueue.enQueue (WaitQueueNode) operation. WaitQueue has 2 attributes, <waitQueueCount, waitQueue[]>, and 10 operations,

<enQueue(WaitQueueNode), remove(WaitQueueNode), isEmpty(), front(), Fairnss_TaskScheduling(), RankHYBD_TaskScheduling(), Easy_Backfilling(), Conservative_Backfilling(), FirstFit(), FCFS()>. Table 3-6 shows WaitQueue class.

Attributes:

1. waitQueueCount: the total number of WaitQueueNodes in WaitQueue. In other words, it represents the length of WaitQueue.

2. waiQueue[]: an array that WaitQueueNodes are stored.

Operations:

1. enQueue(WaitQueueNode): an operation that inserts a WaitQueueNode into WaitQueue.

2. remove(WaitQueueNode): an operation that removes a WaitQueueNode from Table 3-6 WaitQueue class

21

WaitQueue.

3. isEmpty(): an operation that checks whether WaitQueue is empty or not. If WaitQueue is empty, it returns true. Otherwise, it returns false.

4. front(): returns the first WaitQueueNode in WaitQueue.

5. Fairness_TaskScheduling() and RankHYBD_TaskScheduling(): both operations implement two distinct task scheduling algorithms. The order of WaitQueueNodes in WaitQueue is determined by these two operations. The details of these two scheduling algorithms will be described in Chapter 4.

6. Easy_Backfilling(), Conservative_Backfilling() and FirstFit(): In parallel task scheduling, a task is delayed when the processors it needs are more than free processors in the system. This situation causes a scheduling hole. These approaches provide distinct methods to locate waiting tasks for the scheduling hole to improve resource usage. The details of these algorithms will be described in Chapter 4.

Workflow Scheduling:

Workflow Scheduling implements workflow scheduling algorithms and contains 2 operations, <SWS(), CPWS()>. SWS means simple workflow scheduling, and CPWS means critical path workflow scheduling. The detailed descriptions of these two workflow scheduling algorithms are presented in Chapter 4. Table 3-1 shows WorkflowScheduling class.

Table 3-7 WorkflowScheduling class

22

Allocation:

Allocation implements allocation algorithms and contains 2 operations, <SA(), AA()>. SA means simple allocation, and AA means adaptive allocation. The detailed description of these two allocation algorithms are presented in Chapter 4. Table 3-8 shows Allocation class.

Table 3-8 Allocation class

23

相關文件