Rtos 101
Rtos 101
Priority Inheritance
• Solution to priority inversion
• Temporarily increase task’s priority when it acquires
a lock
• Level to increase: highest priority of any task that
might want to acquire same lock
– High enough to prevent it from being preempted
• dormant (idle): task has no need for computer time • Danger: Low-priority task acquires lock, gets high
• ready: task is ready to go active, but waiting for processor time priority and hogs the processor
• active (running): task is executing associated activities – So much for RMS
What is a RTOS? • waiting (blocked): task put on temporary hold to allow lower priority task • Basic rule: low-priority tasks should acquire high-
chance to execute priority locks only briefly!
• An RTOS is a preemptive multitasking operating system intended
for real-time applications. • suspended: task is waiting for resource
• It must support a scheduling method that guarantees re- VxWorks Architecture
sponse time
– Especially to critical tasks
Priority-Based
• Tasks must be able to be given a priority
– Static or dynamic
Preemptive Scheduling
• An RTOS has to support predictable task synchronization • Problem: Multiple tasks at the same priority level?
mechanisms
– Shared memory mutexes / semaphores, etc. • Solutions:
• A system of priority inheritance has to exist – Give each task a unique priority
• Manages hardware and software resources. – Time-slice tasks at the same priority
• Deterministic: guarantees task completion at a set deadline. • Extra context-switch overhead
– A system is deterministic if, for each possible state and each set of in- • No starvation dangers at that level
puts, a unique set of outputs and next state of the system can be de-
termined.
– Tasks at the same priority never preempt the other
• Behavior time constraints should be known and minimized • More efficient
– Interrupt latency (i.e., time from interrupt to task run)
– Minimal task-switching time (context switching) • Still meets deadlines if possible
NASA Independent
Richard E. Kowalski, [email protected], TASC Inc. Verification and
Validation Facility
NASA POC: Frank Huy, [email protected] Fairmont, West
Virginia