An optimal energy-saving real-time task-scheduling algorithm for ...

14 downloads 0 Views 795KB Size Report
2Hunan Vocational College of Commerce, Changsha, China. 3School of Computer ... Guangzhou University, Guangzhou, Guangdong Province, 510006, China.
Research Article

An optimal energy-saving real-time task-scheduling algorithm for mobile terminals

International Journal of Distributed Sensor Networks 2017, Vol. 13(5) Ó The Author(s) 2017 DOI: 10.1177/1550147717707891 journals.sagepub.com/home/ijdsn

Ziran Peng1,2 and Guojun Wang3

Abstract This article discusses the principles, mechanisms, and strategy of hard real-time task scheduling appropriate for mobile terminal equipment. Mobile terminals have timeliness requirements for completing hard real-time tasks and also clear energy-management requirements. Therefore, this study attempts to schedule tasks under these two constraints to achieve an optimal level of energy savings. First, terminal equipment operating time and standby time should meet the maximum requirements, and second, all tasks should meet the constraints of real-time parallel scheduling. We propose a scheduling strategy based on grouping according to the latest cut-off time, with each group adopting a dynamic optimization strategy to make scheduling decisions. The feasibility and validity of this algorithm are demonstrated through experiments and simulations. Keywords Mobile terminal, real-time task scheduling, earliest deadline first scheduling, optimal energy saving, step-by-step optimization strategy

Date received: 4 November 2016; accepted: 9 April 2017 Academic Editor: Juan Cano

Research background Research status of real-time task scheduling based on intelligent terminal systems Mobile intelligent terminals that run a number of hard real-time tasks that must be completed within the specified time have relatively high requirements for realtime task scheduling. Failure to meet these requirements can result in the malfunction of systems such as traffic control systems and medical monitoring systems. Periodic real-time tasks must be executed once during each fixed period of time. For example, the signal analysis and diagnosis task of a medical monitoring system is a periodic real-time task. Given a task-scheduling algorithm, if the execution of each task can be completed within its deadline, the task scheduling is denoted as feasible. The earliest-deadline-first (EDF) scheduling algorithm determines the

order in which tasks are run according to the deadline of task completion such that tasks with the earliest deadlines are run first.1 The least-leisure-time-first (LSF) algorithm assigns the highest priority to the task with the shortest deadline to ensure that the most urgent tasks are executed first. Based on the EDF algorithm, Vrimani et al.2 proposed a new scheduling

1

School of Information Science and Engineering, Central South University, Changsha, China 2 Hunan Vocational College of Commerce, Changsha, China 3 School of Computer Science & Educational Software, Guangzhou University, Guangzhou, China Corresponding author: Guojun Wang, School of Computer Science and Educational Software, Guangzhou University, Guangzhou, Guangdong Province, 510006, China. Email: [email protected]

Creative Commons CC-BY: This article is distributed under the terms of the Creative Commons Attribution 4.0 License (http://www.creativecommons.org/licenses/by/4.0/) which permits any use, reproduction and distribution of the work without further permission provided the original work is attributed as specified on the SAGE and Open Access pages (http://www.uk.sagepub.com/aboutus/ openaccess.htm).

2

International Journal of Distributed Sensor Networks

strategy based on genetic algorithm to address the defects of the EDF algorithm.

Problem analysis and research objectives Although the EDF algorithm has been improved, the algorithm is not appropriate for energy-sensitive devices such as mobile terminals because it does not consider the energy consumption of peripherals. Due to the rapid development and proliferation of on-chip processor systems and mobile intelligent terminals with advances in mobile computing and the Internet of Things, intelligent embedded real-time systems have become increasingly critical. For mobile intelligent terminals, the power standby time has become a critical performance index, making energy management an increasingly important issue in mobile real-time systems. The energy consumption of complementary metal oxide semiconductor (CMOS)-integrated processing chips has two main aspects: capacitor power consumption and leakage current power consumption.3,4 Modern integrated chip technology generally uses voltage/frequency regulation and dynamic power management (DPM) technology to reduce power consumption. In general, the dynamic energy consumption decreases with decreasing central processing unit (CPU) frequency. However, for a mobile terminal, chip energy management is only one component in energymanagement concern because the chip controls the external devices through the interface. In fact, most of the interrupted tasks processed by the system are interrelated with management of external equipment run states.5 Generally, the energy consumption of these peripherals accounts for 25%–95% of the energy consumption of the entire system. In the working mode of intelligent mobile health-monitoring equipment, life detection sensors and life signal processing modules consume 50% of the energy of the overall system, whereas in standby mode, the energy consumption of the processor is 75% of the total system consumption. Operating data obtained from the MWatch healthmonitoring wristwatch show that in the working mode, the operating current of the bi-signal front-end processing RC network and the active power amplifier chip is 17 mA, and the current consumption of the power regulation management module is 1.5 mA. The organic light-emitting diode (OLED) display consumes 25 mA, the average operating current of the capacitive touch screen is 2.5 mA, and the operating current of other external devices is approximately 0.5 mA. The peak current of the processor is 12 mA. Therefore, it can be estimated that the power consumption of the processor in the working state accounts for only 20.5% of the consumption of the overall system.

Figure 1. Mobile health-monitoring watch developed in this article for scheduling hard real-time tasks.

Based on this background information, this study considers peripheral energy consumption as the primary factor in the energy consumption of the entire system.6 During exploration of the principles, mechanisms, and strategy of hard real-time task scheduling appropriate for mobile terminal equipment, we establish a relevant system model composed of the processor, tasks, and the total energy consumption of the system. We propose a new optimal energy-saving algorithm for the hard realtime task scheduling of mobile terminals. The feasibility and validity of this algorithm is demonstrated through experiments and simulations that assess the power consumption of a mobile health-monitoring wristwatch that implements the proposed algorithm and the EDF algorithm.

Article structure In this article, the algorithm is introduced in five main parts. The first part introduces the current situation and main research objectives, the second part reviews related work, and the third part describes the system model. Because the scheduling of tasks is a complicated process involving many factors in the hardware and software systems, it is necessary to establish a theoretical model to strictly define the quantity of and logical relationship between the components and to establish a theory for discussing the scheduling algorithms of the system. The fourth part focuses on the scheduling algorithm. Using three theorems, the theoretical basis of the scheduling algorithm and the correctness of the algorithm are presented, and the concrete algorithm is outlined. The fifth part is the experimental and simulation results that verify the correctness and feasibility of the algorithm. The sixth part provides the conclusions.

Related work To improve the efficiency of real-time periodic task systems, a common real-time task model was proposed,7

Peng and Wang which allowed the end time and cycle time of a periodic task to be changed over a given period of time. The system efficiency was improved, and both the EDF and LSF algorithms were further optimized by accelerating the speed of task scheduling and reducing the waiting time through timely adjustment of task deadlines and periods under the condition of ensuring the normal operation of system scheduling.8 Burns and other researchers proposed a scheduling strategy based on a weight (priority) value.9 This strategy performed some tasks from the task set selectively to ensure that the system had the best overall weight value. To increase the unit weight value of the system, the task weight density was determined according to the maximum execution time and the task weight, and then the highest value density first (HVDF) algorithm was proposed, using the maximum weight density, to prioritize the execution of tasks in order to contribute the highest weights to the system.8 J Liu and J Guo10 studied the energy efficiency scheduling of periodic real-time tasks on multi-core processors with voltage islands and proposed a voltage maximum capacity first (voltage island largest capacity first (VILCF)) algorithm for energy-efficient scheduling of periodic real-time multi-core processors. This achieved better energy efficiency, by making full use of the remaining capacity of each island, before opening more islands or increasing the voltage level of the current active island. The experimental results show that VILCF is superior to the existing algorithm when there are multiple cores in the voltage island. K Li11 examined how the core allocates tasks and schedules tasks, when multiple processors of cloud computing data centers are shared by a large number of concurrent tasks, in order to minimize energy consumption. By adding the constant velocity method into the algorithm, the performance of the scheduling algorithm is improved further. M Fan et al.6 proposed an on-line power management method to minimize the power consumption of single-processor real-time scheduling under reliability constraints. The simulation results show that using runtime kinetics, the proposed method can save more energy than using previous work under reliability constraints. HE Zahaf et al.12 focus on real-time scheduling based on dynamic voltage and frequency scaling (DVFS). They present a model of the performance and energy consumption of parallel real-time tasks carried out on the ARM big LITTLE architecture. The optimization problem is first defined as an integer nonlinear programming (INLP) problem, and then, a heuristic method is proposed in order to find an effective solution to the problem. The results show that the method has a good energy-saving effect. M Akbari et al.13 used a genetic algorithm to solve the static task-scheduling problem of processors in heterogeneous computing

3 systems. The algorithm improves the performance of their genetic algorithm through a significant change to the genetic function, and the introduction of a new operator, ensuring consistent coverage of sample variety and the whole space. In addition, the random initial population has been replaced by some fixed initial population, with a partially optimized solution, to reduce the reproducibility of the genetic algorithm. Compared with other task-scheduling algorithms, the new algorithm is applicable to the practical application of heterogeneous computing systems with extensive characteristics. The results show that the proposed algorithm results in significant improvements. In order to deal with the scheduling of tasks on heterogeneous systems, M Akbari and H Rashidi14 proposed an algorithm that reduces the execution time while allowing maximum parallelization. The algorithm is based on the multi-objective scheduling azalea optimization algorithm (MOSCOA). In this algorithm, each cuckoo represents a dispatch solution, which takes into account the tasks assigned to them, along with the order of the processors. By the target migration operator in the algorithm to complete global optimization, and push each repetitive plan to an optimized plan to protect the global optimal, MOSCOA realizes a large number of random graphs, and realistic applications, whose graphs possess extensive features and show that MOSCOA is superior to the previous task-scheduling algorithm. D Konar et al.15 studied the efficient realtime task scheduling assisted by a hybrid quantuminspired heuristic genetic algorithm (HQIGA) in a multiprocessor environment. The HQIGA method uses a revolving door operation to explore the variable chromosomes described in the qubit of the Hilbert hyperspace. Simulation results show that HQIGA is superior to both the classical genetic algorithm (CGA) and mixed particle swarm optimization (MPSO) in the use of numerous codes and achieves significant improvements in the scheduling time.

System model The author is a core member of the mobile healthmonitoring system key technology project research team and presided over the research and development of an intelligent health care watch. The developed intelligent health care watch is an intelligent terminal that offers real-time electrocardiography (ECG) monitoring in which ECG information can be extracted, detected, and analyzed and sent to a remote server through WiFi for further processing. As shown in Figure 2, the optimal real-time scheduling problem is an important sub-task of the project. For intelligent mobile terminal equipment, certain external devices are driven by the firmware, such as the display, capacitive touch screen,

4

International Journal of Distributed Sensor Networks

Figure 2. System structure of the mobile health-monitoring watch.

FLASH, and medical sensors, among others. Each time that the device is initialized, the operating system needs only to perform an interrupt call on the line. Selected external devices have a single feature that does not require a firmware-driven peripheral, such as a power management chip similar to the power-gating header. However, for the system, the same calls to the firmware are made via external interrupts that can be abstracted into a class of external interrupt devices for unified management.16

Processor model Assuming a single-processor system with an operating frequency v, we denote pd (v) as the dynamic power consumption at runtime, which primarily derives from the power consumption caused by the gate charge, the discharge capacitance, and the short-circuit power consumption caused by the short-circuit transient current. It is well known that pd (v) is proportional to the third power of v, which can be represented as pd (v) = av3 . This statement means the static power consumption ps (v), which is independent of v, is primarily due to the leakage power consumption generated by the leakage current. In general, ps (v) is a constant, and we set ps (v) = b. Therefore, the processor power function is p(v) = pd (v) + ps (v) = av3 + b, a.0, b  0. This processor power consumption model applies to multiple dynamic voltage frequency scaling (DVFS) processors, and pðvÞ is a strictly convex increasing function, as

Figure 3. Processor energy consumption versus clock frequency.

shown in Figure 3. The energy consumption of a processor that performs a single clock cycle at frequency v is p(v)=v = av2 + b=v. The value of v for which p(v)=v attains a minimum value is denoted as the critical frequency. Without consideration of processor performance, it is clear that the minimum energy consumption is obtained at the lower bound of v. The processor has two states: the sleep state and the active state. When the processor is in the sleep state, DPM can turn off the processor clock to reduce the processor voltage to a very low level. At that time, the power consumption of the device is negligible.17 A processor that is executing a task is in the active state.

Peng and Wang

5

When the processor is idle in the active state, the minimum power consumption processor executes the idle operation instruction at a very low frequency.18 We denote the idle power consumption as pidle and assume that it is not less than the minimum possible power consumption of the processor at the lower bound of v, denoted in this work as pmin such that pidle  pmin . When the period during which the processor sits idle is greater than the maximum idle period tu , the processor is placed in the sleep state. Setting Esw as the energy consumption required for the processor to switch between operating states and tsw as the time cost of state switching, the process of switching the operating state is energy efficient when (tu  tsw )Pidle  Esw such that tu  Esw =Pidle + tsw . Obviously, if the energy savings increase, the longer the processor resides in the sleep mode.

Task model Definition 1. G(R, T , P, C, D) represents a task model, where R is the time when the task is released, T is the time when the task is scheduled, P is the power consumed when the task is waiting, C is the time required to execute the task, and D is the final deadline for the task to be completed. We refer to G as a real-time task set, and j 2 G indicates that j is a task entity in the task set. According to Definition 1, each j has five attribute components, where, for example, j½R represents the time component when the task is released. Definition 2. Given a task set G(X , Y ), where X and Y are attribute fields of G, when j½X  = §, the image set of § in Z is Z§ = fj½Zjj 2 G, j½X  = §g. Definition 3. The task projection operation p forms a new task set from several attribute columns selected from G and is denoted as pA (G) = fj½Ajj 2 Gg.

Gt1 , t2 = sRt1 ^T + D  t2 (G) ð2Þ = fjjj 2 G ^ j½ R  t 1 ^ j½T + j½D  t 2 g

Definition 7. jkey 2 Gt1 , t2 if it satisfies jkey ½R + jkey ½D = minfjj ½R + jj ½D0  j  s, jj 2 Gt1 , t2 g, and jkey is the key tuple of Gt1 , t2 . If the subsequence j01 , j02 , . . . , j0r of Gt1 , t2 , which does not include jkey , satisfies t1  ji ½T  + ji ½C  ji + 1 ½T , jr ½T  + jr ½C  t 2 , then the subsequence is referred to as a feasible scheduling of Gt1 , t2 that is relative to jkey and is denoted as SCGt1 , t2 (jkey ). This work considers two sets of tasks. One set is represented by the hard real-time periodic task set GT (R, T, P, C, D), where P indicates the power consumed by the peripherals of the task while waiting for a time Dt at idle for scheduling. Setting the peripheral operating current associated with the process as I and the operating voltage is U, P = UIDt, and the total energy consumed by a hard-cycle task set P peripheral during a super cycle of a task is EH = Nk= 1 pk Dtk . For the intelligent health-monitoring wristwatch developed in this study, most of the hard real-time tasks are related to peripherals or sensors. For example, in module-related ECG monitoring data acquisition tasks, the digital-to-analog converter generates a hard interrupt after the acquisition and conversion of a segment of data. At the same time, the ECG module remains in the active state and consumes 3.3 V 3 17 mA of power at idle. The ECG module resides in a waiting mode until the CPU sets the general-purpose input/output (GPIO) control register state to turn off the power supply of the RC network. If each waiting time of this task is Dt = 500 ms and the ECG sampling frequency is 200 Hz, then the power consumption due to scheduling is P = (200 Hz 3 0.5 ms 3 3.3 V 3 17 mA)/1000 = 5.61 mW. The second hard real-time random task set GO (R, T, P, C, D) does not consider cycles.

Energy consumption model Definition 4. The task selection operation s forms tasks selected from G that satisfy a given condition and is denoted as sF (G) = fjjj 2 G ^ F(j) = ‘‘true’’g. Definition 5. Gt is a subset of the tasks that enter the scheduling process at the moment t and is denoted as Gt = sRt (G) = fjjj 2 G ^ j½ R  t g

ð1Þ

Definition 6. Gt1 , t2 is the subset of tasks that enter the scheduling process at the moment t1 and that have absolute deadlines greater than or equal to t2 . It is denoted as

P Definition 8. PWSCGt, d (j1 ,j2 , ..., jr ) = ri= 1 ji ½P, where PWSCGt,d (j1 ,j2 , ..., jr ) is denoted as the power output of the feasible scheduling SCGt, d (j1 ,j2 , ..., jr ). Definition 9. PCSCGt, d (j1 , j2 , . . . , jr ) is denoted as the power loss of the feasible scheduling SCGt, d (j1 , j2 , . . . , jr ) if PCSCGt, d (j1 , j2 , . . . , jr ) =

r X

(ji ½P

i=2

+

X ji 2Gt, d ^ji 62SCGt, d

ji ½P

r X j=0

jj ½C

i1 X j=0

jj ½C) ð3Þ

6

International Journal of Distributed Sensor Networks

Definition 10. In addition to the condition of Definition 9, if SCGt, d (j1 , j2 , . . . , jr ) also satisfies SCGt, d (j1 , j2 , . . . , jr ) = MIN (SCGt, d (j01 , j02 , . . . , j0m ), j0k 2 Gt, d )

ð4Þ

then we denote this feasible scheduling as the optimal energy-saving scheduling OPESGt, d (j1 , j2 , . . . , jr ). This work does not consider the energy consumption costs of switching between the active and sleep states of processors, and only a single-processor environment is considered. Based on this assumption, it is proposed that the OPESGt, d (j1 , j2 , . . . , jr ) assigning all tasks in the task set to the same processor must satisfy the following properties.

jk ½P

k 1 X

ji ½C + jk + 1 ½P

i=0

1. 2.

Tk + Ck  Rk + Dk , Tk + 1 + Ck + 1  Rk + 1 + Dk + 1 Tk + Ck  Rk + 1 + Dk + 1  Ck + 1

Proof. The necessity is obvious, and we only discuss the adequacy here. Because of the limitations Tk + Ck  Rk + Dk , each task can be completed by the deadline. Because Tk + Ck  Rk + 1 + Dk + 1  Ck + 1 , we assume that the (k + 1)th task enters the scheduling operation immediately after the kth task is completed. The deadline of the (k + 1)th task is Tk + Ck + Ck + 1 . Because the deadline of the (k + 1)th task is Rk + 1 + Dk + 1 , the task-scheduling constraint condition must only satisfy Tk + Ck + Ck + 1  Rk + 1 + Dk + 1 . This statement is exactly equivalent to equation (2) of Theorem 1. Therefore, the adequacy is proven. Theorem 2. In the OPESGt, d (j1 , j2 , . . . , jr ), the condition jk ½P=jk ½C  jk + 1 ½P=jk + 1 ½C must be satisfied. Proof. Because j1 . . . jk , jk + 1 . . . jr is the optimal energy-saving scheduling of task set Gt, d , j1 . . . jk , jk + 1 . . . jr must be a feasible scheduling, and the sequence j1 . . . jk + 1 , jk . . . jr generated by the exchange in the orders of two elements is also a feasible scheduling SCGt, d (j1 . . . jk + 1 , jk . . . jr ). By Definition 9, the power loss for optimal scheduling is given by equation (3). Compared with equation (3), the power loss of SCGt, d (j1 . . . jk + 1 , jk . . . jr ) has only two differences, which are described as follows: jk + 1 ½P P Pk1 k1 j ½C + j ½P( j ½C + j ½C). k k +1 i=0 i i=0 i Because OPESGt, d (j1 , j2 , . . . , jr ) fulfills condition equation (4) by Definition 10, the condition

! ji ½C + jk + 1 ½C

i=0

 jk + 1 ½P

k 1 X

ji ½C + jk ½P

i=0

k 1 X

! ji ½C + jk + 1 ½C

i=0

ð5Þ

must be met. After expanding equation (5), we obtain the following inequality jk ½P

k 1 X

ji ½C + jk + 1 ½P

i=0

 jk + 1 ½P

k 1 X

ji ½C + jk + 1 ½Pj½C

i=0 k 1 X i=0

Theorem 1. For S = (t1 , t2 , . . . , tk , tk + 1 . . . ), where and tk + 1 = (Rk + 1 , Tk + 1 , tk = (Rk , Tk , Ck , Pk , Dk ) Ck + 1 , Pk + 1 , Dk + 1 ) in a feasible scheduling sequence, the necessary and sufficient conditions are

k1 X

ji ½C + jk ½P

k 1 X

ji ½C + jk ½Pjk + 1 ½C

i=0

ð6Þ

The elimination of equivalent terms yields jk + 1 ½Pjk ½C  jk ½Pjk + 1 ½C

ð7Þ

This statement can also be written as jk ½P=jk ½C  jk + 1 ½P=jk + 1 ½C, and therefore, the proposition is proven.

Energy-saving optimal scheduling algorithm Theoretical basis of the algorithm Definition 11. rk = jk ½P=jk ½C and is denoted as the power factor for a task item. Obviously, in the schedulable case, the priority of the scheduling increases with increasing rk . Theorem 3. We use rk as the priority, ranging from high to low, for scheduling to be implemented in task set Gt, d . If the resulting feasible scheduling sequence satisfies PWSCGt, d (j1 , j2 , . . . , jr ) = MAX (PWSCGt, d (j01 , j02 , . . . , jm )), j0k 2 Gt, d , then the scheduling sequence must also satisfy condition (4), and this scheduling represents the OPESGt, d (j1 , j2 , . . . , jr ). Proof. We prove this statement by the method of counterevidence. Suppose SCGt, d (j1 , j2 , . . . , jr ) does not satisfy OPESGt, d (j1 , j2 , . . . , jr ), and when jr .j0r , SCGt, d (j1 , j2 , . . . , j0r ) satisfies PCSCGt, d (j1 , j2 , . . . , jr )  PCSCGt, d (j1 , j2 , . . . , j0r )

ð8Þ

Thus, by definition, the following inequality is met

Peng and Wang r1 X

ðji ½PÞ

i=2

7

i1  X

r1 X  jj ½C + jr ½P jj ½C

j=1

+ j0 r ½P

r X

j=1

jj ½C +

r1 X

ðji ½PÞ

i=2

+ jr ½P

i1  X

r X

jj ½C

j=1

r1 X  jj ½C + j0 r ½P jj ½C

j=1 r X

ji ½P

ji 6¼j0 r ^ji 2Gt, d ^ji 62SCGt, d

j=1



X

j=1

X

jj ½C +

j=1

r X

ji ½P

jj ½C

j=1

ji 6¼jr ^ji 2Gt, d ^ji 62SCGt, d

ð9Þ

Eliminating equivalent terms on both sides of the inequality yields (jr ½P  j0r ½P)

r1 X

jj ½C  (jr ½P  j0r ½P)

j=1

r X

jj ½C ð10Þ

j=1

Setting jr ½P  j0r ½P, we draw the conclusion r1 X

r X

jj ½C 

j=1

jj ½C

ð11Þ

jk ½P

k1 X

ji ½C + jk + 1 ½P

i=0

!

 jk + 1 ½P

ji ½C + jk ½P

i=0

k 1 X

! ji ½C + jk + 1 ½C

i=0

ð12Þ

must be met. After expanding the above, we obtain the following inequality jk ½P

k 1 X

ji ½C + jk + 1 ½P

i=0

 jk + 1 ½P

k 1 X

ji ½C + jk + 1 ½Pj½C

i=0 k 1 X i=0

ji ½C + jk ½P

jr ½C  jr + 1 ½C + jr + 2 ½C  d  jr ½T  jr ½P  jr + 1 ½P + jr + 2 ½P

ð15Þ

This statement indicates that a new schedule can be constructed with a substitution of jr + 1 , jr + 2 for jr and that PWSCGt, d (j1 , j2 , . . . , jr + 1 , jr + 2 ) must be greater than PWSCGt, d (j1 , j2 , . . . , jr ). Therefore, an appropriate jr + 1 ½C, jr + 2 ½C exists such that PWSCGt, d (j1 , j2 , . . . , jr + 1 , jr + 2 )  PWSCGt, d

ð16Þ

Inference 2. Scheduling in task set Gt, d is implemented according to the EDF algorithm, and the resulting is not necessarily the SCGt, d (j1 , j2 , . . . , jr ) OPESGt, d (j1 , j2 , . . . , jr ).

ji ½C + jk + 1 ½C

i=0 k 1 X

Proof. Let jr be the last element in the resulting scheduling sequence according to the RM algorithm, that is, and rr  rr + 1  rr + 2 . jr + 1 2 Gt, d , jr + 2 2 Gt, d Depending on the definition, the following conditions might exist

(j1 , j2 , . . . , jr ), jk 2 Gt, d

j=1

By definition, jj ½C.0, jj 2 Gt, d , and therefore, the above conclusion cannot be established, and the proposition is proven. Because OPESGt, d (j1 , j2 , . . . , jr ) satisfies condition (4), the condition k1 X

Inference 1. We assume rk as a fixed priority, and a schedule in task set Gt, d is implemented according to the rate-monotonic scheduling (RM) algorithm. The sequence SCGt, d (j1 , j2 , . . . , jr ) obtained is not necessarily the OPESGt, d (j1 , j2 , . . . , jr ).

k1 X

ji ½C + jk ½Pjk + 1 ½C

i=0

ð13Þ

Elimination of equivalent terms yields jk + 1 ½Pjk ½C  jk ½Pjk + 1 ½C

Verification. This inference is easily verified because from Definition 5, Gt, d = sRt^Dd (G) = fjjj 2 G ^ j½R  t ^ j½D  d:g. Because every task in task set Gt, d can be completed within the deadline d, the proposition becomes an RM scheduling problem. As discussed, this study considers the optimal energy-saving scheduling process. After scheduling the task items from high to low priority according to the energy consumption factor, the optimal energy-saving solution is obtained by constructing a scheduling sequence in a step-by-step manner. Assuming an order of decisions j1 , j2 , . . . , jn , after making the decision ji , the problem involves one of the following choices: ji is abandoned, and the state remains unchanged, or ji is retained as the solution element of the optimal sequence, and the state vector changes accordingly, as follows

ð14Þ

This statement can also be written as jk ½P=jk ½C  jk + 1 ½P=jk + 1 ½C. Therefore, the proposition is proven.

PWSCGt, d (j1 , j2 , . . . , ji ) = PWSCGt, d (j1 , j2 , . . . , ji1 ) + ji ½P

ð17Þ

8

International Journal of Distributed Sensor Networks

PCSCGt, d (j1 , j2 , . . . , ji ) = PCSCGt, d (j1 , j2 , . . . , ji1 ) + ji ½P

i1 X

jj ½C  ji ½P

j=0

OPESSCGt, d (j1 , j2 , . . . , jr ) r X

jj ½C

j=0

ð18Þ

P Definition 12. Let Oi = d  ij = 0 jj ½C, Oi = Oi1  ji ½C. The resulting sequence from the decision of the kth step is (j01 , j02 , . . . , j0r ), and FPk (Ok ) represents the subsequent power output value of the sequence, that is, FPk (Ok ) = PWSCGt, d (j01 , . . . , j0k ). Each step requires two different decisions that must be integrated. According to Definition 9, this process can be expressed as FPk (Ok ) = MAX (FPk1 (Ok1 ), FPk1 (Ok1  jk ½C) + jk ½P)

ð19Þ

Obviously, this example is a process of optimal selection. If it can be guaranteed that FPk1 (Ok1 ) is an optimal choice, then FPk (Ok ) can be treated as an optimal choice based on the previous optimal decision, and the result is obviously optimal. Theorem 4. According to equation (19), and based on recursive relations, we make a dynamic decision from the sequence represented by FP0 (O0 ). The result must be optimal. Proof. The following holds from Definition 9 FPk (Ok ) = PWSCGt, d (j01 , . . . , j0k ) = MAX(FPk1 (Ok1 ), FPk1 (Ok1  jk ½C) + jk ½P) ð20Þ

We define the maximization conditions for solving (j01 , . . . , j0k )) and the probthe problem MAX(PWSCGt,P d lem constraints Oi = d  ij = 0 jj ½C  0. We specify the steps needed to solve the problem and make scheduling decisions according to the tuple sequence rk = jk ½P=jk ½C from high to low priority. This method of solving problems is consistent with the principle of optimization, where regardless of the initial state of the process and whatever the initial decision, the remaining decision-making process constitutes an optimal decision sequence relative to the initial state. Thus, the result must be optimal. In other words, we can obtain a solution vector satisfying MAX(PWSCGt, d (j01 , . . . , j0k )). According to Theorem 2, this statement is equivalent to finding a solution

 S3 =

ð21Þ

= MIN(PCSCGt, d (j01 , j02 , . . . , jm )), j0k 2 Gt, d

This type of dynamic planning and scheduling algorithm is herein denoted as a decisive path scheduling (DPS) algorithm.

DPS algorithm In this article, we clarify the function of the DPS algorithm using an example and present the main steps. Let a set of tasks Gt1 = 102, t2 = 109 exist, as listed in Table 1. Because j4 is the deadline’s earliest critical tuple, j4 must be scheduled at the time when j4 ½T  = t + d  j4 ½C = 108. The prerequisite is to obtain the optimal energy-saving scheduling SCGd1, d2 (j4 ). Because j6 is less than r4 , the j6 tuple is excluded from the scheduling. Therefore, we obtain the sequence (j5 , j1 , j3 , j2 ), which is scheduled in the time period18 according to the value of r from high to low. In this example, we consider the following step-by-step process based on the initialization sequence S0 = ff;g, FP0 (0) = 0g. For the first step, we perform decision making on j5 : abandon j5 , FP1 (0) = FP1 (0) = 0; accept j5 , FP1 (j5 ½C) = FP1 (4) = 20; merge them and obtain the solution set S1 = fff;g, FP1 (0) = 0)g, ffj5 g, FP1 (4) = 20)gg ð22Þ

For the second step, we perform decision making on j1 : abandon j5 , FP2 (0) = 0, FP2 (4) = 20; accept j1 , FP2 (3) = 12, FP2 (7) = 32; merge them and obtain the solution set  S2 =

ff;g, FP2 (0) = 0)g, ffj5 g, FP2 (4) = 20)g ffj1 g, FP2 (3) = 12)g, ffj1 , j5 g, FP2 (7) = 32)g



ð23Þ

For the third step, we perform decision making on j3 : abandon j3 , the solution set is j3 , and we obtain s2 and accept j3 to obtain the solution set S30 =



ffj3 g, FP3 (3) = 9)g, ffj3 , j5 g, FP3 (7) = 29)g ffj1 , j3 g, FP3 (6) = 21)g, ffj1 , j5 , j3 g, FP3 (10) = 41)g



ð24Þ

where the solution set ffj1 , j5 , j3 g, FP3 (10) = 41)g passes beyond the domain of the problem, 0  O  7 and is discarded. After merging S3 and S30 , we obtain the solution set

ff;g, FP3 (0) = 0)g, ffj5 g, FP3 (4) = 20)g, ffj1 g, FP3 (3) = 12)g, ffj1 , j5 g, FP3 (7) = 32)g ffj3 g, FP3 (3) = 9)g, ffj3 , j5 g, FP3 (7) = 29)g, ffj1 , j3 g, FP3 (6) = 21)g

 ð25Þ

Peng and Wang

9

Table 1. Task set example. G

R

T

C

P

D

r

j1 j2 j3 j4 j5 j6

100 100 101 101 102 102

t t t t t t

3 2 3 1 4 10

12 5 9 2 20 15

13 11 9 8 10 9

4.0 2.5 3.0 2.0 5.0 1.5

For the fourth step, we perform decision making on j2 : abandon j2 , the solution set is S3 and accept j2 and by excluding the solution that passes beyond the established domain, we obtain the solution set S40

 =

ffj2 g, FP3 (2) = 5)g, ffj5 , j2 g, FP3 (6) = 25)g ffj1 , j2 g, FP3 (5) = 17)g



ð26Þ

After merging S3 , S40 , we obtain the solution set 9 8 ff;g, FP3 (0) = 0)g, ffj2 g, FP4 (2) = 5)g > > > > = < ffj1 g, FP4 (3) = 12)g, ffj5 g, FP4 (4) = 20)g S4 = ffj1 , j2 g, FP3 (5) = 17)g, ffj5 , j2 g, FP3 (6) = 25)g > > > > ; : ffj1 , j5 g, FP4 (7) = 32)g

ð27Þ

Analysis of the DPS algorithm We denote the power consumption of each task by ji ½P. The space P complexity of the is P DPS algorithm i n determined as 0\i\n1 jSi j = 0\i\n1 2 = 2  1 and is O(2n ). If the generation of Si by Si1 requires a time FðjSi1 jÞ, then Pthe calculated total time of S1 , S2 , . . . , Sn1 is F( jSi1 j). However, there exists jSi j  2i such that the total number of operations of the Si tuple ji and its time cost ji ½C are expressed as integers. Therefore, the elements in each of the ordered pairs Si should be integers, which P P yields jSi j  1 +  1 + minf j ½P and S j j i 0\i\n1 i 0\i\n1 j i ½C, Og. In this case, the time and space complexity of DPS is ( n

O min 2 , n

X

)! ji ½C, nO

ð28Þ

0\i\n

From S4 , FP4 (7) = 32 can be easily obtained as the optimal solution, and the optimal energy-saving solution set is fj1 , j5 g. The main steps of the DPS algorithm are given as follows.

The above analysis indicates that the performance of the DPS algorithm is unsatisfactory when n is large. However, viewed from the perspective of practical use, the number of real-time scheduling tasks for mobile portable devices is limited. According to statistics

Algorithm 1. DPS. (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) (19) (20)

For i = 1 to N2 1 do S0 = S ; u = jS0 j; For j = 1 to u do If Oi1, j + ji ½C  O then Oi1, j = Oi1, j + ji ½C; FPi (Oi, j ) = FPi (Oi, j ) + ji ½C k = 0; While Oi1, k  Oi, j and FPi1 (Oi1, k )\FPi (Oi, j ) do k = k + 1; End while If k \ u and Oi1, k  Oi, j FPi1 (Oi1, k )\FPi (Oi, j ) then S0 = S0  S0k ; Else if k = u then S0j = S0j [ ji ; End if End if End for (j) S = Merge(S0 , S); End for (i) Output(S);

10

International Journal of Distributed Sensor Networks

obtained for the MWatch health-monitoring wristwatch in the working state, in a period of 1024 clock cycles, the hard real-time tasks generated by the system range from 0 to 7, which indicates that the most serious scheduling calculations for the current system are 27 = 128, which is acceptable. In practice, a stricter and finer rule can eliminate a large number of unnecessary intermediate results in advance, and the algorithm converges rapidly.19 We further discuss the functioning of hard real-time scheduling algorithms based on the DPS algorithm, as follows. First, we fully sort the hard real-time task set Gt (j1 , j2 , . . . , jn ) according to the deadline and obtain the scheduling tasks set Gt1 , t2 . Second, we apply the DPS algorithm to process Gt1 , t2 and obtain OPESGt, d (j1 , j2 , . . . , jr ). Finally, we update G according to the scheduling result. If Gt is null, the algorithm ends; otherwise, the above-mentioned steps are repeated. This algorithm is denoted herein as the hierarchical reliability-driven scheduling (HRDS) algorithm. The steps of the HRDS algorithm are given as follows. Algorithm 2. HRDS. INPUT: Gt (j1 , j2 , . . . , jn ), S = ; (1) (2) (3) (4) (5) (6) (7) OUTPUT(S)

Figure 4. Real-time system energy consumptions of the GS2011M-based health wristwatch.

Experimental and simulation results Through ‘‘Key technology of a mobile healthmonitoring watch’’ project, we performed a number of comparative experiments using the proposed algorithm in the mobile-embedded platform shown in Figure 4 and fully verified its effectiveness and feasibility in this platform. The platform chip is based on

t 1 = t, t2 = j1 ½R + j1 ½D  j1 ½C; Gt1 , t2 = sRt1 ^T + D  t2 (G) = fjjj 2 G ^ j½R  t 1 ^ j½T + j½D  t2 g S = S [ OPESGt, d (j1 , j2 , . . . , jr ) = DPS(Gt1 , t2 ) If Gt1 , t2  OPESGt, d (j1 , j2 , . . . , jr ) 6¼ ; Gt (j1 , j2 , . . . , jn ) = Gt1 , t2  OPESGt, d (j1 , j2 , . . . , jr ) Repeat steps (1) to (4); END IF

Theorem 5. For the schedulable task set SCGt, d (j1 , j2 , . . . , jr ), the output S after completion of the HRDS algorithm is an optimal energy-saving scheduling, that is, S = OPESGt, d (j1 , j2 , . . . , jr ). Proof. From the arithmetic operation process, we and observe that S = S1 [ S2 [ , . . . , Sm Sk = OPESGt, d (j1 , j2 , . . . , jr ). For any tuple, ji must assuming ji 2 Sj0 , appear in a subset Sj 0 0 S = S1 [ S2 [ , . . . , Sj , . . . , Sm exists, and PCSCGt, d (S)  PCSCGt, d (S 0 ). This statement indicates that PCSCGt, d (S)  PCSCGt, d (S 0 ), which obviously contradicts the nature of the DPS algorithm discussed earlier, thus proving the energy-saving optimality of the HRDS algorithm from a negative perspective.

the GainSpan GS2011M module, which uses an ARMÒ CortexÒ M3 two-core CPU, where one core is used for Wi-Fi wireless communications and the other for Application processing. The hard real-time tasks listed in Table 2 were performed during stress testing of the algorithm. Table 3 shows the real-time process set abstract for the real-time task set. A portion of the task exists because the release time is random, and another portion of the task is released in accordance with the fixed operating cycle. Thus, the task of release time must be treated as a random time for dynamic processing. The system maintains a queue S that has been scheduled and is waiting to run and an EDF queue G that waits for scheduling. When G is nonempty, the element j is selected from the header of G to perform DPS

Peng and Wang

11

Table 2. Real-time process of the GS2011M health-monitoring platform. Task number

Task function

Operating time (ms)

Operating cycle (ms)

Deadline (ms)

T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12

Touch screen driver LED switches Power supply monitoring Signal monitoring FASH driver ECG module control SpO2 module control ECG data reading and writing SpO2 data reading and writing Infrared light driver Pulse driver Power supply voltage regulator

125 150 28 10 65 20 15 75 75 15 12 28

20 10 8000 8000 20 No No 50 50 20 200 No

1000 1000 9000 9000 1000 5000 5000 500 500 100 100 9000

LED: light-emitting diode; ECG: electrocardiography.

Table 3. Real-time process set abstracted as a real-time task set. G

R

T

C

P

D

r

j1 j2 j3 j4 j5 j6 j7 j8 j9 j10 j12 j13

l1 l2 l3 l4 l5 l6 l7 l8 l9 l10 l11 l12

t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12

125 150 28 10 65 20 15 75 75 15 12 28

25 40 4 4 4 35 40 5 3 3 30 6

1000 1000 9000 9000 1000 5000 5000 500 500 100 100 9000

0.20 0.27 0.14 0.40 0.06 1.75 2.67 0.07 0.04 0.20 2.50 0.21

scheduling. If the optimal scheduling is satisfied, j is moved from G to S and so on until it is empty. Because the task j6 , j7 , j11 with a high-energy consumption factor always maintains priority in processing of the HRDS scheduling algorithm, although the energy consumption of j6 , j7 , j11 accounts for nearly 1/2 of the total energy consumption of the system, the energy consumption of the system decreases rapidly, and thus, the advantages of HRDS scheduling algorithm are quite obvious. Figure 4 shows the energy consumption curves of the GS2011M mobile platform environment in terms of the kernel implementing the EDF scheduling algorithm and the HRDS scheduling algorithm. According to the data, the energy consumption of the device is significantly reduced with the HRDS scheduling algorithm, and the average power consumption is only 37% of that with the EDF algorithm. The main reason for this result is the high power consumption of the external equipment of the operating environment, which accounts for 79% of the total system power consumption, and thus, the actual effect of using the HRDS algorithm is significant. We simulated the above environment with the EDF scheduling algorithm and the HRDS scheduling

Figure 5. MATLAB simulation of real-time system energy consumption.

algorithm on the MATLAB platform and increased the number of hard real-time processes to 100. Figure 5 presents a comparison of the simulation data. In this case, compared with the actual environment, the data effect is slightly worse, mainly because the number of tasks has increased, and therefore, CPU idle time is reduced and the ratio of peripheral power consumption to CPU power consumption is decreased. However,

12 compared with the energy consumption when using the EDF algorithm, the average energy consumption with the HRDS algorithm is substantially less and is only 61% of that of the EDF algorithm. Relatively, the effect is highly significant.20

Conclusion The main goal of current hard real-time scheduling of periodic and non-periodic tasks is to save energy while ensuring the real-time completion of tasks. In this article, we discussed the nature and effect of the energy consumption factor in the case of peripheral energy loss sensitivity. In addition, we introduced the basic idea of the algorithm and its basic theory and proposed an energy-saving priority scheduling algorithm. The results from the experiments and simulations show that HRDS can ensure real-time scheduling and minimize energy consumption in the case of schedulable tasks. However, because the volume of the calculation is somewhat large, if the scale increases with the problem, it is expected to cause greater overhead to the system.

International Journal of Distributed Sensor Networks

5.

6.

7.

8.

9.

10.

11.

Acknowledgement Z.P. and G.W. conceived and designed the experiments, Z.P. performed the experiments, G.W. analyzed the data and contributed analysis tools, and Z.P. wrote and edited the main manuscript text. All authors reviewed the manuscript.

Declaration of conflicting interests The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

12.

13.

14.

Funding The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was supported by National Natural Science Foundation of China (61632009, 61472451, 61272151, and 61462006), Natural Science Foundation of Hunan Province (2017JJ5038) and the ‘‘Mobile Health’’ Ministry of Education China Mobile Joint Laboratory (MOE-DST No. [2012]311).

References 1. Saifullah A, Xu Y, Lu C, et al. Real-time scheduling for wirelessHART networks. In: Proceedings of the 31st IEEE real-time systems symposium, San Diego, CA, 30 November–3 December 2010, pp.150–159. New York: IEEE. 2. Vrimani D and Jain S. Real time scheduling with virtual nodes for self stabilization in wireless sensor networks. Int J Inform Tech Knowl Manag 2011; 4: 477–483. 3. Rhn J-H, Sun J-H, Kim K, et al. Utility accrual real-time scheduling for (m, k)-firm deadline-constrained streams on multiprocessors. Electron Lett 2011; 47: 316–317. 4. Yang C, Chen J, Thiele L, et al. Energy-efficient realtime task scheduling with temperature-dependent

15.

16.

17.

18.

19.

20.

leakage. In: Proceedings of the 2010 ACM symposium on applied computing, Sierre, 22–26 March 2010, pp.9–14. New York: ACM. Zhang F and Chanson ST. Blocking-aware processor voltage scheduling for real-time tasks. ACM T Embed Comput S 2004; 3: 307–335. Fan M, Han Q and Yang X. Energy minimization for on-line real-time scheduling with reliability awareness. J Syst Software 2017; 127: 168–176. Jejurikar R and Gupta R. Energy-aware task scheduling with task synchronization for embedded real-time systems. IEEE Trans Comput Aided Des Integrated Circ Syst 2006; 25: 1024–1037. Jejurikar R and Gupta R. Energy aware non-preemptive scheduling for hard real-time systems. In: Proceedings of the 17th Euromicro conference on real-time systems, Palma de Mallorca, 6–8 July 2005, pp.21–30. New York: IEEE. Yan L, Luo J and Han K. Joint dynamic voltage scaling and adaptive body biasing for heterogeneous distributed real-time embedded systems. IEEE Trans Comput Aided Des Integrated Circ Syst 2005; 24: 1030–1041. Liu J and Guo J. Energy efficient scheduling of real-time tasks on multi-core processors with voltage islands. Future Gener Comp Sy 2016; 56: 202–210. Li K. Scheduling parallel tasks with energy and time constraints on multiple manycore processors in a cloud computing environment. Future Gener Comp Sy. Epub ahead of print 11 January 2017. DOI: 10.1016/j.future.2017.01.010. Zahaf HE, Benyamina AEH, Olejnik R, et al. Energy-efficient scheduling for moldable real-time tasks on heterogeneous computing platforms. J Syst Architect 2017; 74: 46–60. Akbari M, Rashidi H and Alizadeh SH. An enhanced genetic algorithm with new operators for task scheduling in heterogeneous computing systems. Eng Appl Artif Intel 2017; 61: 35–46. Akbari M and Rashidi H. A multi-objectives scheduling algorithm based on cuckoo optimization for task allocation problem at compile time in heterogeneous systems. Expert Syst Appl 2016; 60: 234–248. Konar D, Bhattacharyya S, Sharma K, et al. An improved Hybrid Quantum-Inspired Genetic Algorithm (HQIGA) for scheduling of real-time task in multiprocessor system. Appl Soft Comput 2017; 53: 296–307. Melhem R, Mosse D and Elnozahy E. The interplay of power management and fault recovery in real-time systems. IEEE T Comput 2004; 53: 217–231. Saidani T, Piskorski S, Lacassagne L, et al. Parallelization schemes for memory optimization on the cell processor: a case study of image processing algorithm. In: Proceedings of the workshop on memory performance: dealing with applications, Brasov, 16 September 2007, pp.9–16. New York: ACM Press. Peng Z and Wang G. Study on parallel algorithm of wavelet transform based on MPSoC platform. Comput Eng Appl J 2017; 53(5): 67–74. Mathew M and Weng N. Adaptive sensor node sleep scheduling for quality-of-experience enhancement. Int J Distrib Sens N 2016; 2016: 6960876. Shi W, Wang J, Zhang H, et al. A new link scheduling algorithm for 60 GHz-WPAN communication system. Int J Distrib Sens N 2016; 2016: 6395385.

Suggest Documents