Research Article | Open Access

# An Efficient Multitask Scheduling Model for Wireless Sensor Networks

**Academic Editor:**X. Song

#### Abstract

The sensor nodes of multitask wireless network are constrained in performance-driven computation. Theoretical studies on the data processing model of wireless sensor nodes suggest satisfying the requirements of high qualities of service (QoS) of multiple application networks, thus improving the efficiency of network. In this paper, we present the priority based data processing model for multitask sensor nodes in the architecture of multitask wireless sensor network. The proposed model is deduced with the M/M/1 queuing model based on the queuing theory where the average delay of data packets passing by sensor nodes is estimated. The model is validated with the real data from the Huoerxinhe Coal Mine. By applying the proposed priority based data processing model in the multitask wireless sensor network, the average delay of data packets in a sensor nodes is reduced nearly to 50%. The simulation results show that the proposed model can improve the throughput of network efficiently.

#### 1. Introduction

Wireless sensor network (WSN) is a basic network for accessing the data information in the sensor layer of the Internet of Things (IOS). WSN is widely applied in various areas [1]. For instance, in military, the troop and equipment can be identified and services can be coordinated to fight with the assistance of WSN. In the aspect of biomedical, human health can be monitored by the surgical sensors implanted in body, which is a typical application of WSN. Moreover, in earthquake prediction, ad hoc deployment of seismic sensors along the volcanic area can detect the development of earthquakes and eruptions [2]. WSN integrates the technologies of information sensing, data processing and transmission, which is a multitask system. Numerous data services are operating on the multitask system, such as the wireless monitoring and information management systems for coalmine safety production. The types of the service data provided by WSN are classified as automatic control command, safety monitoring data, audio and video data, and so on [3]. Usually, the coverage range of wireless sensor network is not very large. Thus, the transmission delay of electromagnetic wave may be neglected. As the sensor nodes are constrained in computation, storage, and energy, it is difficult to meet the requirement of good quality of service (QoS) for more tasks running in a network. Moreover, due to the unreliable wireless channel interfered by noise, QoS of the wireless transmission is often depressed, which is especially significant in multitask wireless network. And therefore, in order to improve the performance of multitask wireless sensor network, it is very important to carry out research on the high-efficient multitask scheduling model for wireless sensor network.

TinyOS is an operating system, which is widely used in wireless sensor networks. The operating system adopts First Come First Served (FCFS) scheduling strategy for task scheduling, which is efficient to reduce the requirements of storing space [4, 5]. However, as there are no the priorities among various kinds of service data, some real-time services cannot be timely responded, so that many services are missed, which results in the low throughput of network [6]. For the drawback of TinyOS in the scheduling strategy, the researchers have done many researches for improving the scheduling strategy. The contribution [7] introduced a dual circular-based task scheduling strategy. In this strategy, the single circular queue is substituted with the dual circular queues with different priorities. The tasks are assigned different priorities and then are allocated in the two circular queues according to their priorities. The tasks in different queues are dynamically switched according to their time variations for guaranteeing them to be responded as much as possible. The strategy improves the speed of response to real-time tasks, but the throughput of network is still low. In contribution [8, 9], a priority based soft real-time task scheduling strategy was proposed, which increases the throughput of network but does not satisfy the real-time requirement of some high-priority tasks. For solving the existing problem in [8, 9], the contribution [10] introduced an improving scheduling strategy, EF-RM (emergency task first rate monotonic), which is the preemptive scheduling for both periodical and nonperiodical tasks to ensure the implementation of the important task of priority in TinyOS. The contribution [11] proposed the IS-EDF (idle sleep-earliest deadline first) scheduling strategy, which adjusts the priority of tasks dynamically to ensure that the important task is real-time processed.

In this paper, through further research on the relevant contributions mentioned above, we propose the priority queue-based data processing model for multitask network and deduce the theoretical formulas of the QoS of network with the proposed model, including average queue length, delay, and delay jitter. The performance of the proposed models is analyzed and compared by the practical simulation experiments.

The rest of this paper is organized as follows: The architecture of multitask wireless sensor network is presented in Section 2. Then, the queue theory is introduced in Section 3 first. Subsequently, in Sections 4 and 5, two queue models are described, respectively. The experimental results are shown in Section 6. Finally, we conclude this paper in Section 7.

#### 2. Architecture of Multitask Wireless Sensor Network

In the wireless sensor network, a large number of wireless sensor nodes are densely and fully deployed in the network. These wireless sensor nodes are organized into many clusters. Each cluster is composed of a cluster head and multiple sensor nodes. The internal sensor nodes can communicate with each other in the cluster. The external communications between clusters are fulfilled by the cluster heads in these clusters. Moreover, the cluster head is responsible for assigning the time slot for each sensor nodes in its cluster. The data collected from each wireless sensor nodes are first gathered in the cluster heads and then transmitted to a database in the server by the sink nodes through the wired Ethernet. All applications in the network share the data in the database for different functions. The architecture of multitask wireless sensor network is shown in Figure 1.

#### 3. Concept of Queuing Theory

Queuing theory is a mathematical method for analyzing the congestion and delays of data packets in a link. With queuing theory, the arrival, service, and depart of data packets can be accurately evaluated so that the data packets can be efficiently scheduled in a link. For describing the proposed model based on the queuing theory easily, we give the following definitions.

*Definition 1 (inputting distribution ). *In the inputting process, let be the th data packet arriving at the network node and the arrival time is ; then, , which means the time interval between and . Assume that and the arriving data packets are independent; then, is the sequence of independent random variables, written as .

*Definition 2 (serving distribution ). *In the service process, let the service time of data packet be . Assume that the services of data packets are independent; then, is the dependent sequence of random variables, written as .

*Definition 3 (arrival probability of data packet ). *Let be the number of data packets in a network node at time and let be the arrival probability of data packets in time interval ; then, there is the relation

*Definition 4 (arrival rate of data packet ). *An average number of data packets arrive at a network node in unit time, which reflects how fast the data packets arrive at a network node. is just the average arrival time interval of data packets.

*Definition 5 (service rate of network node ). *An average number of served data packets depart from a network node in unit time, which reflects how fast the services are in the network node. is just the average time of the data packets severed in a network node.

*Definition 6 (service intensity ). *The average service time of each network node in unit time, which is an important indicator for measuring how busy the network nodes, is , .

In the real situation of wireless sensor network, the data packets arrive at sensor nodes continuously. Thus, the number of data packets is regarded as infinite. For simplicity, the arrival times of data packets are assumed to follow M/M/1 queue model. The input process of data packets, that is, the arrival times, is similar to the Poisson stream with parameter . The arriving time interval and service time follow the negative exponential distribution with parameters and , respectively, where the service window size is 1. Based on the reasonable assumptions and the definitions on queue theory mentioned above, two queue system models, nonpriority and priority models, are analyzed and compared as follows. And therefore, the high efficient queue model is proposed in this paper.

#### 4. Data Processing Model Based on Nonpriority Queue System

As shown in Figure 2, the data packets enter the network nodes continuously and are lined up in a queue with the average arrival rate . The data packets depart in turn from the queue and data services are scheduled in the scheduler at the average processing rate . The node state at time is denoted as , where is the number of data packets including the processing data packet, that is, the queue length. It is easy to be proved that is birth-death process [12–16].

Let , where . Referring to Figure 3, if , the balance equations are as follows: Because there is and holds, so the average length of data packets in network node is. And the average waiting queue length of data packets in network node is According to the Little theorem, the average waiting time of a data packet is expressed as And the average residence time of a data packet in network node, that is, delay of a data packet, is And the delay jitter of a data packet in network node, that is, variance of delay, is

#### 5. Data Processing Model of Queue with Priority

In this model, the data packets entering the network node are classified into two queues with different priorities at the average rates and by the classifier, as shown in Figure 4. In the scheduler, according to the service rule given by the priority decision module, the services are obtained at the average processing rates and . The priority decision module decides the processing sequence of data packets for the scheduler. It employs the preemptive priority service rule, which allows that the services of low-priority data packets are interrupted and free up resource for serving the high-priority data packets. The data packets with the same priority will be serviced according to the FCFS rule.

The data packet with priority is denoted by C1 and the data packet without priority is denoted by C2. The data packets C1 and C2 arrive at the network node in independent Poisson distribution with the parameters and , respectively, and their service times follow the negative exponential distribution with the parameters and . The system utilization is denoted by , which is the time rate of service busy. That is the proportion of time that the scheduler busies. is the average arrival rate of all data packets and is the average processing rate for all data packets. The relations between these parameters can be expressed as , , , , and .

The state of network node at time is denoted as . If the number of data packets C1 is and the number of data packets C2 is , it is easy to prove that is the birth-death process [12–16]. The state diagram of birth-death process for queuing system with priority is shown in Figure 5.

**(a) state as center**

**(b) State as center**

**(c) State as center**

**(d) State as center**

Let According to the states in Figure 5, if , then the following equations hold: The process of solving the equations (9) can be referred to [12–16], which solves through the inverse solving method with the following generating function : where . The solution of function is solved by the differential generating function ; that is, Let the probabilities of C1 data packets and C2 data packets in network node be and , respectively. Their probabilities of generating functions are and .

By formula (10), let , using the L’Hospital Rule; we can get Thus, , which is the same as the M/M/1 queue system with only one kind of client. As a result, it shows that the existence of C2 data packets has no effect on the C1 data packets, which is in accord with the practical situation of network. Similarly, the average length of C1 data packet queue and the average length of C1 data packet waiting queue can be got as And the average waiting time and average residence time of single C1 data packet are The delay jitter of a C1 data packet in the network node that is the delay variance is as follows: Then, by formula (10), we get Derivate formula (17) by and then let ; the average queue length of C2 data packets can be deduced as Thus, the average residence time of a C2 data packet is

#### 6. Simulation Experiments and Discussion

The proposed multitask schedule model can be used in many network applications. In coalmine, there are many monitoring and information management systems for its safety and production, which are the typical multitask wireless sensor network applications. In this kind of monitoring systems, the usual detecting period is 20 seconds and the number of monitoring nodes is usually more than 200. Thus, the proposed model applied in the gas warning system needs to process the data of thousands of sensor nodes. Moreover, the network delay and processing time need to be considered in practice applications.

In this experiment, we use the practical data from Huoerxinhe Coal Mine, China, which lay the gas warning wireless network with the same system structure as in Figure 1. In this network, the backbone network is optical fiber Ethernet, based on which network is partitioned into many zones. In each zone, a number of wireless sensor nodes are evenly laid out. Various monitoring data, such as gas concentration, CO concentration, CO_{2} concentration, and so on are detected in real time by the sensor nodes. These data will be collected to the Sink node in the zone. Subsequently, all data are transferred to the server by the sink nodes in each zone. The transfer capability of Sink nodes is the bottleneck of the capability of the network system. In the test data set from Huoerxinhe Coal Mine, a Sink node is able to send 200 UDP packets per second, from which 90 UDP packets arrive at the target node. Each UDP packet contains 85 bytes. The parameters , , , , , and in formula (6), (15), and (19) are decided according to the field test.

If the priority processing rule is not employed, that is, the sink node employs the data processing model based on queue system without priority, the packets/s and . According to formula (6), the average delay of each packet is 9.1 ms. If the priority processing rule is employed, that is, the sink node employs the data processing model based on queue system with priority, the data are distinguished with different priorities. Taking the coal monitoring system as an example, the gas concentration and monitoring control command are with higher priority and others are with lower priority.

According to the statistics, the probability of C1 occurrence is 0.10 and the probability of C2 occurrence is 0.90. Meanwhile, packets/s, packets/s, packets/s, and packets/s. Thus, according to formulas (15) and (19), the average delay of C1 packets is 5.2 ms and the average delay of C2 packets is 9.7 ms.

The theoretical analysis shows that compared with the data processing model based on queue system without priority, the average delay of data packets processed with the model based on queue system with priority is reduced up to 43%. However, the average delay of data packets without priority is slightly reduced only 6.6%.

For observing the queue and service process of data packets in network nodes with the proposed model, we use MatLab to simulate the model. The model parameters , , , , , and are set in accordance with the theoretical analysis. The simulation results are shown in Figures 6, 7, 8, and 9, which show the same results with theoretical analysis. In fact, operation practice of multitask wireless sensor network in Huoerxinhe Coal Mine also confirmed our theoretical analysis and simulation experiments.

**(a)**

**(b)**

**(a)**

**(b)**

#### 7. Conclusions

In this paper, two data processing models with and without priority are proposed for multitask wireless sensor networks. The proposed models are established from the M/M/1 queue model. The average delay theory of data packets based on the proposed models is also deduced. The practical data from Huoerxinhe Coal Mine are used for testing the performances of the proposed two models applied in the coal safety monitoring system, which is a typical wireless sensor network application. The simulation results show that the average delay of data packets processed with the proposed model is significantly reduced. Compared with the average delay of data packets without priority, the proposed model can be applied to the multitask wireless sensor network harmonically.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

This work is supported by the National Natural Science Foundation of China 61379100 and 61001108, Bagui scholarship project; the Natural Science Foundation of Guangxi under Grant no. 2011GXNSFA018154 and 2012GXNSFGA060003; the Science and Technology Foundation of Guangxi under Grant no. 10169-1; Guangxi Scientific Research Project no. 201012MS274; Funded Projects of Innovation Plan for Guangxi Graduate Education no. gxun-chx2013t18;and Guangxi University for Nationalities Project no. 2012QD017.

#### References

- I. F. Akyildiz, W. Su, Y. Sankarasubramaniam, and E. Cayirci, “Wireless sensor networks: a survey,”
*Computer Networks*, vol. 38, no. 4, pp. 393–422, 2002. View at: Publisher Site | Google Scholar - J. Yick, B. Mukherjee, and D. Ghosal, “Wireless sensor network survey,”
*Computer Networks*, vol. 52, no. 12, pp. 2292–2330, 2008. View at: Publisher Site | Google Scholar - H.-S. Yin, Z. Liu, J.-S. Qian, K. Zhang, and J. Wu, “QoS model of multimedia integrated services digital network in coal mine,”
*Journal of China University of Mining and Technology*, vol. 39, no. 1, pp. 109–115, 2010. View at: Google Scholar - M. M. R. Mozumdar, L. Lavagno, and L. Vanzago, “A comparison of software platforms for wireless sensor networks: MANTIS, TinyOS, and ZigBee,”
*ACM Transactions on Embedded Computing Systems*, vol. 8, no. 2, pp. 123–129, 2009. View at: Publisher Site | Google Scholar - C. Karlof and D. Wagner, “Secure routing in wireless sensor networks: attacks and countermeasures,”
*Ad Hoc Networks*, vol. 1, no. 2-3, pp. 293–315, 2003. View at: Publisher Site | Google Scholar - J. Ager and L. Clare, “An integrated architecture for cooperative sensing networks,”
*Computer*, vol. 33, no. 5, pp. 106–108, 2000. View at: Publisher Site | Google Scholar - N. Nasser, L. Karim, and T. Taleb, “Dynamic multilevel priority packet scheduling scheme for wireless sensor network,”
*IEEE Transactions on Wireless Communications*, vol. 12, no. 4, pp. 1448–1459, 2013. View at: Publisher Site | Google Scholar - C. Duffy, U. Roedig, J. Herbert, and C. J. Sreenan, “Adding preemption to TinyOS,” in
*Proceedings of the 4th Workshop on Embedded Networked Sensors (EmNets '07)*, pp. 88–92, Cork, Ireland, June 2007. View at: Publisher Site | Google Scholar - Y. Zhao, Q. Wang, W. Wang, D. Jiang, and Y. Liu, “Research on the priority-based soft real-time task scheduling in TinyOS,” in
*Proceedings of the International Conference on Information Technology and Computer Science (ITCS '09)*, pp. 562–565, Kiev, Ukraine, July 2009. View at: Publisher Site | Google Scholar - M. Yu, S. Xiahou, and X. Y. Li, “A survey of studying on task scheduling mechanism for TinyOS,” in
*Proceedings of the 4th International Conference on Wireless Communications, Networking and Mobile Computing (WiCOM '08)*, pp. 1–4, Dalian, China, October 2008. View at: Publisher Site | Google Scholar - K. Mizanian, R. Hajisheykhi, M. Baharloo, and A. H. Jahangir, “RACE: a real-time scheduling policy and communication architecture for large-scale wireless sensor networks,” in
*Proceedings of the 7th Annual Communication Networks and Services Research Conference (CNSR '09)*, pp. 458–460, Moncton, Canada, May 2009. View at: Publisher Site | Google Scholar - J.-S. Qian, H.-S. Yin, X.-R. Liu, G. Hua, and Y.-G. Xu, “Data processing model of coalmine gas early-warning system,”
*Journal of China University of Mining and Technology*, vol. 17, no. 1, pp. 20–24, 2007. View at: Publisher Site | Google Scholar - S. Asmussen,
*Applied Probability and Queues*, Springer, New York, NY, USA, 2nd edition, 2003. View at: MathSciNet - L. Lipsky,
*Queueing Theory: A Linear Algebraic Approach*, Springer, New York, NY, USA, 2nd edition, 2009. View at: MathSciNet - D. Gross and C. M. Harris,
*Fundamentals of Queueing Theory*, John Wiley & Sons, New York, NY, USA, 1998. View at: MathSciNet - P. J. Smith, A. Firag, P. A. Dmochowski, and M. Shafi, “Analysis of the M/M/N/N queue with two types of arrival process: applications to future mobile radio systems,”
*Journal of Applied Mathematics*, vol. 2012, Article ID 123808, 14 pages, 2012. View at: Publisher Site | Google Scholar

#### Copyright

Copyright © 2014 Hongsheng Yin et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.