**3.1 Grid scheduling algorithms**

A scheduling algorithm determines how the applications should be distributed for execution and how resources should be used, according to the system performance goals and the provided information. However, task mapping to a set of heterogeneous resources is a well known NP-complete problem (El-Rewini et al., 1994; Ibarra & Kim, 1977).

Scheduling algorithms can be grouped into two modes: batch and on-line (Maheswaran et al., 1999). In the on-line scheduling mode, a task is mapped to a machine as soon as it arrives to the scheduler. In the batch mode, tasks are not mapped as they arrive. Instead, they are placed inside a data structure called a meta-task and are mapped only in predefined interval times, called mapping events. In this way, batch algorithms can compare the task's resource requirements for performing better mappings.

Dong and Akl (Dong & Akl, 2006) describe scheduling algorithms commonly used in grid computing environments, among which we highlight the following:

**Work Queue (WQ)** is an on-line algorithm that assigns each task to the next machine that becomes available. If multiple machines become available simultaneously, one is randomly chosen. This algorithm maps only one task to a single resource. WQ does not use any specific information regarding the application or the grid resources and is particularly useful for systems where the main objective is to maximize the resources usage, instead of minimizing the execution time of individual tasks. Depending on the implementation, this algorithm may need to check the status of all *m* grid resources to find out which machines are available. Thus, the scheduling complexity of this algorithm is *O*(*m*). An extension of this algorithm, called WQR, uses a replication mechanism. This variant is used by the OurGrid middleware 4.

**Minimum Conclusion Time (MCT)** is an on-line heuristic that assigns each task to the machine with the shorter expected completion time to accomplish it. The completion time corresponds to the sum of the time necessary for the machine to become available (in case it is already running another tasks) plus the time that it will take in order to execute the task. This algorithm can map more than one task per resource. The mapping complexity is *O*(*m*), since as a task arrives, all grid machines are examined for determining the one having the shortest expected conclusion time for its execution.

**Min-min** is a batch heuristic based on MCT. This algorithm takes as input parameters a set of unmapped tasks *M* (meta-task) and a set of grid machines *R*. At its first step, the algorithm computes the completion time of each task in *M* for every machine in *R*. Next, the algorithm searches for the lowest completion time for each task. Min-min then selects the task with the minimum completion time among all tasks in *M* and assigns it to the machine in which this performance is expected to be obtained. The mapped task is removed from the meta-task *M*, and the algorithm increments the expected available time of the chosen grid resource considering the time to run the newly mapped task. This process is repeated until there are no more tasks left to be scheduled. As MCT, min-min also maps more than one task per node. Being *m* the number of tasks in *M* and *r* the amount of resources contained in *R*, computing the completion time of each task in all machines will take *O*(*mr*). The loop is repeated *m* times, leading to a total cost of *O*(*m*2*r*).

<sup>4</sup> http://www.ourgrid.org

**Task Grouping** is an algorithm for scheduling applications comprising a large amount of short-duration tasks. In this case, scheduling and distributing each individual task would overload the system during the tasks transfer to grid resources. The algorithm groups the application's tasks according to their computation sizes and the processing power of the grid resources. Each group is sent to a single resource, reducing the required transmission overhead for task transferring.

Algorithms such as min-min and MCT need to compute how long it would take for running applications on grid resources. This information can be estimated by prediction algorithms (Liu, 2004), which usually follow two basic approaches. The first approach calculates an application estimated execution time based on stored records of previous runs of the same or similar applications. The second approach is based on knowledge regarding the application execution model, which are usually parallel applications with divisible workloads (MPI or PVM). The application code is analyzed, estimating the execution time of each task according to the capacity of the grid resources. An example of this latter approach is the PACE (Performance Analysis and Characterization Environment).
