SlideShare a Scribd company logo
1 of 33
Presentation Outline
Definitions
Role of an OS in Real Time Systems
Features of Real Time Operating Systems
 Scheduling
 Resource Allocation
 Interrupt Handling
 Other Issues
Linux for Real Time Systems and RTLinux
rtker – Our own RTOS
Other RTOS’s
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.
Non Example – PC system
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
Qualitative Definition.
Hard and Soft Real Time Systems
(Operational Definition)
Hard Real Time System
 Validation by provably correct procedures or
extensive simulation that the system always meets
the timings constraints
Soft Real Time System
 Demonstration of jobs meeting some statistical
constraints suffices.
Example – Multimedia System
 25 frames per second on an average
Role of an OS in Real Time Systems
Standalone Applications
 Often no OS involved
 Micro controller based Embedded Systems
Some Real Time Applications are huge &
complex
 Multiple threads
 Complicated Synchronization Requirements
 Filesystem / Network / Windowing support
 OS primitives reduce the software design time
Features of RTOS’s
Scheduling.
Resource Allocation.
Interrupt Handling.
Other issues like kernel size.
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.
Scheduling Algorithms in RTOS
Clock Driven Scheduling
Weighted Round Robin Scheduling
Priority Scheduling
(Greedy / List / Event Driven)
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.
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.
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
Priority Scheduling
Earliest Deadline First (EDF)
 Process with earliest deadline given highest
priority
Least Slack Time First (LSF)
 slack = relative deadline – execution left
Rate Monotonic Scheduling (RMS)
 For periodic tasks
 Tasks priority inversely proportional to it’s period
Resource Allocation in RTOS
Resource Allocation
 The issues with scheduling applicable here.
 Resources can be allocated in
 Weighted Round Robin
 Priority Based
Some resources are non preemptible
 Example : semaphores
Priority Inversion if priority scheduling is used
Priority Inversion
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
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
Sophisticated features can be removed
 No Virtual Memory
 No Protection
Linux for Real Time Applications
Scheduling
 Priority Driven Approach
 Optimize average case response time
 Interactive Processes Given Highest Priority
 Aim to reduce response times of processes
 Real Time Processes
 Processes with high priority
 No notion of deadlines
Resource Allocation
 No support for handling priority inversion
Interrupt Handling in Linux
Interrupts are disabled in ISR/critical
sections of the kernel
No worst case bound on interrupt
latency avaliable
 eg: Disk Drivers may disable interrupt for
few hundred milliseconds
Not suitable for Real Time Applications
 Interrupts may be missed
Other Problems with Linux
Processes are non preemtible in Kernel
Mode
 System calls like fork take a lot of time
 High priority thread might wait for a low
priority thread to complete it’s system call
Processes are heavy weight
 Context switch takes several hundred
microseconds
Why Linux
Coexistence of Real Time Applications
with non Real Time Ones
 Example http server
Device Driver Base
Stability
RTLinux
Real Time Kernel at the lowest level
Linux Kernel is a low priority thread
 Executed only when no real time tasks
Interrupts trapped by the Real Time
Kernel and passed onto Linux Kernel
 Software emulation to hardware interrupts
 Interrupts are queued by RTLinux
 Software emulation to disable_interrupt()
RTLinux (contd)
Real Time Tasks
 Statically allocate memory
 No address space protection
Non Real Time Tasks are developed in
Linux
Communication
 Queues
 Shared memory
RTLinux Framework
rtker – Our RTOS
Motivation
 Our own OS
 Full grasp over source code – Easily modifiable, portable
Features
 Modular Design
 Isolation of Architecture/CPU dependent and
independent code – Easy to Port
 Pluggable Scheduler
 Two level Interrupt Handling
 Small footprint
 Oskit’s Device Driver Framework
Pluggable Scheduler
Scheduler - part of the Application
Kernel interacts with the scheduler
through an API
Application developer needs to
implement the scheduler API
 Can optimize on Data Structures &
Algorithms for implementing the scheduler
rtker – Block Diagram
Two Level Interrupt Handling
Two level Interrupt Handling
 Top Half Interrupt Handler
 Called Immediately – Kernel never disables interrupts
 Cannot invoke thread library functions - Race Conditions
 Bottom Half Interrupt Handler
 Invoked when kernel not in Critical Section
 Can invoke thread library functions
Very Low Response time (as compared to
Linux)
Two Level Interrupt Handling
Other Features
Footprint
 Small footprint (~50kb)
Oskit’s Device Driver Framework
 Allows direct porting of existing drivers
from Linux.
 Example – Ethernet Driver of Linux
Other RTOS’s
LynxOS
 Microkernel Architecture
 Kernel provides scheduling/interrupt handling
 Additional features through Kernel Plug Ins(KPIs)
 TCP/IP stack , Filesystem
 KPI’s are multithreaded
 Memory Protection/ Demand Paging Optional
 Development and Deployment on the same host
 OS support for compilers/debuggers
Other RTOS’s (contd)
VxWorks
 Monolithic Architecture
 Real Time Posix compliant
 Cross development System
pSOS
 Object Oriented OS
Peripheral devices and protocols
• Interfacing
Serial/parallel ports, USB, I2C, PCMCIA, IDE
• Communication
Serial, Ethernet, Low bandwidth radio, IrDA,
802.11b based devices
• User Interface
LCD, Keyboard, Touch sensors, Sound, Digital
pads, Webcams
• Sensors
A variety of sensors using fire, temperature,
pressure, water level, seismic, sound, vision

More Related Content

Similar to rtos.ppt

Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Chirag Jog
 
rtosbyshibu-131026100746-phpapp01.pdf
rtosbyshibu-131026100746-phpapp01.pdfrtosbyshibu-131026100746-phpapp01.pdf
rtosbyshibu-131026100746-phpapp01.pdfreemasajin1
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
pptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfpptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfJaganBehera8
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating SystemsPawandeep Kaur
 
presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)chetan mudenoor
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Michael Christofferson
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded SystemsHimanshu Ghetia
 
OVERVIEW OF RTOS
OVERVIEW OF RTOSOVERVIEW OF RTOS
OVERVIEW OF RTOStaruian
 
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-1 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingFastBit Embedded Brain Academy
 
Real Time Operating Systems, Dynamic Precision: Exploring the Realm of Real-...
Real Time Operating Systems,  Dynamic Precision: Exploring the Realm of Real-...Real Time Operating Systems,  Dynamic Precision: Exploring the Realm of Real-...
Real Time Operating Systems, Dynamic Precision: Exploring the Realm of Real-...Adobe2801
 

Similar to rtos.ppt (20)

Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
Rtos by shibu
Rtos by shibuRtos by shibu
Rtos by shibu
 
Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how
 
rtosbyshibu-131026100746-phpapp01.pdf
rtosbyshibu-131026100746-phpapp01.pdfrtosbyshibu-131026100746-phpapp01.pdf
rtosbyshibu-131026100746-phpapp01.pdf
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating System
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
pptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfpptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdf
 
Rtos 8051
Rtos 8051Rtos 8051
Rtos 8051
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
 
Real Time OS For Embedded Systems
Real Time OS For Embedded SystemsReal Time OS For Embedded Systems
Real Time OS For Embedded Systems
 
Process management
Process managementProcess management
Process management
 
Autosar Basics hand book_v1
Autosar Basics  hand book_v1Autosar Basics  hand book_v1
Autosar Basics hand book_v1
 
OVERVIEW OF RTOS
OVERVIEW OF RTOSOVERVIEW OF RTOS
OVERVIEW OF RTOS
 
L11-RTOS.ppt
L11-RTOS.pptL11-RTOS.ppt
L11-RTOS.ppt
 
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-1 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-1 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
 
PPT.pdf
PPT.pdfPPT.pdf
PPT.pdf
 
Real Time Operating Systems, Dynamic Precision: Exploring the Realm of Real-...
Real Time Operating Systems,  Dynamic Precision: Exploring the Realm of Real-...Real Time Operating Systems,  Dynamic Precision: Exploring the Realm of Real-...
Real Time Operating Systems, Dynamic Precision: Exploring the Realm of Real-...
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 

Recently uploaded

Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesRashidFaridChishti
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxhublikarsn
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information SystemsAnge Felix NSANZIYERA
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxMustafa Ahmed
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 

Recently uploaded (20)

Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information Systems
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

rtos.ppt

  • 1. Presentation Outline Definitions Role of an OS in Real Time Systems Features of Real Time Operating Systems  Scheduling  Resource Allocation  Interrupt Handling  Other Issues Linux for Real Time Systems and RTLinux rtker – Our own RTOS Other RTOS’s
  • 2. 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. Non Example – PC system
  • 3. 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 Qualitative Definition.
  • 4. Hard and Soft Real Time Systems (Operational Definition) Hard Real Time System  Validation by provably correct procedures or extensive simulation that the system always meets the timings constraints Soft Real Time System  Demonstration of jobs meeting some statistical constraints suffices. Example – Multimedia System  25 frames per second on an average
  • 5. Role of an OS in Real Time Systems Standalone Applications  Often no OS involved  Micro controller based Embedded Systems Some Real Time Applications are huge & complex  Multiple threads  Complicated Synchronization Requirements  Filesystem / Network / Windowing support  OS primitives reduce the software design time
  • 6. Features of RTOS’s Scheduling. Resource Allocation. Interrupt Handling. Other issues like kernel size.
  • 7. 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.
  • 8. Scheduling Algorithms in RTOS Clock Driven Scheduling Weighted Round Robin Scheduling Priority Scheduling (Greedy / List / Event Driven)
  • 9. 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.
  • 10. 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.
  • 11. 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
  • 12. Priority Scheduling Earliest Deadline First (EDF)  Process with earliest deadline given highest priority Least Slack Time First (LSF)  slack = relative deadline – execution left Rate Monotonic Scheduling (RMS)  For periodic tasks  Tasks priority inversely proportional to it’s period
  • 13. Resource Allocation in RTOS Resource Allocation  The issues with scheduling applicable here.  Resources can be allocated in  Weighted Round Robin  Priority Based Some resources are non preemptible  Example : semaphores Priority Inversion if priority scheduling is used
  • 15. 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
  • 16. 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 Sophisticated features can be removed  No Virtual Memory  No Protection
  • 17. Linux for Real Time Applications Scheduling  Priority Driven Approach  Optimize average case response time  Interactive Processes Given Highest Priority  Aim to reduce response times of processes  Real Time Processes  Processes with high priority  No notion of deadlines Resource Allocation  No support for handling priority inversion
  • 18. Interrupt Handling in Linux Interrupts are disabled in ISR/critical sections of the kernel No worst case bound on interrupt latency avaliable  eg: Disk Drivers may disable interrupt for few hundred milliseconds Not suitable for Real Time Applications  Interrupts may be missed
  • 19. Other Problems with Linux Processes are non preemtible in Kernel Mode  System calls like fork take a lot of time  High priority thread might wait for a low priority thread to complete it’s system call Processes are heavy weight  Context switch takes several hundred microseconds
  • 20. Why Linux Coexistence of Real Time Applications with non Real Time Ones  Example http server Device Driver Base Stability
  • 21. RTLinux Real Time Kernel at the lowest level Linux Kernel is a low priority thread  Executed only when no real time tasks Interrupts trapped by the Real Time Kernel and passed onto Linux Kernel  Software emulation to hardware interrupts  Interrupts are queued by RTLinux  Software emulation to disable_interrupt()
  • 22. RTLinux (contd) Real Time Tasks  Statically allocate memory  No address space protection Non Real Time Tasks are developed in Linux Communication  Queues  Shared memory
  • 24. rtker – Our RTOS Motivation  Our own OS  Full grasp over source code – Easily modifiable, portable Features  Modular Design  Isolation of Architecture/CPU dependent and independent code – Easy to Port  Pluggable Scheduler  Two level Interrupt Handling  Small footprint  Oskit’s Device Driver Framework
  • 25. Pluggable Scheduler Scheduler - part of the Application Kernel interacts with the scheduler through an API Application developer needs to implement the scheduler API  Can optimize on Data Structures & Algorithms for implementing the scheduler
  • 26. rtker – Block Diagram
  • 27. Two Level Interrupt Handling Two level Interrupt Handling  Top Half Interrupt Handler  Called Immediately – Kernel never disables interrupts  Cannot invoke thread library functions - Race Conditions  Bottom Half Interrupt Handler  Invoked when kernel not in Critical Section  Can invoke thread library functions Very Low Response time (as compared to Linux)
  • 29.
  • 30. Other Features Footprint  Small footprint (~50kb) Oskit’s Device Driver Framework  Allows direct porting of existing drivers from Linux.  Example – Ethernet Driver of Linux
  • 31. Other RTOS’s LynxOS  Microkernel Architecture  Kernel provides scheduling/interrupt handling  Additional features through Kernel Plug Ins(KPIs)  TCP/IP stack , Filesystem  KPI’s are multithreaded  Memory Protection/ Demand Paging Optional  Development and Deployment on the same host  OS support for compilers/debuggers
  • 32. Other RTOS’s (contd) VxWorks  Monolithic Architecture  Real Time Posix compliant  Cross development System pSOS  Object Oriented OS
  • 33. Peripheral devices and protocols • Interfacing Serial/parallel ports, USB, I2C, PCMCIA, IDE • Communication Serial, Ethernet, Low bandwidth radio, IrDA, 802.11b based devices • User Interface LCD, Keyboard, Touch sensors, Sound, Digital pads, Webcams • Sensors A variety of sensors using fire, temperature, pressure, water level, seismic, sound, vision