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
Other Kernel Objects
•
•
•
•
Pipes
Event registers
Signals
Condition variables
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Pipe Definition
•
•
•
•
Unidirectional data exchange facility
A pipe descriptor/pipe end
Data is unstructured byte stream
FIFO data reading
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Pipe == Message Queue?
• Conceptually, yes
o
o
Reader blocks when pipe is empty
Writer blocks when pipe is full
• Significant differences are:
o
o
o
o
No multiple message storage
Stream of unstructured bytes
No data prioritization
FIFO data flow
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Pipe
Data was read
(more data remain)
Data was read
(more space for writing)
Data was read
(no data left)
Pipe created
(no data)
Empty
Not Empty
Data was written
Data was written
(more space for writing)
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Full
Data was written
(no more space for
writing)
Pipe Usages
Task-to-task or ISR-to-task
data transfer
Asynchronous inter-task
communication
Amr Ali Abdel-Naby@ 2009
Real-Time Operating Systems
Typical Pipe Operations
• Pipe creation and deletion
o
o
o
Pipe
Open
Close
• Pipe read and write
o
o
Read
Write
• Pipe control
o
Control
• Pipe select
o
Select
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Event Register
• = Group of binary flags
• Tracks occurrence of specific events
• A task can check events occurrence to control its execution.
o
o
Checking events: No wait, wait, wait with timeout
Conditional check: AND, OR …
• Another task or ISR can post events.
ISR 1
Task
Task
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Event Register Usages
• Unidirectional activity synchronization
•
•
•
Task 1 send event X to task
Task decide 2when to receive
Task 2 receive event X
No source identification
No data transmission
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Typical Event Register Operations
• Event register send and receive
o
o
Send
Receive
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Signal
•
•
•
•
= SW interrupt
Generated by tasks and ISRs
System and RTOS dependent
When a signal arrives, the task is diverted from its normal
execution path, and the corresponding signal routine is invoked.
ISR
Task
Task
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Signal Usages
• Asynchronous event notification
• Extending hardware ISRs in task’s context
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Typical Signal Operations
•
•
•
•
•
•
Catch
Release
Send
Ignore
Block
Unblock
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Condition Variable
• Enables tasks communication and identifying shared resources
states
• A condition variable itself is a shared resource.
o
Protected by mutexes
ISR
Task
Task
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Condition Variable Usage
• Resource state notification
• Task 1:
o
Lock mutex
Examine shared resource
While (shared resource is Busy)
WAIT (condition variable)
Mark shared resource as Busy
o
Unlock mutex
• Task 2:
o
Lock mutex
Mark shared resource as Free
SIGNAL (condition variable)
o
Unlock mutex
Amr Ali Abdel-Naby@2010
Introduction to RTOS
Typical Condition Variable Operations
•
•
•
•
Create
Wait
Signal
Broadcast
Amr Ali Abdel-Naby@2010
Introduction to RTOS