27
Real Time System T S PRADEEP KUMAR VIT University

Real time system tsp

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Real time system tsp

Real Time System

T S PRADEEP KUMAR

VIT University

Page 2: Real time system tsp

2

Key points

Real Time System and its types Characteristics Scheduling Strategies RTOS Concepts

Page 3: Real time system tsp

3

What is Real Time System (RTS)

A real-time system is any information processing system which has to respond to externally generated input stimuli within a finite and specified period the correctness depends not only on the

logical result but also the time it was delivered

failure to respond is as bad as the wrong response!

Page 4: Real time system tsp

4

Terms Associated with RTS

Tasks Periodic

Time-driven. Characteristics are known a priori E.g.: Task monitoring temperature of a patient in an ICU.

Aperiod Event-driven. Characteristics are not known a priori E.g.: Task activated upon detecting change in patient’s

condition

Sporadic Aperiodic tasks with known minimum inter-arrival time.

Page 5: Real time system tsp

5

Terms Associated with RTS

Release time of a job: The time instant the task becomes ready to execute.

Deadline of a job: The time instant by which the task must complete

execution. Relative deadline of a job:

Deadline - Release time. Response time of a job:

Completion time - Release time.

Page 6: Real time system tsp

6

Example

Page 7: Real time system tsp

7

Types of RTS

Hard real-time — systems where the responses occur within the required deadline. Eg.Nuclear Reactor control Systems.

Soft real-time — systems where deadlines are important but which will still function correctly if deadlines are occasionally missed.

Firm real-time — systems which are soft real-time but in which there is no benefit from late delivery of service.

Page 8: Real time system tsp

8

Hard RTS Vs Soft RTS

Characteristics Hard RTS Soft RTS

Response Time Hard- Required

Soft- required

Peak Load Performance

Predictable Degraded

Controlled by Environment Computer

Safety Critical Non Critical

Size of Data Small Large

Error Detection Autonomous User Assisted

Page 9: Real time system tsp

9

Real Time Spectrum

Page 10: Real time system tsp

10

Characteristics of RTS

Deterministic Operations are performed at predetermined times or

within predetermined time intervals

Responsiveness How long, after acknowledgment, it takes the

operating system to service the interrupt Includes amount of time to begin execution of

the interrupt Includes the amount of time to perform the

interrupt

Page 11: Real time system tsp

11

Characteristics…

User control User specifies priority What processes must always reside in

main memory Rights of processes

Reliability Degradation of performance may have

catastrophic consequences

Page 12: Real time system tsp

12

Characteristics…

Fail-soft operation Ability of a system to fail in such a way as

to preserve as much capability and data as possible

Stability

Page 13: Real time system tsp

13

Typical RTS Task Model

Each task a triplet: (execution time, period, deadline)Usually, deadline = period Can be initiated any time during the period P=(2,8,8)

Page 14: Real time system tsp

14

Scheduling Algorithms

Cyclic Executive (Round Robin) Static Priority or offline scheduling

Rate Monotonic Scheduling Deadline=period

Deadline Monotonic Scheduling Deadline ≠period

Dynamic Priority or online scheduling Earliest Deadline First

Page 15: Real time system tsp

15

Preemptive and Non preemptive Schedule

Preemptive Schedule The higher priority task activated when it requires the

CPU while the low priority task suspended during the time in which the higher priority tasks run.

Most of the RTOS provides preemptive schedule

Non Preemptive Schedule The Low priority task will never suspend when any

higher priority task require the CPU time.

Page 16: Real time system tsp

16

Cyclic Executive

Simplest approachfor (;;)

{

do part of task 1

do part of task 2

do part of task 3

}

Page 17: Real time system tsp

17

Cyclic Executive

Advantages Simple implementation Very predictable

Disadvantages Can’t handle sporadic events Everything must operate in lockstep Code must be scheduled manually

Page 18: Real time system tsp

18

Rate Monotonic Scheduling (RMS)

Processes with shorter period given higher priority, deadline=period

Works for Periodic tasks RMS Schedule can exists if

Processor Utilization U < n(21/n-1), where U=Σci/pi

if U > 1, then no processor can be running 110% of the time.

Page 19: Real time system tsp

19

Rate Monotonic Scheduling

Each process has a fixed priority based on its frames/second, value (hence, rate monotonic)

Select always the highest priority process Rule:

Each periodic process must complete within its period

If a high priority process becomes ready for execution at any time, it preempts the running process if there is any

optimal, static, priority-driven real-time scheduling algorithm for preemptive, periodic jobs optimal, in the sense that no other static algorithm can schedule

a set of tasks that RM cannot schedule

Page 20: Real time system tsp

20

RMS Scheduling

Five assumptions necessary: all tasks with deadlines are periodic; each task must be completed, before the

next request occurs; all tasks are independent; run-time for each request of a task is

constant; any non-periodic task has no required

deadline

Page 21: Real time system tsp

21

RMS Example

Page 22: Real time system tsp

22

RMS Example 2

Task set: Ti = (ci, di, pi)

T1 = (2,6,6) and T2 = (4,10,10)

Schedulability check:

2/6 + 4/10 = 0.33 + 0.40 = 0.73 ≤ 2(√2 -1) = 0. 82

T11 T1

2

0 2 6 8 10

T21 T2

2

0 2 6 10

T1

T2

Hole

Background scheduling: basic

idea --Scheduling

aperiodic tasks in holes like this

Schedule continues

Page 23: Real time system tsp

23

Earliest Deadline First (EDF)

Earliest Deadline First (EDF) Online Preemptive Dynamic priorities Always run the process that is closest to its deadline

• Requirements: Pi has a max computation time ei the process must be finished before its deadline processes are independent (do not share resources) the process with shortest absolute deadline (di) will run first

Page 24: Real time system tsp

24

EDF Example

Page 25: Real time system tsp

25

EDF Schedule

Earliest deadline first scheduling is optimal: If a dynamic priority schedule exists, EDF

will produce a feasible schedule EDF schedule usually achieves 100%

processor utilisation. If a schedule is not feasible under EDF

algorithm, then there is no other algorithm to give a feasible schedule

Page 26: Real time system tsp

26

Comparison between Static and dynamic Scheduling

RMA only guarantees feasibility at 69% utilization.

EDF guarantees it at 100% EDF is complicated enough to have

unacceptable overhead More complicated than RMA Less predictable: can’t guarantee which

process runs when

Page 27: Real time system tsp

27

Questions!!!