Category Based Multilevel Queue Static scheduling ...

10 downloads 365 Views 2MB Size Report
Complex cyber-physical systems' software; such as satellite flight-control software ... mission-aware scheduler called “Satellite Mission-aware Multilevel Queue” ...
International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

Efficient Design for Satellite Mission- Aware Multilevel Queue scheduler Mohamed O. Elsedfy*#1, Wael A. Murtada#2, Ezz Farouk#*1, Mahmoud Gad- Allah#3 *

Egyptian Armed Forces

1

Ph.D. candidate, [email protected] 3 Ph.D., [email protected] 2 Ph.D., On-Board Computers and Space Software department, NARSS [email protected] 3Professor, Modern Academy, [email protected] #

cairo, Egypt.

Abstract— Recently, many task-scheduling policies were introduced to enhance the system performance by adding more awareness to the scheduler. Complex cyber-physical systems’ software; such as satellite flight-control software (SFCSW); has various physical parameters to control. It is required to add the awareness demand to the selected scheduler. Control parameters (CP), which include power consumption, temperature rising, etc., are given directly from the mission requirements. In this Research, we introduce a mission-aware scheduler called “Satellite Mission-aware Multilevel Queue” (SMAMLQ) scheduler. The proposed scheduler classifies incoming tasks, using K-means clustering algorithm, into four groups. Incoming tasks are classified to data exchange tasks, control application tasks, soft real-time tasks and background tasks. Each class; as a queue of tasks; represents one of the four types SFCSW’s tasks. Tasks’ priority inside the queue is identified according to the task CP deadline, which the task belongs to as a mission dependent parameter. Utilization of each queue is Calculated to be used as the acceptance criteria for any incoming sporadic or periodic task. The proposed scheduler was implemented and tested with promising results compared to traditional MLQ used with SFCSW. The proposed SMAMLQ contributes with the following aspects: Using the CP as a mission-aware scheduling parameter, relaxing the hard real-time constraints, applying mission requirements directly to different task properties, and Adding agility to long-term mission satellites. Keywords—Multilevel-Queue; Mission-aware scheduler; flight control software; Cyber-Physical Systems; K-means; Control parameter.

I.

INTRODUCTION

A cyber-physical system (CPS) is a system that collaborates computational elements to monitor and control physical parameters. Applications of CPS include satellite, avionics, military systems, smart automotive, etc. Scheme of CPS and remote sensing satellite (RSS) are shown in Figure 1.a-b, where sensors, actuators, and processing units are connected together[1],[2]. RSS is a complex CPS, whereas a large number of redundant sensors and actuators connected together with the onboard main computer in hard environmental conditions. Redundancy enhances the system reliability but adds more real-time constraints and complexity on software design. Onboard Main Computer SFCSW

Navigation Computer

Communication Computer

Camera Computer

Data Bus Thermal

Heaters Power Feeders :

Electromagnetometer

Power Relay Commands Computer RCC

Telemetry Acquisition Computer TAC

..

: Gyro

Figure 1.b Remote Sensing satellite

Figure 1.a Cyber-physical systems

Sensors and actuators are smart to have their own processing unit; like GPS, Camera; or attached to a special purpose computer. For example, Thermal sensors and power relays are connected to the digital signal processor (DSP) or analog to the

10

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

digital converter (ADC) to an interface computer. This allows to exchange and process data with other computers on the system. On Figure 1.b, a thermal sensor connected to the Telemetry Acquisition Computer (TAC), whereas heater is connected to the Relay Commands Computer (RCC). Real-time systems are those systems, which succeed not only when it functions proper, but in the right time. Real-time schedulers play a major role in CPS and RSS software. Their software consists of real-time operating system (RTOS) and set of real-time tasks. RTOS schedule tasks according to a certain scheduling policy to ensure that all tasks will meet their hard/soft deadlines. Scheduling policy is chosen according to the architecture of the CPS and tasks type. Scheduling algorithm efficiency is affected by some parameters, which are CPU utilization, throughput, turnaround, waiting time, response time and loss ratio[3]. The majority of today’s commercial RTOS schedule tasks based on a single parameter such as tasks’ priority [4],[5]. Traditional schedulers schedule tasks according to different parameters as shown in Table 1 [6],[7], Whereas this single parameter may ensure successful scheduling, it is not enough to express all the applications’ requirements. Table 1 Traditional scheduling parameter

Scheduler Highest priority first First-In-First-Out (FIFO) Shortest Task Next (STN)

Parameter tasks priority Arrival time Execution time

Shortest Remaining Time (SRT)

Execution, Remaining time

Disadvantages the starvation problem of Low priority tasks Lose task priority scheme Longer tasks have starvation problem Remaining time calculation overhead Longer tasks have starvation problem

𝑊(𝑤𝑎𝑖𝑡𝑖𝑛𝑔 𝑡𝑖𝑚𝑒)

Highest Response Ratio Next (HRRN) RR= 𝑆(𝑠𝑒𝑟𝑣𝑖𝑐𝑒 𝑡𝑖𝑚𝑒) + 1 Response ratio calculation overhead Rate Monotonic(RM) Early Dead Line first(EDF) Multilevel Queue

Period Deadline Queue priorities

Longer tasks have starvation problem Unpredictable when system is overloaded Lower level queues priority starvation

Satellite’s flight control software (SFCSW) is one of those applications that require more integration between real-time scheduling and control. It is needed to: (1) Scheduling tasks based on more than one priority parameter. (2) More integration between control and scheduling by adding awareness to the scheduler. (3) Relaxes real-time constraints to reduce system cost. The rest of this paper is structured as follows. Section II is an overview of SFCSW. Section III is the state-of-the-art related to scheduler awareness.Section IV is a survey on integration between real time schedulers and control.Section V introduces the important approaches in multilevel queue scheduler (MLQ), which is customized in our research for SFCSW.Section VI and VII include the proposed algorithm and its implementation on a real hardware with satisfactory results. Finally, we give concluding remarks in Section VIII. II. SATELLITE FLIGHT CONTROL SOFTWARE Satellite’s flight control software (SFCSW) drives the satellite on its orbit in a hard and unpredicted environment by a set of hard/soft real-time tasks. SFCSW is composite from three layers as shown in Figure 2. [8],[9].SFCSW is to maintain thermal

Figure 2 Satellite flight control software layers

11

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

control, power control, attitude control, pointing accuracy, maneuver, autonomous control, etc. All control issues are located in the application layer. Control tasks are the main tasks, which control and maintain the satellite on orbit in all modes of operations. Mass data is exchanged on the network and is carried by I/O tasks in RTOS layer. I/O task properties are abstracted directly from the related I/O devices characteristics, whereas control tasks properties are abstracted from mission requirements. Control task requests I/O task for exchanging data, whereas that I/O task acquires data from various sensors with different refresh rates(frequencies). At design time, it is difficult to assign the right priority to a control task, while it processes data from other I/O tasks. These mixed criticality tasks add more restriction on their properties. This problem can be solved only by adding more constraints on tasks’ properties such as period and deadline. Otherwise, priority inversion problem may occur. Adding constraints requires more resources such as processing power, which adds costs and complexity to the system. Designers face difficulties on determining right system timing requirements in absence of an integrated way between control and scheduling issues[10]. Two examples for controlled parameters (CP) in RSS will be presented, which are Thermal control system (TCS) and attitude determination and control AD&C. TCS monitors and maintains temperature conditions for satellite subsystems to operate normally. TCS is composed of a set of tasks TTh to control thermal conditions of the satellite, where T Th ={τ1 ,τ2 ,τ3},where τ1 for acquiring thermal readings (from TAC), τ2 to issue control commands to heaters and radiators (to RCC) and thermal control task τ3 ,which processes thermal data and performs the proper actions. AD&C is composed of a set of tasks TAD&C= {τ1, τ2, τ3, τ5, τ6}. τ1 acquires gyro data (from TAC), τ4 acquires data from GPS receivers at navigation computer, τ 2 issues control commands to the flywheel and Electro-magnetometer (to RCC), Navigation and state vector prediction tasks τ5, τ6 respectively. For any mission requirements, AD&C requires maintaining the satellite “state vector prediction” not more than 100ms, while TCS requires maintaining the thermal conditions not more than 1000ms. This is an example of a mixed criticality tasks that are corporate together to carry on various control parameters. For instance, task τ1 may have a different deadline and readiness time for each control parameter; less than 1s for TCS and less than 100ms for AD&C. At design time, the only possible way is to assign the minimum deadline, maximum rate to τ1, which adds hard real-time constraints and requires more processing power (additional costs). SFCSW may have hard, soft, and non-real-time tasks. Hard real-time tasks are those critical tasks, which control satellite motion, thermal, power, modes of operations, data exchange, etc. Soft real-time tasks are tasks that do not contribute on any control parameter, such as telemetry packing, routing, etc. Non-real-time or background tasks like memory defragmentation task, memory checker, etc., which has no definite deadline. SFCSW as safety critical systems is characterized by hard real-time constraints. It usually uses static schedulers instead of dynamic ones to guarantee a predictable behavior. Dynamic scheduling may improve system performance but can lead to unpredicted system behavior, when tolerating timing constraints and may cause damage to the environment. Resolution or responsiveness of any system control parameter is defined as the amount of time from an action to the appropriate response. Actions can be an event, kind of change on sensed parameter or driven clock source. The response can be commands to subsystems, changes in system mode. In other words, system responsiveness for any physical parameter is that control parameter deadline. The control parameter is carried out by a set of tasks each with its own attributes. SFCSW scheduler is one of the most important SFCSW components. Traditional schedulers; which is based on tasks’ priority only; miss the relation between those tasks and their physical characteristics (i.e. control and real-time scheduler issues). When a task is engaged in more than one control parameter, it becomes more difficult to set the tasks’ attributes such as priority, arrival rate, and deadline. As the number of the control parameter's increases, system complexity increases accordingly. Integration of

12

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

many functions on a single computer (Onboard-computer) is an increasing trend in design to reduce the cost. The problem of those integrated tasks running on one system and sharing the same resources, whereas they do not share the same criticality level is said to be a mixed-criticality problem[11][12]. Stability of any mixed criticality system can be judged on its responsiveness[10]. Complex CPS and RSS have various control parameters. Each of these control parameters as different properties like hard/soft real-time constraints, frequency, arrival time, response time, deadline, and quality of service (QoS). III. SCHEDULER AWARENESS Regardless of scheduling policies and parameters, a lot of researchers added a kind of awareness to improve the scheduler and enhance the overall system efficiency. The most noted awareness is energy aware schedulers. Two techniques are used for reducing energy consumption in the processing unit, which is “Dynamic Voltage and Frequency Scaling (DVFS)” and “Dynamic Power Management (DPM)”[13].Another interesting awareness is resource awareness in CPS, which was introduced in [14] and called “Performance-Aware Scheduler Synthesis for Control Systems”. They introduce a co-design scheduler to find the optimal performance for all the control loops. This can be done by finding out the control signals rate should be dropped to maintain the optimal system performance. Mission-Aware Optimization; on a tabletop Satellite as a CPS; is introduced in[2]. They introduced a cost function for physical actuation effort and the computational resources required to acquire and process that information. They used this function to minimize the energy and increase the mission efficiency as an optimization problem. This adds additional computational effort and dynamic actions also. IV. REAL-TIME SCHEDULING AND CONTROL CO-DESIGN Research area on mutual integration between control and computing systems is extensively introduced in last decades. In fact, Control applications derived the development of computers and embedded systems. Complex CPS has one or more control loop, whereas any control loop consists of three parts: input collector, control algorithm, and output commands transmitter. Control task runs periodically with a certain sampling period. Dynamics and real time constraints of the controlled plant declare the sampling period side by side with the feedback process[15]. Early researches were subjected to find the optimal sampling period; i.e. control tasks frequencies; limited to the available computer resources[16]. Real-time scheduler paradigm can act as a feedback controller to select the most suitable task to be executed at any given instant[17]. This guarantee that tasks meet their deadline by scheduling constraints and don not corrupt the plant by the closed loop feedback. From that paradigm, the scheduling of control tasks should be based on the state of the plant side by side with other scheduling parameters such as release times and deadlines. For complex control systems, iterative solution of the quadratic optimization problem is found and formulated. Optimal sampling period selection for a set of linear-quadratic (LQ) controllers is treated in [18],[16].The integration of static cyclic scheduling and optimal (LQ) control is treated in [19], where a number of processes should be controlled by a set of state-feedback controllers. The performance of each controller is measured by a quadratic cost function. Control performance depends on the sampling interval[20]. It was presented as a function of a steady rise time, overshoot, state error and settling time and input-output latency to be optimized by minimizing tasks utilization with relative to scheduling constraints[21],[22]. Control loop performance is measured mostly by application performance measures, which affects, in turn, the performance of the overall system (not a single control loop). Hence, the performance is extracted from the mission objectives, not from the performance of the individual loops. the effects of the selected scheduling policy on the loop timing are difficult to analyze[15].An interested real-time middleware named “Etherware” is introduced in [23], to support temporally predictable execution behavior for safety-critical applications. A notion of the QoS of message delivery is introduced, and the scheduling mechanisms of the “Etherware” are enhanced in such a way that a message with a QoS specification can be delivered with the

13

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

priority that is determined by the QoS of a message. To achieve better system performance in unpredictable environments than traditional design approaches, a novel methodology, control-scheduling co-design, is emerging in the context of integrating feedback control and real-time computing (Feedback Scheduler). From all above, the motivation for introducing a mission-aware scheduler is increased to interpret different control loops' parameters(mission requirements) side by side with overall mission requirements as a scheduling parameter which will be introduced in section E. V. MULTILEVEL QUEUE SCHEDULER Multilevel queue scheduling (MLQ) is suitable for systems in which tasks can be easily classified into explicit groups [24]like SFCSW. MLQ distribute tasks in the ready queue to multiple queues based on a certain scheduling policy. This policy may change dynamically to optimize the overall scheduling performance[3]. Main Scheduler schedule queues rather than tasks in other scheduling algorithms, whereas each queue has a particular internal scheduler as shown in Figure 3. Scheduling between different queues is done by two ways. The first one is to fix the queues’ priorities. The second one is to provide a time slice for each queue based on a certain policy. Many scheduling policies were introduced for switching between different queues, rather than the scheduling policy used inside each one. Let us Consider a scheduler has N queues; each queue Qi has a set of Mi tasks. Each task is represented by τi, j 𝜖 Qi Where i=0,1… ,N-1 , N is the total number of queues, j=0,1,…,Mi-1 tasks in Qi . The jth task in queue Qi is τij are assigned to that queue generally based on some properties of that task, such as task priority and task type.

Figure 3 Multilevel Queue scheduler Block Diagram

For any two tasks Task τa,b, and τc,d, the priority τa,b are higher than τc,d, iff the priority of Qa is greater than Qb. This property of MLQ may cause a starvation problem for those tasks in lower priority queues. One of the recent algorithms to overcome this starvation problem is “Multilevel Queue with Priority & Time Sharing for real-time scheduling” Scheduler shares the CPU execution time between tasks based on its priority level. After each share, the priority of each task is re-calculated and a new execution queue is built up. This adds calculation time overhead. Fuzzy based algorithms for MLQ were introduced in many types of research. One of them is “Fuzzy-Based Multilevel Queue Scheduling Algorithm”[25], where the ready queue is divided into two sub-queues; "input /output bounded tasks" and "CPU bounded tasks". CPU bound tasks queue consumes CPU only time, while the I/O bounded queue is for exchanging data with the outer world. CPU time is allocated dynamically (quantum) to each queue. Two fuzzy inference systems (FIS) were introduced. The first one, allocate the CPU time dynamically for each queue. The second one, calculate the time quantum to schedule the I/O bounded tasks to improve the starvation problem and the average response time. Another fuzzy based algorithm is “Fuzzy Dynamic Weighted Fair Queue (FDWFQ)”[26].The algorithm places the incoming requests into various queues and assigns a weight for each queue. Incoming requested tasks are classified by the

14

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

following factors, which are tasks’ deadline, processing time, ready time, and the importance level of the process. Weights of different queues are based on the service requirement to minimize the incoming request's rejection and the CPU utilization factors. The value of dynamic weights is determined by the FIS. Markov chain based algorithms for MLQ had been introduced also by some researchers. Data model approach and Markov chain based analysis of MLQ scheduling were introduced in[27][28]. Markov chain model is used for general setup of multilevel queue scheduling, while the scheduler performs a random movement on each queue over a time quantum. To study task state transition in the presence of a deadlock, A Data model based on Markov chain model is proposed [27]. A scheduling scheme is designed with four states related to arrival, input, resting, and waiting states(queues) of tasks. All the first four queues are allowed to accept a new task with initial probabilities. The scheduler has a random movement over all states on quantum variation. Multilevel Feedback Queue scheduler (MLFQ) is an enhanced model of MLQ, where tasks can move between queue to enhance the overall scheduling performance and solve the starvation problem [29]. The main scheduler is priority preemptive one, which needs to define how many queues, scheduling algorithm for each queue, conditions for increasing/decreasing task priority and the rules for deciding, which queue a task should be located[30]. Queues may have their own internal scheduling policies; such as round ribbon (RR), Shortest Job First (SJF), Early Deadline First (EDF), or First Come First Serve (FCFS). Simulation of multilevel feedback MFQ program shows that using RR in different queues, while applying SJF prior to RR from the second queue forward, may improve the CPU utilization. This done using the dynamically generated time quantum by the proposed simulator [31]. VI. SATELLITE MISSION-AWARE MULTILEVEL QUEUE SCHEDULER Satellite Mission-aware multilevel queue scheduler (SMAMLQ) will be introduced in a single processor environment (onboard computer). SMAMLQ is a static approach of MLQ to be used with SFCSW and similar complex CPS. That we fixed the priority of each queue according to the queue type, then tasks inside a queue; whatever the queues’ internal scheduler is; get its priority from the control parameter deadline, which belongs to. Real-time systems have to respond to external events within a finite and specified time. Nevertheless, real-time does not necessarily mean fast computation or communication. The key point in real-time systems is the predictability, implying that the system should execute at a speed that meets the timing requirements of the external physical world[5]. After studying the nature of satellite, avionics, and other CPS control systems, the need to design a mission-aware scheduler becomes necessary to reflect the mission requirements directly to the scheduler properties. Tasks on that kind of systems can be grouped according to system architecture into separate groups. Each group has different properties such as priority, frequency, and deadline. A. TASKS CLASSIFICATION Grouping tasks; according to SFCSW architecture; is the first step in our proposed algorithm to allocate each group to its corresponding queue level, priority, and frequency. According to the RSS architecture; as shown in Figure 1.b and Figure 2; tasks can be grouped into four groups. The first one is “Data exchange tasks group (DET)”, which are tasks control the data exchange between main computer and the other computer on the network. This group is I/O bounded with hard real-time constraints. The Second one is “control application tasks Group (AT)”. AT is those tasks from the application layer of SFCSW with different levels of priorities, frequencies, deadlines, and arrival rate. Those properties are abstracted from mission requirements for each control parameter. AT consumes CPU time only while processing data.AT group, include different types of tasks, which

15

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

are tasks that analyze, process calibrate and format redundant sensors raw data; Tasks that generate appropriate commands to the actuator, Service tasks; Tasks that perform logic analysis of whole satellite performance and status monitoring; Remote commands processing tasks, etc. AT group is the main and useful group, whereas failure in one of its tasks causes a whole system failure. Grouping that kind of tasks in one queue make it easy to allocate special processing resources and satisfy critical tasks requirements over other groups. The third group is “Soft real-time tasks (ST)”. ST is those tasks with soft real-time and relaxed constraints. Missing the deadline of STs’ tasks will not cause system failure, but may cause performance degradation[32]. Examples of ST are telemetry, system log, encryption, compression, etc. The last group is “Background tasks (BT)”, which are non-real-time tasks or tasks that have no time boundaries such as memory checker. B. CLUSTERING TASKS Clustering is transforming data to knowledge[33]. Clustering a set of objects to groups is a process of grouping data points into clusters. In our case, the number of clusters is predefined a priori. A well know K-means clustering algorithm is used as a prescheduling step[34].K-means clustering is a statistical clustering algorithm, which is used to group a set of objects or data points based on specific features into K-groups, in which each object belongs to specific cluster with the nearest mean. Cluster features should be selected carefully in order to perform a correct clustering. In K-means algorithm, clustering is done by minimizing the “Euclidian distance” between data points and setting each cluster center. Assume that we have N different points such that xi = (x1,x2 , …,xn), where each point is represented in d-dimensions and each dimension represents a feature. Start

T= {τ1, τ 2,., τ m},k=4 New incoming task tn+1

Set first four tasks as clusters centers Attribute the closest cluster to each data point

Min||µi-tn+1 || Co-scheduler part

For i=0 to n

Calculate the distance set D between Ti data point and cluster centers.

DET

τ11, τ12,.. AT

in

τ31, τ32,..

Recalculate the new cluster center

BT

τ41, τ42,.. Ready Queues

yes

μi changed

End of prescheduling part

No

Pre-scheduler part

Figure 4 K-means clustering pre-scheduling and co-scheduling algorithm flowchart

16

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

K-means algorithm iteratively partitions n points into a number of sets K, where S represents clusters or groups such that 0 < k ≤ n, S = {S1, S2,…, Sk}.μi is the arithmetic mean of data points in Si .The objective is to minimize the within-cluster sum of squares (WCSS) to get the data points associated cluster as follows: k

argmin ∑ ∑ ||X − μi ||2

(1)

i=1 xϵSi

K-means algorithm is used as a pre-scheduling algorithm to cluster a set of tasks Τ into a four predefined and independent sets ΤDET,ΤAT,ΤST,ΤBT where Ta

∩ T𝑏 = ∅ a#b ,TDET ∪TAT ∪TST∪TBT=T. Each task is represented by two dimensions, which are

deadline and period as a point τi in D-P plane τi={xi ∈ Di ; yi ∈ Pi } ∀ 𝐷𝑖 𝑎𝑛𝑑 𝑃𝑖 ∈ R + ,where Di ,Pi are deadlines and periods of ith tasks. Consider a metric space (T, d), T is a set of tasks with a distance function “d” that is Euclidean distance function defined on T. Clustering is done in two phases, pre-scheduling(offline) and co-scheduler (run-time). At pre-scheduling, the kmeans algorithm allocates each task to the corresponding queue; as shown in Figure 4. Henceforth, it is not allowed for any task to move anymore between the queues. During the long life of RSS, new tasks may be uploaded to the RSS to enhance or add some features or to overcome some problems. Those new tasks may be sporadic tasks or periodic tasks. At run time, clustering algorithm allocate any incoming task τn+1 to the ith queue with the minimum distance to its centroid (𝛍𝐢 ).It is not feasible to apply the whole k-means algorithm .This may lead to move some old tasks between groups ( queues) ,wh ich will turn SMAMLQ to a dynamic scheduler with unpredicted behavior. C. TIME FRAMES Each kind of sensors and actuators has a specific refresh rate and response time to interact with the environment. SFCSW is characterized by a high data exchange rate between the processing units. DET should be carried out at a high rate to avoid the priority inversion problem. SMAMLQ grant the priority and frequency for QDET to imply the system nature on the scheduler. AT process sensed data, consumes more CPU time, generate appropriate commands to actuators and plays the major part in SFCSW. QAT is divided into a number of sub-queues according to different frequencies and phases. ST tasks like AT tasks, but with relaxed or soft real-time constraints. ST should not belong to any control parameter. If one of ST tasks misses its deadline, the system continues to work properly but with some performance degradation. BT will run in the background; as a non-real-time queue; when the scheduler flushes the other queues. SMAMLQ has three-time frames for queues DET,AT and ST , which are sub-frame (SF), main frame (MF) and major frame (JF) as shown in Figure 5.At the start of each subframe, QDET preempts any running queue with an absolute priority over other queues.

Queue

~

~

SF ~ S-2 S-1 0 MF MFM-1 JF DET

1

2

S-3 0

n-1 AT

~

~ S-2 S-1

0

1

2

S-3 S-2 S-1 1

~ ~

~

~ 0

1

2

S-3 M-1

n ST

S-2 S-1 0 1 ~ 0 n+1

BT Figure 5 Queues execution over Major frame, mainframe, and subframe Gant chart

17

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

MF is the time frame to flush QAT on the rest time between QDET. JF is the time for QST after flushing QAT each MF and QDET each SF. PS is the period of SF, S is the total number of subframes in one MF, PM = S*PS is the period of one MF, M is the number of MF in one JF, where PJ=M* tm is the period of one major frame. At design time, JF and MF periods are chosen equal to the maximum and minimum period of any control parameter deadline respectively, which directly specify the number of MF in JF. SF period is selected so that DETs’ WCET does not exceed 20% of SF time. AT ready queue is divided into a number of ready queues each with a different frequency and phase shift. The Readiness time of any AT task is given by:

R = ∅ + n ∗ 𝑡m

(2)

Where ∅ =1,2….,M-1 ,is the phase shift in the main frame from the start of each major frame, n=1,2,.., M/2. For any two AT’s tasks τAT,i , τAT,j, have the same rate tm /2, τAT,j has phase shift equal 1, τAT,i will be ready at MF0, MF2, MF4,..,MFM-2, while τAT,j at main frames MF1, MF3, MF5,..,MFM-1.

System tick controls the SF period and updates the main scheduler internal clock in

the format of JF:MF:SF ,which is updated every tick. This clock is also useful SFCSW event log. D. QUEUE UTILIZATION Tasks may have different input argument, which of course affects its execution time. SMAMLQ allows no more than one instant of tasks for every queue flush. Whereas DET is flushed every SF, the pattern of DET differs each SF.DET carries out AT and ST requests with different input arguments. We are going now to calculate the utilization of each queue. Each task well has a unique name which is an index. The execution time of the ith task τk,i∈ Qk at nth subframe on mth mainframe is C k,i,n,m . CDET, 5,2,3 for example, is the execution time of the 5th task in QDET at the second subframe on the third main frame. Thus, the execution time of any task can vary according to the argument of that task. Total execution time of tasks in Qk is given by: N

k C k = ∑i=1 ci

(3)

Total execution time of QDET in sub-frame “s” and main frame “m” is given by eq. 3.a , 3.b. respectively. 𝑵

𝐃𝐄𝐓 𝑪𝐃𝐄𝐓 ,𝐬 = ∑𝒊=𝟏 𝒄𝒊,𝑫𝑬𝑻,𝒏

(4.a)

𝑵

𝐃𝐄𝐓 𝐂𝐃𝐄𝐓,𝐦 = ∑𝑺𝒏=𝟏 ∑𝒊=𝟏 𝒄𝑫𝑬𝑻,𝒊,𝒏,𝒎 (3.b)

The rest time after flushing QDET at mth MF on any JF is Δtr, which is the available time for AT, ST and BT respectively. From equations 3,3. a,3. b Δtr is given by:

Δtr |m = tm - CDET,m (5) Total execution time of QDET in one major frame is given by: 𝑁

𝑀 DET CDET=∑𝑚=1 ∑𝑆𝑛=1 ∑𝑖=1 𝑐𝐷𝐸𝑇,𝑖,𝑛,𝑚 (6)

18

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

It is obvious that as long as CDET execution time is minimized relative to SF period, Δtr increases, which gives AT, ST the opportunity to meet its deadline before the end of the current MF and JF respectively. The total execution time of QAT in one major frame is given by: 𝑁

𝑀

DET 𝐶𝐴𝑇 = ∑𝑚=1 ∑𝑖=1 𝑐𝐴𝑇,𝑖,𝑚 (7)

Hard real-time tasks belong to DET, AT only. from equations 5,6 the utilization of hard real-time tasks UHR on any MF is given by:

UHR =

𝐶𝐷𝐸𝑇 +𝐶𝐴𝑇

(8)

𝑃𝑀

Total execution time of soft real-time tasks QST in any JF is given by: 𝑁

ST 𝐶𝑆𝑇,𝑗 = ∑𝑖=1 𝑐𝑖,𝑆𝑇 (9)

The available time for ST is given by

, 𝐶𝑆𝑇 ≤ tST

tST = tj - (CDET+ CAT)

(10)

Utilization of all real-time task queues DET, AT, ST over one major frame from eq.7,8,9 is given by:

𝑈𝑅 =

𝐶𝐷𝐸𝑇 +𝐶𝐴𝑇 +𝐶𝑆𝑇 𝑃𝑗

≤1

(11)

From eq.10, 𝑈𝑅 ≤ 1 is the necessary and sufficient condition for successful scheduling of SMAMLQ .From eq. 7 and 10, The acceptance of any new task τn+1 (sporadic, batch, or periodic) after the co-scheduler allocate it to the closest group is given by: Cn+1

UR+ Cn+1

UHR+

𝑃M

𝑃j

≤1 ∀ τn+1 ∈ TST ,

≤1 ∀ τn+1 ∈ TDET or TAT

( 12 )

Where soft and hard real-time utilization UR , UHR values is calculated from previous JF and MF respectively. BTs’ new tasks are accepted unconditionally as non-real-time tasks. E. SYSTEM CONTROL PARAMETER System control parameter (CP) is introduced as a set of tasks cooperate to carry one of system functional requirements to monitor and control the environment. In fact, each control parameter represents one of the system control loops. SFCSW, as described in section II, is a set of tasks corporate to monitor and control some parameters inherited from satellite mission requirements. For any SFCSW with a number of independent tasks m, a set T is the universe set of independent tasks, where T= {τ1, τ 2,., τ m} and CP set is the set of control parameters in that mission , where CP= {CP1 ,CP2,..,CPn}, m, n≥1. The control parameter CPi ∈ CP is defined as CPx=f (Tx,Dx,Px) ,where Tx ϲ T is a set of tasks that carry out CPx. Dx and Px are the CPx deadline and period respectively, where Dx , Px ≤ TJ. Dx and Px are an integer multiple of MF period.

19

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

SFCSW and similar Complex CPS may compose of many CPs with different rates and deadlines. In SMAMLQ, system CP deadline can be as maximum as one JF; for low rate CP; and as minimum as one or multiple of MF; for higher rate parameters. Figure 6 shows the process of carrying out two different CPs. The first one is attitude determination and control AD&C parameter CPAC={TAc , tm , tm} where TAC={ τDET,1 , τDET,2 , τDET,4 , τAT,5 , τAT,6 ,τAT,7 }. The second one is thermal control parameter CPTh={TTh , tj , 2*tm} where TTh={ τDET,1 , τDET,2 , τAT,3 , τAT,7 }.

Figure 6 Two control parameters sharing tasks with different timing constraints SMAMLQ relaxed the constraints for τDET,1∈ CPTH and restrict it for τDET,1∈ CPAC, while in traditional scheduler the possible way only is to set the τDET,1 deadline to the restricted requirement of CP. F.

QUEUES INTERNAL SCHEDULER QDET, QAT internal scheduler uses the Early Deadline CP first (EDF); instead of tasks; integrated with the “highest priority

task first” policy. At preemption point, as shown in Figure 7 the scheduler sorts the tasks according to their CP deadline first, then with the priority of the task itself.

Figure 7 Gantt chart for internal Queues’ scheduler with/without CP scheduling parameter

20

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

The role of queues internal scheduler is to grant the highest priority for tasks instants which belongs to CP with the earliest deadline. In the case of a two CPs with equal deadlines or tasks which do not belong to any CP, it uses the internal scheduling policy of that queue. Consider any two tasks on the same queue τa,AT ∈ Ti for CPi=(Ti,Di,Pi) and τb,AT ∈ Tj for CPj(Tj,Dj,Pj). If the priority of τa,AT > τb,AT ,ATs’ internal scheduler should run τa,AT first unless Di>Dj. In this case, it temporarily raises the priority of τbAT such that τa,AT < τb,AT . Henceforth, the scheduler schedules tasks based on CP and tasks’ priority, which directly reflects the SFCSW nature. Both Figure 6 and Figure 7 explain the idea of CP as a scheduling parameter, while τ1 is postponed many times, CPTh meets its deadline and save the hard real-time constraint. G. EVALUATION Techniques for any scheduling algorithm evaluation are deterministic modeling, comparing with a particular predetermined workload and defines the performance of each algorithm for that workload, Queueing models, Simulation, and Implementation.” The effective accurate way to evaluate a scheduling algorithm is to code it up, put it in the operating system and see how it works”[6]. In our research, we use both deterministic modelings as shown in Figure 7 and implementation of the proposed algorithm on target processor similar to the onboard computer board performance as described in section 7. VII. IMPLEMENTATION The main scheduler contextually switches between different queues according to a driven clock or system tick. Each queue has a control block (QCB) as shown in Figure 8.QCB acts as a library of information about the current and next queue, pointer to the current queue internal scheduler, current status (initializing, running, paused, faulty) and the system clock in terms of SF, MF,JF. Thread control blocks are used by the internal scheduler to pick up the right task for execution. SMAMLQ is shown in Fig. 9;

Figure 8 SMAMLQ Data structure

Figure 9 SMAMLQ main scheduler algorithm

21

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

A. RESULTS

Figure 10 Logic analyzer / keil vision 5.01 on CORTEX M4F407VG

SMAMLQ was implemented on the evaluation board “ARM CORTEX M4 stm32f407” using the integrated development environment. “Keil µvision IDE”. Using ANSI C. Experiment setting is shown in Table 2.The time frames are SF=10ms, MF=16* SF=160ms and JF=8*MF=128 SF=1280ms.Using “Keil µvision logic analyzer” , Figure 10 shows the real-time Gantt chart of queues and tasks over different time frames (subframe /mainframe /major frame) as designed and was previously shown in Figure 5. Table 2 Experiment Configuration

Actual Properties Normed Properties Queue Period(ms) Deadline(ms) Period Deadline Name

Task ID

Task name

1

F20

10

20

1SF

2SF

2

F21

15

25

1SF

2SF

3 4 5 6 7

F22 F40 F41 F42 F43

12 200 400 450 400

22 200 400 450 400

1SF 1MF 2MF 2MF 4MF

2SF 2MF 2MF 2MF 2MF

17 18 19 20 21 22

F53 F54 F55 F56 F57 F60

1200 1300 200 200 200 2400

1200 1300 200 200 200 2400

1JF 1JF 1MF 1MF 1MF 1JF

2MF 2MF 2MF 2MF 2MF 1JF

2000 2400 0

1JF 1JF sporadic

1JF 1JF 10JF

0

sporadic

10JF

~

~ 26 27 28

F64 F65 F80

-

32

F84

-

~

Control Parameter

CP1, CP2, CP3, CP4, CP5, CP6, CP7, CP8 DET CP1, CP2, CP3, CP4, CP5, CP8 CP1, CP2, CP3, CP4, CP5 CP1, CP8 CP1, CP2, CP4, CP5 CP7 CP8 AT

ST

CP3, CP4, CP5, CP6 CP6, CP8 CP1 CP1 CP1, CP6, CP7, CP8 -

BT

22

-

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

Figure 11 shows the current queue for two consecutive major frames JF .For simplicity, each queue is represented as an integer such that QDET=1 ,QAT=2,QST=3,QBT=4 and do-nothing =5. Figure 12 gives a zoom on one main frame only.

Figure 11 Gantt Chart for two major frames queues activities 6 5 4 3

2 1 0 16.80

19.79

22.80

ms

25.79

-1 0

1

2

3

4

5

6

7

8

9

10

11

-2 -3

-4 -5 1 -6

1-DET

2-AT

Major Frame

3-ST

Main Frame

4-BT

5-Do nothing

SubFrame

CurrentScheuler

Figure 12 Gantt Chart for one main frame queues activities

Fig. 13 shows both queues and tasks execution on five consecutive SFs. Tasks id (function index value) is just to distinguish between tasks names on the graph only.

Fig. 13 Gantt Chart for queues and tasks activities 23

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

VIII.

CONCLUSION

A new effective design for multilevel-queue scheduler was introduced and called satellite mission aware MLQ “SMAMLQ” to be used in SFCSW and similar CPS. SMAMLQ added a mission awareness to SFCSWs’ by mutating the control loops requirements of a mission into a scheduling parameter. At a pre-scheduling step, tasks are clustered using K-Means algorithm to a number of predefined groups according to SFCSW architecture. SMAMLQ schedules each group as a queue with different time frames based on each group characteristics. Control parameters (CP) are introduced for each control loop as a mission awareness parameter. SMAMLQ uses CP’s deadline as a scheduling parameter. Internal queues’ scheduler uses CP side by side with its scheduling policy in setting up tasks’ priorities to maintain the control loop deadline. Utilization of each queue was derived to be used as acceptance criteria for new incoming tasks without affecting real-time constraints. A co-scheduler classifier is used to accept new tasks(sporadic/periodic) in the corresponding queue which alleviated the acceptance problem of new tasks in static schedulers. SMAMLQ gains more integration between control and scheduling issues, adds more capabilities for control and software engineers to implement mission requirements directly on scheduler properties, relaxes hard real-time constraints on tasks. IX. REFERENCES E. A. Lee, “The past, present and future of cyber-physical systems: A focus on models,” Sensors MDPI Journal, vol. 15, no. 3, pp. 4837–4869, 2015. [2] J. M. Bradley, M. L. Clark, E. M. Atkins, and K. G. Shin, “Mission-Aware Cyber-Physical Optimization on a Tabletop Satellite,” in Guidance, Navigation, and Control and Co-located ,AIAA Infotech Conference, 2013, pp. 1–12. [3] V. Chahar, “A Review of Multilevel Queue and Multilevel Feedback Queue Scheduling Techniques,” International Journal of Advanced Research in Computer Science and Software Engineering (IJARCSSE), vol. 3, no. 1, pp. 110–113, 2013. [4] M. S. S. Nakate, B. B. Meshram, and J. P. Chavan, “New Trends in Real Time Operating Systems,” IOSR Journal of Engineering, vol. 2, no. 4, pp. 883–892, 2012. [5] F. Xia and Y. Sun, “Control-Scheduling Codesign: A Perspective on Integrating Control and Computing,” Dynamics of Continuous , Discrete and Impulsive Systems, vol. 13, no. S1, p. 7, 2008. [6] A. Silberschatz, P. B. Galvin, and G. Gagne, Operating system concepts, Ninth. Wiley, 2013. [7] N. Goel, “A Comparative Study of CPU Scheduling Algorithms,” International Journal of Graphics & Image Processing, vol. 2, no. 4, pp. 245–251, 2012. [8] T. H. Hannu Leppinen, Antti Kestilä, Pauli Pihajoki, Jukka Jokelainen, “On-board data handling for ambitious nanosatellite missions using automotive-grade lockstep microcontrollers,” in :Small Satellites Systems and Services - The 4S Symposium, 2014, no. 1, pp. 1–10. [9] ESA, “HW & SW Reference architecture ESA,” ESA, 2014. [Online]. Available: http://www.esa.int/Our_Activities/Space_Engineering_Technology/Onboard_Computer_and_Data_Handling/Architectures_of_On board_Data_Systems. [Accessed: 23-Nov-2016]. [10] I. Bate, P. Nightingale, and A. Cervin, “Establishing timing requirements for control loops in real-time systems,” Microprocessors and Microsystems,Elsevier, vol. 27, pp. 159–169, 2003. [11] S. Baruah, V. Bonifaci, G. D’Angelo, H. Li, A. Marchetti-Spaccamela, N. Megow, and L. Stougie, “Scheduling real-time mixedcriticality jobs,” in IEEE Transactions on Computers, 2012, vol. 61, no. 8, pp. 1140–1152. [12] D. de Niz, K. Lakshmanan, and R. Rajkumar, “On the Scheduling of Mixed-Criticality Real-Time Task Sets,” in 2009 30th IEEE Real-Time Systems Symposium, 2009, pp. 291–300. [13] M. Bambagini, M. Marinoni, H. Aydin, and G. Buttazzo, “Energy-Aware Scheduling for Real-Time Systems,” ACM Transactions on Embedded Computing Systems, vol. 15, no. 1, pp. 1–34, 2016. [14] R. Majumdar, I. Saha, and M. Zamani, “Performance-aware scheduler synthesis for control systems,” 2011 Proceedings of the Ninth ACM International Conference on Embedded Software (EMSOFT), pp. 299–308, 2011. [15] a. Crespo, P. Albertos, K. Arzen, A. Cervin, M. Torgren, and Z. Hanzalek, “Roadmap on Real-Time Techniques in Control System Implementation Control for Embedded Systems Cluster,” 2005. [16] D. Seto, J. P. Lehoczky, L. Sha, and K. G. Shin, “On task schedulability in real-time control systems,” in 17th IEEE Real-Time Systems Symposium, 1996, no. October, pp. 13–21. [17] P. Tabuada, “Event-triggered real-time scheduling of stabilizing control tasks,” IEEE Transactions on Automatic Control, vol. 52, no. 9, pp. 1680–1685, 2007. [18] J. Eker, P. Hagander, and K. E. Årzén, “Feedback scheduler for real-time controller tasks,” Control Engineering Practice, vol. 8, no. 12, pp. 1369–1378, 2000. [19] H. Rehbinder and M. Sanfridson, “Integration of off-line scheduling and optimal control,” Proceedings - Euromicro Conference on Real-Time Systems, pp. 137–143, 2000. [20] P. Tabuada, “Event-triggered real-time scheduling of stabilizing control tasks,” IEEE Transactions on Automatic Control, vol. 52, no. 9, pp. 1680–1685, 2007. [21] M. Ryu and S. Hong, “Toward automatic synthesis of schedulable real-time controllers,” Integr Comput Aided Eng, vol. 5, no. 3, pp. 261–277, 1998. [22] R. Gerber, S. Hong, and M. Saksena, “Guaranteeing Real-Time Requirements With Resource-Based Calibration of Periodic Processes,” IEEE Transactions on Software Engineering, vol. 21, no. 7, pp. 579–592, 1995. [23] K.-D. Kim, P. R. Kumar, and K.-D. Kim, “Real-Time Middleware for Networked Control Systems and Application to an Unstable System,” IEEE Transactions on Control Systems Technology, vol. 21, no. 5, pp. 1898–1906, 2013. [24] I. Sattar, M. Shahid, and N. Yasir, “Multi-Level Queue with Priority and Time Sharing for Real Time Scheduling,” International journal of multidisciplinary sciences and engineering, vol. 5, no. 8, pp. 14–17, 2014. [25] V. Chahar, I. O. Bound, F. Come, F. Served, and R. Robin, “Fuzzy Based Multilevel Queue Scheduling Algorithm,” in Advances in Computing, Communications and Informatics (ICACCI),IEEE, 2013, pp. 115–120. [26] A. Rezaee, A. M. Rahmani, S. Adabi, and S. Adabi, “A fuzzy algorithm for adaptive multilevel queue management with QoS feedback,” in International Conference on High Performance Computing and Simulation, IEEE, 2011, pp. 121–127. 24 https://sites.google.com/site/ijcsis/ ISSN 1947-5500 [1]

International Journal of Computer Science and Information Security (IJCSIS), Vol. 15, No. 1, January 2017

D. Shukla and S. Ojha, “Deadlock index analysis of multi-level queue scheduling in operating system using data model approach,” Computer Science and Telecommunications GESJ, vol. 6, no. 6, pp. 93–110, 2010. [28] D. Shukla, S. Ojha, S. Jain, M. P. Sagar, C. Sc, and M. P. Sagar, “Data Model Approach And Markov Chain Based Analysis Of Multi-Level Queue Scheduling,” Journal of Applied Computer Science & Mathematics, vol. 8, no. 8, pp. 50–56, 2010. [29] H. S. Behera, R. K. Naik, and S. Parida, “Improved Multilevel Feedback Queue Scheduling Using Dynamic Time Quantum and Its Performance Analysis,” International Journal of Computer Science and Information Technologies IJCSIT, vol. 3, no. 2, pp. 3801– 3807, 2012. [30] M. V. P. Rao and K. C. Shet, “Analysis of New Multi Level Feedback Queue Scheduler for Real Time Kernel,” International journal of computational cognition, vol. 8, no. 3, pp. 5–16, 2010. [31] C. Technology, “A simulator based performance analysis of Multilevel Feedback Queue Scheduling,” in 5th International Conference on Computer and Communication Technology,IEEE, 2014, pp. 341–346. [32] I. Rajput and D. Gupta, “A Priority based Round Robin CPU Scheduling Algorithm for Real Time Systems,” International Journal of Innovations in Engineering and Technology (IJIET), vol. 1, no. 3, pp. 1–11, 2012. [33] D. K. Tasoulis and M. N. Vrahatis, “Generalizing the k-Windows clustering algorithm in metric spaces,” Mathematical and Computer Modelling, vol. 46, no. 1–2, pp. 268–277, 2007. [34] P. Grabusts, “The Choice of Metrics for Clustering Algorithms,” Proceedings of the 8th International Scientific and Practical Conference., vol. 11, no. 1, pp. 70–76, 2011. [27]

25

https://sites.google.com/site/ijcsis/ ISSN 1947-5500

Suggest Documents