A Comparative Study of Scheduling Algorithms for Real Time Task

100 downloads 207 Views 799KB Size Report
constraints in Real time system for scheduling the task, different scheduling algorithms ..... [1] Jane W.S. Liu, Real-Time Systems , Pearson Education, India, pp.
International Journal of Advances in Science and Technology, Vol. 1, No. 4, 2010

A Comparative Study of Scheduling Algorithms for Real Time Task M.Kaladevi, M.C.A.,M.Phil.,1 and Dr.S.Sathiyabama, M.Sc.,M.Phil.,Ph.D,2 Assistant Professor, Department of M.C.A, Vivekanandha College of Arts and Sciences for Women, Elayampalayam, Tiruchengode – 637 205. Tamil Nadu, India. E-Mail : [email protected]

1

2

Professor, Department of M.C.A, K.S.Rangasamy College of Technology, Tiruchengode, Tamil Nadu, India. E-Mail : [email protected]

Abstract The Real Time Operating System (RTOS) supports applications that meet deadlines in addition to providing logically correct results. In multitasking operating system for the applications need to meeting of time deadlines and functioning in real time constraints. To meet the real-time constraints in Real time system for scheduling the task, different scheduling algorithms were used. Most of the real-time systems are designed using priority based preemptive scheduling and worst case execution time estimates to guarantee the execution of high priority tasks. Workstation and personal computers are increasingly used for applications with real time characteristics such us speech understanding and synthesis, media computations and I/O and often concurrently executed with traditional non-real-time workstation. The main objective of this paper is to compare two important task schedulers such as Earliest DeadLine First (EDF) scheduler and Ant Colony Optimization Based (ACO) scheduler. It also presents a system that can be schedule multiple independent tasks. Tasks can obtain minimum guaranteed execution time with its performances.

Keywords: Real-Time Operating Systems, Scheduling Algorithm, Deadline, Scheduler, Earliest Deadline First(EDF), Ant Colony Optimization (ACO)

1. Introduction 1.1. Real-time systems and Scheduling techniques Real– time system are defined as those systems in which the correctness of the system does not depend only on the logical results of computations but also on the time at which the results are produced [1]. Real-time systems have well defined, fixed time constraints i.e., processing must be completed within the defined constraints otherwise the system will fail. There are two main types of real-time systems: Hard Real-Time System, Firm or Soft Real-Time System. In Hard Real-Time System requires that fixed deadlines must be met otherwise disastrous situation may arise whereas in Soft Real-Time System, missing an occasional deadline is undesirable, but nevertheless tolerable. System in which performance is degraded but not destroyed by failure to meet response time constraints is called soft real time systems. The objective of a real-time task scheduler is to guarantee the deadline of tasks in the system as much as possible when we consider soft real-time system. Mostly all the real-time systems in existence use preemption and multitasking. We observe that the choice of an operating system is important in designing a real time system. Designing a real time systems involves choice for proper language, task portioning and merging and assigning priorities using a real time scheduler to manage response time. The depending upon scheduling objectives parallelism and communication may be balanced. The designer of scheduling policy must be determine critical tasks and assign them high priorities . however, care must be taken avoid starvation, which occurs when high priority tasks are always ready to run.

November Issue

Page 8 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

Real-time scheduling techniques can be largely divided into two categories: Static and Dynamic. Static algorithms assign priorities at design time. All assigned priorities remain constant for the lifetime of a task. Dynamic algorithms assign priorities at runtime, based on execution parameters of tasks. Real Time Scheduling Techniques

Dynamic

Static Priority

Static

Dynamic Priority

Earliest Deadline First

Rate Monolithic Monolithic

Least Slack Time First Deadline Monolithic Figure 1. Types of Real Time Task Scheduling Techniques Dynamic scheduling (see figure 1) can be either with static priority or dynamic priority. RM(Rate Monolithic) and DM(Deadline Monolithic) are examples of dynamic scheduling with static priority[2]. EDF(Earliest Deadline First) and LST (Least Slack Time First) are examples of dynamic scheduling with dynamic priority[3]. EDF and LST algorithms are optimal under the condition that the jobs are preemptive, there is only one processor and the processor is not overloaded [2][3]. But the limitation of these algorithms is, their performance decreases exponentially if the system becomes slightly overloaded [4].

1.2 Ant Colony Optimization (ACO) ACO is a branch of Swarm Intelligence. The advantages of ant-based systems are inherent parallelism, robustness & scalability along with simplicity of individual agent[5][6]. In the early 1990s, ant colony optimization (ACO) was introduced by M. Dorigo and colleagues as a novel nature-inspired metaheuristic for the solution of hard combinatorial optimization (CO) problems. ACO belongs to the class of metaheuristics, which are approximate algorithms used to obtain good enough solutions to hard CO problems in a reasonable amount of computation time. The inspiring source of ACO is the foraging behavior of real ants. When searching for food, ants initially explore the area surrounding their nest in a random manner. As soon as an ant finds a food source, it evaluates the quantity and the quality of the food and carries some of it back to the nest. During the return trip, the ant deposits a chemical pheromone trail on the ground. The quantity of pheromone deposited, which may depend on the quantity and quality of the food, will guide other ants to the food source. As it has been shown in indirect communication between the ants via pheromone trails enables them to find shortest paths between their nest and food sources. This characteristic of real ant colonies is exploited in artificial ant colonies in order to solve CO problems. 1.2.1 Biological Inspiration of Natural Ants: Ant Colony Optimization was originally inspired by the behaviour of natural ants[7]. In the real world, ants release a certain amount of pheromone while walking, and each ant probabilistically prefers to follow a direction which is rich in pheromone. The famous bridge experiment (Deneubourg and Goss, 1989) shows that ants always can find the shortest path between the colony and food source. In the following illustration, we explain why ants are able to adjust to changes in the environment, such as new obstacles interrupting the shortest path.

November Issue

Page 9 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

Figure. 2: Ants' food path between their nest and the food source without obstacles first, as shown in figure.2, ants follow the shortest path to carry food back to their colony. If there is an obstacle obstructs the path the ants will randomly choose another way around the obstruction (right, left, over or under). If we assume that the ants cannot go wider or over the obstruction, we can safely assume that approximately half of the ants will go right and the other half left when ants reach points A and B, as illustrated in figure.3. The ants that happen to pick the shorter path will obviously create a strong trail of pheromone a lot faster than the ants choosing the longer path. This will cause more and more ants to choose the shorter path until eventually all ants have found the shortest path as shown in figure.4.

Figure. 3: Ants explore new paths after encountering obstacle

Figure. 4: Ants find the new shortest path between the food and their nest Ant Colony Optimization attempts to apply similar techniques in order to solve much more complex problems in real life. The main idea is to repeatedly use simulations of artificial ants as agents to generate new solutions to the problem at hand. In general, the ACO approach attempts to solve an optimization problem by repeating the following two steps: • Candidate solutions are constructed using a pheromone model, that is, a parameterized probability distribution over the solution space; • The candidate solutions are used to modify the pheromone values in a way that is deemed to bias future sampling toward high quality solutions. That the ACO based scheduling algorithm performs well during overloaded condition[8]. This algorithm to be optimal when the system is under loaded. But the limitation of this algorithm is that it takes more time for execution compared to EDF algorithm. The whole paper is organized as follows: In Section 2, the system and task model is explained. In Section 3 describes the basic requirements of RTOS scheduler, Section 4 the EDF, ACO based scheduling algorithm is discussed. In Section 5 contains the comparison and analysis of EDF and ACO based scheduling and ends with a conclusion in Section 5.

November Issue

Page 10 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

2. System And Task Model Each unit of work that is scheduled and executed by the system as a job and a set of related jobs, which jointly provide some system function, is a task[9]. All the tasks are assumed to be periodic. The system knows about arrival time, period, required execution time and deadline of the task in priori. There are no precedence constraints on the task; they can run in any order relative to each other as long as their deadlines are met. A task is ready to execute as it arrives in the system. We have assumed that the system is not having resource contention problem. The task set is assumed to be preemptive. We have also assumed that preemption and the scheduling algorithm incurs no overhead. In soft real-time systems, each task has a positive value. The goal of the system is to obtain as much value as possible. If a task succeeds, then the system acquires its value. If a task fails, then the system gains less value from the task. In a special case of soft real-time systems, called a firm real-time system, there is no value for a task that has missed its deadline, but there is no tragedy moreover [9]. Here, we propose an algorithm that applies to firm realtime system. The value of the task has been taken same as its execution time required.

3. Basic Requirements of Scheduler in RTOS The following are the basic requirements of Scheduler in RTOS.  Multitasking and Preemptable  Dynamic Deadline Identification  Predictable Synchronization  Sufficient Priority levels  Predefined latencies a) Multitasking and Preemptable: To support multitasks in real time applications an RTOS should be multitasking and preemptable. The Scheduler should be able to preempt any task in the system and give resource to the task that needs it. b) Dynamic Deadline Identification: In regulate to achieve preemption; an RTOS should be able to dynamically identify the task with the earliest deadline. To handle deadlines, deadline information may be converted to priority levels that are used for resource allocation. It is also employed for lack of a better solution and error less. c) Predictable Synchronization: Multiple threads to communicate among themselves in a timely fashion, predictable inter-task communication and synchronization mechanisms are required. Predictable synchronization requires compromise. Ability to lock or unlock resources is the ways to achieve data integrity. d) Sufficient Priority levels: When using prioritized task scheduling, the RTOS must have a sufficient number of priority levels, for effective implementation. Priority inversion occurs when a higher priority task must wait on a lower priority task to release a resource and turn the lower priority task is waiting upon a medium priority task. Two workarounds in dealing with priority inversion, namely priority inheritance and priority ceiling protocol, need sufficient priority levels. e) Predefined latencies: The timing of system calls must be defined using the following specifications:  Task switching latency or time to save the context of a currently executing task and switch to another.  Interrupt latency or the time elapsed between the execution of the last instruction of the interrupted task and first instruction of the interrupt handler.  Interrupt dispatch latency or the time to switch from the last instruction in the interrupt handler to the next task scheduled to run

4. Dynamic Scheduling Algorithms Dynamic algorithms assign priorities at runtime, based on execution parameters of tasks. Dynamic scheduling can be either with static priority or dynamic priority.

November Issue

Page 11 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

The most important dynamic scheduling with dynamic priority algorithms are: 1. Earliest Deadline First (EDF) algorithm 2. Ant Colony Optimization (ACO) based Scheduling algorithm. EDF Algorithm: The priority of each task is decided based on the value of its deadline. The task with nearest deadline is given highest priority and it is selected for execution. This algorithm is simple and proved to be optimal when the system is preemptive, under loaded and there is only one processor. ACO Based Scheduling Algorithm: The ACO based algorithms are computational models motivated by the collective foraging behavior of ants [3]. Each ant is an autonomous agent that constructs a path. There might be one or more ants concurrently active at the same time. Ants do not need synchronization. Forward ant moves to the good-looking neighbor from the current node, probabilistically. A probabilistic choice is biased by Pheromone trails previously deposited and heuristic function. Without heuristics information, the algorithm tends to converge towards initial random solution. In backward mode, ants lay down the pheromone. Pheromone intensity of all the paths decreases with time, called pheromone evaporation. It helps in unlearning poor quality solution [1]. Pseudo-code of the ACO based scheduling algorithm is given as per following [8]: ACO based Scheduling algorithm • Construct the tour of different ants • Analyze the results of ants‟ journeys • Update the value of Pheromone • Find probability of each task and select the task for execution In ACO based scheduling algorithm, each schedulable task is considered as a node and all the ants will start their journey from different nodes. Number of ants are taken same as number of schedulable tasks at that time. The ants will traverse depending on the value of pheromone and some heuristic function. Pheromone value will be updated on each node depending on the performance of the journey and finally the task is selected with maximum probability of the best performance.

5. Comparison and Analysis The periodic tasks load (L) of the system can be determined using the following equation: m L = ∑ Ei / Qi i=1 where, m – Number of tasks E - Execution time required by the task P - Period of the task D – Deadline of the task Q = P if P >= D = D if P < D The three main performance measuring criteria are 1. Successive Ratio 2. Effective CPU Utilization 3. Execution Time In real-time systems, deadline meeting is the most important. The most important performance metric is the Successive Ratio and it is defined as, SR = Number of jobs successfully scheduled Total number of jobs arrived Effective CPU Utilization gives information about how efficiently the processor is used and it is defined as, ECU = ∑ Ei / T iR



Ei  Execution time = Value of the job, if the job completes with in its deadline. = 0, if the job fails to meet the deadline

November Issue

Page 12 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

R  Set of all the jobs which are executed by the CPU T Total time of scheduling The execution time required by each scheduling algorithm is very important especially when working with real time systems. Table 1 shows the load successive ratio and effective CPU utilization when Load ≤ 1 using EDF algorithm, ACO based scheduling algorithm. It proves that both algorithms are equally optimal for single processor and preemptive environment. Figure 5 shows the comparison of the execution time taken by each algorithm. From the results, can observe EDF algorithm performs well in under loaded condition and it takes less time than ACO based algorithm during under loaded conditions. ACO gives better result during overloaded conditions with more execution time.  

Table 1: The Successive Ratio and Effective CPU Utilization WITH LOAD ≤ 1 Load

% Successive Ratio EDF ACO 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

1.00 0.90 0.80 0.70 0.60 0.50 0.40 0.30

% ECU EDF 99.67 88.59 79.40 69.80 59.88 49.67 39.44 29.70

ACO 99.67 88.59 79.41 69.83 59.88 49.65 39.43 29.70

Comparison of Execution Time % ECU EDF

% ECU ACO

Time (Micro Seconds)

250

200

150

100

50

0 0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Load

Figure 5. Comparison of the Execution time

6. Conclusions This comparison is based on scheduling periodic task on single processor environment and the tasks are pre emptive. EDF algorithm does not perform well when the system is overloaded and ACO based scheduling algorithm takes more execution time in that type of condition- These are the main limitations of both algorithms. During under loaded condition, the execution time taken by the EDF algorithm (i.e. less time) and during overloaded condition, it gives performance of ACO based scheduling algorithm (i.e. more efficiency). In future a new algorithm should be developed to switch automatically between EDF algorithm and ACO based scheduling algorithm to deal overloaded and under loaded conditions. The new algorithm will be very useful when future workload of the system is changeable.

November Issue

Page 13 of 64

ISSN 2229 5216

International Journal of Advances in Science and Technology

References [1] Jane W.S. Liu, Real-Time Systems , Pearson Education, India,pp. 121 & 26, 2001. [2] J. Liu, Real-Time Systems, Pearson Education, 2000. [3] K. Kotecha and A. Shah,“ACO based dynamic scheduling algorithm for real-time operating system”, Sent to AIPR-08, Florida, 2008. [4] G.Saini, “Application of fuzzy logic to real-time scheduling”, Real TimeConference, 14th IEEENPSS, 2005. [5] Bank, M., Honig, U., and Schiffmann, W.: „An ACO-based approach for scheduling task graphs with communication costs‟. Proc. Int. Conf. on Parallel Processing (ICPP‟05), 2005, pp. 623–629 [6] M. Dorigo and T.Stutzle, Ant Colony Optimization , The MIT Press, Cambridge, 2004 [7] Omolbani Mohamad Rezapour, Amirahmad dehghani and Lee Teang Shui Australian Journal of Basic and Applied Sciences, 4(7): 2099-2108, 2010, INSInet Publication [8] Hyeonjoong Cho, Binoy Ravindran & E. Douglas Jensen “ Optimal Real-Time Scheduling Algorithm for Multiprocessors “ Proceedings of the 27th IEEE International Real-Time Systems Symposium (RTSS'06)- 2006 [9] V. Ramos, F. Muge and P. Pina,“Self-organized data and image retrieval as a consequence of interdynamic synergistic relationships in artificial ant colonies”, IOS Press, vol. 87, 2002. [10] N. Fisher et al., ”The Non-preemptive Scheduling of Periodic Tasks upon Multiprocessors”, Journal of Real-Time Systems, vol. 32, n. 1-2, pp. 9-20, 2006.

Authors Profile Mrs.M.Kaladevi obtained her Master Degree in Computer Applications from

University of Madras, Chennai in 1998. And Completed her M.Phil degree in Computer Science from Bharathidasan University. Trichirapalli. At present she is working as Assistant Professor in Master of Computer Applications Department at Vivekanandha College of Arts and Sciences for Women,Elayampalayam,Tiruchengode.. Also attended both national level and international level conferences. Area of interest is Real Time Embedded System.

Dr. S. Sathiyabama obtained her M.Sc. Degree in Computer Science from Avinashilingam Deemed University, Coimbatore in 1997. She completed her M.Phil. Degree in Computer science from Bharathiyar University, Coimbatore in 2002. She obtained her Ph.D.degree from Periyar University in November 2007 in the area of Data Mining. Now she is working as a Professor in Master of Computer Applications Department at K.S.Rangasamy College of Technology, Tiruchengode. Dr. S. Sathiyabama has published more than 30 Research Papers in the various National and International Conferences and Journal in the area of Data Mining. The Periyar, Bharathiar and Bharathidasan Universities recognized her as a research guide for M.Phil. and Ph.D. degree and she is guiding 10 Ph.D. scholars She got the Life Membership in Indian society for Technical Education. Her area of interest includes Classification in Data Mining, Object Oriented databases, Web technology etc.

November Issue

Page 14 of 64

ISSN 2229 5216