Towards Preemption Control Using CPU Frequency Scaling in Sporadic Task Systems Abhilash Thekkilakattil, Radu Dobrin and Sasikumar Punnekkat alardalen Real-Time Research Center, M¨ alardalen University, Sweden {abhilash.thekkilakattil, radu.dobrin, sasikumar.punnekkat}@mdh.se Abstract—Preemptions in real-time systems scheduling typi- cally lead to variations in task execution times, increase the temporal overhead required for various RTOS related operations and may even cause unschedulability. We examine the preemption behavior of sporadic tasks scheduled under the Fixed Priority Scheduling (FPS) policy, and evaluate the possibility of using CPU frequency scaling for preemption control. We propose an online heuristic-based algorithm, of linear complexity, to control the number of preemptions in a sporadic task system using CPU frequency scaling. Evaluation results show that CPU frequency scaling is an attractive option to control the preemption behavior of real-time sporadic task systems. I. I NTRODUCTION Preemptive and non-preemptive fixed priority real-time scheduling have been widely studied during the past decades. While preemptive FPS, is generally considered to achieve higher processor utilization while guaranteeing the tasks’ schedulability, it suffers from a number of preemption-related costs, e.g., undesired processor utilization, high energy con- sumption and, in some cases, even infeasibility. Preemption costs may also lead to unpredictable variations in task exe- cution times. Though the task execution times can be safely determined using static timing analysis, at runtime, the pre- emption overheads (e.g., cache related preemption delays) can lead to variations in the Worst Case Execution Times (WCET). Hence, the unpredictable variations may have detrimental impacts in terms of schedulability, which is not acceptable in most of the real-time systems today. Preemptive FPS also requires the use of resource access protocols to achieve mutual exclusion, in cases where tasks communicate through shared resources. These resource access protocols, though predictable, introduce schedulability overheads to the system, as well as lead to pessimistic assumptions in the schedulability tests. A non-preemptive scheduling scheme on the other hand does not allow the full utilization of the available processor time, as a low priority task cannot be interrupted by a more urgent higher priority task, which will result in a lower utilization bound in order to guarantee the schedulability of the tasks. Thus, one of the costs of using a non-preemptive scheduler is the loss of utilization which comes from the blocking of higher priority tasks by the lower priority tasks [1]. However, it should be noted that non-preemptive scheduling can be infeasible even for arbitrarily low utilizations. The This work was partially supported by the Swedish Research Council project CONTESSE (2010-4276). advantage, however, of using a non-preemptive scheduling algorithm in real-time systems is its low runtime overhead. Also, the WCET assumptions based on the static analysis on task executions do not change, as the tasks are allowed to complete their executions once they start executing, without, e.g., context-switch or cache-related variations. Modern processors support Dynamic Voltage and Frequency Scaling (DVS) which can be used to increase or decrease tasks’ execution times by manipulating the CPU frequency at which they are executed. DVS techniques have been traditionally used for energy conservation by reducing the supplied voltage and, thus, lowering the CPU frequency. This, however, in- creases the task execution times, which, in its turn, potentially increases the number of preemptions in the schedule. The ability to scale up/down the CPU frequency provides us with the possibility of manipulating task execution times to achieve various goals. We explore the use of CPU frequency scaling for preemption control in sporadic task systems. We present an online algorithm of linear complexity, for preemption control in sporadic task systems, and evaluate its performance through simulations using synthetic task sets. The evaluation results show that online CPU frequency scaling is an attractive as well as affordable approach towards controlling the preemption behavior of sporadic tasks in FPS. The paper is organized as follows. In section II we discuss the related work. Section III details the system model and in section IV, we discuss the possibility of preemption control in sporadic task systems using CPU frequency scaling, where we present an online algorithm to control the preemption behavior, followed by an example in section V. We conclude our paper in section VII after presenting our evaluations in section VI. II. RELATED WORK Preemptive FPS has been extensively analyzed since the work of Liu and Layland [2], and is used in a large number of applications, mostly due to its flexibility and simple run- time overhead. The need for preemption elimination is widely recognized in the literature [3][4]. Bui et. al [3] observed that, in an extreme case, cache related preemption delays can lead to as large as 33% increment in task execution time on a PowerPC MPC7410 with a 2 MB two way associative L2 cache. Buttazzo [5] showed that the rate monotonic algorithm (RM) introduces a higher number of preemptions than earliest deadline first algorithm (EDF). Several methods have been proposed in the past to reduce the number of preemptions in 35 978-1-61284-820-4/11/$26.00 ©2011 IEEE