P RESENTATION T IME O PERATING S YSTEMS (P RIORITY- DRIVEN S CHEDULING OF P ERIODIC TASKS

)
ON R EAL

Presented by: Dalia Sobhy Presented to : Dr. Fatma Zada

2

W HAT ARE R EAL - TIME S YSTEMS ?

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. .

3 T YPES OF R EAL T IME S YSTEMS .

A hard real-time system is a system where a late result (not reacting to an event within a strict timeframe) may lead to critical or catastrophic failures such as physical damage or loss of life. car engine control system. car airbag. nuclear power station. Some examples of hard real-time systems: Heart pacemaker. EW system. car braking system. .

Some examples of soft real-time systems: DVD player. A soft real-time system is a system that will tolerate lateness with decreased service quality. programmable thermostat. mobile telephone. . video game console. but no critical consequences.

4 A S AMPLE R EAL T IME S YSTEM (1) .

5 A S AMPLE R EAL T IME S YSTEM (2) .

Eyes and Ears of the driver.Cameras.Computer: Sensors . Controlling System . and Infrared receiver.Human driver: Sensors . . Controlled System: Car. . Mission: Reaching the destination safely. Operating environment: Road conditions.

.

.

.

6 R EAL T IME O PERATING S YSTEM (RTOS) K ERNEL .

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. Application Software RTOS Hardware .

7 RTOS K ERNEL F UNCTIONS .

8 TASK M ANAGEMENT .

. 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.

Can make them run in a very timely and responsive fashion. Main service offered is Task Scheduling Controls the execution of application software tasks. .

9 TASK S WITCH .

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 should continue to run. Allow the selected task to run. Set up the running environment of the task that will run next. Determine which task should run next. Save the environment of the task that was stopped (so it can continue later). .

10 I NTERTASK C OMMUNICATION & S YNCHRONIZATION .

These services makes it possible to pass information from one task to another without information ever being damaged. .

Makes it possible for tasks to coordinate & productively cooperate with each other. .

11 M ESSAGE PASSING IN RTOS .

the OS copies a pointer to the message delivers the pointer to the message-receiver task. In RTOS. Message Sender Task Message Message Receiver Task Message RTOS RAM msg_ptr msg_ptr . and then deletes the copy of the pointer with message-sender task.

12 T YPES OF S CHEDULING A LGORITHMS .

. 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 to move into the ready state and allow a higher prioritized process to run.

13 TASK S CHEDULING .

it completes its full execution. Non Real -time systems usually use Nonpreemptive Scheduling Once a task starts executing. .

Basic rules for priority based preemptive task scheduling . Most RTOS perform priority-based preemptive task scheduling.

The Highest Priority Task that is Ready to Run. . will be the Task that Must be Running.

14 P RIORITY BASED P REEMPTIVE TASK S CHEDULING .

. Every Task in a software application is assigned a priority.

Higher Priority = Higher Need for Quick Response. .

. Follows nested preemption.

15 N ESTED P REEMPTION Timeline for Priority-based Preemptive Scheduling .

16 T YPES OF P RIORITY A LGORITHMS .

. 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.

17 P RIORITY BASED P REEMPTIVE TASK S CHEDULING (C ONT · D ) .

FIFO Job queue is first-in-first-out by release time. . Least slack time first. LIFO Job queue is last-in-first-out by release time. Real-time priority scheduling assigns priorities based on deadline or some other timing constraint: Earliest deadline first.

18 E ARLIEST DEADLINE FIRST (EDF) .

. Assign priority to jobs based on deadline.

. Earlier the deadline. higher the priority.

Simple. . just requires knowledge of deadlines.

19 E XAMPLE .

Consider 3 periodic processes scheduled using EDF. Compute the Utilization. the following acceptance test shows that all deadlines will be met. .

Process P1 P2 P3 Execution Time (C) 1 2 4 Period = T 8 5 10 .

20 E XAMPLE (C ONT · D ) .

Rule : .

925 = 92. . The utilization will be: (1/8) + (2/5) + (4/10) = 0.5%.

The theoretical limit for any number of processes is 100% and so the system is schedulable. .

21 L EAST S LACK T IME FIRST (LST) .

.

execution time ei. and was released at time ri.(t . A job Ji has deadline di.ri) Slack time tslack = di .t trem . At time t < di: Remaining execution time trem = ei .

Assign priority to jobs based on slack time. tslack .

. Slack time is the amount of time left after a job if the job was started now.

The smaller the slack time. Knowing the actual execution time is often difficult a priori. since it depends on the data. the higher the priority. need to use worst case estimates ( poor performance) .

22 O PTIMALITY OF EDF AND LST .

e. as long as preemption is allowed and jobs do not contend for resources. Constraints: on a single processor. These algorithms are optimal i. . they will always produce a feasible schedule if one exists.

23 R ELATIVE M ERITS .

.

and dynamic-priority scheduling algorithms have different properties. Fixed. . neither appropriate for all scenarios. LIFO. Algorithms that do not take into account the urgencies of jobs in priority assignment usually perform poorly Ex: FIFO.

. The EDF algorithm gives higher priority to jobs that have missed their 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 in cases where RM and DM cannot But fixed priority algorithms often more predictable. . lower overhead.

ANY QUESTIONS? .

THANK YOU ! .

Sign up to vote on this title
UsefulNot useful