Embedded and Real Time Systems

Document technical information

Format ppt
Size 77.3 kB
First found May 22, 2018

Document content analysis

Category Also themed
Language
English
Type
not defined
Concepts
no text concepts found

Persons

Organizations

Places

Transcript

Real Time Operating Systems
Lecture 10
David Andrews
[email protected]
What We Will Cover Today
•
Operating Systems Services
–
•
Base Components
Real Time Considerations
–
Task Management
•
•
–
Interprocess Communications
•
•
–
Time Triggered
Event Triggered
Blocking
Non-Blocking
Time Management
•
•
Services
Maintenance
Operating Systems Functionality
Task Manager
Timer Services IPC
Scheduling
Semaphores
Watchdog
Countdown
System Time
File Mgt
Synch
Asynch
• Considerations
– Footprint An Issue
– Small Numbers of Programs
– Virtual Memory Will Not be Required For Our Study
Virtual Mem
Cache
Task Taxonomy
• Simple Task (S-task)
• No synchronization within task
• Executes from beginning to end, subject only to pre-emption by interrupts
– Might be triggered by some other task initially
– Might communicate results to some other task
– But, no internal synchronization with other tasks
• Complex Task (C-task)
• Has some synchronization with other tasks
– May have to wait for another task to process a request
– May have to wait for I/O to complete
– May have to wait for resource to become available (memory, network)
• Timing depends on the rest of the system
– So, C-tasks are “bad” because they increase complexity
– And, C-tasks make it more difficult to analyze system timing properties
C-Task Execution time
• S-Task execution time plus:
• Waiting for other processes…
• Not so bad if other tasks are S-Tasks and it is just a remote procedure
call
• General case can be impractical to handle
• General solution:
• Break C-tasks into S-tasks separated by interactions
• Then, make sure that S-tasks are scheduled far enough apart for
interaction to complete
• Great when it works...
Task Management
• Key component is scheduler:
– Static: Schedule Built up Prior To Running
• Scheduler Develops Time Triggered Schedule
• Periodic/Predictable
– Dynamic: Schedule Built During Run Time
• Can Be Based on Worst Case Execution Time (WCET)
• Scheduler Invoked by events
– Timer, Interrupts, suspend, resume, etc.
Worst Case Execution Time (simple version)...
• Assume a simple task (S-task) that just executes its own code
without coordinating with other threads or I/O
How hard could it be to determine timing?
• Timing is once through the code + jitter due to:
• Non-fixed loop iteration count
• Non-fixed number of recursive calls
• Garbage collection
• Conditional statement execution asymmetry (if/else path timings)
• Effects of hardware non-determinism
– Cache
– Data-dependent instruction execution time
–…
… Plus S-Task Context Swapping
• Overhead from task switching: OS + Hardware
• … multiply by number of pre-emptions
• Gives WCAO (Worst-Case Administrative Overhead)
due to pre-emptions
Task B
Task A
Restore context
Save context
OS
OS
Restore context
Save Context
Task B
WACO
WACO
… Plus Effects From Nested Interrupts
• What if you have multiple prioritized interrupts
• Worst case execution time for interrupt at Priority X is = Execution
time for interrupt at Priority 1 (perhaps multiple times)
+ Execution time for interrupt at Priority 2 (perhaps multiple times)
+ Execution time for interrupt at Priority 3 (perhaps multiple times)
…
+ Execution time for interrupt at Priority X (perhaps multiple times)
• You can bound this as long as the period of each interrupt is
bounded
• Same algorithm as for computing worst case CAN message latency(!)
• Scheduling on a CPU is a dual problem to scheduling on a network
Task Management
• Time Triggered
– A priori build Task-Descriptor Table (TADL)
Time
10
17
22
38
47
Action WCET
Start T1 12
Send M5
Stop T1
Start T3 20
Send M3
Dispatcher
Interprocess Communications
• IPC can support Messages, or Common Data Regions…
• Messages
– We have already discussed synch/asynch
• Asynchronous can be implemented in S-Tasks
• Synchronous (suspend) can be implemented in C-Tasks
• Common Data Regions
– Implemented via shared memory
• Introduces critical regions
• Semaphore Operations needed
– Test and Set
Time Management
• Time Management provides:
– Clock synchronization
– Time stamping
– Watchdog Timers
• User Accessible
• Operating System
Real Time Operating Systems
• Unix “feel”
• QNX
• LinxOS
• “Smaller” RTOSs
• OS9, Microware
• VxWorks (be sure to get the memory protection extension)
• pSOS
• RTX, VenturCom
• A few research/freeware RTOS systems:
• KURT (KU real Time)
• RT-Mach, CMU
• …others
• Windows: WinCE; embedded NT, Windows + RT add-on products
Questions To Ask Your RTOS Vendor
• Real Time Operating System
• Purports to ensure timeliness of task execution
• Uses task priorities and a scheduling algorithm
• Hard questions:
• What is the tasking model (preemptive or non-preemptive)?
Scheduler?
• What is the longest task switch latency?
– Function of interrupt masking time
• How big is the footprint for a real system? (Not a stripped-down toy
system)
• Does it have inter-task memory protection?
• How much of POSIX does it really support?
• How long does the system take to reboot?
• What is the runtime license fee?
• How robust is it (and what is the exception handling model?)

Similar documents

×

Report this document