In this excerpt from Jejurikar and Gupta’s 2004 study, we can see that PTS reduces context switches by 70% - 90%.
What’s interesting about PTS is that it eliminates context switching in many cases, while still enabling the system to meet real-time deadlines 100% of the time. But, embedded real-time systems that use ARM processors also demand massive throughput. For example, mobile devices handling streaming video are extremely dependent on high throughput, without which they could never provide the rich entertainment we have come to expect from our smartphones and tablets.
But, context switches use valuable CPU cycles, and this can prevent the system from meeting its throughput requirements, even with a powerful ARM9 or Cortex CPU. In fact, context switches on ARM processors tend to be faster (require fewer cycles) than on other processor architectures, because ARM processors use a relatively small register set, enable the loading/storing of multiple registers (including PC/SPSR) at a time. ThreadX further optimizes context switching on ARM by not saving/restoring the context when no thread is running (and therefore there is no preemption). And, Cortex-M parts are further optimized to save compiler scratch registers as part of the interrupt fetch on the interrupted thread's stack, making it unnecessary for the RTOS to do so.
Given the cycle cost of context switches, and the fact that context switches are an inevitable consequence of preemption, how does the developer support preemption and still achieve high throughput? With PTS, only the context switches that are essential to meeting deadlines are performed, while others are denied, even if it means letting a low priority thread continue to run while a higher priority thread is waiting. This reduces system overhead by completely eliminating many costly context switches, while preserving the system’s ability to meet real-time scheduling requirements. No matter how fast a context switch is performed, skipping it entirely is even faster!
For those looking for the full story, several articles and white papers are available on this topic:
"Lower the Overhead in RTOS Scheduling"
Professor Alexander Dean, Ph.D., Embedded Systems Design Magazine, March, 2011
“Scheduling Fixed-Priority Tasks with Preemption Threshold”
Wang, Concordia University, and Saksena, University of Pittsburgh
“Preemption threshold scheduling: Stack optimality, enhancements and analysis”
R. Ghattas and A. G. Dean, RTAS ’07: Proc. of the 13th IEEE Real Time and Embedded Technology and Applications Symposium, 2007
“Reducing Stack with Intra-Task Threshold Priorities in Real-Time Systems”
G. Yao and G. Buttazzo, Proceedings. of the 10th Int. Conf. on Embedded Software, 2010
So, developers - How do you balance the tradeoff between real-time responsiveness and maximum throughput in your ARM-based design? Would PTS possibly offer an attractive means of achieving the balance you desire? Please let us know your thoughts!
ARM welcomes its wealth of Partners in the ARM Connected Community (CC) to submit guest blogs to be published on our multiple community blogs. If interested in participating please submit email inquiries to Tell.Us@arm.com.
The ARM Connected Community (CC) is an extensive ecosystem covering all aspects of ARM processor-based design, from chip implementation through to system and device design. The CC provides a platform for collaborative innovation, with multiple types of forums for members to work with one another, and with customers, to solve industry challenges, all with the purpose of enabling designers to focus on differentiating features and an accelerated time-to-market for ARM powered solutions.
0 Comments On This Entry
Please log in above to add a comment or register for an account
Peggie: University of Oxford, UK - Shell Eco-Marathon Finals in Rotterdam
on May 22 2013 02:31 PM
Cortex-M0+ a year after: smaller, thriftier and smarter!
on May 20 2013 02:59 PM
The Continuing Hazards of Dhrystone
on May 16 2013 10:24 AM
Make versus buy: it's about risk management!
on May 15 2013 02:29 PM
Accelerated Internet of Things (IoT) development with ARM mbed and Xively
on May 14 2013 12:21 PM