A dynamic scheduling algorithm for energy harvesting embedded systems
 Yonghong Tan^{1}Email author and
 Xiangdong Yin^{2}
https://doi.org/10.1186/s1363801606028
© Tan and Yin. 2016
Received: 26 September 2015
Accepted: 4 April 2016
Published: 22 April 2016
Abstract
Energy harvesting embedded systems are embedded systems that integrate with energy harvesting modules. In this kind of systems, service tasks and energy harvesting tasks must be scheduled efficiently to keep the whole system working properly as long as possible. In this paper, we model an energy harvesting embedded system with an energy model, a task model, and a resource model and propose a dynamic task scheduling algorithm. The proposed algorithm is based on dynamic voltage and frequency scaling technique and dynamically concentrates all disperse free time together to harvest energy. We validate the efficiency and effectiveness of the proposed algorithm under both energyconstraint and nonenergyconstraint situations with the Yartiss simulation tool.
Keywords
Energy harvesting embedded systems Dynamic scheduling algorithm Energy model1 Introduction
In embedding systems, the energy is usually provided with batteries, and the requirements of real time and many extensive smart functions make embedding systems consume more and more energy [1]. If we run the embedding systems arbitrarily, the energy would run out very quickly; this would shorten the working time of smart devices. The techniques of dynamic voltage and frequency scaling (DVFS) [2] and dynamic power management (DPM) [3] could decrease the power consumption of embedding systems whereas satisfying the time constraints. However, once deployed, the embedded application will run a long time, and the energy of the battery will run out finally. Besides replacement of the battery, the embedded systems can harvest energy from the external environment [4], such as sunshine [5], wind [6], and vibration [7]. By applying these energy harvesting techniques [8, 9], the working time of embedded systems can be increased. While harvesting energy from the environment, both the harvest and storage of energy need processing time, and this needs to reschedule the processor and thus interrupts the working tasks. So, an energy harvesting embedded system is an embedded system with different kinds of energy harvesting modules inside.
In energy harvesting embedded systems [10], one needs to schedule tasks between harvesting tasks with working tasks, and the aim is to keep the energy of embedded systems in a reasonable level, while providing normal working services at the same time. During the scheduling of the tasks in energy harvesting embedded systems, both the energy output and storage units are the physical environment and the change of status is a continuous physical process [11]. The physical process provides much information for the computing environment, and the decisionmaking process of the computing environment affects the physical environment too. According to interaction and fusion [12] of the computing and physical environment, one can allocate the resources efficiently and thus optimize the performance of the whole system.
In this paper, we study the problem of task scheduling in energy harvesting embedded systems. In an energy harvesting embedded system, the system needs to harvest energy from the external environment during free or idle time. We model an energy harvesting embedded system with an energy model, a task model, and a resource model and propose a dynamic task scheduling algorithm. Based on dynamic voltage and frequency scaling techniques, the proposed algorithm concentrates all disperse free time together to harvest energy by dynamically scheduling harvesting tasks and service tasks.
The rest of the paper is organized as follows. In Section 1.2, we review related works about scheduling algorithms in embedded systems. In Section 1.3, we propose a model for energy harvesting embedded systems. In Section 1.4, we propose a dynamic task scheduling algorithm. Experiments and conclusions are given in Sections 1.5 and 2, respectively.
2 Related works
In this section, we review related works about scheduling algorithms in embedded systems, especially focus on energy saving and energy harvesting scheduling algorithms.
2.1 Energy saving scheduling algorithms
Energy saving task scheduling is a key research in embedded systems and sensor networks. The techniques of energy saving scheduling can be classified into traditional scheduling method and utilitybased scheduling method. Traditional energysaving scheduling methods [13, 14] can be applied to the simple taskarrival mode, such as period tasks, but it cannot assure the arrival tasks to be scheduled in real time.
In general, every completion of a task would bring some utility, and the utility depends on the running time of the task. The longer the running time, the smaller the utility is. Jensen et al. [15] proposed a time/utility function to describe the relationship between the running time and the utility of a task, and their aim is to maximize the total utility by finishing all tasks as quickly as possible. References [16–18] studied how to get the maximal utility with limited energy. In addition, in order to satisfy the utility acquirement and the energy budget, Wu et al. [19] proposed a unimodal arbitrary arrival with energy bounds algorithm (EBUA), and the EBUA solved the problem of task scheduling based on unimodal arbitrary arrival model.
2.2 Energy harvesting scheduling algorithms
The task scheduling problem in energy harvesting embedded systems was first proposed by Allavena and Mossé in [20], and then some algorithms for solving this problem were proposed. The lazy scheduling algorithm (LSA) proposed by Moser et al. [21] adjusts the worstcase execution time by adjusting frequency of the CPU according to tasks’ energy consumption. The LSA is based on a strong assumption that the worstcase execution time of a task is related with its energy consumption directly, and this assumption is impractical [22]. Chandarli et al. [23] proposed an ALAP scheduling algorithm, and it was a fixedpriority scheduling policy that delayed the executions of jobs as long as possible. Abdeddaïm et al. [24] proposed an ASAP algorithm, and this algorithm scheduled tasks as soon as possible when there was available energy in the battery and suspended execution to replenish the energy needed to execute one time unit. Under constraints of energy and time, ASAP is proved to be optimal.
In addition, in order to get better system performance and less energy consumption, some scheduling algorithms [25, 26] take dynamic voltage frequency scaling into consideration. The EADVFS algorithm [25], proposed by Liu et al., adjusts the CPU frequency by the remaining energy of the system. If there is not enough energy to run the task, then it decreases the CPU frequency; otherwise, it runs the task with maximal CPU frequency. The HADVFS algorithm [26] optimizes the system performance and improves the energy utilization further based on the EADVFS algorithm. However, in some realtime embedded systems with high reliability, DVFS and related algorithms can extend the running time of tasks, affect the runtime attribute of the system, and thus decrease its reliability.
3 Energy harvesting embedded system model
In this section, we model the embedded system with an energy model, a task model, and a resource model.
3.1 The energy model
where S _{3}, S _{2}, S _{1}, and S _{0} are constants.
3.2 The task model
We assume that the embedded system is a preemptive realtime system and the task set is Γ = {τ _{1}, ⋯, τ _{ n }}. Every arrival task is an instance of its corresponding task, and the jth instance of task τ _{ i } is denoted as τ _{ i,j }. In a unimodal arrival model, each task is related with one tuple < a _{ i }, P _{ i } >, and the tuple means that the maximal number of arrival instances is a _{ i } in any sliding window P _{ i }. The periodic realtime task mode is a special case of the unimodal arrival model, where the value a _{ i } equals to 1.
We use U _{ i }(⋅) to denote the time/utility function of the task τ _{ i }, and thus, U _{ i }(⋅) is the time/utility function of any instance of τ _{ i }. If τ _{ i,j } finishes with time t, then the utility is U _{ i }(t). In addition, we define the beginning time of U _{ i } with the arrival time of τ _{ i } and define the ending time of U _{ i } with the sum of its beginning time and the length of the sliding window P _{ i } We let the number of clock periods be c _{ i } and the relative deadline be D _{ i }, and both computations of c _{ i } and D _{ i } can be found in [19].
3.3 The resource model
The critical sections of a task can be nested, that is for critical sections z _{ i,j } and z _{ i,k } of task τ _{ i }, we can have z _{ i,j } ⊂ z _{ i,k }, z _{ i,k } ⊂ z _{ i,j }, or z _{ i,j } ∩ z _{ i,k } = null.
4 Dynamic task scheduling algorithm

\( {c}_{ns}^r\left({\tau}_i,t\right) \) is the remaining computing ability in the noncritical section of task τ _{ i } at time t.

\( {c}_{cs}^r\left({z}_{i,j},t\right) \) is the remaining computing ability in critical section z _{ i,j } at time t.

EET(τ _{ i }, t) is the required estimating time for the remaining part of task τ _{ i } at time t, which can be computed with the remaining computing ability, the running speed in the noncritical section, and the static running speed in the critical section.

EEC(τ _{ i }, t) is the estimation of the required energy of task τ _{ i } at time t, which can be computed with the remaining computing ability, the running speed in the noncritical section, the static running speed in the critical section, and the energy consumption defined in Section 1.2.1.

UER(τ _{ i }, t) is the estimated ratio of utility to the energy of task τ _{ i } starting from time t, while it is not blocked, that is UER(τ _{ i }, t) = U _{ i }(t + EET(τ _{ i }, t))/EEC(τ _{ i }, t).

UER′(τ _{ i }, t) is the maximal speed of task τ _{ i } starting from time t, while it is not blocked.

queue is the waiting queue of arrival tasks.

recordtime(τ _{ i }) is the starting time of the sliding window of task τ _{ i }, which initializes to be 1.

RC(τ _{ i }, t) returns the number of instances, which can be accepted in the future, of task τ _{ i } at time t, and it equals to capacity(τ _{ i }) minus the accepted number of instances of task τ _{ i } in the current sliding window.

checkfeasible(τ _{ i }, t) checks whether or not the current sliding window can accept new instances of task τ _{ i } at time t, and if queue = null, t − recordtime(τ _{ i }) ≥ D _{ i } or RC(τ _{ i }, t) > 0, then this is the idle rate of task τ _{ i } at time t, which can be computed by the following equation:$$ 1\left({\displaystyle {\sum}_{r=1}^i}\left(\frac{c_{ns}\left({\tau}_r\right)}{\eta_{ns}\left({\tau}_r\right)\cdot {D}_r}+{\displaystyle {\sum}_{k=1}^{N_{cs}\left({\tau}_r\right)}}\frac{c_{cs}\left({z}_{r,k}\right)}{\eta_{cs}\left({z}_{r,k}\right)\cdot {D}_r}\right)+\frac{B_i}{D_i}\right). $$
 1.
runningstate(τ _{ i }, t) reflects the running status of task τ _{ i } at time t, which returns true if τ _{ i } is selected to run as a candidate task before t, and false, otherwise.
 2.
f(τ _{ i }, t) is the current running speed of task τ _{ i } at time t, which can be computed by Theorem 1.
 3.
increaseslu(τ _{ i }, sl, t) increases the idle rate of task τ _{ i } at time t, that is SLU(τ _{ i }, t) = SLU(τ _{ i }, t) + sl/D _{ i }.
 4.
decreaseslu(τ _{ i }, sl, t) decreases the idle rate of task τ _{ i } at time t, that is SLU(τ _{ i }, t) = SLU(τ _{ i }, t) + sl/D _{ i }.
 5.
selectcandidate(t) selects a candidate task to run.
 6.
resource(τ _{ i }, t) is the resource accessed by task τ _{ i } at time t, which is effective when τ _{ i } is in the critical sections, and returns null otherwise.
Algorithm 1 describes the proposed dynamic DVFS algorithm. Line 3 rectifies the accepted number of instances in the current sliding window; line 5 selects a candidate task to run; and line 6 adjusts the running speed of the candidate task (details are in Algorithm 2). If a new sliding window is opened (line 10), we use line 11 to initialize the parameters and preserve the computing ability for the following tasks. When a new task arrives, line 14 restricts the number of the following tasks by adjusting RC(τ _{ i }, t). From lines 11 to 13, we see that every sliding window of task τ _{ i } can have capacity(τ _{ i }) instances at most. Lines 15 to 17 reselect a candidate task and compute its running speed.
The aim of Algorithm 2 is to decrease the energy consumption by releasing/recycling free time and maximize the total utility. When a candidate task starts to run, lines 1 and 2 recycle the free time between the maximal blocking time with the practical blocking time. When the resource occupied by task τ _{ i } at time t is null (line 3), line 4 computes the running speed of the candidate task in noncritical sections, line 5 selects the running speed for task τ _{ i } at time t, and line 6 is equal to ∀ j ≥ i{SLU(τ _{ j }, t) × D _{ j }. When we have the running speed of the candidate task, the available time of the task would be deducted (line 8) or released (line 10). Finally, we use line 12 to assure that the running speed of the candidate task in the critical section is equal to its static running speed.
5 Experiments
5.1 Experimental setup
In this experiments, we compare our proposed algorithm with the ASAP and ALAP algorithms and use the simulation tool Yartiss [28] to implement these algorithms. Yartiss provides a simulation framework, and this framework can execute massive tasks of different algorithms with different parameters. We let the output of energy harvesting unit be equal to the energy supply rate e _{bat} of the system, and every time unit provides several energy units. The energy consumption of a task is linear, and every task consumes E _{ i }/C _{ i } energy units per time unit. In order to evaluate the performance of algorithms, we compare our proposed algorithm with the ASAP and ALAP algorithms under both energyconstraint and nonenergy constraint situations. Under energy constraints, we evaluate the performance of algorithms by increasing the number of tasks; and under nonenergy constraints, we design six application scenes with different amount of batteries and let P _{ h } = e _{bat} = 15, E _{min} = 0, and the running time Duration = 2550.

1) Average busy period is the average period of the CPU under simulation. The longer the average busy period, the higher the utility of the CPU is.

2) Average idle period is the average period of the CPU while it is free. Under energy constraints, it includes free time and relaxed time. The longer the average idle period, the higher the average energy level is, and thus, the lower energy constraints the system has.

3) Average overhead is the average time required to execute a task under simulation. The bigger the average overhead, the more likely the task will be missed before the stopping time.

4) Average preemption is the ratio of the preempted tasks to total tasks. The bigger the average preemption, the more context switches it has, and thus, the heavier the overhead is. The heavy overhead will decrease the performance of the whole system and make the scheduling algorithm unpracticable.

5) Average energy level is the average energy percent of batteries. The higher the average energy level, the lower energy constraints the system has.

6) Average battery switch mode is the ratio of battery switch modes to total tasks. The more the average battery switch mode, the lower the energy utility is. Low energy utility would make the system work unproperly.
5.2 Experimental results
Under nonenergy constraints, the comparisons of average busy period, average idle period, average overhead, and average preemption are in Figs. 1, 2, 3, and 4, respectively. The ALAP algorithm postpones the execution of tasks as long as possible, and it generates massive free time, so both the average busy period and idle period are minimum. However, with the increase of the number of tasks, the average overhead of the ALAP algorithm increases obviously. The ASAP algorithm executes tasks as soon as possible, and it is equal to the scheduling of fixedpriority preemption. Our algorithm is based on fixedpriority preemption, and increases the threshold of preemption, so it has similar average busy period, average idle period, and average overhead to the ASAP algorithm. In addition, with the introduction of preemption threshold, our algorithm avoids the tasks with high priorities preempted, while keeping these tasks finished in time. So, our algorithm has the least number of preemptions.
Under energy constraints, the comparisons of average busy period, average idle period, average overhead, average energy level, average preemption, and average battery switch mode are in Figs. 5, 6, 7, 8, 9, and 10, respectively. As we can see from these figures, our algorithm has the least preemption too. The reason is that the ASAP algorithm judges preemption after every execution time unit and our algorithm runs tasks concentratedly. When the energy is not enough, our algorithm concentrates all available relaxed time to harvest energy, which reduces the preemptions caused by lacking energy. Our algorithm reduces the battery switch mode, uses the relaxed time to harvest energy, and then maximizes the busy period and idle period. So, our algorithm provides higher energy level and decreases the energy constraints of the system. The overheads of all the above algorithms tend to be identical. Our algorithm keeps the battery being on charge or discharge mode all the time and has less battery switch mode than the ASAP algorithm.
6 Conclusions
In energy harvesting embedded systems, the system needs to harvest energy from the external environment during free or idle time and schedule service tasks and energy harvesting tasks to keep the whole system working properly as long as possible. In this paper, we study the problem of task scheduling in energy harvesting embedded systems. We model an energy harvesting embedded system with an energy model, a task model, and a resource model and propose a dynamic task scheduling algorithm. Based on the dynamic voltage and frequency scaling techniques, the proposed algorithm concentrates all disperse free time together to harvest energy by dynamically scheduling harvesting tasks and service tasks. In the future, we will build a real energy harvesting embedded system, which implements the proposed algorithm. Currently, we only do some simulation experiments to validate the effectiveness of the proposed algorithm theoretically, and real improvement of lifetime on a real system will be our future work too.
Declarations
Acknowledgements
The work was supported by the following funds: Hunan Provincial Natural Science Foundation of China (Grant No.2015JJ6043); Hunan University of Science and Engineering; Scientific Research Fund of Hunan Provincial Education Department(Grant No.12A054); and The Construct Program of the Key Discipline in Hunan University of Science and Engineering(Circuits and Systems).
Open AccessThis article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
Authors’ Affiliations
References
 TA Nguyen, M Aiello, Energy intelligent buildings based on user activity: a survey. Energy Build. 56, 244–257 (2013)View ArticleGoogle Scholar
 EL Sueur, G Heiser, Dynamic voltage and frequency scaling: the laws of diminishing returns. International Conference on Power Aware Computing and Systems. USENIX Association, 18 (2010)Google Scholar
 L Benini, A Bogliolo, G De Micheli, A survey of design techniques for systemlevel dynamic power management. IEEE Trans. Very Large Scale Integr. VLSI Syst. 8(3), 299–316 (2000)View ArticleGoogle Scholar
 S Chalasani, JM Conrad, A survey of energy harvesting sources for embedded systems. Southeastcon. 442447 (2008)Google Scholar
 V Raghunathan, A Kansal, J Hsu, J Friedman, M Srivastava, Design considerations for solar energy harvesting wireless embedded systems. In: Proceedings of the 4th International Symposium on Information Processing in Sensor Networks, (IEEE Press, 2005), p. 64Google Scholar
 S Li, J Yuan, H Lipson, Ambient wind energy harvesting using crossflow fluttering. J. Appl. Phys. 109(2), 26104 (2011)View ArticleGoogle Scholar
 SP Beeby, MJ Tudor, N White, Energy harvesting vibration sources for microsystems applications. Meas. Sci. Technol. 17(12), 175 (2006)View ArticleGoogle Scholar
 A Kansal, J Hsu, S Zahedi, MB Srivastava, Power management in energy harvesting sensor networks. ACM Trans. Embed. Comput. Syst. 6(4), 32 (2007)View ArticleGoogle Scholar
 RV Prasad, S Devasenapathy, VS Rao, J Vazifehdan, Reincarnation in the ambiance: devices and networks with energy harvesting. IEEE Commun. Surv. Tutorials 16(1), 195–213 (2014)View ArticleGoogle Scholar
 V Raghunathan, PH Chou, Design and Power Management of Energy Harvesting Embedded Systems. International Symposium on Low Power Electronics and Design. 369374 (2006) Google Scholar
 T Tong, S Ulukus, W Chen, Optimal packet scheduling for delay minimization in an energy harvesting system. IEEE International Conference on Communications. IEEE, 42414246 (2015) Google Scholar
 M Song, Y Zhang, M Peng, J Zhai, Low frequency wideband nano generators for energy harvesting from natural environment. Nano Energy 6, 66–72 (2014). Tan and Yin Page 8 of 8View ArticleGoogle Scholar
 Y Zhang, XS Hu, DZ Chen, Task scheduling and voltage selection for energy minimization. Proceedings of the 39th Annual Design Automation Conference (ACM), 183–188 (2002)Google Scholar
 G Quan, X Hu, Energy efficient fixedpriority scheduling for realtime systems on variable voltage processors. Design Automation Conference, 2001. Proceedings (IEEE), 828–833 (2001)Google Scholar
 ED Jensen, CD Locke, H Tokuda, A timedriven scheduling model for realtime operating systems. RTSS 85, 112–122 (1985)Google Scholar
 L Huang, MJ Neely, Utility optimal scheduling in energyharvesting networks. IEEE/ACM Trans. Networking 21(4), 1117–1130 (2013)View ArticleGoogle Scholar
 A Jaleel, HH NajafAbadi, S Subramaniam, SC Steely, J Emer, Cruise: cache replacement and utilityaware scheduling. ACM Comp. Ar. 40, 249–260 (2012). ACMGoogle Scholar
 D Xue, R Murawski, E Ekici, Distributed utilityoptimal scheduling with finite buffers. International Symposium on Modeling and Optimization in Mobile, Ad Hoc and Wireless Networks. IEEE, 278285 (2012)Google Scholar
 H Wu, B Ravindran, ED Jensen, Utility accrual realtime scheduling under the unimodal arbitrary arrival model with energy bounds. IEEE Trans. Comput. 56(10), 1358–1371 (2007)MathSciNetView ArticleGoogle Scholar
 A Allavena, D Mossé, Scheduling of framebased embedded systems with rechargeable batteries, in Workshop on Power Management for RealTime and Embedded Systems (in Conjunction with RTAS 2001), 2001Google Scholar
 C Moser, D Brunelli, L Thiele, et al. Lazy Scheduling for Energy Harvesting Sensor Nodes[M]// From ModelDriven Design to Resource Management for Distributed Embedded Systems. (Springer US, 2006) 125134Google Scholar
 R Jayaseelan, T Mitra, X Li, Estimating the worstcase energy consumption of embedded software. RealTime and Embedded Technology and Applications Symposium. Proceedings of the 12th IEEE (IEEE), 81–90 (2006)Google Scholar
 Y Chandarli, Y Abdeddaim, D Masson, The Fixed Priority Scheduling Problem for Energy Harvesting RealTime Systems. 2012 IEEE International Conference on Embedded and RealTime Computing Systems and Applications. IEEE Computer Society, 415418 (2012)Google Scholar
 Y Abdeddaïm, Y Chandarli, D Masson, Toward an optimal fixedpriority algorithm for energyharvesting realtime systems, in RTAS 2013 WiP, 2013, pp. 45–48Google Scholar
 S. Liu, Q. Qiu, Q. Wu, Energy aware dynamic voltage and frequency selection for realtime systems with energy harvesting. In: Design, Automation and Test in Europe, 2008. DATE’08 (IEEE, 2008), p. 236–241Google Scholar
 S Liu, J Lu, Q Wu, Q Qiu, Harvestingaware power management for realtime systems with renewable energy. IEEE Trans. Very Large Scale Integr. VLSI Syst. 20(8), 1473–1486 (2012)View ArticleGoogle Scholar
 TL Martin, Balancing Batteries, Power, and Performance: System Issues in CPU SpeedSetting for Mobile Computing. PhD thesis, PhD thesis, Department of Electrical and Computer Engineering, Carnegie Mellon University, 1999Google Scholar
 Y Chandarli, F Fauberteau, D Masson, S Midonnet, M Qamhieh, Yartiss: a tool to visualize, test, compare and evaluate realtime scheduling algorithms, in Proc. of the 3rd Int’l Workshop on Analysis Tools and Methodologies for Embedded and Realtime Systems, 2012, pp. 21–26Google Scholar