real timeos updated
TRANSCRIPT
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 1/25
Presented by: Dalia Sobhy
Presented to : Dr. Fatma Zada
PRESENTATION
ON
R EAL TIME OPERATING SYSTEMS
(PRIORITY-DRIVEN SCHEDULING
OF PERIODIC TASKS)
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 2/25
WHAT ARE R EAL-TIME
SYSTEMS ?
Real-time systems
Those systems in which the correctness of the
system depends not only on the logical result of
computation, but also on the time at which the
results are produced.
2
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 3/25
TYPES OF REAL TIME
SYSTEMS3
A hard real-time system is a system where a lateresult (not reacting to an event within a stricttimeframe) may lead to critical or catastrophic failures
such as physical damage or loss of life. Some examples of hard real-time systems: Heart
pacemaker, car engine control system, car airbag, carbraking system, nuclear power station, EW system.
A soft real-time system is a system that will toleratelateness with decreased service quality, but no criticalconsequences.
Some examples of soft real-time systems: DVD player,video game console, programmable thermostat,mobile telephone.
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 4/25
A SAMPLE REAL TIME
SYSTEM (1)4
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 5/25
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 6/25
REAL TIME OPERATING
SYSTEM(RTOS) KERNEL
RTOS Kernel provides an Abstraction layer that
hides from application software, the hardware
details of the processor / set of processors upon
which the application software shall run.
6
Application Software
RTOS
Hardware
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 7/25
RTOS KERNEL FUNCTIONS7
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 8/25
TASK MANAGEMENT
Set of services used to allow application software
developers to design their software as a number of
separate chunks of software where
Each handles a distinct topic, a distinct goal, and
sometimes its own real-time deadline.
Main service offered is Task Scheduling
Controls the execution of application software tasks.
Can make them run in a very timely and responsive
fashion.
8
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 9/25
TASK SWITCH
Each time the priority-based preemptive scheduler
is alerted by an External world trigger / Software
trigger it shall go through the following steps that
constitute a Task Switch:
Determine whether the currently running task shouldcontinue to run.
Determine which task should run next.
Save the environment of the task that was stopped (so itcan continue later).
Set up the running environment of the task that will runnext.
Allow the selected task to run.
9
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 10/25
INTERTASK COMMUNICATION &
SYNCHRONIZATION
These services makes it possible to passinformation from one task to another
without information ever beingdamaged.
Makes it possible for tasks to coordinate& productively cooperate with eachother.
10
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 11/25
MESSAGE PASSING IN RTOS
In RTOS, the OS copies a pointer to the messagedelivers the pointer to the message-receiver task,and then deletes the copy of the pointer with
message-sender task.
11
Message Sender
Task
RAM
Message Receiver
Task RTOS
msg_ptr
msg_ptr
Message Message
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 12/25
TYPES OF SCHEDULING
ALGORITHMS Non-preemptive:
Picks a process to run and will allow it
to run forever until it chooses to end.
Preemptive:
Allows the process to run, but at
anytime it can force the process tomove into the ready state and allow a
higher prioritized process to run.
12
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 13/25
TASK SCHEDULING
Non Real -time systems usually use Non-
preemptive Scheduling
Once a task starts executing, it completes its full
execution.
Most RTOS perform priority-based preemptive task
scheduling.
Basic rules for priority based preemptive taskscheduling
The Highest Priority Task that is Ready to Run, will
be the Task that Must be Running.
13
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 14/25
PRIORITY BASED PREEMPTIVE
TASK SCHEDULING
Every Task in a software application is
assigned a priority.
Higher Priority = Higher Need for Quick
Response.
Follows nested preemption.
14
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 15/25
NESTED PREEMPTION15
Timeline for Priority-based Preemptive Scheduling
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 16/25
TYPES OF PRIORITY
ALGORITHMS
Fixed-priority algorithms:
Task-Level: Jobs in a task assigned the same priority.
Job-Level: The priority of each job is fixed.
Dynamic-Priority Algorithms:
Task-Level: Jobs in a task assigned different priorities.
Job-Level: The priority of each job is dynamic.
16
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 17/25
PRIORITY BASED PREEMPTIVE
TASK SCHEDULING (CONT·D)
Real-time priority scheduling assigns priorities based on
deadline or some other timing constraint:
Earliest deadline first.
Least slack time first.
FIFO Job queue is first-in-first-out by release time.
LIFO Job queue is last-in-first-out by release time.
17
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 18/25
EARLIEST DEADLINE
FIRST(EDF)
Assign priority to jobs based on deadline.
Earlier the deadline, higher the priority.
Simple, just requires knowledge of deadlines.
18
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 19/25
EXAMPLE
Consider 3 periodic processes scheduled using EDF, the
following acceptance test shows that all deadlines will
be met.
Compute the Utilization.
19
Process Execution Time (C) Period = T
P1 1 8
P2 2 5
P3 4 10
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 20/25
EXAMPLE (CONT·D)
Rule :
The utilization will be:
(1/8) + (2/5) + (4/10) = 0.925 = 92.5%.
The theoretical limit for any number of processes is 100%and so the system is schedulable.
20
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 21/25
LEAST SLACK TIME FIRST
(LST)
A job Ji has deadline d i , executi on time ei , and wasreleased at time r i.
At time t < d i :
Remaining executi on time trem = ei - ( t - r i )
Slack time t slack = d i - t trem
Assign pri ority t o j obs based on slack time, t slack
Slack time is the amount o f time left after a j ob if the j ob
was started now. T he smaller the slack time, the higher the pri ority.
Knowing the act ual executi on time is o ften difficult a pri ori,since it depends on the data, need t o use w orst caseestimates ( poor perf ormance)
21
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 22/25
OPTIMALITY OF EDF AND
LST
These algorithms are optimal
i.e. they will always produce a feasible schedule if one
exists.
Constraints: on a single processor, as long as
preemption is allowed and jobs do not contend for
resources.
22
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 23/25
RELATIVE MERITS
Fixed- and dynamic-priority scheduling algorithms havedifferent properties; neither appropriate for all scenarios.
Algorithms that do not take into account the urgencies of jobsin priority assignment usually perform poorly
Ex: FIFO, LIFO.
The EDF algorithm gives higher priority to jobs that have missedtheir deadlines than to jobs whose deadline is still in the future
Not necessarily suited to systems where occasional
overload unavoidable.
Dynamic algorithms like EDF can produce feasible schedules incases where RM and DM cannot
But fixed priority algorithms often more predictable, loweroverhead.
23
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 24/25
ANY Q UESTIONS?
8/3/2019 Real TimeOS Updated
http://slidepdf.com/reader/full/real-timeos-updated 25/25
THANK YOU !