A Trusted Real-Time Scheduling Model for Wireless Sensor Networks

Heterogeneousmulticore andmultiprocessor systems have beenwidely used for wireless sensor information processing, but system energy consumption has become an increasingly important issue. To ensure the reliable and safe operation of sensor systems, the task scheduling success rate of heterogeneous platforms should be improved, and energy consumption should be reduced.Thiswork establishes a trusted task scheduling model for wireless sensor networks, proposes an energy consumption model, and adopts the ant colony algorithm and bee colony algorithm for the task scheduling of a real-time sensor node. Experimental result shows that the genetic algorithm and ant colony algorithm can efficiently solve the energy consumption problem in the trusted task scheduling of a wireless sensor and that the performance of the bee colony algorithm is slightly inferior to that of the first two methods.


Introduction
Energy consumption has become a major problem in wireless sensor networks.Sensor nodes are often equipped with small batteries [1].Therefore, the reduction of energy consumption to prolong the lifetime of networks is a widespread concern.Wireless sensor networks perform mainly real-time tasks.We thus need to focus on reducing energy consumption under the premise of meeting specified task deadlines.
The real-time task scheduling of wireless sensor networks involves forming a mapping relationship between the realtime task scheduling and the processors within the acceptable time scope of the system.The real-time tasks are then assigned to the processors according to the mapping relationship.In this way, the tasks can be executed within the deadline.The mapping relationship should effectively meet time and resource constraints.
In the process of establishing time scheduling models, the operating environment of the real-time calculation must be considered because calculation resources consist of different heterogeneous hosts, workstations, and even PCs that are distributed in different locations.These resources can be run in a variety of operating systems, such as UNIX, Linux, and Windows, and the storage media may be large storage devices, databases, or other devices.Therefore, a scheduling model and energy consumption model must be built specifically for heterogeneous platforms.
Heterogeneity is mainly reflected in the following aspects.(1) Computer hardware heterogeneity: a server processor that executes calculation operations may be heterogeneous.It may cause considerable differences in energy consumption when processing the same tasks in unit time.(2) Operating system heterogeneity: the heterogeneous components of an operating system are assigned to a particular machine, the sequence of tasks to be executed may be disrupted, and the execution time could either increase or decrease.(3) Heterogeneity of communication network: the topological structure of a network may resemble items such as a bus, ring, and tree, and the communication medium may be a cable, optical fiber, microwave, and so on.Such variance results in different transmission rates and different transmission time periods.Heterogeneity degree can be used to evaluate the degree of difference among heterogeneous computing systems.A large heterogeneity degree is associated with obvious system heterogeneity.Hence, heterogeneity degree can serve as an important reference and basis for selecting task scheduling strategies.
Research results [2] indicate that the execution power and response time of different computers vary in the implementation of different computing tasks.For example, when 2 Journal of Sensors a CPU and GPU execute the same image processing task, their execution power and response time, as well as their total energy consumption for completing the task, will vary.Therefore, as a result of different energy consumption factors, a given task may be completed at different periods and with different levels of energy consumption when different scheduling methods and supply voltages are used.Under such circumstances, the energy consumption problem should be considered when carrying out parallel task scheduling in a real-time computing environment.
Several studies have established energy consumption models on the basis of resource utilization rates.Li and John [3] proposed a hardware counter-based linear model to estimate the energy consumption of an operating system.Topcuoglu et al. [4] proposed a simple linear regression model based on CPU utilization rate and hard disk utilization, proved that the model is accurate, and used the model to reduce the energy consumption of the server cluster.By establishing an inquiry table for system power and resource utilization rate, the authors [4] established an energy consumption model for a server system and proposed several methods for applying the model to different systems of the same series.Currently, energy consumption optimization management technologies based on distributed parallel computing systems are divided into three categories: off/sleep technology, dynamic voltage scaling (DVS) technology, and virtualization technology.The off/sleep technology is mainly used to reduce idle energy consumption.The other two technologies are mainly used to reduce the execution power consumption.Execution power consumption is defined as the power consumption generated by the operation of computer hardware driven by commands and data when using a computer to complete a task.The power consumption of the operated hardware in this case is referred to as execution power.In the execution of the same task, the execution power may constantly change under different implementation phases and given different task characteristics [5].
In 2010, Wang et al. [6] proposed a scheduling algorithm for energy consumption perception and a method for calculating idle time.The proposed scheduling algorithm considers the method for reducing voltage in the communication process.In 2009, Khan and Ahmad [7] studied task allocation for energy consumption perception and assigned tasks to a computing grid with DVS features.The goal of such task assignment is to reduce energy consumption and response time [8].In China, Zhu et al. [9] considered the situation in which copying a scheduling algorithm can reduce the waiting time and time delay but increase energy consumption and subsequently proposed a heuristic processor reduction optimizing method.Kwok and Ahmad [10] studied network energy consumption models and algorithm networks from a global perspective, established a systematic optimization model of network energy consumption, proposed a building network system for optimizing energy consumption models, and proposed a network packet routing algorithm for optimizing energy consumption.Lee and Zomaya [11] established the HCS model according to DVS technology and developed the ECS algorithm, which is an innovation of the energy consumption model with good usability [12,13].
The privacy-preserving techniques for WSNs are classified into two for protecting two types of private information: data-oriented and context-oriented privacy [14].KIPDA [15] is a data-oriented privacy-preserving aggregation method, which can hide a wide range of aggregation functions.Ozdemir et al. present a polynomial regression based data aggregation protocol that preserves the privacy of sensor data [16].
The rest of the paper is organized as follows.Section 2 introduces the system model and formulates the problem of real-time task scheduling in a heterogeneous wireless sensor network.Section 3 introduces the genetic algorithm and ant colony algorithm, which are adopted to obtain the shortest scheduling length and lowest energy consumption.Section 4 presents a new bee colony algorithm.Section 5 provides an analysis of the performance and results of the proposed algorithms.Section 6 concludes the paper with a summary and details of future research directions.

Real-Time Task DAG Model.
A real-time parallel task model can be abstracted as a DAG diagram DAG = (, , , ), in which  = { 1 ,  2 , . . .,   } represents the collection of tasks;  indicates the number of tasks;  = {  |   ,   ∈ } ⊆ × denotes the collection of directed edges that describe the dependency relationship between tasks;  = { 1 ,  2 , . . .,   } is the computational quantity collection of tasks, with   ∈  representing the number of clock ticks of task   in the processor; and  is the communication between tasks {  }, with   ∈  representing the duration of communication between the two ends of   .
The earliest starting time of each task in the parallel task map is defined as Est( entry ) = 0, Est(  ) = max   ∈pred(  ) {Est(  ) + Met(  ) + Act  }, where  entry represents the entry subtask without a precursor node, Met(  ) represents the minimum execution time of task   , and Act  represents the communication time between task   and task   .The earliest completion time of each task Eft(  ) is defined as Eft(  ) = Est(  ) + Met(  ).Lft(  ) is the latest completion time of task   , Lft( exit ) = , and Lft(  ) = min   ∈Succ(  ) {Lft(  ) − Met(  ) − Act  }, where  exit denotes the exit subtask without a successor node.The deadline of each task is Lft(  ), which is the latest completion time of task   .
In Figure 1,   in the inner circle represents the serial number of the task node, the digit adjacent to the circle represents the computation amount of the task node, and the digit on the arrow line represents the amount of communication between the two tasks.After processing, the DAG diagram of the parallel task is assumed to have only one entry node and one exit node.

Scheduling Model.
A scheduling model is represented by a scheduling matrix  × .In  × , each element  , represents the corresponding relation between task   and processor   , and  , can only be set to 0 or 1, with  , = 1 indicating that task   is assigned to processor   and with  , = 0 indicating that task   is not assigned to processor   .

Constraint Model.
The effect matrix of the task scheduling problem in a heterogeneous processor is  × .The element  , of  × is defined as  , =  , /  , which represents the consumed computing ability of   when performing   .The value of  , is a real number within the scope of (0, 1) ∪ +∞.If   cannot be operated in   , then  , can be set to +∞.
According to the definition of the effect matrix  × , the constraints [17] of task scheduling in the heterogeneous processor are given.The constraints are as follows: In (a), each task is fully allocated to the processor.In (b), the total calculation amount of the tasks assigned to each processor is not greater than the maximum allowable amount of calculation.In (c), the task is either assigned or not assigned to a processor.
Each specific element value of the scheduling matrix is 0 or 1.Under the restriction of the constraint model, the size of each task is 10 5 × 10 scheduling matrixes  5×10 , as shown in Table 1.
In the scheduling matrix of  5×10 ,  , = 1 indicates that task   is assigned to processor   .To apply the matrix to the swarm intelligence algorithm, the compressed scheduling matrix is {2, 4, 0, 3, 1, 0, 3, 2, 1, 3}, the compressed scheduling matrix in the programming application becomes an index, and the task serial number is mapped on the corresponding processor according to the order of the compressed scheduling matrix.

Energy Consumption Model.
With the development of processor hardware technology, the CMOS integrated circuit has become the digital circuit of widely used processors.The power consumption of the CMOS integrated circuit mainly consists of dynamic power consumption and internal shortcircuit power consumption.As the internal short-circuit power consumption of an ordinary processor is less than 10% of the dynamic power consumption, the internal short-circuit power consumption of a processor is not considered when utilizing a DVS technology-based processor as a research platform to study the scheduling problem and reduce energy consumption.The dynamic power consumption equation [11] of the processor that adopts DVS technology is where  is the circuit flip frequency,  is the load capacitance,  is the supply power voltage, and  is the clock rate.In digital circuits, voltage  and clock rate  are positively correlated; the formula indicates that supply power voltage is a determining factor of power consumption [11].As for a given processor,  ⋅  is generally considered a constant, and different supply voltages correspond to different levels of power consumption.When the supply voltage of a computing resource is reduced, the calculating speed and power of the computing resource decrease accordingly.
In the present study, the execution time of a single task is  , =   /  , and the scheduling length (makespan) in a single processor is where  is the number of tasks assigned to processor   ,  , represents the execution time assigned to processor   , and  ,next is the communication time between the current task and the next task.Thus, the total scheduling length of a task graph is The total execution power consumption of the scheduling system can be expressed with the following formula: where   is the corresponding computation amount of each task and  is the symbol indicating that task   is assigned to processor   .Scheduling success rate is the number of successful scheduling tasks completed within the deadline divided by the total number of tasks.This index is used to evaluate the performance of the real-time task scheduling.

Ant Colony Scheduling Algorithm
The ant colony algorithm is based on the foraging behavior of ants, especially their means of finding the shortest paths between food sources and their nest.While moving food to their nest, ants leave a pheromone trail on the ground.Ants can smell pheromones.When choosing the path to search for food, they tend to choose the path with the highest concentration of pheromones.Pheromones have a positive feedback effect.When a path is taken by an increasing number of ants, the corresponding pheromone concentration increases.This condition entices the other ants to take such path.Ants follow this pheromone trail to find the shortest path between the food source and their nest.
On the basis of this observation, Dorigo et al. first presented ant colony algorithms to resolve difficult combinatorial optimization problems.The present work applies this algorithm to the energy consumption optimization problem.
In the actual simulation and application process, the algorithm design should consider the definition of ants, pheromone trail representation, design of pheromone deposition and volatilization, and relevant design of pheromone and path selection.
Each ant is defined according to the definition in the compressed scheduling matrix and effect matrix, and each scheduling matrix represents a walking path of ants.However, because pheromones are gradually released, the compressed scheduling matrix cannot be randomly generated and should instead be constantly selected and allocated by ants.According to the effectiveness of the path, the status of ants can be divided into three categories: partial solution, feasible solution, and infeasible solution.
Several methods can be used to represent a pheromone trail.In the present work, the pheromone trail is represented by the support rate (, ), which indicates the support rate of task   assigned to processor   in the ant colony.In the scheduling matrix, the ants move from the upper left corner to the lower right corner;  , = 1 indicates that the ants pass through the path.The movement of the ants follows the constraints.

Design of Ant Pheromone Deposition and Volatilization
Rate.The design of a scheduling algorithm should comply with three objectives, the methods for which should be exactly the same as those used for the calculation of the genetic algorithm but are referred to as optimal solutions in separate representations.First, the maximum information concentration of the ant colony algorithm is defined as where  best is the optimal solution of the current calculation,  is the volatilization rate of the pheromones, and () is the corresponding evaluation function of each solution, the definition of which corresponds to the three objectives of this research.
The minimum information concentration is defined as where  is a constant that is greater than or equal to 1 and  is the number of iterations of the ant colony algorithm (starting from 1).After the assignment of task   to processor   , the pheromone trail is updated according to the relationship between (  ,   ) and  best .The updating formula is If (, ) >  max , then (, ) =  max ; if (, ) <  min , then (, ) =  min to maintain the information concentration within a certain range.

Ant Colony Algorithm Design.
The purpose of programming a specific ant colony algorithm is to find feasible solutions for the three objectives of this work and to output corresponding targets to find the optimal path for ants.The ant colony algorithm can be terminated under two conditions: (1) a feasible solution is found and (2) the algorithm execution reaches the maximum number of iterations.
The specific process flowchart for designing the ant colony algorithm is shown in Figure 2.

Bee Colony Scheduling Algorithm
The bee colony algorithm is an emerging swarm intelligence algorithm that has been widely used in recent years.It explores the optimal value according to the role assignment and comprises conversion and information exchange methods that bee colonies adopt to search for food.The application methods of the bee colony algorithm and ant colony algorithm are almost the same.However, the bee colony algorithm adopts its own unique calculation formula to find the adaptation value and selection probability of food sources.The following section of this paper introduces the role of ants in the bee colony algorithm according to the implementation process of the bee colony algorithm.
The algorithmic frameworks of the bee colony algorithm include the initial period, employed bee period, and scout bee period.In the last two periods of a cycle, employed   bees become onlooker bees according to the food sources found until they find the optimal solution or the maximum number of cycles.In the bee colony algorithm, the bees are divided into three categories: employed bees, onlooker bees, and scout bees.Employed bees are related to a particular food source, onlooker bees observe the dance information of employed bees to select the food source, and scout bees randomly search for food.In the initial stage, the scout bees find all the food sources.Then, the employed bees and onlooker bees make use of the food sources.The employed bees that deplete the food sources become scout bees.
In the scheduling matrix, when a bee is a scout bee, it randomly searches the path from left to right of the matrix and selects one point in each column until  , = 1, which indicates that the task has been assigned.The scout bee then becomes an employed bee.When a bee is transformed into an onlooker bee, it selects employed bees to follow its

Fitness Value and Selection Probability of the Bee Colony
Algorithm.The value of the objective function determines the method for calculating the fitness value of the employed bee period.The definition of the bee colony algorithm takes the positive and negative values of the objective function.However, the values of the objective function proposed in this work are positive.Thus, the fitness function is calculated as where  is a bee and () is the target path value of the bee.
In the scout bee period, employed bees are chosen to follow the path.The selection probability   of each employed bee is calculated as where SN is the number of employed bees.

Bee Colony Algorithm Design. The bee colony algorithm program has two termination conditions:
(1) a feasible solution is found and (2) the maximum cycle index is reached.
During the cycle, onlooker bees choose to follow employed bees according to the selection probability value, which is calculated according to the path of the employed bees.The flowchart is shown in Figure 3.

Experiment Test Program Design.
As for the three algorithms implemented in the heterogeneous platform, the unity of scheduling tasks and the differences in the parameter setting of each algorithm should be considered, and each algorithm should select the optimal parameters to achieve the best performance.The optimal state of each algorithm should then be used to compare the scheduling efficiencies of different algorithms.
The configuration of the experiment platform used in this work is as follows: (1) operating system: Windows 7 Ultimate, (2) CPU: Intel® Core TM i3 2.27 GHz, (3) memory: 2.00 GB.
The three tests of the algorithm on the heterogeneous platform are mainly performance tests.Small-scale tasks are adopted in each performance test, and the main reference indicators are the algorithm's scheduling success rate, scheduling length, and energy consumption.Each test is repeated 10 times.The test results are the average values of each test.
The parameters of the three algorithms on the heterogeneous platform are shown in Table 2 (genetic algorithm), Table 3 (ant colony algorithm), and Table 4 (bee colony algorithm), separately.

Experiment Results.
The genetic algorithm is taken as a standard to compare the performance of the ant colony algorithm and bee colony algorithm.The test results are shown in Table 5, in which the values are the average values of 10 experiments.
As shown in the table, the ant colony algorithm is superior to the genetic algorithm in terms of achieving the three objectives.As for the bee colony algorithm, the scheduling results indicate its potential use for the combinatorial optimization of task scheduling; however, this algorithm needs to be improved further, or the program needs to be optimized to obtain convincing results.The results shown in the table cannot verify the advantages and disadvantages of the bee colony algorithm in task scheduling.

Conclusion
This work takes a real-time parallel task based on the DAG model as a scheduling object, adds the energy consumption model for a heterogeneous platform, pursues the goal of reducing energy consumption, and designs the ant colony algorithm and bee colony algorithm for a heterogeneous platform.Through a series of experiments, this work verifies the combinatorial optimization ability of the genetic algorithm in optimizing task scheduling and proves that the ant colony algorithm is superior to the genetic algorithm in terms of combinatorial optimization.The bee (a) ∑  =1  , = 1, ( = 1, 2, 3, . . ., ); (b) ∑  =1  , *  , ≤ , ( = 1, 2, 3, . . ., ),  = 1, is the maximum computing amount allowed by each processor; (c)  , is set as 0 or 1 ( = 1, 2, 3, . . ., ;  = 1, 2, 3, . . ., ).
best ant If the ant is improved Call pheromone deposition If the path is a solution or the counter reaches the maximum iteration number Do pheromone evaporation function, counter++

Figure 2 :
Figure 2: Flowchart for designing the ant colony algorithm.
Initialize the effect matrix, the food source, the objective function matrix, and the fitness value Save the best food source and the corresponding parametersRelease employed beeCompute the objective function value and fitness value and selection probabilitiesCheese onlooker bees to follow employed bees according to the selection probability value, counter++If food source becomes better or the counter reaches the maximum iteration number Return the optimal solution

Figure 3 :
Figure 3: Flowchart of the bee colony algorithm program.
Model.The processor is represented by the symbol .We assume that each processor  only executes one command within one clock tick and that different processors have different operating speeds.A processor has two properties, namely, processing frequency and corresponding voltage.Let  , denote the clock rate of task   in processor   , Figure 1: Example of DAG task map.and let  , denote the execution time of task   in processor   .Then,  , =   / , , in which   represents the calculation amount of the corresponding   .The platform (heterogeneous multiprocessor platform, HMP) comprising  heterogeneous processors is expressed as HMP = { 1 ,  2 , . . .,   };  processors have different clock rate-voltage pairs.

Table 2 :
Experimental parameters of the genetic algorithm.

Table 3 :
Experimental parameters of the ant colony algorithm.