Final Rtos
Final Rtos
System
Outline
Real-Time System
Task categories
Why we need scheduling
Real time scheduling taxonomies
Scheduling Periodic Tasks
Real-Time Scheduling Algorithms
Static scheduling algorithms
Dynamic scheduling algorithms
Hybrid algorithm
references
Real-Time System
• Real-time systems have been defined as: “those systems
in which the correctness of the system depends not only
on the logical result of the computation, but also on the
time at which the results are produced“
• Correct function at correct time
• Usually embedded
• Deadlines
• Hard real-time systems
• Soft real-time systems
Real Time Tasks
• Task in which performance is judged on the basis of time.
• The result of task are good if has produced within specified time
constraints otherwise system fail or reduced value for the quality of
service.
• Release time (or ready time): This is the time instant at which a
task(process) is ready or eligible for execution
• Schedule Time: This is the time instant when a task gets its chance
to execute
• Completion time: This is the time instant when task completes its
execution
E.g. decoding of video frame may occasionally get delayed by reasons like
unexpected interrupts and the like. when such frames are delivered late,
the playback does not look good. Skipping such frames and making sure
that not too much such frames are delayed will be better. Because effect
will be less noticeable to user than playing back the delayed frames.
Real time tasks
• Periodic
Tasks which are activated regularly at fixed rate
Periodic tasks must execute once per period
Each task is repeated at a regular interval
Max execution time is the same each period
Arrival time is usually the start of the period
Deadline is usually the end
Real time tasks
•Aperiodic
Stream of jobs arriving at irregular intervals
Each task can arrive at any time
• Inter-arrival period between two such tasks can be zero.
• Aperiodic tasks implied to have soft deadlines and aim of
scheduling is to provide fast response time.
Real time tasks
• Sporadic is a an aperiodic task with hard deadline and a
minimum inter-arrival time.
• Without minimum inter-arrival time restriction, it is impossible
to guarantee that a deadline of sporadic task would always be
met.
• E.g. such tasks are emergency conditions like fire
Preemptive and non-Preemptive
tasks
• Preemptive task:
Task which can be preempted if another task of higher priority
becomes ready.
• Non- preemptive:
execution of non-preemptive task should be without
interruption, once started
Preemptive task
Non-preemptive task
Real Time Operating System
• Some embedded applications require only dedicated
hardware and firmware e.g. mp3 player, printer and scanner
etc.
• Such system are called superloop system
• Whole code for systems is written in one loop which executes
continuously.
• When external event come, interrupts are generated to alert
the processor and system respond appropriately.
• There can be no. of inputs and corresponding actuators too.
• code for all these is in flash memory.
Real Time Operating System
• Some embedded system like mobile phone need a manager
• all embedded system need not real –time operating system.
Only where time constraint is a factor real-time OS is required
What does RTOS does?
• RTOS provides abstraction layer between embedded hardware
and application software
• RTOS manages interaction between hardware and
applications.
• RTOS ensures that the multiple tasks that comes in are
managed and done on time.
• OS has a kernel which form core of OS.
Hardware- Software hierarchy
in complex embedded system
Kernel services of RTOS
Real-Time Scheduling Algorithms
Off-line On-line
Static Dynamic
Priortity Priority
Rate Deadline
Monotonic Monotonic Earliest
Least Laxity
scheduling scheduling Deadline
First
First
Off Line Scheduling (Pre Run time
scheduling)
• They generate scheduling information prior to system
execution (Deterministic System Model)
• This scheduling is based on :
• Release time
• Deadlines
• Execution
Scheduling algo can use precise schedule which optimizes several
different measures and optimal algo can be used which
guarantee very good system performance.
E.g. Fixed factory jobs where nothing changes under normal
conditions can use this approach
• Disadvantage: Inflexibility, If any parameter changes, the
policy will have to be redone
On-Line Scheduling
• Number and types of tasks, associated parameters are not
known in advance.
• Scheduling must accommodate
• dynamic changes in user demands
• Availability of resources
T1 T2 T3 T1 T3 T1 T3 T2 T1 T3
0 2 6 7 9 14 16 17 21 23 24
• CPU utilization=1/4+2/6+4/9=1.027
Using RM technique