Dynamic Soft Real-Time Scheduling with Preemption Threshold for Streaming

Over the last decades, the advancements in networking technology and new multimedia devices have motivated the research on efficient video streaming mechanisms under wireless. We consider combing soft real-time video streaming scheduling with threshold to minimize the ineffective preemption. Based on the value density and urgency of soft real-time task, the dynamic scheduling with preemption threshold strategy (DSPT) is proposed in the paper. By analyzing the response time and preemption relationship of tasks, the preemption thresholds are assigned. Simulation results show that the DSPT strategy achieves improvements about success rate, delay time, and benefit of the system.


Introduction
With the advancements in networking technology and new multimedia devices, video streaming mechanisms under various network and devices have attracted more and more attention.Nowadays, multimedia communications over the internet especially wireless network are the necessarily part of modern life.Many researchers have studied on video streaming management over wireless, including video coding [1][2][3][4], network coding [5][6][7][8], and wireless communication [9][10][11].In wireless networks, video streaming applications are almost the largest consumer of mobile wireless data, so scheduling video streaming in wireless networks is very important.
Video streaming scheduling in wireless networks has been developed for recent years, such as given quality on service mechanisms [12][13][14][15][16] and real-time adaptive [17][18][19].Many of video streaming scheduling studies are about hard real-time [20][21][22] that requires all the packets complete before the deadline; otherwise the packets will be considered invalid and dropped.However, for some actual video streaming media application, the packets of the transmission with delay can still bring a certain service and these packets can be forwarded and represented by soft real-time tasks.The soft real-time task model with value function is also applicable to video streaming with delay [23,24].For soft real-time scheduling, task executing under delay-constrained can bring goodput and benefit.
Generally, real-time scheduling can be divided into preemptive scheduling and non-preemptive scheduling according to whether the task can preempt each other or not.In a dynamic network, the preemptive method is more applicable.However, arbitrary preemption between tasks will affect the scheduling performance.Therefore, considering the drawbacks of the two methods, a compromise approach is utilized to limit the arbitrary or invalid preemption by setting preemption threshold.Furthermore, the limited preemption scheduling strategy is a correct choice for improving the performance.
Soft real-time task model is conducted for the video streaming under wireless.We propose a soft real-time threshold preemption scheduling strategy by combining value density and urgency for video streaming in the paper.Simulation results show that the strategy can improve the goodput, reduce the delay, and increase the benefit comparing with the EDF and LSF methods.
In this paper, we only consider the CPU in the system scheduling and ignore the time caused by context switching.We study the video streaming transmission problem of gateway devices in wireless network at the specific level of packets of transport tiers.
Organization.The structure of the paper is organized as follows: Section 2 describes the related work.Section 3 designs the structure of DSPT strategy.Section 4 defines the task model and problem analysis in detail.Section 5 is priority and preemption thresholds description.The details of scheduling based on preemption threshold are introduced in Section 6.The simulation setup and results are given in Section 7. Finally, the conclusions and future work are discussed.

Related Work
In wireless networks, the scheduling strategy should ensure high quality.For this purpose, lots of studies were proposed.The works in [1,2] enabled high-quality HTTP streaming, in which video pre-encoded into segments that can only start to play if all the packet have received.However, much packet lost for video application in the above work.The literature [3] optimized the dynamic HTTP live streaming service by segment adaption.Some literatures proposed video streaming scheduling using video coding with network coding.For example, the literatures [5,6] optimized video streaming by combining video coding and network coding for P2P network and distributed network, respectively.However, it might suffer from bandwidth inefficiencies because of unrecoverable packets.The work [7] proposed streaming scheduling for multiple server by Markov decision processes, but it had high computational complexity.In [9], the authors designed a crosslayer optimization scheme for dynamic wireless video streaming.However, these methods cannot contain the packet urgency for streaming control.
With the emergence of various networks, the research on heterogeneous wireless networks had been motivated.The literatures [11,19] studied the concurrent multipath transfer of the capacity-limited heterogeneous wireless platform.Another work [17] proposed a real-time adaptive video streaming deliver method over multiple wireless networks.In [23,24], delay-constrained video transmission with multiple interface in heterogeneous network was proposed.
Some researchers considered video streaming as hard real-time; that is, the streaming packet missing the deadline will be considered invalid.For example, the literature [20] proposed a feedback-based control approach under hard real-time workload to improve admission rate.In literatures [18,21], the author studied in hard real-time video stream allocation to improve the utilization of video decoding.Nevertheless, most video streaming data meets the characteristics of soft real-time task, so delay-constrained of video is considered acceptable in applications.

DSPT Detail Design
We consider video streaming deliver over wireless networks as soft real-time scheduling.The streaming packet is expressed as task, and its quality and urgency are the metrics in scheduling.The task's delay will affect the quality.Therefore, we introduced the value to measure the quality.
Response time analysis (RTA) is used to test the schedulability of real-time task, and the preemption threshold-based scheduling approach is to reduce invalid preemption among tasks.The scheduling algorithm can effectively reduce the delay and improve the success rate and benefit.The flow diagram of DSPT strategy is shown in Figure 1.In this paper, we assume that the value function   () of the soft realtime task   keeps unchanged in the interval [  ,   ) and decreases linearly in the interval.While executing in the interval [  ,   ), the task   is not allowed to be preempted in order to protect the execution of the task.
Contribution 1.We construct the priority assignment function combining value density and urgency, improving the success and quality of task soft real-time scheduling.
Contribution 2. We propose the task scheduling strategy DSPT based on preemption threshold, which can obtain better performance.

Task Model and Analysis
Considering video streaming with delay-constrained under wireless, we conduct soft real-time task model in this section.

Soft Real-Time Task Model.
We refer to a task as an aperiodic task model, and the task is soft real-time.This section provides the definitions of soft real-time task model used in the paper.
Task   : An aperiodic task   is defined as a triple   := {  ,   ,   ,   }, where   ,  ,  , and   are the arrival time, the estimated execution time, the relative deadline, and the critical time of task   .
Having executed time ℎ  : ℎ  denotes that the task has been executing ℎ  units at time  0 .
Required execution time   :   denotes the remaining execution time of task   .Thus, it meets   =   − ℎ  .
Executable time   :   is the executable time of the task   prior to its deadline   , where at the time  0 ( 0 <   ).
Soft Executable time   : When missed deadline   , task can continue to execute until   .  is the executable time prior to the critical time   , that is,   =   −  0 .
Slack time   : The slack time   denotes that the time unit after finish execution until deadline   , thus,   =   −   .  remains stable when the task   is in execution, and   decreases when the task   is preempted.Once   < 0, the task   cannot finish before   .
Delay Time   : The delay time   denotes the finish time of task   after   .At the time  0 (  <  0 ≤   ), it meets   =  0 −   .
Priority   :   is defined as the priority of task   .The larger   's value, the higher   's priority.
Threshold   :   is the preemption threshold of task   , where   ≥   .
Value function   ():   () defines the value of the system for executing   at time , where  ∈ [  ,   ).The task   's value will change when   keeps executing, and the function   () is dynamic.  () will be analyzed in detail in Section 4.

Value and Value Density Function of Soft Real-Time Task.
According to assumption, the value function   () of the soft real-time task   at time  is defined as From (1), we can see that when  <   ,   () is stable at   ; however when   ≤  <   ,   () is linearly diminishing until 0.
Value density function   () is denoted as We can see that   () is not only concerned with   () but also related to   .According to the definition,   =   − ℎ  .As we known, when the task   is executing,   decreases with the growing of the time .And when the task   is blocked, the   remains unchanged.The discussion of   () is as follows: (1)  <   .Within this interval,   () =   /  .When   is executing,   () grows with the decreasing of   .While   is blocked,   () remains unchanged.
(2)   ≤  <   .In this interval,   () can be derived as follows:   () = (  /  ) × ((  − )/(  −   )) From the above expression, the affect part of the   () is Because the task in scheduler can finish without any interference of any other task, (  − )/  > 1.In this case, if the task   keeps executing, the molecular part and the denominator part of (3) decrease at the same time.Further analysis is needed: (   () is affected by   , the discussion is as follows: (1) When   remains in execution,   does not change with the growing of the time  and then   () remains unchanged.
(2) When   is blocked,   decreases with the growth of , which makes   () increase.

Priority and Preemption Thresholds for Soft Real-Time Tasks
Task scheduling is driven by priority, while task priority function combines value density with urgency.

The Construction of Task's Priority Function.
Considering the urgency and the benefits of task, task scheduling is based on priority.Only the completed task can gain value, so relative to the value density, the urgency is more important.In system scheduling, the first consideration is system success rate and then is value brought by tasks.It means that urgency is given much greater weight than value density in priority function.Therefore, we use exponential weighting to the urgency while using logarithmic weighting to the value density.The function of priority assignment can be rewritten to Based on the above analysis of value density   () and urgency   (), we can conclude that (1) When   executes at interval [  ,   ),   satisfies Further analysis is needed: ( (2) When   executes at [  ,   ), its slack time is   and satisfies By analyzing the response time of   , its threshold   can be obtained under the condition which can be scheduled.The procedure of preemption threshold selection is shown in Algorithm 1, where   is the highest priority task.
Obviously, the computational complexity of Algorithm 1 is ().

Task Scheduling Strategy Based on Preemption Threshold
We propose a limited preemption scheduling strategy DSPT based on preemption threshold, which reduces the blocking time of the tasks by restricting preemption.
Definition 4. Sufficient and necessary conditions of   >   is that task   can preempt task   .
By Definition 4, if task   preempts task   , there must be   >   .Theorem 5.If task   and task   are not preempted, the following should be satisfied: (  ≤   ) ∧ (  ≤   ).
Proof.Supposing that there are two tasks,   and   , which do not preempt each other, ⌝(( There are two possible cases: (1) If   >   , task   can preempt task   , (2) If   >   , task   may be preempted by task   .
Obviously, tasks   and   can preempt each other, in contradiction with Definition 4. Therefore, Theorem 5 can be proved.

Scheduling Algorithm Based On Preemption Threshold.
The soft real-time dynamic task scheduling based on preemption threshold (DSPT) called Algorithm 1 is to calculate the threshold and determines the scheduling queue dynamically as shown in Algorithm 2.

Algorithm Complexity.
There is only one loop in Algorithm 2, that is, the 7th step is the loop of the length that is equal to the number of tasks in the ready queue.Thus, the computational complexity of the Algorithm 2 is ( × ), and the computational complexity of the whole scheduling algorithm is ( × ).

Simulations and Analysis
7.1.Simulation Experiments.The experiment platform's CPU is Intel dual-core 2.8 GHZ processor, and the memory is 8 GB.The operating system is Ubuntu Linux, and the source code is implemented by C language.
In the experiment, we consider the aperiodic soft realtime task.Any task   's arrival time   obeys Poisson distribution ( = 4) and the estimated execution time   is subject to [3.0, 5.0] average distribution.Therefore, its relative deadline   is [1.2, 1.5] ×   average distribution, its critical time   is [1.2, 1.5] ×   , and its value   is randomly selected between [10,50].
Performance indicators are included as follows: (1) Systematic success rate (SSR): where   denotes as the number of successful tasks and  represents the number of system overages.
(2) Average task latency rate ATDR: where  denotes the successful task set and   and   denote execution latency and execution time of the success task   .
(3) Effective utilization Rate (EUR): where   denotes as the CPU time for successful tasks and  represents the total CPU time in scheduling.
(4) Cumulative Value (CV): (11) where  denotes the successful task set and represents the value of the task   .

Performance Analysis.
Under soft real-time environment, the preemptive threshold scheduling strategy is compared with Earliest Deadline First (EDF) method and Least Slack First (LSF) method, and the simulation results and performance are analyzed as follows.
(1) Figure 2 shows simulation results for SSR scheduled by DSPT, EDF and LSF.The task's arrival interval is represented on the horizontal axis, and the vertical axis is SSR.When the arrival interval of the task is very short, the preemption among the tasks causes the SSR to be low.With the increasing of arrival interval, the preemption among tasks decreases and the SSR arguments.From Figure 2, SSR is sorted in descending order followed by DSPT, LSF, and EDF.This is due to the EDF algorithm chooses task with earliest deadline but not most urgent, which can lead to many tasks fail.While the LSF algorithm always chose the task with the shortest slack time dynamically, its unrestricted preemption causes the thrashing which can make lots of task fail.The DSPT can adapt to the system environment dynamically, and its preemption threshold can avoid the invalid preemption among tasks.(2) The simulation results of ATDR are shown in Figure 3, in which the ATDR is on the vertical axis and arrival interval is on the horizontal axis.It can be seen from Figure 3, the ATDR decreases since the arrival interval grows from 2.5, while ATDR is lower because the intervals among tasks are so short that many of these are dropped to 1.0.Moreover, EDF algorithm leads to the highest ATDR, while the DSPT method produces the lowest ATDR.Because the EDF algorithm always chooses the task with earliest deadline of slack time to execute, many tasks miss the deadline and delay.Relative to the EDF method, the LSF algorithm assigns the most urgency task to execute in time.But its unconstrained preemption may cause serious thrashing among tasks under system overload and this increases the ATDR.The DSPT approach chooses the most urgency task to execute, and limits the preemption among the tasks by the threshold, thereby reduces the delay of the task effectively.
(3) The simulation results for EUR scheduled by EDF, LSF, and DSPT are shown in Figure 4, where the horizontal  axis is task's arrival interval and the vertical axis is EUR.The short arrival interval means intense preemption among tasks, which causes the EUR low.While the arrival interval becomes longer, there are EUR arguments as the tasks' preemption decreases.From Figure 4, DSPT obtains the best EUR and EDF has the least EUR.Because the EDF algorithm always execute the task with earliest deadline, which causes more invalid CPU utilization than LSF along with the task failure.The DSPT using preemption threshold can improve the EUR through reducing invalid preemption of tasks.
(4) Figure 5 plots the system's CV as arrival interval grows.It can be seen from Figure 5, the CV increases when the arrival interval of tasks increases.DSPT obtains the highest CV, because it assigns higher executing priority of the task with high value density.The LSF method produces better CV than EDF method, because under the same system load, that more tasks finish augments CV obtained with the formal approach.

Conclusions and Future Works
In this paper, we consider video streaming scheduling in wireless networks as soft real-time scheduling.The soft realtime task model has been constructed to express streaming packet and its quality, measure as value, and urgency metric are explored in scheduling.Response time analysis (RTA) approach has been used to test the task's schedulability, and preemption threshold has been added to the schedule to release the invalid preemption.The scheduling schema DSPT can constrain the delay and improve the success ratio and benefit effectively.
In future works, we want to apply our scheduling method to practical wireless networks, like 5G net, to test its practical effect.Moreover, the stream scheduling of mixed hard realtime and soft real-time characterizes are also a study work in the next step.

Figure 1 :
Figure 1: The flow diagram of DSPT strategy.
Theorem 1.While the task keeps executing in the progress, it increases with time .4.3.Analysis of the Task's Urgency.The more urgency of the task is, the sooner execution is required.Definition 2. At any , the urgency   () of task   is defined as   () = 1/   .
: preemption threshold of   ;   : priority of   ;   : ready tasks queue. 1 ≤  ≤ ,  is the number of tasks in the queue;   : task just arriving;   : task in executing;   : the highest priority task of   ;