# Minimizing Energy and Computation in Long-Running Software
## 4 A Program with a Single Long Loop
This emphasizes the importance of setting \(n\) to be close or at \(n^{o}\), when there is a need for minimizing the execution time of the program. The examples of Figures 1-4 show that a significant reduction in the execution time of a software application can be achieved by the ALCR mechanism, if the checkpoint interval is selected to be at, or close to, the optimum \(n^{o}\). In these examples, the Gain ranges from 64% to 80%. However, suboptimal values of the checkpoint interval will lead to a smaller Gain or even to an average execution time, which is larger than when ALCR is not used. Indeed, the checkpoint interval should not be selected arbitrarily and must be tuned to a value at, or close to, the optimum \(n^{o}\). Still, there is a relationship between calculations for \(n^{o}\) and \(n^{+}\). However, we must have in mind that the optimum checkpoint interval will be different regarding energy consumption and execution time. Figure 5 shows how they correspond to each other. More specifically, Figure 5a shows how execution time changes when we want to use optimal checkpoint interval calculated for energy consumption. Similarly, Figure 5b shows how energy consumption changes when we want to use the checkpoint interval that optimizes execution time. The numerical example presented in Figure 5 shows that the checkpoint interval that minimizes the energy consumption does not necessarily minimize the execution time as well and vice versa. In particular, in the given example, setting the value of \(n\) to \(n^{o}\) will minimize the expected execution time of the software program, but will lead to around half the maximum achievable energy savings. Similarly, setting the value of \(n\) to \(n^{+}\) will minimize the expected energy consumption of the software program, but will lead to lower than the maximum achievable savings in execution time. Hence, the type of the application  
Figure 1: The case of a small software program (i.e., \(Y=10^{4}\)): (a) Expected execution time comparison (logarithmic axes) (b) Expected execution time gain. should be also taken into account in order to decide, whether to prioritize the execution time or the energy consumption of a given program. It should be noted that the model is highly configurable, which means that the user can define the relative importance of the quality attributes of execution time and energy consumption for a given software program, by properly setting the \(\alpha\) and \(\beta\) parameters of the model (see Section 3). This enables the calculation of the checkpoint interval that strikes a desired balance between these two quality attributes. Figure 3: The case of a large software program (i.e., \(Y=10^{6}\)): (**a**) Expected execution time comparison (logarithmic axes) (**b**) Expected execution time gain. Figure 2: The case of a software program of medium size (i.e., \(Y=10^{5}\)): (**a**) Expected execution time comparison (logarithmic axes) (**b**) Expected execution time gain. Impact of \(g\) and \(B\) on the Optimum Checkpoint Interval  
The optimum checkpoint interval \(n^{o}\) is expected to be influenced both by the probability of failure \(g=1-a\), and by the cost of checkpointing \(B^{c}=B^{c}_{0}\). In Figure 6, the optimum checkpoint interval \(n^{o}\) is plotted against the probability of failure \(g\), for three different cases of checkpointing cost \(B^{c}\). Four different examples are provided, corresponding to a sample software program of small, medium, large, and very large size. In fact, the same cases of programs that were investigated in Section 4 were considered in this section. From the different graphs in Figures 6 and 7, we notice that the same behavior is observed regarding the impact that the values of \(B^{c}\) and \(g\) have on the optimum checkpoint interval, regardless of program size. Indeed for a given checkpointing cost \(B^{c}\), the higher the probability of failure \(g\), the lower the optimum checkpoint interval \(n^{o}\).