Top Banner
1.Real Time Systems
18
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: RTOS

1.Real Time Systems

Page 2: RTOS

Presentation Outline

DefinitionsTypesFeatures of Real Time Operating Systems Scheduling Resource Allocation Other Issues

Page 3: RTOS

Real Time System

A system is said to be Real Time if it is required to complete it’s work & deliver it’s services on time.Example – Flight Control System All tasks in that system must

execute on time.

Page 4: RTOS

Hard and Soft Real Time Systems

Hard Real Time System Failure to meet deadlines is fatal example : Flight Control System

Soft Real Time System Late completion of jobs is undesirable but

not fatal. System performance degrades as more &

more jobs miss deadlines Online Databases, Multimedia System,Video

Streaming System

Page 5: RTOS

Some Definitions

Timing constraint: constraint imposed on timing behavior of a job: hard or soft.Release Time: Instant of time job becomes available for execution. If all jobs are released when the system begins execution, then there is said to be no release time Deadline: Instant of time a job's execution is required to be completed. If deadline is infinity, then job has no deadline. Absolute deadline is equal to release time plus relative deadline Response time: Length of time from release time to instant job completes.

Page 6: RTOS

Tasks and Jobs: Definitions

A task is like a process or thread in an OS.

Task─ term used for the process in the RTOSes for the embedded systems.

For example, VxWorks and μCOS-II are the RTOSes, which use the term task.Job (Jij): Unit of work, scheduled and

executed by system.

Page 7: RTOS

Features of RTOS’s

Scheduling.

Resource Allocation.

Interrupt Handling.

Other issues like kernel size.

Page 8: RTOS

Other Features Of RTOS’s

1. Real-Time Operations i.e. Perform immediate operations when needed2. Low Power Consumption, i.e. no power consumption when not doing any work3. RTOS usually has the basic and common features of OS to eliminate complexity.4. Simple device interface.

Page 9: RTOS

Scheduling in RTOS

More information about the tasks are known No of tasks Resource Requirements Release Time Execution time Deadlines

Being a more deterministic system better scheduling algorithms can be devised.

Page 10: RTOS

Scheduling Algorithms in RTOS

Clock Driven Scheduling

Weighted Round Robin Scheduling

Priority Scheduling (Greedy / List / Event Driven)

Page 11: RTOS

Scheduling Algorithms in RTOS (contd)

Clock Driven All parameters about jobs (release

time/ execution time/deadline) known in advance.

Schedule can be computed offline or at some regular time instances.

Minimal runtime overhead. Not suitable for many applications.

Page 12: RTOS

Scheduling Algorithms in RTOS (contd)

Weighted Round Robin Jobs scheduled in FIFO manner Time quantum given to jobs is proportional to

it’s weight Example use : High speed switching network

QOS guarantee. Not suitable for precedence constrained jobs.

Job A can run only after Job B. No point in giving time quantum to Job B before Job A.

Page 13: RTOS

Scheduling Algorithms in RTOS (contd)

Priority Scheduling (Greedy/List/Event Driven)

Processor never left idle when there are ready tasks

Processor allocated to processes according to priorities

Priorities static - at design time Dynamic - at runtime

Page 14: RTOS

Priority Scheduling

Earliest Deadline First (EDF) Process with earliest deadline given highest priority

Least Slack Time First (LSF):-Least Slack Time (LST) scheduling is a scheduling algorithm. It assigns priority based on the slack time of a process. Slack time is the amount of time left after a job if the job was started now. 

slack = relative deadline – execution left

Rate Monotonic Scheduling (RMS):-In computer science, rate-monotonic scheduling (RMS) is a scheduling algorithm used in real-time operating systems with a static-priority scheduling class. The static priorities are assigned on the basis of the cycle duration of the job: the shorter the cycle duration is, the higher is the job's priority.

Page 15: RTOS

Resource Allocation in RTOS

Resource Allocation The issues with scheduling applicable here. Resources can be allocated based on

Weighted Round Robin Priority Based

Some resources are non preemptible Example : semaphores

Priority Inversion if priority scheduling is used

Page 16: RTOS

Priority inversion

priority inversion is a problematic scenario in scheduling in which a high priority task is indirectly preempted by a medium priority task effectively "inverting" the relative priorities of the two tasks.

Page 17: RTOS

Solutions to Priority Inversion

Non Blocking Critical Section Higher priority Thread may get blocked by

unrelated low priority thread

Priority Ceiling Each resource has an assigned priority Priority of thread is the highest of all priorities

of the resources it’s holding

Priority Inheritance The thread holding a resource inherits the

priority of the thread blocked on that resource

Page 18: RTOS

Other RTOS issues

Interrupt Latency should be very small Kernel has to respond to real time

events Interrupts should be disabled for

minimum possible time

For embedded applications Kernel Size should be small Should fit in ROM