RL-ARM User's GuideRL-RTX Overview Product Description Product Specification Technical Data Timing Specifications Advantages Your First RTX Application Theory of Operation Timer Tick Interrupt System Task Manager Task Management Idle Task System Resources Scheduling Options Pre-emptive Scheduling Round-Robin Scheduling Cooperative Multitasking Priority Inversion Stack Management User Timers Interrupt Functions Configuring RL-RTX Configuration Options Tasks Stack Size Stack Checking Run in Privileged Mode Hardware Timer Round-Robin Multitasking User Timers FIFO Queue Buffer Idle Task Error Function Create New RTX_Config.c Configuration Macros Alternate Tick Timer Low Power RTX Library Files Using RL-RTX Writing Programs Include Files Defining Tasks Multiple Instances External References Using a Mailbox SWI Functions SVC Functions Debugging System Info Task Info Event Viewer Usage Hints ARM7/ARM9 Version Cortex-M Version Create New RTX Application Function Reference Event Flag Management Routines Mailbox Management Routines Memory Allocation Routines Mutex Management Routines Semaphore Management Routines System Functions Task Management Routines Time Management Routines User Timer Management Routines RL-FlashFS RL-TCPnet RL-CAN RL-USB Example Programs Library Reference Appendix
RL-ARM User's Guide
The RTX Real Time Operating system employs a priority-based preemptive scheduler. The RTX scheduler assings each task a unique priority level. The scheduler ensures that of those tasks that are ready to run, the one with the highest priority is always the task that is actually running.
Because tasks share resourcs, events outside the scheduler's control can prevent the highest priority ready task from running when it should. If this happens, a critical deadline could be missed, causing the system to fail. Priority inversion is the term of a scenario in which the highest-priority ready task fails to run when it should.
Tasks need to share resources to communicate and process data. Any time two or more tasks share a recource, such as a memory buffer or a serial port, one of them will usually have a higher priority. The higher-priority task expects to be run as soon as it is ready. However, if the lower-priority task is using their shared resource when the higher-priority task becomes ready to run, the higher-priority task must wait for the lower-priority task to finish with it.
To prevent priority inversions, the RTX Real Time OS employs a
Priority inheritance method. The lower-priority task
inherit the priority of any higher-priority task pending on a
resource they share. For a short time, the lower-priority task runs
at a priority of a higher-priority pending task. The priority change
takes place as soon as the high-priority task begins to pend. When
the lower-priority task stops using a shared resource, it's priority
level returns to normal.