1 Introduction

Heterogeneous multiprocessor platforms have been constantly adapted to the varying computational requirements of different kinds of tasks. Such platforms, which are suitable for different applications [1,2,3], improve system performances and satisfy increasing energy consumption. Nevertheless, allocating real-time tasks to multiprocessors has been proven to be an NP-hard problem.

In real-time systems, a multiprocessor platform can duplicate a task and execute copies on different processors. This process is called task duplication, which requires increased computing power. Task duplication has been utilized in many applications, such as quadruplicate redundancy computers in spaceships [4], which are widely regarded as the safest and strictest real-time systems. The computing system of spaceships consists of five identical computers that are responsible for strict flight missions. For strict time tasks that require an answer in 1 s, four computers serve as redundancy computers that use the same input data and implement the same code. They send the results to the aviation electronics subsystem, followed by a voting on the results.

This real-time task scheduling system differs from others in the following aspects: (1) task scheduling is accomplished in a heterogeneous multiprocessor platform; (2) each task has several copies to account for error tolerance and accuracy. In a real-time task scheduling system, system processing and control accuracy is determined not by task allocation alone (i.e., task execution accuracy or logical validity) but also by the high efficiency of the computation and processing results. A real-time task always comes with a deadline, and every task must be accomplished and verified within that deadline. In practical situations, a real-time task also requires quick task allocation and scheduling as well as quick responses to maintain high system efficiency. Therefore, efficiency is vital to task scheduling, and long-time scheduling cannot be tolerated in practical applications.

Real-time task allocation under a heterogeneous environment is an NP-hard problem. Many approximation algorithms have been used to solve this problem, including traditional real-time task scheduling algorithms, such as rate monotonic (RM), deadline monotonic (DM), least laxity first (LLF) and earliest deadline first (EDF), as well as swarm intelligence algorithms, such as genetic algorithm (GA), memetic algorithms (MAs), particle swarm optimization (PSO), ant colony optimization (ACO) and shuffled frog leaping algorithm (SFLA) [5].

Liu and Layland [6] proved the optimality of rate-monotonic scheduling algorithm, which is efficient and easy to implement, in static scheduling. In the worst case, however, the utilization of processors only reaches 88% in this algorithm. Yujia Ge and Guiyi Wei [7] described and evaluated a genetic algorithm-based technique for task-level scheduling in cloud computing systems. Compared with first-in-first-out (FIFO) and delay scheduling, they found that GA algorithms have a higher performance. However, they assumed that one task exclusive of one processor until the task is completed. They did not take resource utilization into consideration. Other algorithms above either do not find all the feasible solutions or do not meet our needs.

Baruah et al. [8] analyzed the independent task scheduling performances of 11 heuristic algorithms under a heterogeneous computing environment with the goal of minimizing scheduling time. They proposed a polynomial time complexity algorithm that can find feasible task allocation plans under certain conditions. They assumed that the completion time of every task in a fixed process is known. Their findings revealed that GA is superior over the other 10 algorithms.

Baruah et al. [9] converted a task scheduling problem on a multiprocessor platform into an integer-linear-programming (ILP) problem and proposed an approximate polynomial time algorithm. However, a linear-programming (LP) problem has many feasible solutions, and the polynomial time algorithm cannot guarantee that the elementary solution can be found. Similarly, Chuprat et al. [10] converted a task scheduling problem on a multiprocessor platform with assignable and precedent tasks into a LP problem. However, they considered that each task can be divided randomly. Such a hypothesis has limitations in practical applications.

Gopalakrishnan et al. [11] proposed a polynomial time scheduling algorithm on a multiprocessor platform with preemptive and transmissible tasks to solve the task scheduling problem on heterogeneous processor platforms under the constraints of a series of real-time tasks. However, they ignored the communication expenses and the feasibility of task division.

Efficiency and stability [12] are two important aspects of real-time task scheduling algorithms with task duplication error tolerance [13, 14]. This paper develops an independent real-time task scheduling system under a heterogeneous multiprocessor platform with duplication. This system uses a linear programming algorithm and a dynamic programming algorithm to solve task scheduling problems. The optimum algorithm under different conditions, i.e., that with higher efficiency and stability, is determined through a comparative analysis. This project can be used as the core component of any real-time task scheduling system that requires duplication error tolerance to accomplish periodic task scheduling and accelerate system response while maintaining system stability.

Our paper makes three main contributions:

  1. 1.

    This paper analyzed the characteristics of real-time tasks, the task classification in task scheduling problem and the periodic real-time task scheduling process.

  2. 2.

    According to the two characteristics of the problem, i.e., the periodic real-time task with duplication and heterogeneous platform, this paper designed linear and dynamic programming algorithms to simulate the task scheduling process.

  3. 3.

    We tested the algorithms with multiple sets of real-time task data and analyzed the result of each algorithm.

The remainder of this paper is organized as follows. Section 2 describes the real-time task scheduling system model. Section 3 introduces the linear and dynamic programming algorithms employed in this study. Section 4 describes the experimental tests and the results of the analysis of these algorithms. Section 5 presents the drawn conclusions and future prospects.

2 System model

2.1 Task set model

Tasks are generally independent periodic tasks with duplication. In this paper, a periodic task set is expressed by \(\{T=T_{1} ,T_{2}, T_{3}, \ldots , T_{n} \}\). When a task \(T_{i}\) is allocated to a processor \(P_{j}\), it takes \(e_{i,j}\) for execution. All tasks will be executed periodically in every processor (\(p_{i}\) is number of \(T_{i}\) periods).

This paper discusses tasks with duplication [15]; that is, every task has one common attribute K, which is the number of tasks and their copies. In this study, K refers to the number of task copies. For example, \(K=2\) indicates that this periodic task has two copies. Task \(T_{i}\) has \(T_{i}^{[1]}\) and \(T_{i}^{[2]}\) copies. In other words, for any given K, the \(i^{th }\)periodic task in the task set has K copies: \(T_{i}^{[1]}, T_{i}^{[2]}, {\ldots }, T_{i}^{[k]}\). At the same time, any two copies of these K copies cannot be executed on the same processor.

Task categories are represented by the task heterogeneity, which is an integer. For instance, task \(\hbox {heterogeneity}=m\) indicates that there are m kinds of tasks, and consequently, one processor will have m processing time means of tasks.

2.2 Processor set model

A heterogeneous processor set is expressed by \(P=\{P_{1} , P_{2}, P_{3}, \ldots , P_{m}\}\), which represents that the system has m heterogeneous processors to execute real-time tasks. Processor categories are denoted by the processor heterogeneity.

2.3 Resource utilization matrix

The operation of every task will occupy a certain amount of processor resources. Different heterogeneous processors have different processing resources. Therefore, the resource utilization of different heterogeneous processors by different heterogeneous tasks should be calculated. Processor resources occupied by tasks are defined as utilization (u). The specific value of u is determined by both the task and the processor. More specifically, we define \(i(i\le m)\) as the index of processor and \(j(j\le n)\) as the index of task. If task \(T_{i}\) is assigned to processor \(P_{j}, u\) of \(P_{j}\) by \(T_{i}\) is \(e_{i,j}/ p_{i}=u_{i,j.}u_{i,j}\) values between 0 and 1. This reflects that \(T_{i,j}\) occupies \(u_{i, j}\) resources of processor \(P_{j}\). If task \(T_{i}\) cannot be executed on processor \(P_{j}, u_{i, j}=\infty \). This defines the task matrix under any heterogeneous multiprocessor platform explicitly. The resource utilization matrix (U) when there are n tasks and m processors is shown in Table 1.

Table 1 Processor utilization matrix (U)

This matrix can be generated automatically as long as the number of processors, number of tasks, processor heterogeneity and task heterogeneity are set. A task matrix under a real situation (U) can be input manually for simulation. Moreover, the system can also provide the optimum scheduling plan according to this task matrix.

2.4 Scheduling of heterogeneous real-time task with copies

In a real-time task scheduling system consisting of m processors and n tasks, an indicator variable \(x_{i,j}^{[k]} (x_{i,j}^{[k]} \in \{0,1\})\) is introduced into the resource utilization matrix U. K is defined as the index of copies of each task. U reflects whether the \(k{\mathrm{th}}\) copy of task \(T_{i}\) is executed on processor \(P_{j}\); 0 means no and 1 means yes. According to definition of the indicator variable, we can obtain \(K^{n\times m}\) indicator variable matrices. The \(k{\mathrm{th}}\) indicator variable matrix is displayed in Table 2.

Table 2 \(k{\mathrm{th}}\) indicator variable matrix

According to the definition of the indicator variable \(x_{i,j}^{[k]}\), any two copies of a task cannot be assigned to the same processor. Therefore,

$$\begin{aligned} \forall i,\forall j:\sum \nolimits _{k=1}^{K} {x_{i,j}^{\left[ k\right] }} \le 1 \end{aligned}$$
(1)

To describe the objective function of the integer programming problem, \(U_{j} (T)\) is defined as the total u of the jth processor under the current scheduling plan, i.e., the sum of u of all tasks assigned on \(P_{j}\). In other words, \(U_{j} (T)\) is the resource utilization of the jth processor after task allocation is performed. As a result, the objective function is

$$\begin{aligned} U_{j} (T)=\sum \nolimits _{i=1}^{N} {\sum \nolimits _{k=1}^{K} {x_{i,j}^{\left[ k \right] } u_{i,j}}} \end{aligned}$$
(2)

If a feasible solution exists under the current heterogeneous multiprocessor environment, the u of any processor must be smaller than 1.

$$\begin{aligned} U_{j} (T)\le 1,\forall j \end{aligned}$$
(3)

Thus, in this integer programming problem, the objective function of the problem can be defined as

$$\begin{aligned} U=\max \{U_{1} (T),U_{2} (T),\ldots ,U_{M} (T)\} \end{aligned}$$
(4)

In other words, the processor with the highest u can be calculated according to the current scheduling plan.

Such an integer programming problem aims to minimize U, i.e., to minimize the maximum u of all processors.

This integer programming problem is described in Table 3.

Table 3 Integer programming problem

The real-time task scheduling problem has one feasible solution when \(U \leqq 1\) but may not have feasible solutions when \(U>1\). A total of \(K^{n\times m}\) indicator variable matrices can be gained by solving such an integer programming problem. The real-time task scheduling system only has to allocate tasks according to these indicator variable matrices.

3 Linear programming algorithm and dynamic programming algorithm

Task scheduling [16,17,18,19] is still a difficult problem for integer programming and has been proven to be an NP-Hard problem that cannot be solved within polynomial time. For a small-scale task scheduling problem, the optimum solution within the acceptable time range can be gained by using CPLEX [20] (IBM ILOG CPLEX Optimization Studio), an optimization software package). However, a task scheduling problem with increasing scale brings about RAM problems and excessive computing time. A common solution is converting the task scheduling problem into a linear programming problem to achieve a better performance and obtain a solving algorithm of polynomial time or exponential time in a worst case scenario. Another solution is to use dynamic programming algorithm, with which the optimal solution can be obtained. However the dynamic programming algorithm need more time before convergence. The authors also present shuffled frog leaping and particle swarm optimization algorithms to solve energy-aware real-time tasks scheduling problem on heterogeneous platforms or wireless sensor networks [21,22,23].

3.1 Linear programming algorithm

Linear programming is a special case of mathematical programming, which is a branch of operations research. It is a mathematical theory to solve the extreme value problems of objective functions under linear constraint conditions. A simple but typical linear programming problem usually likes this: Find the maximal value of \(z=x+y\) subject to the following constraints: \(x\ge 0, y\ge 0, x\le 2\) and \(y\le 2\). After painting the graph in Fig. 1, we can easily find out the maximal value of z is 4, where \(x=2\) and \(y=2\):

Fig. 1
figure 1

Solution to a simple linear programming problem

The scheduling problem is an optimization problem essentially, aiming at finding the highest resource utilization under some restrictions, which including CPU types, number of tasks and number of their copies. It is similar to the form of linear programming problem. By making some simple modification, we can convert scheduling problems into linear programming problems and solving them through mature linear programming algorithms.

To convert the task scheduling problem into a linear programming problem, the constraint (C1) in the integer programming problem should be relaxed. \(x_{i,j}^{[k]} \) can be relaxed to \(x_{i,j}^{[k]} \ge 0\) from the limited integer to convert the problem into a linear programming problem. The description of this linear programming problem is provided in Table 4.

Table 4 Linear programming problem

However, given the unique expression of the objective function, classical linear programming algorithms, such as simplex method, interior point method and ellipsoid method, cannot construct the objective function that describes the problem. For example, in the most classical simplex method, the objective function must conform to Eq. (5):

$$\begin{aligned} U=A_{1} x_{1} +A_{2} x_{2} +\cdots +A_{n} x_{n} \end{aligned}$$
(5)

For this reason, this linear programming algorithm should be improved to a certain extent, such that it can solve the task scheduling problem.

With respect to U in the linear programming algorithm, to ensure problem accuracy, constraint (C4) is modified into Eq. (6) before the objective function is corrected:

$$\begin{aligned} \sum \nolimits _{i=1}^{N} {\sum \nolimits _{k=1}^{K} {x_{i,j}^{\left[ k \right] } u_{i,j}}} \le A,\quad \forall j,A\le 1 \end{aligned}$$
(6)

This reflects that the u of \(P_{j}\) is smaller than or equal to 1, thus ensuring the existence of a feasible solution.

Thus, the objective function can be corrected into the minimizing Eq. (7):

$$\begin{aligned} {U}'=\sum \nolimits _{i=1}^N {\sum \nolimits _{j=1}^M {\sum \nolimits _{k=1}^K {x_{i,j}^{\left[ k \right] } u_{i,j}}}} \end{aligned}$$
(7)

Minimizing \({U}'\) suggests that the overall resource utilization must be reduced as much as possible. Obviously, this still cannot ensure that the task allocation will be optimum. Therefore, iterations are necessary. The objective function decreases after every iteration by updating one constraint in the problem continuously. After certain iterations or if the objective function remains same in subsequent iterations, the current task scheduling plan can be considered the approximately optimum one.

In the first iteration, set \(A=1\). Suppose \(A=A'\) in the \(\lambda {\hbox {th}}\) iteration. The linear programming problem is described in Table 5.

Table 5 Linear programming problem

The core idea of this algorithm is to decrease A after every iteration, thus enhancing the C4 constraint continuously and making the linear programming solution approach the optimum one. The new objective function only provides an optimization direction: to minimize the global resource utilization as much as possible. However, the ultimate goal is to decrease the real objective function. To prevent excessive iterations, the algorithm can the number of maximum iterations (R).

The flowchart of this iterative linear programming algorithm is shown in Fig. 2.

Fig. 2
figure 2

Flowchart of iterative linear programming algorithm

In this algorithm, the objective function \({U}'\) can be calculated by other linear programming algorithms, such as interior point method. This paper discussed the simplex method only.

If the linear programming problem has an optimum solution, it must be achieved on the peaks of the feasible region. However, testing these peaks is time- and labor-consuming. Given that the peaks of the feasible region correspond to basic feasible solutions, the optimum solution can be acquired from basic feasible solutions.

Fig. 3
figure 3

Flowchart of dynamic programming algorithm

The numerical calculation contains three steps:

  1. 1.

    Determine whether the current basic feasible solution is the optimum one.

  2. 2.

    If it is not, swap-in and swap-out the basic and non-basic variables to form a new basic feasible solution.

  3. 3.

    If the objective function remains the same or increases significantly, the minimum value is the optimum solution.

The simple description of the simplex algorithm reveals that the optimum solution of the linear programming problem can be obtained through the countable swap-in and swap-out of basic and non-basic variables.

3.2 Dynamic programming algorithm

Dynamic programming is a feasible way [24] for real-time task scheduling under a heterogeneous multiprocessor platform with task duplication.

For convenience, the dynamic programming algorithm is described by pseudocode.

  1. 1.

    Enumerate all of the feasible states of the \(i{\mathrm{th}}\) processor. For \(1\sim n\) tasks, if the task can be executed on the ith processor, it is not allocated completely. If the current state is not full, update the array dp.

  2. 2.

    Processor number \(i+1\). If \(i>m\), exit; otherwise, return to Step (1).

The algorithm flowchart is shown in Fig. 3.

In this algorithm, when all the tasks and their copies have been allocated, the current state will be full. And a state that is legal must meet the constraints described in the integer programming problem. dp is a two-dimensional array. dp[i][s] denotes the minimum of U when the state is s after n tasks have been allocated by \((i-1)\)th processor.

4 Experiment

To simulate all possible situations in a practical problem, an experimental dataset containing eight combinations were used : C_HT_HP, C_HT_LP, C_LT_HP, C_LT_LP, IC_HT_HP, IC_HT_LP, IC_LT_HP and IC_LT_LP. C indicates that the task is consistent; i.e., the task has strict execution time. When the execution time of task i on any CPU is shorter than that of task j, its execution time on all CPUs is shorter than that of task j; otherwise, that task is IC. C is used in the form of the several conditional inequalities. T refers to task heterogeneity. The parameter N appeared below has the same meaning of T. LT denotes the lower limit of T, which is set to 5, whereas HT denotes the higher limit of T, which is set to 100. P represents processor heterogeneity. The parameter M has the same meaning with P. LP and HP denote the lower and higher limits of P, which are set to 5 and 20, respectively.

Table 6 Parameters of the linear programming algorithm

For every situation, 15 testing samples were generated for experiments based on the dataset generation program. Therefore, each algorithm has 120 testing samples in every experiment. The data of each situation are operated for 10 times.

4.1 Test results of the linear programming algorithm

  1. (1)

    Parameter setting

    Parameter setting of the linear programming algorithm is displayed in Table 6.

    Situations of \(N=10, 12, 14, M=6\) and \(K=2\) or 3 were tested. Every group of data were tested for 10 times to calculate the mean run time.

  2. (2)

    Testing environment

    • Testing environmental parameters are:

    • Operating system: windows 8 64 bit

    • Compiler: VC ++7.0

    • CPU: Intel i3-330 M

    • RAM: 4G

  3. (3)

    Test results

    Test results of linear programming algorithm when K = 3 are shown in Table 7.

When \(K=3\), the run time of the linear programming algorithm increases slowly as the task scale increases. It operates quickly and performs well for task scale data ranging from 10 to 14 (Fig. 4).

Table 7 Test results of linear programming algorithm when \(K=3\)
Fig. 4
figure 4

Run time comparison of the linear programming algorithm when \(K=3\)

4.2 Test results of dynamic programming algorithm

Table 8 Parameters of dynamic programming algorithm
  1. (1)

    Parameter setting

    Parameter setting of the dynamic programming algorithm is displayed in Table 8.

    Situations of \(N=6, 8, 10, M=6\) and \(K=2\) or 3 were tested.

  2. (2)

    Testing environment

    • Testing environmental parameters are:

    • Operating system: windows 8 64bit

    • Compiler: VC ++7.0

    • CPU: Intel i3-330 M

    • RAM: 4G

  3. (3)

    Test results

    Test results of dynamic programming algorithm when \(K=2\) are shown in Table 9.

Table 9 Test results of dynamic programming algorithm when \(K=2\)

Test results of dynamic programming algorithm when \(K=3\) are shown in Table 10.

Table 10 Test results of dynamic programming algorithm when \(K=3\)

4.3 Test result analysis

The linear and dynamic programming algorithms can be compared through the Tables 7 and 10. The time complexity of the dynamic programming algorithm is \(O((k+1)^{n})\). By increasing k or n a bit, the algorithm presents a sharp increase. The dynamic programming algorithms cost much more time to get the optimal solution while the linear programming algorithms only need several milliseconds to get a near-optimal solution.

Figrue 4 illustrates the results of the linear programming algorithm. The results show that with the growth of N (Number of tasks), the cost of the algorithm increases. The performance of the linear programming algorithms is pretty good.

Figures 5 and 6 are drawn according to their mean task execution time obtained in the dynamic programming algorithm tests with four groups of testing data models.

When \(K=2\), the mean run time of algorithms increases sharply as N increases from 6 to 8 and then to 10 (Fig. 5).

Fig. 5
figure 5

Run time variation of algorithms when \(K=2\)

Similarly, the run time of algorithms also increases very quickly as N increases from 6 to 8 and then to 10 (Fig. 6).

Fig. 6
figure 6

Run time variation of algorithms when \(K=3\)

The effect of K on the time consumption of algorithms under same N is analyzed based on DP_LT_LP algorithm (Fig. 7).

Fig. 7
figure 7

Time consumption of DP_LT_LP algorithm under different K

An increase of N or K causes a significant increase in the time consumption of dynamic programming algorithms under all scenarios. Compared with linear programming algorithms, dynamic programming algorithms cost much more time in a scenario with relatively small N.

The different combinations of the experimental dataset also have different results. From Figs. 4, 5 and 6, we know that a task with lower task heterogeneity and processor heterogeneity has a better performance.

5 Conclusions

This paper analyzes the expandability of two periodic real-time task scheduling algorithms, namely dynamic programming algorithm and linear programming algorithm, with particular focus on their operating efficiency and stability. The findings reveal that the linear programming algorithm is superior to the dynamic programming algorithm in terms of expandability. With an increase in task scale and copy amount, the run time of the linear programming algorithm increases linearly, whereas that of the dynamic programming algorithm presents a sharp increase, which is related to the exponential change of state scale. In future work, we will run the experiments on real heterogeneous platforms.