Performance Comparison of RTS Scheduling Algorithms

Size: px
Start display at page:

Download "Performance Comparison of RTS Scheduling Algorithms"

Transcription

1 ISSN : (Print) ISSN : (Online) Performance Comparison of RTS Scheduling s Amit Sandhu Deptt. of CSE, Arni School of Technology, Arni University, Kathgarh (HP), India IJCST Vo l. 2, Is s u e 2, Ju n e 2011 Abstract In this paper Real Time Scheduling s are proposed for both preemption and non-preemptions, to fulfill the deadline constraint for which simulation techniques are used, where these proposed algorithms are implemented and results are shown in Gantt charts and graphs. In this we find out the power consumption, load of the CPU and remaining time of the task using different algorithms. We are taking task with shortest completion time. Keyword GTFD_U, GTFD_M, RRQ_P, RRQ_NP, WCET I. Introduction The Oxford Dictionary of Computing [1] defines a real-time system as: Any system in which the time at which output is produced is significant. This is usually because the input corresponds to some movement in the physical world, and the output has to relate to that same movement. The lag from input time to output time must be sufficiently small for acceptable timeliness. Scheduling s in Real Time System can be classified among many dimensions. Some Scheduling s deal only periodic tasks, while others are intended to deal both periodic and aperiodic. Similarly, some algorithms allow preemption of executing tasks, while other can be non preemptive in nature. Precedence relationships, resource constraints, importance of deadline (soft, firm and hard tasks) are some other characteristics of Real Time Systems, While affect the nature of scheduling algorithms. The scheduling algorithms also depend on the types of systems for which they are intended. Some are for Uniprocessor, while other are for multiprocessor systems. Thus Scheduling algorithm can be classified into different categories [2], depending on whether a system performs feasibility analysis or not, if it does, whether it is done offline (at design time) or online (dynamically), and whether the result of analysis itself produces a schedule or plan according to which tasks are dispatched at run time, and postponement of scheduling decision up to the occurrence of certain conditions. II. System Model In this section I am presenting assumptions, terminology in real time scheduling aspect. A. Assumptions Set of tasks Ti every task has attribute arrival time, Deadline, Worst case execution time. Priorities of the task, priorities are set according to the scheduling algorithm. System_clock is the clock set for the task i.e. deadline time to every task, system clock is set according to the task requirement. arrival_queue is used to store the arrival task, i.e. all the arrival tasks are inserted into the arrival_queue. ready_queue is the queue for inputting the ready task, i.e all the ready to execute tasks are store in ready queue. remove method is used to take the task from queue. execute method is used to process the task, i.e. according to the turn of the task they are get executed. Compare method function is used to compare the task for their deadline if deadline of the task Ti is greater than the task Tk then task Ti is executed otherwise Tk is executed using executed method if both having equal deadline then task with first arrival is executed. B. Proposed GTFD_U (Going To Finish Deadline Uniprocessor) I am proposing the GTFD_U algorithm in which tasks with shortest completion time is considered and implemented on single processor I am using assumptions and some terminology, this algorithm is based on preemption i.e. once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. 1: GTFD_U (Going To Finish Deadline Uniprocessor) 1. Input set of periodic tasks set S=T1, T2, T3., Tn, Duration, Activation Time, Deadline in arrival_queue ; 3. for time 1,2,3 system_clock, system_clock do 4. remove task from arrival_queue and put all tasks Ti in 5. start with highest priority task Ti according to their 6. while(ready_queue is not empty) remove task Ti from execute task Ti on single CPU; compare(ti,tk) if Deadline(Ti) > Deadline(Tk) execute Ti; else execute Tk on single CPU; if Deadline(Ti) = = Deadline(Tk) use first input of end while 7. end C. Proposed GTFD_M (Going To Finish Deadline on Multiprocessor) I am proposing the GTFD_M algorithm in which tasks with shortest completion time is considered and implemented on multiprocessor in this algorithm I am using some assumptions and some terminology for solve or implement my ideas, this algorithm is based on preemption i.e. once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. International Journal of Computer Science and Technology 391

2 IJCST Vo l. 2, Is s u e 2, Ju n e : GTFD_M (Going To Finish Deadline on Multiprocessor) 1. Input set of periodic tasks set S=T1, T2, T3., Tn, Duration, Activation Time, Deadline ; 3. for time 1,2,3 system_clock, system_clock do 4. remove task from arrival_queue and put all tasks Ti in 5. start with highest priority task Ti according to their while(ready_queue is not empty) remove task Ti from execute task Ti on Multiple CPUs; compare(ti,tk) if Deadline(Ti) > Deadline(Tk) execute Ti on Multiple CPUs; else execute Tk on Multiple CPUs; if Deadline(Ti) = = Deadline(Tk) use first input of for T=1 To Ti //Loop to check for preemption if newly arrival task Tk>currently executing task Tk then preempt(); end while preempt () Temp=Ti; execute Tk on Multiple CPUs; assign priority to newly arrival task; 8. end D. Proposed RRQ_NP (Round Robin Quantum Non Preemptive) I am proposing the RRQ_NP Round Robin Quantum Non Preemptive algorithm where all the tasks are executed according to the quantum value is set until the deadline is occurred. This algorithm is based on the non preemption i.e. once task take the resource for execution it release the same after completion of the task or by termination. 3: RRQ_NP (Round Robin Quantum Non Preemptive) 1. Input set of periodic tasks set S=T1, T2, T3., Tn, in arrival_queue Duration, Activation Time, Deadline,Quantum; 3. Set Quantum=n; 4. for time 1,2,3 system_clock, system_clock do 5. remove task from arrival_queue and put all tasks Ti in 6. start with highest priority task Ti according to their ISSN : (Print) ISSN : (Online) 7. while(ready_queue is not empty) remove task Ti from execute task Ti on Singlee CPU; if Quantum is complete then take another task Tk according to priority on single CPU; end if end while 8. end E. Proposed RRQ_P (Round Robin Quantum Preemptive) I am proposing the RRQ_P Round Robin Quantum Preemptive algorithm where all the tasks are executed according to the quantum value is set until the deadline is occurred. This algorithm is based on the preemption i.e. once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. 4: RRQ_P (Round Robin Quantum Preemptive) 1. Input set of periodic tasks set S=T1, T2, T3., Tn, in arrival_queue Duration, Activation Time, Deadline,Quantum; 3. Set Quantum=n; 4. for time 1,2,3 system_clock, system_clock do 5. remove task from arrival_queue and put all tasks Ti in 6. start with highest priority task Ti according to their 7. while(ready_queue is not empty) remove task Ti from execute task Ti on Multiple CPU; if Quantum is complete then take another task Tk according to priority on Multiple CPU; If task with higher priority than preempt currently executing task preempt (); end if end while 8. end The increasing complexity of the hardware multiprocessor architectures as well as of the real-time applications they support makes very difficult even impossible to apply the theoretical realtime multiprocessor scheduling results currently available so I am using simulation techniques to implement my algorithms. This Simulation takes the input as XML file in which java main class is called i.e. scheduling algorithms are implemented in JAVA which are called in XML tags and then XML file is executed on simulation console which then produce the results in the form of Gantt charts of all the inputting tasks and concerned CPU 392 International Journal of Computer Science and Technology

3 ISSN : (Print) ISSN : (Online) III. Simulation Parameters and Assumptions Proposed are implemented and simulation results are presented in Gantt charts and graphs, I am considering WCET (Worst Case Execution Time), activationdate (arrival time of the task), Periods (Number of Slots of a ), Priority, Deadline, CPU Load, Power Consumption of CPU, Remaining Time of the task as simulation parameters. Table 1: Simulation Parameters Simulation Parameters Description WCET Worst Case Execution Time activationdate arrival time of the task Periods Number of Slots of a Priority Preference is given Deadline Maximum time allowed to execute CPU Load Find the total CPU Load CPU Power Power Consumption of CPU Remaining Time of Remaining Time of the task the task A. Proposed GTFD_U (Going To Finish Deadline Uniprocessor) In GTFD_U algorithm tasks with shortest completion time is considered and implemented on single processor I am assuming once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. Simulation inputs CPU= 1 Table 2 Id Period Activation date WCET Priority Deadline 1. Performance Measurements Performance of the scheduling algorithms is calculated with deadline constraint, CPU load, CPU power usage and remaining time of the task. In above Gantt chart of CPU we have seen at slot 0-4,12-16,26-30,35-39, is executed and at slot 6-9,16-19,21-22,24-26,32-35,41-44, is executed and at slot 4-6,10-12,19-21,22-24,30-32,39-41,48-50 and at slot 9-10 CPU is idle. It is clear from the graph load of the CPU is up from 0 and down from 9 to 10 and again load is up from 10 to 51. It is shown in CPU power graph according to the load of the CPU it uses the power so it uses lowest power at 9 to Remaining Time of s Remaining time of the 1, Twask2, and 3 can be seen and scheduling policy. B. Proposed GTFD_M (Going To Finish Deadline on Multiprocessor) I am proposing the GTFD_M algorithm in which tasks with shortest completion time is considered and implemented on multiprocessor in this algorithm I am using some assumptions and some terminology for solve or implement my ideas, this algorithm is based on preemption i.e. once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. Simulation inputs CPU= 2 Table 3 Id Period Activation date IJCST Vo l. 2, Is s u e 2, Ju n e 2011 WCET Priority Deadline Performance Measurement Performance of the scheduling algorithms can be calculated on following factors, i.e. deadline constraint, CPU load, CPU power usage and remaining time of the task. In above Gantt chart of CPU1 and CPU2 we have seen at slot 0-4, 10-14, 20-22, 23-25, 30-34, 41-45, is executed and at slot 2-5, 12-15, 20-23, 29-32, 38-41, is executed and at slot 4-6, 10-12, 16-18, 22-24, 28-30, 34-36, 40-42, is executed.cpu1 is free at slot 6-10, 14-15, 18-20, 25-28, 36-38, 45-46, and CPU2 is free at slot 0-2, 5-10, 14-20, 24-29, 32-40, Load of the CPU1 is from is up from 0 to 6,10 to 14, 15 to 18, 18 to 22, 24 to 28, 30 to 34, 36 to 40, 42 to 46, 50 to 51 and load of the CPU2 is at 0 to 610 to 14, 15 to 18, 20 to 25, 28 to 36, 38 to 45, 46 to 48, Power consumption of the CPU1 is depend upon the uses of the CPU maximum power consumption by CPU1 is at 0 to 6, 10 to 14, 15 to 18, 18 to 22, 24 to 28, 30 to 34, 36 to 40, 42 to 46, 50 to 51 and power consumption of CPU2 is at at 0 to 610 to 14, 15 International Journal of Computer Science and Technology 393

4 IJCST Vo l. 2, Is s u e 2, Ju n e 2011 to 18, 20 to 25, 28 to 36, 38 to 45, 46 to 48, 5. Remaining Time of tasks Remaining time of the 1, Twask2, and 3 can be seen and scheduling policy of the s C. Proposed RRQ_NP (Round Robin Quantum Non Preemptive) I am proposing the RRQ_NP Round Robin Quantum Non Preemptive algorithm where all the tasks are executed according to the quantum value is set until the deadline is occurred. This algorithm is based on the non preemption i.e. once task take the resource for execution it release the same after completion of the task or by termination. Quantum = 1 CPU= 1 Table 4 Id Period Activation date WCET Priority Deadline 1. Performance Measurement Performance of the scheduling algorithms can be calculated on following factors, i.e. deadline constraint, CPU load, CPU power usage and remaining time of the task. In above Gantt chart of CPU we have seen at slot 0-5, 10-11, 12-13, 15-16, 17-18, 20-21, 30-31, 33-34, 36-37, 39-40, 42-43, is executed and at slot 5-6, 7-8, 9-10, 13-14, 16-17, 19-20, 22-25, 29-30, 32-33, 34-35, 38-39, 40-41, 43-44, 47-48, is executed and at slot 6-7, 8-9, 11-12, 14-15, 18-19, 21-22, 25-27, 28-29, 31-32, 35-36, 37-38, 41-42, 44-45, 46-47, is executed and at slot 27-28, CPU is idle. Load of the CPU is high at 0 to 27, 28 to 45, and 46 to 50 Power consumption of the CPU is totally depending on the utilization of the CPU. 5. Remaining Time of s Remaining time of the 1, Twask2, and 3 can be seen and scheduling policy of the s ISSN : (Print) ISSN : (Online) D. Proposed RRQ_P (Round Robin Quantum Preemptive) I am proposing the RRQ_P Round Robin Quantum Preemptive algorithm where all the tasks are executed according to the quantum value is set until the deadline is occurred. This algorithm is based on the preemption i.e. once task take the resources for execution and another task with higher priority (deadline) comes, task with lower priority releases the resources and are allocated to task with higher priority. Quantum = 1 CPU= 2 Table 5 Id Period Activation WCET Priority Deadline date Performance Measurement Performance of the scheduling algorithms can be calculated on following factors, i.e. deadline constraint, CPU load, CPU power usage and remaining time of the task. In above Gantt charts of CPU1 and CPU2 we have seen at slot 0-5, 10-15, 20-25, 30-35, 40-45, is executed and at slot 2-5, 12-15, 20-22, 24-25, 29-32, 38-40, 42-43, is executed and at slot 5-7, 10-12, 16-18, 22-24, 28-30, 34-36, 40-42, is executed. CPU1 is free at slot 7-10, 14-15, 18-20, 25-28, 35-38, 44-45, and CPU2 if free at slot 0-2, 5-10, 15-20, 25-29, 32-34, 36-40, Load of the CPU1 is high at 0 to 7, 10 to 14, 15 to 18, 20 to 25, 28 to 35, 38 to 44, 45 to 48 and load of the CPU2 is at 2 to 5, 10 to 15, 20 to 25, 29 to 32, 34 to 36, 40 to 43, and 47 to 50. Power consumption of the CPU1 is depending on the utilization of the CPU1 is at 0 to 7, 10 to 14, 15 to 18, 20 to 25, 28 to 35, 38 to 44, 45 to 48 and CPU2 is at 2 to 5, 10 to 15, 20 to 25, 29 to 32, 34 to 36, 40 to 43, and 47 to Remaining Time of s Remaining time of the 1, Twask2, and 3 can be seen and scheduling policy of the s IV. Conclusion We can observe from the Gantt chart in Appendix of GTFD_U algorithm that CPU s power consumption is lowest at slot 9 and then increasing. In GTFD_M algorithm, CPU s load at slot 6 is low for CPU1 but CPU2 is busy. In RRQ_NP CPU, power is low at 27 to 28 but high up to 45 and again low at slot but in RRQ_ P CPU load is varied high from 0-50 and power consumption is low after every three slots and high after every three slots. 394 International Journal of Computer Science and Technology

5 ISSN : (Print) ISSN : (Online) References [1] Velorie illing worth, Dictionary of Computing (3rd ed.) Oxford University Press, Inc, New York, 1990 [2] K. G. Shin, P. Ramanathan, "Real Time Computing: A New Dicipline of Computer Science and Engineering", Proceedings of the IEEE, 82(1):6-24 jan 1994 [3] K. Ramamritham, J.A. Stankovic, P.F. Shiah, "Efficient Scheduling s for Real Time Multiprocessor System", IEEE Tran. On Parallel and Distributted System, 1(2): , Apr [4] M. Joseph, P. Pandya, "Finding Response Times in areal Time System", BCS Computer Journal, 29(5): , Oct,1986 [5] Lipari, Giorgio Buttazzo, "Schedulability Analysis of Periodic and Aperiodic s with Resource Constraints Giuseppe", Journal of Systems Architecture 46 (2000) pp [6] Wenming Li, Krishna Kavi, Robert Ak., "A non-preemptive scheduling algorithm for soft real-time systems", 10 April 2006, Elsevier [7] Xiao Qin, "A Novel Fault-tolerant Scheduling for Precedence Constrained s in Real-Time Heterogeneous System", Parallel Computing, vol. 32, no. 5-6, pp , June [8] Vinay Devadas, Fei Li, Hakan Aydin, "Competitive analysis of online real-time schedulingalgorithms under hard energy constraint", Real-Time System 46: pp , Springer 2010 [9] Meikang Qiu, Laurence T. Yang, Zili Shao, Edwin H.M. Sha, "Dynamic and Leakage Energy Minimization With Soft Real-Time Loop Scheduling and Voltage Assignment", IEEE TRANSACTIONS ON VERY LARGE SCALE INTEGRATION (VLSI) SYSTEMS, VOL. 18, NO. 3, MARCH 2010, 501 Transactions. [10] Sergey Zhuravlev Sergey Blagodurov Alexandra Fedorova, "Addressing Shared Resource Contention in Multicore Processors via Scheduling", ASPLOS 10, March 13 17, 2010, Pittsburgh, Pennsylvania, USA ACM. Amit Sandhu is presently working as Assistant Professor with department of computer science & engineering, Arni School of Technology, Arni University, Kathgarh, Himachal Pradesh (India). He has done his Master of Computer Application (MCA) and M.Tech in Computer Science & Engineering both from Kurukshetra University, Kurukshetra (India) and Master of Philosophy (M.Phil) in Computer Science from Annamalai University, Annamalainagar (India). Appendix Proposed s are implemented and simulation results are shown in this Appendix Fig. No. 1.1, 1.3 and 1.5 are for T1, T2 and T3 respectively, Fig. No. 1.2, 1.4 and 1.6 are for remaining time of T1, T2 and T3 respectively, Fig. No. 1.7, 1.8 and 1.9 are for CPU Execution, Power Consumption of the CPU and load of the CPU respectively of GTFD_U algorithm. In Simulation Results of GTFD_M, Fig. No. 2.10, 2.12 and 2.14 are for T1, T2 and T3 respectively, 2.11, 2.13 and 2.15 are for remaining time of T1, T2 and T3 respectively and 2.16, 2.17, 2.18, 2.19, 2.20 and 2.21 are for CPU Execution, Power Consumption of the CPU and load of the CPU1 and CPU2 respectively. Fig No. 3.22, 3.24 and 3.26 are for T1, T2 and T3 respectively, Fig. No. 3.23, 3.25 and 3.27 are for remaining time of T1, T2 and T3 respectively and 3.28, 3.29 and 3.30 are for CPU Execution, Power Consumption of the CPU and load of the CPU respectively are implementation result of RRQ_NP algorithm. For RRQ_P algorithm, Fig. No. 4.31, 4.32 and 4.34 are for T1, T2 and T3 respectively, 4.33 and 4.35 for remaining time and 4.36, 4.37, 4.38, 4.39 and 4.40 are for CPU Execution, Power Consumption of the CPU and load of the CPU respectively. 1.1 T1 1.2 T1 1.3 T2 1.4 T2 1.5 T3 1.6 T3 1.7 CPU 1.8 CPU POWER 1.9 CPU load 2.10 T T T2 IJCST Vo l. 2, Is s u e 2, Ju n e 2011 International Journal of Computer Science and Technology 395

6 IJCST Vo l. 2, Is s u e 2, Ju n e 2011 ISSN : (Print) ISSN : (Online) 3.27 T CPU 2.13 T T CPU POWER 3.30 CPU LOAD 2.15 T CPU T T CPU CPU 1 POWER 4.33 T T CPU 2 POWER 2.20 CPU1 LOAD 4.35 T CPU CPU2 LOAD 3.22 T CPU1 LOAD 4.38 CPU T T CPU2 LOAD 4.40 CPU2 POWER 3.25 T T3 396 International Journal of Computer Science and Technology