# Reducing Dynamic Power Consumption in Mixed-Critical Real-Time Systems
## 5 The Proposed Scheme  
### Dynamic Power Aware Scheme MCS Jobs  
The proposed scheme dynamically adjusts the CPU frequency level depending on both the system mode and task mode. The baseline frequency levels are derived from static analysis so that \(x,f_{LO}^{LO},f_{LO}^{HI}\) \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Task** & \(P_{t}\) & \(C_{i}(LO)\) & \(C_{i}(HI)\) & \(X_{i}\) & \(VD_{i}=x\cdot P_{i}\) & \(C_{i}(LO)/f_{LO}^{LO}\) & \(C_{i}(HI)/f_{LO}^{HI}\) \\ \hline \(\tau_{1}\) & 6 & 1 & 2 & HI & 3.36 & - & 1.25 \\ \(\tau_{2}\) & 8 & 1 & 3 & HI & 4.48 & - & 1.25 \\ \(\tau_{3}\) & 12 & 1 & 1 & LO & - & 1.67 & - \\ \(\tau_{4}\) & 16 & 2 & 2 & LO & - & 2.33 & - \\ \hline \hline \end{tabular}
\end{table} 
Table 1: An example of tasks. Figure 3: An example of power-aware mixed-criticality Scheduling of Table 1.  
and \(f_{HI}^{HI}\) are obtained before run-time. Throughout the optimization problem, we solve those values in the initial step. The power-consumption with consideration of both high- and low-crticality modes in defined by the following three equations. The unit-time power consumption in low-crticality mode is derived by Equation (6), where \(LCM\) is the least common multiplier of all periods. In Equation (6), the total power consumption during \(LCM\) is computed by adding the power consumption of task \(\tau_{i}\) in low mode using Equation (1). The number of \(\tau_{i}\)'s jobs is \(LCM/P_{i}\). Thus, the unit-time power consumption is obtained by dividing the total sum with \(LCM\). Similarly, the unit-time power consumption in high-criticality mode is defined by Equation (7). Thus, the average unit-time power consumption can be obtained as the expected value in each mode, as in Equation (8), where \(P_{LO}\) and \(P_{HI}\) denote the probabilities of the system mode in low- and high-crticality, respectively. \[UP_{LO} = \frac{1}{LCM}\left(\sum_{\tau_{i}\in T_{LO}}\frac{LCM}{P_{i}} \cdot\frac{C_{i}(LO)}{f_{LO}^{LO}}\cdot(f_{LO}^{LO})^{3}+\sum_{\tau_{i}\in T _{HI}}\frac{LCM}{P_{i}}\cdot\frac{C_{i}(LO)}{f_{LO}^{HI}}\cdot(f_{LO}^{HI})^ {3}\right) \tag{6}\] \[= \sum_{\tau_{i}\in T_{LO}}\frac{C_{i}(LO)}{P_{i}}\cdot(f_{LO}^{ LO})^{2}+\sum_{\tau_{i}\in T_{HI}}\frac{C_{i}(LO)}{P_{i}}\cdot(f_{LO}^{HI})^{2}\] \[= U_{LO}^{LO}\cdot(f_{LO}^{LO})^{2}+U_{LO}^{HI}\cdot(f_{LO}^{HI}) ^{2}\]  
\[UP_{HI} = \frac{1}{LCM}\sum_{\tau_{i}\in T_{HI}}\frac{LCM}{P_{i}}\cdot \frac{C_{i}(HI)}{f_{HI}^{HI}}\cdot(f_{HI}^{HI})^{3} \tag{7}\] \[= \sum_{\tau_{i}\in T_{HI}}\frac{C_{i}(HI)}{P_{i}}\cdot(f_{HI}^{HI} )^{2}\] \[= U_{HI}^{HI}\cdot(f_{HI}^{HI})^{2}\]  
\[UAP = UP_{LO}\cdot P_{LO}+UP_{HI}\cdot P_{HI} \tag{8}\] Figure 3:0  
For the given probabilities of \(P_{LO}\) and \(P_{HI}\), the problem of deciding the optimal frequency levels and \(x\) of EDF-VD is: to minimize  
Figure 3:1  
subject to  
Figure 3:2  
Figure 3:3  
The scheduling system flow in low mode is shown in Figure 3(a). Each task releases jobs with \(C_{i}(LO)\) execution time every period. Since we use EDF-VD, the virtual deadline of a high-criticality job released at time \(t\) is given by \(t+VD_{i}\). The deadline of low-criticality job is set as \(t+p_{i}\). These new jobs are waiting in the ready queue. The scheduling algorithm for jobs is based on early deadline first so that the job with the earliest deadline is scheduled first. At the time of dispatching a high-criticality job, the CPU frequency level is set as \(f_{LO}^{HI}\). On the contrary, the frequency level is adjusted with \(f_{LO}^{LO}\) for low-criticality job execution. When a high-criticality job does not complete its low-mode execution time, then the system switches to high-criticality mode. At that time, all low-criticality jobs are dropped in order to guarantee high-criticality tasks as shown in Figure 3(b). However, the system can switch back to low-mode at any time when there is no pending task.