Introduction to RTOS
About SwiftACT
• A Technology services startup company
o
Under establishment
• Areas of specialties:
o
o
Mobile telecommunication services development
Embedded systems development
• Types of services:
o
o
o
o
Consultation
Managed services
Sourcing
Training
Amr Ali Abdel-Naby@2010
Introduction to RTOS
About Me
• Graduated 2004
o
ECE, ASU: 5 yrs distinction
• 5+ years in embedded systems development
o
SDLC, Apps, MW, DD, Porting, ...
• 3+ years in SW engineering
o
PSP, CMMI, Systematic reuse, ...
• 3+ years in SW testing
o
IBM certified, ISTQB certified, ...
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Copyright
• Materials in this course is the property of Amr Ali Abdel-Naby.
• Reproduction or transmission of the materials in any manner
without the copyright owner permission is a law violation.
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Outline
•
•
•
•
•
•
Introduction
Tasks
Semaphores
Message Queues
Other Kernel Objects
Other Kernel Services
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Outline
•
•
•
•
•
•
Introduction
Tasks
Semaphores
Message Queues
Other Kernel Objects
Other Kernel Services
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Brief History of Operating Systems
• Programs of primitive times
o
o
Tight integration of SW + HW Low portability
Difficult and costly to maintain
Modularity
Abstraction
GPOS
Evolution of OS
Interconnectivity
Amr Ali Abdel-Naby@2010
RTOS
Introduction to RTOS
RTOS vs. GPOS
• RTOS == GPOS
o
o
o
Multitasking
SW + HW management
HW abstraction
Amr Ali Abdel-Naby@2010
• RTOS != GPOS
o
o
o
o
o
o
More reliable
Scalable
Faster
Reduced memory needs
ROM or RAM bootable
Portable
Introduction to RTOS
GPOS or RTOS for embedded
systems
• GPOS can run on embedded systems with high memory and soft
real-time requirements.
• RTOS is more suitable for low memory and hard real-time
requirements.
• Many embedded systems run without RTOS!
Amr Ali Abdel-Naby@2010
Introduction to RTOS
RTOS Definition
• A program that schedules
execution in a timely manner,
manages system resources,
and provides a consistent
foundation for developing
application code.
• A kernel is the RTOS heart.
Application
RTOS
C/C++
Library
• Kernel = Scheduler + Objects
+ Services
Amr Ali Abdel-Naby@2010
File
Systems
Network
Protocols
Introduction to RTOS
Kernel
Other
Device Components
Drivers
Hardware
Scheduler
• Which task will run next?
o
Scheduler has the answer.
• Scheduler = Scheduling algorithm + Dispatcher
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Scheduling Algorithm
• AKA scheduling policy
• Most kernels support:
o
o
Preemptive priority based algorithm
Round-Robin algorithm
Preemptive priority
based algorithm
T3
Priority
T2
Priority
T2
T1
Round-Robin
algorithm
T1
T4
T1
T2
T1
Time
Time
Amr Ali Abdel-Naby@2010
T3
Introduction to RTOS
T2
Dispatcher
• Performs context switch
• Lets see an example of a context switch.
o
Click Here
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Objects
• Building blocks for system development
• Most common objects are:
o
o
o
Tasks
Semaphores
Message queues
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Services
• They perform operations on objects.
• Or provide other operations like:
o
o
o
o
Timer management
Interrupt handling
Device I/O
Memory management
Amr Ali Abdel-Naby@2010
Introduction to RTOS
C/Cs of RTOS
• Reliability
• Predictability
• Performance
• Compactness
• Scalability
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Reliability
• How long systems can operate without human interaction?
• Different reliability may be required.
• Reliable system = Available and does not fail
• Measured by downtime per year
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Predictability
• Real-time System = Correct functionality + Correct timing
• Predictable RTOS = Deterministic RTOS
o
o
Completion of OS calls occurs within known timeframes.
Variance in response times is very small.
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Performance
• RTS must be fast enough.
• CPU performance is measured in MIPS.
• Throughput measures overall system performance.
o
o
o
SW + HW
Rate of generating output by a system
Measured in bps
• WCET of a RTS must be known.
o
RTOS per se does not specify performance.
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Compactness
• Embedded systems have constrained memory.
• RTOS must be small and efficient.
• Designers must understand both the static and dynamic memory
consumption of the RTOS and the application that will run on it.
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Scalability
• RTOS is used in a variety of systems.
• They should scale up or down to meet different requirements.
• Modular deign of RTOS aids scalability.
Amr Ali Abdel-Naby@2010
Introduction to RTOS