Вы находитесь на странице: 1из 19

INTRODUCTION

The study of real-time scheduling had regained interest this last decade with the continuous
introduction of multiprocessor architectures. Multiple approaches have been used to handle those
architectures. A first approach, called partitioning, consists of splitting the task set into subsets.
Each of these subsets is allocated to a unique processor on which a mono-processor scheduler is
then run. In contrast, a second approach, called global scheduling, allows tasks to migrate from
processor to processor.
Areas such as automotive, avionics, telecommunication, and consumer
electronics are examples where real-time embedded systems can be vastly found. In a real-time
system, the correctness of the system depends not only on its logical behavior, but also on the
time in which the computation is performed. The main distinction is between soft real-time
(SRT) and hard real-time (HRT) systems. In both, applications are typically realized as a
collection of real-time tasks associated with timing constraints and scheduled according to a
chosen scheduling algorithm.
A simulation tool, called SimSo (SImulation of Multiprocessor
Scheduling with Overheads) that is designed to be easy to use and able to take into account the
specificities of the system, starting with LRU caches, context-save/load overheads and
scheduling overhead. SimSo1 is an open source tool, actively developed, designed to facilitate
the study of the behavior of schedulers for a class of task systems and a given hardware
architecture. Deals with SimSo, the tool to simulate multiprocessor real-time schedulers and that
aims at facilitating the design of experimental evaluations.

Chapter 2
Task

In computer programming, a task is a basic unit of programming that an operating system


controls. Task is also referred as process. [1]

2.1 Characteristics of Task :

i.

Arrival time (a ): The time when a task arrives. As shown in fig 2.1.1

ii.

Start time (s ): The time at which execution of the task begins. As shown in fig 2.1.1
i

iii.

Computation time (c ): The time required to complete a task. As shown in fig 2.1.1
i

iv.

Finishing time: Time at which the computation of the task is completed . As shown

in fig 2.1.1

v.

Absolute Deadline (d ): The maximum time a task can take for execution. As shown
i
in fig 2.1.1

vi.

Relative deadline: The maximum time allocated to a task relative to the arrival time.
[1]

3
si

di

Ci

ai

10

I/O Request

I/O Complete

Fig. 2.1.1
SCHEDULER

2.2 Process or task states

INTERRUPT

A task can be in any of the three states


i)

Running: a task is executing on the CPU.

ii)

Ready: a task is ready to be executed but the CPU is busy executing another task
or even OS routines.

iii)

Waiting: the task is waiting for an event, probably waiting for an I/O operation to
be finished. As shown in the figure 2.2.1. [1]

Fig. 2.2.1
3

Chapter 3
Scheduling
In computing, scheduling is a method by which work specified by some means is assigned to
resources that complete the work. The work may be virtual computation elements like threads,
processes or data flows. A scheduler is what carries out the scheduling activity. [1]

3.1 Scheduling Algorithm


The types of scheduling algorithm are:
3.1.1 Rate Monotonic
The Rate Monotonic (RM) scheduling algorithm is a simple rule that assigns priorities to tasks
according to their request rates. Specifically, tasks with higher request rates (that is, with shorter
periods) will have higher priorities. Since periods are constant, RM is a fixed-priority
assignment: a priority Pi is assigned to the task before execution and does not change over time.
Moreover, RM is intrinsically pre-emptive: the currently executing task is pre-empted by a newly
arrived task with shorter period. [1]
Task 1 is assigned with higher priority than Task 2

0 1 2 3 4 5

0 1 2 3 4 5
Fig. 3.1.1
4

Task 2 assigned with higher priority than Task 1.

1
2
Fig. 3.1.2
Characteristics of Rate Monotonic

They are preemptive.


They are uni-processor.
They are of static priority.
They have hard deadline.
They are always online. [1]

3.1.2 Cyclic Executive


Timeline Scheduling (TS), also known as a Cyclic Executive, is one of the most used approaches
to handle periodic tasks in defence military systems and traffic control systems. The method
consists of dividing the temporal axis into slots of equal length, in which one or more task be
allocated for execution, in such a way to respect the frequencies derived from the application
requirements. A timer synchronizes the activation of the tasks at the beginning of each time slot.

In order to illustrate this consider 3 tasks in which three tasks, A, B and C, need to be executed
with a frequency of 40, 20 and 10 Hz, respectively. it is easy to verify that the optimal length for
the time slot is 25 ms, which is the Greatest Common Divisor of the periods. Hence, to meet the
required frequencies, task A needs to be executed in every time slot, task B every two slots, and
task C every four slots.
The duration of the time slot is also called a Minor Cycle, whereas the
minimum interval of time after which the schedule repeats itself (the hyper period) is also called
a Major Cycle. [2]
5

4
0
1

Fig. 3.2.1
Characteristics of Cyclic Executive

They are uni-processor.


They are always primitive.
They are clock driven.
They have hard deadline.
They are always offline. [2]

3.1.3. EDF (Earliest Deadline First)


The Earliest Deadline First (EDF) algorithm is a dynamic scheduling rule that selects tasks
according to their absolute deadlines. Specifically, tasks with earlier deadlines will be executed
at higher priorities.

EDF is a dynamic priority assignment. Moreover, it is typically executed in preemptive


mode, thus the currently executing task is pre-empted whenever another periodic instance with
earlier deadline becomes active. [2]

1 (1,4)
2 (2,5)
3 (2,7)
C2 can be increased
Fig . 3.3.1
Characteristics of EDF

They are uni-processor, pre-emptive, dynamic priority, online and hard deadline.
Applicable to both periodic as well as aperiodic tasks.
The scheduler always schedules the active task with the closest absolute deadline. [2]

Chapter 4
SIMSO

Davis and Burns referenced more than thirty real-time multiprocessor scheduling algorithms in
2011 and more than a dozen of new algorithms have emerged since then. Such a large number of
scheduling algorithms makes their evaluation and comparison difficult. The evaluation generally
comes from theoretical analysis, simulation or an actual implementation, according to criteria
that can include utilization bounds, success rates, number of preemptions, migrations, and/or
algorithm complexity.
A simulation tool, called SimSo (SImulation of Multiprocessor Scheduling with
Overheads) that is designed to be easy to use and able to take into account the specificities of
the system, starting with LRU caches, context-save/load overheads and scheduling overhead.
SimSo1 is an open source tool, actively developed, designed to facilitate the study of the
behavior of schedulers for a class of task systems and a given hardware architecture. Deals with
SimSo, the tool to simulate multiprocessor real-time schedulers and that aims at facilitating the
design of experimental evaluations. [3]

4.1 Context
The context of real-time multiprocessor scheduling and its relevant models is presented.
A real-time application is composed of tasks, i.e. programs to be run on a hardware
architecture made of a limited number of processors. Real-time means that the computing of
tasks has to meet time constraints (typically release times and deadlines). The scheduler is a

software system component whose purpose is to decide at what time and on which processors
tasks should execute. Therefore, a real-time scheduler takes its decisions according to the
urgency of the tasks. [3]

4.1.1 Task
In this model, a great abstraction is made since a task is simply viewed as a computation time.
This means that its functional behavior is ignored A task can be respectively periodic, sporadic,
or aperiodic depending on its inter-activation delay, respectively constant, minimum, or
unknown. A task activation gives rise to the release of a job (an instance of the task) that must
complete before a given deadline date. [3]

4.1.2 Processors
Symmetric multiprocessing hardware architectures (SMP) are considered, which the most
common multiprocessor design is nowadays. In such architecture, the processors are identical
and share a single main memory. [3]

4.1.3 Scheduler
Among the various scheduling strategies, one distinguishes time- and event-triggered ones
depending on the conditions in which the scheduler is invoked, either a rescheduling has to be
made at specified instants, or when a job completes or a new one is released. [4]

4.2 Implementation
4.2.1 Discrete-event Simulation

The core of the simulator has been implemented using SimPy (SimPy Developer Team, 2012), a
process based discrete-event simulation library for Python. The advantage of a discrete-event
simulation over a fixed-step one is that it is possible to handle short durations (such as a contextswitch overhead) as well as long durations (such as a job execution) with the same computational
cost. [4]
9
According to SimPys vocabulary, a Process is an entity that can wait for a signal, a
condition or a certain amount of time. When it is not waiting, a Process can execute code, send
signals or wake up other processes. This Process state is called active, opposed to passive. A
Process is activated by another Process or by the simulation main class itself. [4]
4.2.2 Architecture
The main classes and their mutual interactions are represented in Figure 1 and described below :
i)

Model is the simulation entry point, it will instantiate and launch the processors and
the tasks as active Processes. It will also call the init method of the scheduler so that

ii)

it can initialize its data structures and launch timers if needed. [4]
A Task handles the activations of its jobs. The activations are either periodic or
triggered by another task (aperiodic). Depending on a property of the task, the jobs

iii)

that exceed their deadline can be aborted. [4]


A Job simulates, from a time-related aspect only, the execution of the task code. The
execution time model computes its progression. A signal is sent to its running

iv)

processor when it is ready and when its execution is finished.


A Processor is the central part and simulates the behavior of the operating system
running on a physical processor. There is one Processor for each physical processor.
It controls the state of the jobs (running or waiting) in accordance with the scheduler
decisions. It also deals with the events, activation or end of a job, timer timeout,
schedule request, etc. The attribute running of a processor points to the job that is

running (if any). Similarly, as a real system, some actions can induce overheads (e.g.
v)

context switch or scheduling decision) and only affect the concerned processor.
A Timer allows the execution of a method after a delay, periodically or not. On a real
system, this method would run on a physical processor, thereby inducing a context
switch overhead if a job were running on the same processor. This behavior is
reproduced by sending a timer event to the processor. [4]
10

vi)

The Scheduler unlike the previous elements, the scheduler is not a Process object, all
its methods except the init method are called by the Processor objects. [4]

Fig. 4.2.1

11

Chapter 5
Illustration
Problem description, scheduling of a system using the Earliest Deadline First algorithm .

5.1 Input
The six considered tasks are all periodic and synchronous with the start of the simulation. For the
task partitioning phase , a WCET for each task is mandatory. [4]

Period
WCET

T1
20
10

T2
20
9

T3
15
7
Table 5.1.1

T4
15
5

T5
10
6

T6
10
3

Fig. 5.1.1
12

5.2 On execution
On giving the XML file as input the computation behaviour of the task have been simulated and
shown in fig 4.2.1(a) and fig 4.2.1(b)

Fig: 5.2.1(a)
13

Fig: 5.2.1(b)

14

5.3 Gantt Chart


Output of the above computation, and the behaviour of the CPU has been shown by the
following Gantt chart as per the EDF scheduling.

Fig. 5.3.1

15

Conclusion

Simso simulator dedicated to the study of real-time scheduling. It was designed to be easy to
use, fast and flexible. Real-time embedded systems are now a days present in virtually any
environment. It has helped in the fields of automobile, telecommunication and consumer
electronics. To the best of our knowledge, EPOS is the first Real Time Operating System
designed from scratch to support all multicore real-time scheduling variants of EDF, RM, CE
scheduling policies. To support Real time systems a simulator SIMSO has been introduced.
The architecture of SimSo, in particular the scheduling interface, was briefly explained.
Particular care has been taken to keep a realistic scheduling interface so that practical decisions
are not eluded. This has also enabled SimSo to take into consideration direct overheads such as
the context-switches or scheduling decisions. Moreover, a model that can be selected depending
on the purpose of the simulation determines the computation time of the jobs.

16

Вам также может понравиться