Download - Real time-system
REAL TIME SYSTEM
A Real Time System is any information processing system which has to respond to externally generated input stimuli within a finite & specified period.
In real time computing , the correctness of the computation depends not only on the logical results but also on the time at which the results are produced.
In RTS a substantial fraction of the design effort goes into making sure that the task deadlines are met.
A Deadline is a given time after a triggering event , by which a response has to be completed.
RTS ON THE BASIS OF DEADLINES
1. Hard real time
systems 2. Soft real time systems
Hard Real Time SystemsSystem should meets the timings constraints.Response time overrun leads to disastrous damage
Example : Flight Control System
SOFT REAL TIME SYSTEMS Deadline overruns are tolerable, but
not desired. There are no catastrophic
consequences of missing one or more deadlines.
Example : Multimedia System
ISSUES IN RTS
Operating System Issues
Architectural Issues
Other Issues
SCHEDULABILITY
By task scheduling , we means that a computer’s resources must be shared out equitably among the users.
In general-purpose system , Round robin scheduling is used , which ensures that user does not get a disproportionate share of the computer’s services.
But Round robin scheduling approach does not work in Real Time applications because priority scheduling makes the difference in the two.
CHARACTERSTICS
Computation
Offline (precomputed)
Online (Dynamically)
Scheduling
Preemptive
NonPreemptive
ASSUMPTIONS MADE IN RTS SCHEDULING
A1. No task has any non- preempt able section & cost of preemption is negligible.
A2. Only processing requirements are significant; memory, I/O & other resource requirements are negligible.
A3. All tasks are independent.
A4. The deadline of a task is equal to its period.
A5. All the tasks in the task set are periodic.
Earliest Deadline First (EDF)
Optimal uniprocessor algorithm Also known as Deadline Monotonic
Scheduling algorithm Tasks are preemptable Dynamic priorities Scheduler picks task , whose deadline
is due next A set of tasks is schedulable ( in hard
real time sense ) , if the total processor utilization is not greater than 1.
NECESSARY & SUFFICIENT CONDITION
In EDF , for a task set is said to be schedulable is if it satisfy the following necessary and sufficient condition : Σ(i=1 to n) ei / pi
≤ 1
Example
Consider 3 periodic processes scheduled using EDF, the following acceptance test shows that all deadlines will be met.
ProcessExecution Time =
ei
Period = pi
P1 1 8
P2 2 5
P3 4 10
The utilization will be:
U = { ( 1/8 ) + ( 2/5 ) + ( 4/10 ) }
= 0.925 ( or 92.5 % )
The theoretical limit for any number of processes is 100% ( or less than 1 ) and so the system is schedulable .
EDF Revisited: Schedulability test
Different possible scenarios
If di ≥ pi If di < pi
∑ ei/pi ≤ 1 ∑ ei/di ≤ 1
Necessary and sufficient
Sufficient but NOTnecessary
Processor demand Based test
Fail
Schedulable
Pass
Necessary and sufficient
•Optimality•Reduces
number of task switches
ADVANTAGES
•Deteriorates badly under overload
•Scheduling is more expensive
•Needs smarter scheduler
DRAWBACKS
Rate Monotonic Algorithm (RMA)
Static priority based algorithm : tasks scheduled according to priorities
Classical uniprocessor scheduling algorithm
Also called Liu-Layland algorithm or Clock driven uniprocessor algorithm
Tasks are pre-emptable
STATEMENT
It says that if the total utilization of the task is not greater than n(21/n -1) where n stands for number of tasks to be scheduled then RM algorithm will schedule all the task to meet their respective deadlines.
The RMA assigns priorities to the tasks based on their rate of occurrence, i.e. the lower the occurrence rate of the task the lower the priority assigned to it.
In RMA the priority of the task is directly proportional to its rate of occurrence or it is inversely proportional to the period
NECESSARY CONDITION
A set of periodic real time tasks would not be RMA schedulable unless they satisfy the following necessary condition:-
Σ(i=1 to n) Ui = Σ(i=1 to n) ei / pi ≤ 1
SUFFICIENT CONDITION
Also referred to as Liu and Layland’s condition.
It implies that a set of ‘n’ real time periodic tasks are schedulable under RMA if :
Σ(i=1 to n) Ui ≤ n (21/n -1)
If the set of tasks satisfies this sufficient condition then it is guaranteed that the set of tasks would be RMA schedulable.
CASES :Consider the case when • there is only 1 task in the system, i.e., n=1
U1 = 1• there is 2 tasks in the system, i.e., n=2
U2 = 0.824• n=∞, applying L’Hospitals Rule
ln 2 = 0.69
CONCLUSION:From above computation it is clear that maximum CPU utilization that can be achieved under RMA is 1.
EXAMPLE
TASK EXECUTION TIME
PERIOD
T1 20 100
T2 30 150
T3 60 200
Consider 3 tasks to be scheduled using RMA, the following acceptance test determines whether that all deadlines will be met or not.
SOLUTION
Checking for the NECESSARY CONDITION :
Σ(i=1 to n) Ui = Σ(i=1 to n) ei / pi ≤ 1
U1 0.2
U2 0.2
U3 0.3
Σ(i=1 to 3) U 0.7
Checking for the SUFFICIENT CONDITION :
Σ(i=1 to n) Ui ≤ n(21/n -1)
For n=3,n(21/n -1) = 3(21/3 -1) = 0.78 < 1
Ui = 0.7 < 0.78
Hence, sufficient condition is satisfied.Therefore, all the given three tasks are schedulable under RMA.
•possesses good transient overload handling
Advantages
•difficult to support aperiodic and sporadic tasks
•not optimal when task periods and deadlines differ
Disadvantages
EDF RMA
EDF is also called Deadline-Monotonic Scheduling algorithm
Dynamic priority algorithm
Tasks do not have to be periodic
Full processor can be feasibly scheduled, if utilization of task set is no greater than 1
It requires a run time overhead. Deteriorates during overload conditions
RMA is also called Liu-Layland algorithm.
Static priority algorithm
All tasks are assumed to be periodic
It lacks flexibility. For e.g. RMA assumes that tasks are infinitely preempt able.
Simpler implementation, even in systems without explicit support for timing constraints (periods, deadlines)