A Group-Based Energy-Efﬁcient Dual Priority Scheduling for Real-Time Embedded Systems

: As the limitation of energy consumption of real-time embedded systems becomes more and more strict, it has been difﬁcult to ignore the time overhead and energy consumption of context switches for ﬁxed-priority tasks with preemption scheduling (FPP) in multitasking environments. In addition, the scheduling for different types of tasks may disrupt each other and affect system reliability. A group-based energy-efﬁcient dual priority scheduling (GEDP) is proposed in this paper. The GEDP isolates different types of tasks to avoid the disruption. Furthermore, it also reduces context switches effectively, thus decreasing system energy consumption. As many studies ignored the context switches’ overhead in the worst-case response time (WCRT) model, and it will affect the accuracy of WCRT, thereby affecting the system schedulability. Consequently, the WCRT model is improved based on considering context switches’ overhead. The GEDP is designed and implemented in Linux, and the time overhead and energy consumption of context switches is compared in different situations with GEDP and FPP. The experimental results show that GEDP can reduce context switches by about 1% and decrease energy consumption by about 0.6% for given tasks. number of context switches for task τ i under GEDP in one experiment. T FPP ( i ) is the number of context switches for all tasks under FPP in the i th experiment. T GEDP ( i ) is the number of context switches for all tasks under GEDP in the i th experiment, and n is the number of experiments. The R c of Memory_test was between 0.3% and 2.5%. The R v of Memory_test was about 1.3%. These ﬁndings showed that the context switches of Memory_test were reduced signiﬁcantly. The R c of Whetstone was between − 1.1% and 7.5%. The R v of Whetstone was about 2.9%. The results indicated that the context switches of Whetstone were signiﬁcantly reduced. The R c and R v of Linpack_bench and Mxm were relatively small, and the changes were not obvious. From the overall analysis of the four benchmarks, R t was between 0.1% and 2.1%. The average reduction rate of the ten experiments was approximately


Introduction
Real-time embedded systems are widely used in high-reliability application domains to ensure reliable execution of mission-critical tasks. These domains include aerospace, unmanned aerial vehicles, automobiles, and so on [1][2][3]. With the development of computer technology, such systems are becoming more intelligent, and the demand for long time running is getting stronger. For example, most real-time embedded systems in the unmanned aerial area are battery powered. The battery life determines the system running time. However, the battery capacity is limited. To ensure the reliability and long time running of real-time embedded system, the research is working on ways to reduce energy consumption, which can reduce system energy demands and improve the reliability and stability of energy supply [4][5][6].
With the ongoing focus on the energy consumption of real-time embedded systems, how to minimize the energy consumption under the premise of guaranteeing system schedulability has been gaining increased attention in recent years [7,8]. At present, the energy optimized technology for embedded systems is at different levels, including the circuit level, system level, storage level, and compile level [9]. At the system level, there are two primary energy-efficient approaches to address the energy consumption optimization: dynamic voltage and frequency scaling (DVFS) [10][11][12] and dynamic power management (DPM) [13,14]. These approaches are mainly the combination of task scheduling, DVFS, and DPM. According to the execution time, deadline, and period of the task, the processor frequency is dynamically adjusted under the premise of ensuring the schedulability of the task. The system energy consumption can be reduced through decreasing the processor frequency. However, this is at the cost of increasing the task response time. Therefore, the energy optimization for real-time systems is the trade-off between energy consumption and the task response time. The real-time systems have high reliability and hard real-time demands. Most of the above energy optimized technologies adjust the voltage and frequency of hardware resources. However, for some high-reliability real-time embedded systems, such as lunar rovers, the primary design objective is to meet the time constraint. The lunar cycle consists of 27 Earth days including the lunar day (about 13 Earth days) the lunar night (about 14 Earth days) [15]. During the lunar day, the moon is illuminated by the Sun. The lunar rover is powered by solar panels, and it has abundant energy to perform scientific exploration missions for 14 Earth days. However, during lunar night, the lunar rover enters the hibernation state [16]. The lunar rover is powered by a battery with limited capacity to keep the core systems warm enough and for processing scientific data. DVFS can save much energy by lowering the processor speed, which results in extending the task execution time. The lunar rover has hard real-time demands for scientific data processing. The voltage regulation technology will cause certain reliability problems that lead to scientific task failure. Therefore, the above energy-saving technology is difficult to adapt to the demands of high-reliability real-time systems.
For task scheduling technology, context switching is an important factor affecting the system energy consumption. With the limitation of the energy consumption of real-time embedded systems becoming stricter, it has been difficult to ignore the context switches' overhead. The preemption threshold scheduling is an effective way to improve processor utilization and reduce context switches. However, its worst-case response time (WCRT) model ignores the context switches [17], thereby affecting the accuracy of WCRT. This would delay the execution of tasks and miss the deadline, thus making the system unable to be scheduled. Furthermore, the preemption threshold scheduling is running under a simulation environment, and it does not have adequate physical experiments to analyze the effect of context switches' overhead. In addition, the scheduling for different types of tasks may cause a disruption and affect system reliability. Due to the above reasons, we present a group-based energy-efficient dual priority scheduling (GEDP) based on preemption thresholds. The contributions of this paper are as follows.
1. The GEDP scheduling algorithm is presented for isolating different types of tasks to avoid disruption and decreasing energy consumption through reducing context switches in a real-time embedded system. 2. The WCRT model is improved based on considering context switches' overhead, and the improved WCRT model can enhance the accuracy of WCRT. 3. To verify the effectiveness of the GEDP, the context switches' statistics methods and the tasks' energy consumption analysis methods are discussed. Furthermore, a physical experiment is set up on the Linux 2.6.32.5 kernel, which is modified to support GEDP, and four benchmarks are taken as testing applications.
The rest of the paper is organized as follows. The related works are summarized in Section 2. Section 3 presents the GEDP scheduling for real-time embedded systems, and the GEDP algorithm is presented based on grouping rules. Section 4 discusses the schedulability of GEDP based on WCRT analysis and the threshold priority assignment method. The physical experiments are included and discussed in Section 5. Finally, the main conclusions and future work are highlighted in Section 6.

Related Work
System-level energy consumption is divided into dynamic energy consumption and static energy consumption [18]. Since DVFS can reduce the dynamic energy consumption of the processor effectively, a large number of voltage regulation scheduling techniques are used to solve the energy consumption problems of the embedded systems. Although DVFS is an effective method to save energy, it will prolong the task execution time. For high-reliability embedded systems, the real-time performance of the task is critical to the system security. Prolonging the execution time may increase the chance of the task missing the deadline. This will increase the probability of transient errors, thus affecting the system reliability [19,20]. Static energy consumption is caused by leakage current. When the processor frequency decreases, the threshold voltage of the CMOS circuit also becomes smaller, which leads to an increase in subthreshold leakage current [21]. When the CPU production process is 180 nm, the static energy consumption caused by the leakage current is negligible. When the CPU production process is 130 nm, the static energy consumption accounts for 10% to 30% of the system energy consumption. When the CPU production process is 70 nm, static energy consumption accounts for 50% of system energy consumption. When the CPU production process is less than 70 nm, the static energy consumption is comparable to dynamic energy consumption. Furthermore, the DVFS method reduces the dynamic energy consumption by decreasing the processor frequency, which leads to an increase in the tasks' execution time and also increases the static energy consumption. Therefore, with the rapid development of the chip production process, the energy consumption of leakage current increase, and the space of using DVFS to reduce system energy consumption becomes smaller.
At present, many studies ignore the context switches' energy overhead. Actually, the context switch is an important factor affecting the system energy consumption in multitasking systems. Every time a process is done on the CPU, a context switch occurs, which adds overhead to the process execution time [22]. Each context switch needs to save the current process state and restore another process state. The context switches may add up to a significant delay, and thus affect schedulability. The total time overhead of context switches would result in significant energy overhead. Many studies attribute context switches to scheduling, but context switches and scheduling are different. The processor has two operation modes in embedded systems: kernel mode and user mode. Ouni and Belleudy [23] pointed out that the scheduler switches from user mode to kernel mode through system calls. This mechanism is called the mode switch. Unlike the mode switch, the context switch refers to the process of a processor switching from one process to another, including direct overhead and indirect overhead. Direct overhead is caused by the operations that the processor must perform for process switching. Indirect overhead is the virtual address translation of process switching, which will disturb the translation lookaside buffer (TLB) [24]. At the same time, they pointed out three basic services of embedded systems: scheduling, context switch, and inter-process communication.
Energy measurement experiments were carried out on an OMAP35x evaluation module (EVM) board, and the measurement of context switch time overhead and energy consumption was given. This method is mainly used to measure the average energy consumption of context switches. Based on the ARM platform, David and Carlyle [25] measured the direct and indirect overhead of the context switch on the Linux operating system. Acquaviva and Benini et al. [26] proposed a method to characterize the system energy consumption. They measured the energy consumption of the real-time system based on the prototype of the wearable device and then discussed the system energy consumption at the kernel level and the I/O driver level. Finally, the energy consumption and performance of service and context switches were analyzed. Previous studies have shown that the indirect overhead is much larger than the direct overhead. These methods focus on the characterization of the energy measurement of context switches and do not take into account the impact of scheduling policies on the energy consumption of context switches.
In view of the impact of context switches' energy overhead, some algorithms to reduce context switches have been proposed. Behera and Mohanty [27] proposed a dynamic quantum with re-adjusted round robin algorithm to reduce context switches. Raveendran and Prasad et al. [28] proposed the variant algorithms of Rate Monotonic (RM) and Earliest Deadline First (EDF); Wang and Saksena [17] proposed a fixed priority scheduling algorithm based on a preemption threshold. Preemptive threshold scheduling can improve system utilization under the premise of maintaining system schedulability and can reduce context switches by preemptive scheduling. Then, the threshold allocation algorithm was improved in [29]; the time complexity was reduced from O(n!) to O(n2). Experiments showed that the preemption threshold scheduling could improve the processor utilization by 15-20% compared with the preemptive scheduling. However, these algorithms are usually assumed to ignore the context switches' overhead and verify the effectiveness through the simulation experiment. They do not support their proposed method through physical experiments, ignoring the complexity environment of the real-time system, and the simulation results need to be verified by physical experiments.

Scheduling Model
The scheduling model is based on the threshold preemption. A real-time embedded system is specified using a set of independent periodic tasks, P = {τ 1 , τ 2 , τ 3 , · · · , τ n }. Each task is characterized by a three-tuple where C i is the worst-case execution time, T i is the task period, and D i is the deadline. Each task will be given a normal priority π i ∈ [1, · · · , n] and a threshold priority The normal priorities and threshold priorities are determined offline before running and remain constant during the running. We assumed that lower values indicate higher priorities. When implementing the scheduling, each task is mapped to a process. We assumed ψ(i) is a mapping of task τ i . This mapping process is offline and maintained constant during running. A scheduling implementation can be defined as a three-tuple I = (Π, Γ, Ψ) for given system P = {τ 1 , τ 2 , τ 3 , · · · , τ n }, where: is a normal priority assignment for the tasks.
is a threshold priority assignment for the tasks.
is a mapping of tasks into processes.
If the worst-case response time under an implementation I is no more than the deadline, the implementation I for a system P is feasible. The feasibility is defined as follows. Then, a system P is said to be schedulable if there is a feasible implementation for it.
In this model, the normal priorities and threshold priorities of tasks are fixed. When task τ i is released, it competes for the CPU at its normal priority. After task τ i has started execution, it can be preempted by task τ j if and only if π j < γ i . In other words, when the task τ i gets the CPU, its normal priority is raised up to its threshold priority, and it maintains priority until it finishes the execution. Preemptive and non-preemptive scheduling is a special case of preemption threshold scheduling. If the threshold priority of each task is equal to the highest priority, it is a non-preemptive scheduling. If the threshold priority of each task is equal to its normal priority, it is a preemptive scheduling. Therefore, preemption threshold scheduling has the advantage of preemptive and non-preemptive scheduling.

GEDP Algorithm
For grouping tasks, tasks are sorted from the highest priority to the lowest priority. In order to avoid interference between system-critical tasks and other tasks, tasks are divided into system tasks and application tasks. The task priority range is [0, high]. System tasks provide system services for the operating system, such as clock interrupts, schedulers, and drivers. The priorities of system tasks are in the range of [0, low). Application tasks refer to the applications that provide specific functions. The priorities of application tasks are in the range of [low, high]. This article uses the task flag T f lag to distinguish system tasks from application tasks. If T f lag = 0, it indicates that the task is a system task. If T f lag = 1, it indicates that the task is an application task. The system tasks are divided into one group and use the default scheduling policy. According to the definition based on L i -level application tasks, the application tasks are divided into several groups. The definition of the L i -level application task is given below. Definition 1. The task priority subset L i ⊆ [low, high], L i cannot overlap. If the priority of task τ i satisfies condition π i ∈ L i , the task τ i is a L i -level application task.
The grouping rules of GEDP are presented as follows: (1) Grouping rule of system tasks: If the priority of task τ i satisfies conditions π i ∈ [0, low) and T f lag = 0, then the task is a system task. Add task τ i into the system task group, denoted as G 0 . (2) Grouping rule of application tasks: If the priority of the task τ i satisfies conditions π i ∈ L i and T f lag = 1, then the task τ i is an application task. Add task τ i into the application task group, denoted as G i .
According to the grouping rules, all system tasks are grouped into one group. The number of system task groups is one. The priority range of application tasks is [low, high]. In extreme cases, if L i = [low, high], all application tasks are divided into one group. That means the application tasks can be divided into one group at least. If the application tasks corresponding to each priority level in [low, high] are divided into a group, the application tasks can be divided into a maximum of high − low + 1 groups. The tasks' group number of the entire system is equal to the sum of the system tasks' group and the application tasks. Therefore, the total system group is between [2, high − low + 2].
Suppose there are n real-time tasks in the operating system, such as τ 1 , τ 1 , · · · , τ n . They are divided into two task groups G 0 and G 1 , where tasks τ 1 , τ 2 , · · · , τ k belong to the system task group G 0 and tasks τ k+1 , τ k+2 , · · · , τ n belong to the application task group G 1 . For the system task group G 0 , fixed-priority preemption scheduling is used, and the normal priority is equal to the threshold priority. For the application task group G 1 , the preemption threshold scheduling is taken.
Based on the above method, the GEDP algorithm designed in this paper is shown in Algorithm 1.

WCRT Analysis
The schedulability is determined by the WCRT of each instance of tasks. This paper analyzed the WCRT based on considering the voluntary context switches and the involuntary context switches. The response time of a task typically consists of three parts: (1) The execution time of the task: The time overhead of voluntary context switches should be considered. Every time the task gives up the CPU, a voluntary context switch occurs; (2) Interference from other higher priority tasks: In this case, the time overhead of involuntary context switches should be considered. Each time a task is preempted, the preemption task will be switched first and then switches back to the current task. In this case, context switches occur twice. (3) Blocking from lower priority tasks caused by the threshold priority: If the lower priority task is running, the objective task cannot be preempted due to higher threshold priority, and this will result in blocking time.
The upper bound of blocking time for task τ i is shown as Equation (1), where B(τ i ) is the blocking time from lower priority tasks and C j is the execution time of blocking tasks.
The busy period of task τ i begins from the critical time. All instances of higher priority tasks arrive simultaneously, and the task contributed maximum blocking time is executed before the critical time. In addition, in order to get the WCRT, all the tasks come at their maximum rate. The Level-I busy period W ( τ i ) can be computed by Equation (2), and C nv is the maximum time overhead of involuntary context switches.
All higher priority task instances that come before the start time and any earlier instances of tasks should be finished before the start time of the qth instance of τ i . Therefore, the start time S i (q) of the qth instance of τ i can be computed iteratively using Equation (3), and C v is the maximum time overhead of voluntary context switch.
During the execution of task τ i , only the task that has higher priority than γ i can obtain the processor before the task τ i finishes. The worst-case finish time F i (q) can be computed using Equation (4).
The WCRT of task τ i is equal to the max response time of all instances in the busy period interval. The WCRT can be calculated by Equation (5).
In order to analyze the effect of the improved WCRT model, we take the time overhead of context switching as 100 ms. We give a set of tasks including four tasks, as shown in Table 1, where W i is the worst-case response time of preemption threshold scheduling. IW i is the improved worst-case response time based on the considering context switches. The task set can be scheduled in W i , but cannot be scheduled in IW i . Because the IW i takes into account the overheads of context switches, the WCRT would be increased, leading the missed deadline of τ 1 and τ 3 . Therefore, the improved WCRT model can enhance the accuracy due to considering context switches' time overhead.

Threshold Priority Assignment
The threshold priority assignment algorithm based on the preemption threshold [17] is shown as Algorithm 2. First, initialize the attributes of the tasks, such as C i , D i , and T i . Second, sort the tasks from low to high priority according to the normal priority using the quick sort algorithm. Third, calculate the threshold for each task. The threshold priority is initialized to normal priority, and then, calculate the WCRT under the current threshold. If the WCRT exceeds the deadline, increase the threshold priority. If the threshold priority is higher than the highest priority, the task set cannot be scheduled. Otherwise, the WCRT is recalculated cyclically.

Algorithm 2:
Threshold priority assignment. 1 Initialize task properties; 2 Use the quick sort algorithm to sort tasks from low to high priority; 3 for i ← 0 to taskNum do 4 γ i = π i ; /* Initial thresholds' priorities */ // Calculate WCRT at the current threshold

Schedulability Analysis Tool
In order to provide a simple way to compute WCRT and threshold priority, we developed an open-source tool called the schedulability analysis tool (SAT) based on Debian 6.0 under the QT integrated development environment. The source code for SAT is available on GitHub at https: //github.com/geyongqi/SAT. In the current version, the main functions of SAT are WCRT analysis, threshold calculation, and task running statistics. The following introduces the interface, functions, and operation demonstration of SAT briefly. The main GUI is shown in Figure 1. SAT includes eight functional modules as shown in red numbers in Figure 1. Module 1 is the menu bar, which can mainly calculate the WCRT and analyze the schedulability. Module 2 is the toolbar corresponding to the menu bar. Module 3 is the task attribute input box. Module 4 is a task list box that displays the task attributes added to the tool. Module 5 is a threshold calculating the switch and determines whether the thresholds need to be calculated or not. Module 6 is a threshold priorities display box, which displays the threshold priorities of each task. Module 7 is a task running statistics display box, which displays the task context switches' time overhead and other information. It captures the statistics of a specific task at runtime, including the task ID, the total number of context switches, the number of voluntary and involuntary context switches, etc. Module 8 is the task running information, showing whether the task is running or not. It can capture the task runtime and resource occupation information, including task ID, parent task ID, task name, normal priority, memory usage, and current running status. The following is the operation demonstration of SAT.
Step 1: Enter the attributes of the task; Step 2: Click the "Add Task =>" button to add the task to the task list. If all tasks have been added, continue to Step 3; otherwise, repeat Step 1 to continue adding tasks; Step 3: If you are doing a non-threshold experiment, go to Step 4 directly. If you are doing a threshold experiment, check the "Open Threshold" check-box and click the "Comp Threshold =>" button to calculate the threshold priorities; Step 4: If the threshold calculation fails, click the "Clear" button to clear all the information and return to the first step to restart the operation; otherwise, click the "RUN" button to run all tasks; Step 5: Enter the task name, and click the "START" button to capture the statistical information when the task is running; Step 6: Click the "START" button to capture the tasks running information in the system. Repeat Step 5 and Step 6 to get the running information of the tasks at different times.

Experiment Setup
The time overhead and energy overhead of context switches is mainly related to the saving and restoring registers, cleaning the CPU pipeline and cache disruption. It is not directly related to other system peripherals. We modified the Linux 2.6.32.5 kernel to support threshold priority and took it as the runtime environment for real-time tasks. The context switches statistics function was implemented in the user space of Linux through netlink sockets. Time acquisition functions were inserted before and after context switches to calculate the time overhead. Four benchmarks were designed as four tasks running in the user space [30], including Linpack_bench, Memory_test, Whetstone, and Mxm. The attributes of the benchmarks are list in Table 2. The energy measurement was based on the Chroma 66200 Digital Power Meter, which was connected to the testing host (Dell Vostro 3450 installed Debian 6.0). According to WCRT analysis, we needed to get the maximum time overhead per context switch for each benchmark to compute the threshold priorities. The context switches' time overhead was closely related to the internal environment of the operating system. Different tasks had different context switch time overhead. Even if the same task was switched at different frequencies, the context switch time overhead may be different. Therefore, we designed the experiment to run four benchmarks according to the attributes in Table 2

Experiment 1: The Number of Context Switches Analysis
In this experiment, due to the influence of the physical experiment environment, the number of context switches in each experiment was different. In order to analyze the trend of the number of context switches comprehensively, we performed ten experiments, and the experimental data are shown in Table 3. Table 3. The ten experiments' data. FPP, fixed-priority tasks with preemption scheduling; GEDP, group-based energy-efficient dual priority scheduling.

Times
Linpack_bench Memory_test  Whetstone  Mxm   FPP  GEDP  FPP  GEDP  FPP  GEDP  FPP  GEDP   T1  798  803  592  582  580  569  1496  1509  T2  802  793  594  579  576  561  1511  1504  T3  807  801  587  576  567  566  1532  1501  T4  797  797  600  578  565  576  1531  1522  T5  804  806  594  588  559  565  1539  1509  T6  801  822  576  573  569  527  1518  1524  T7  814  803  585  576  561  521  1533  1539  T8  812  804  592  579  587  570  1592  1545  T9  802  804  582  580  575  570  1538  1530  T10  796  800  592  586  571  528  1522  1527 Take the experimental data T2 as an example: we compared the voluntary and involuntary context switches under fixed-priority tasks with preemption scheduling (FPP) and GEDP. The trend of context switches of the four benchmarks is shown in  Table 2, since the threshold priority was to prevent preemption of high-priority tasks, the GEDP mainly affected the involuntary context switches and did not affect voluntary context switches. The normal priority and threshold priority of Linpack_bench were the same, and the involuntary context switches should be unchanged. Memory_test had a normal priority of 70 and a threshold priority of 53 to prevent Linpack_bench and Whetstone from preempting. Therefore, under GEDP, the number of involuntary context switches of Memory_test should be reduced. Whetstone had a normal priority of 62 and a threshold priority of 45, which could prevent Mxm from preempting. Therefore, under GEDP, the number of involuntary context switches of Whetstone should be reduced. The normal priority of Mxm was consistent with the threshold priority, and the number of context switches should not change.      As discussed above, the number of context switches for each benchmark was related to its normal priority and threshold priority. Normal priority affects voluntary context switches, and threshold priority affects involuntary context switches. Even if each benchmark kept its own normal priority and threshold priority in multiple experiments, the number of context switches would be different. Combining the experimental results with the above theoretical analysis, the experimental results were basically consistent with the theoretical analysis.
In order to quantify the gains of GEDP relative to FPP on context switching, we defined four analysis indicators. R c is the context switch reduction rate of a task in one experiment, shown as Equation (6); R v is the average context switch reduction rate of a task in multiple experiments, shown as Equation (7); R t is the total context switch reduction rate for all tasks in one experiment, shown as Equation (8); R vt is the average context switch reduction rate for all tasks in multiple experiments, shown as Equation (9).
C FPP (τ i ) is the number of context switches for the task τ i under FPP in one experiment. C GEDP (τ i ) is the number of context switches for task τ i under GEDP in one experiment. T FPP (i) is the number of context switches for all tasks under FPP in the ith experiment. T GEDP (i) is the number of context switches for all tasks under GEDP in the ith experiment, and n is the number of experiments. The R c of Memory_test was between 0.3% and 2.5%. The R v of Memory_test was about 1.3%. These findings showed that the context switches of Memory_test were reduced significantly. The R c of Whetstone was between −1.1% and 7.5%. The R v of Whetstone was about 2.9%. The results indicated that the context switches of Whetstone were significantly reduced. The R c and R v of Linpack_bench and Mxm were relatively small, and the changes were not obvious. From the overall analysis of the four benchmarks, R t was between 0.1% and 2.1%. The average reduction rate of the ten experiments was approximately 0.9%. Based on the above analysis, it can be seen that the number of context switches of Memory_test and Whetstone was significantly reduced due to the threshold priority.

Experiment 2: System Energy Consumption Analysis
In this experiment, we studied the effect of GEDP compared with FPP on energy consumption. Experiments were performed on GEDP and FPP, respectively. Each experiment lasted 10 hours, and the energy consumption was sampled per 1000 seconds. The energy consumption and context switches under GEDP and FPP are shown in Table 4. For FPP, the energy consumption in 10 hours was about 964,448.50 J, and the number of context switches was 38,771. For GEDP, the energy consumption was about 958,537.53 J, and the number of context switches was 38,386. The experiment results showed that: (1) Compared with FPP, the GEDP reduced energy consumption by 5910.98 J and reduced context switches 385 times. The energy consumption and the number of context switching under the GEDP were significantly reduced compared to FPP. This showed that GEDP was efficient to reduce context switches to optimize the system energy consumption. (2) The savings of energy consumption tended to increase as the number of context switches decreased. This was because the GEDP reduced more context switches, thus producing cumulative effects on saving energy. (3) For given benchmarks, the experiment results showed that GEDP provided gains (0.6% energy consumption and 1% context switches) over the previous scheduling FPP. It proved that reducing the number of context switches could decrease system energy consumption. However, affected by the physical experiment environment and different task attributes, different benchmarks may have different gains. We plan to study the relationship between benchmarks and gains in future work. (4) According to the results for total system energy consumption and context switches in Table 4, we could calculate that the average energy overhead of a context switch was about 15 J. The context switches' energy overhead was related to memory accesses in saving/restoring the task context, as well as due to the additional cache misses resulting from a context switch. The context switch energy overhead was not constant.
results demonstrated that the GEDP scheduling ensured efficiencies to decrease the system energy consumption by reducing context switches for real-time embedded systems in this work. In this paper, the gains included two aspects: the number of context switches and system energy consumption. In terms of the number of context switches, the number of context switches for each benchmark was related to its normal priority and threshold priority. Normal priority affects voluntary context switches and threshold priority affects involuntary context switches. Even if each benchmark kept its own ordinary priority and threshold priority in multiple experiments, the number of context switches would be different. In terms of the system energy consumption, the system energy consumption was directly affected by the number of context switches. The more context switches the scheduling saved, the more the energy decreased. In addition, affected by the physical experiment environment and different task attributes, different benchmarks had different gains. Therefore, further research is still needed to develop more benchmarks to study the correlation between the gains.
The WCRT computation will waste a large number of resources. Because the WCRT in this article was calculated offline, it did not affect the task execution. In general, the real execution time of the task was much shorter than the WCRT, which meant the WCRT was not accurate enough. We will continue to study the highly efficient WCRT computing method or explore other methods. In addition, the GEDP can be extended to other scheduling algorithms and compared with other proactive and reactive real-time scheduling. The SAT tool can be improved to support more scheduling algorithms and benchmarks. Furthermore, possible future work would be generalizing this scheduling to be applicable to other kinds of systems.