Survey and Performance Evaluation of Real-Time Operating Systems (RTOS) for Small Microcontrollers

Survey and Performance Evaluation of Real-Time Operating Systems (RTOS) for Small Microcontrollers

This article has been accepted for publication in IEEE Micro but has not yet been fully edited. Some content may change prior to final publication. Survey and performance evaluation of real-time operating systems (RTOS) for small microcontrollers Tran Nguyen Bao Anh*†, Su-Lim Tan† *Renesas Technology Singapore, Singapore Engineering Centre, Singapore 098632 †School of Computer Engineering, Nanyang Technological University, Singapore 639708 Abstract— RTOS has gained popularity over the years in any OS as it affects how the various softwares are microcontroller/processor-based embedded system design. In this executed. Most generic OSes are time-sharing systems paper, we will discuss the important differences between RTOS and in which tasks are allocated the same amount of time generic OS, the advantages and disadvantages of using RTOS for slices (e.g. round robin scheduling) for execution. In small microcontroller system development, and the benchmarking RTOS, tasks are often assigned priorities and higher- methods used for RTOS. Several RTOSes are studied and compared priority tasks can preempt lower-priority tasks during based upon numerous selection criteria, and four RTOSes are selected for performance benchmarking on the same microcontroller execution (preemptive scheduling). There are also platform. For the purpose of performance benchmarking, a list of RTOSes that adopt cooperative scheduling. Such benchmarking criteria which is aimed to be simple and representative scheduling technique usually implies that the running of typical RTOS usages are examined. The benchmarking results task has to explicitly invoke the scheduler to perform a show that there is no clear winner and each RTOS performed well on task switch. certain criteria compared to others. x Predictability in task synchronization: For generic Index Terms- kernel; operating system; real-time system; OS, task synchronization is unpredictable because the RTOS; RTOS benchmarking OS can directly or indirectly introduce delays into the application software. In RTOS, synchronization among I. INTRODUCTION tasks (such as using semaphore, mailbox, message queue, event flag, etc) must be time-predictable. The EAL – time embedded systems are typically designed R for various purposes such as to control or to process data. system services must have known and expected Characteristics of real-time system include meeting certain duration of execution time. deadlines at the right time. To achieve this purpose, real-time x Deterministic behaviors: This can be considered as operating systems (RTOS) are often used. An RTOS is a piece the key difference between generic OS and RTOS. In of software with a set of APIs for users to develop RTOS, task dispatch time, task switch latency, interrupt applications. Using an RTOS does not guarantee that the latency must be time-predictable and be consistent even system will always meet the deadlines, as it also depend on when the number of tasks increases. On the other how the overall system is designed and structured. hand, generic OS (mainly due to its time-sharing While RTOS for embedded systems were predominantly approach) reduces the overall system responsiveness employed in high-end microprocessors or microcontrollers and does not guarantee service call execution within with 32-bit central processing unit (CPU), there is a growing certain amount of time when the number of tasks trend to provide these features in the mid-range (16-bit and 8- increases. Dynamic memory allocation (malloc() in C bit) processor systems. In Section B, the use of RTOS for this language), though being widely supported in generic range of devices will be discussed in details. OS, is not recommended in RTOS because the An operating system (OS) is a piece of software that behavior is unpredictable [1]. Instead, fixed-sized manages the sharing of resources in a computer system. RTOS memory allocation is provided in which only fixed-size is often differentiated from generic OS as it is specifically block of memory is allocated for every request. designed for scheduling to achieve real-time responses. B. RTOS for small scale-embedded systems A. Generic OS versus RTOS There are a number of variants of RTOSes available RTOSes are typically differentiated from generic OSes in nowadays; they ranged from commercial, proprietary, to open- the following: source RTOSes. For small-scaled embedded systems designed x Preemptive, priority-based scheduling: Scheduling using small microcontrollers (i.e. microcontrollers with scheme refers to how the RTOS assigns CPU cycles to maximum ROM of 128Kbytes and maximum RAM of tasks for execution. Scheduling scheme is important in 4Kbytes [2]), there is a common perception that no RTOS is 1 Digital Object Indentifier 10.1109/MM.2009.56 0272-1732/$26.00 © 2009 IEEE This article has been accepted for publication in IEEE Micro but has not yet been fully edited. Some content may change prior to final publication. needed. However, there are significant advantages to use an platform employing a different microcontroller with a RTOS for this range of devices [2, 3], such as: different set of peripherals, these timing features need x Optimizing software development: Even in system to be rewritten again. Unless for special and critical development using small microcontrollers, improving timing issue with unique hardware peripheral, using an software productivity is a critical issue due to time-to- RTOS can helps to speed up the development time market pressure as well as shorten development cycle significantly to tackle these timing issues. [4]. Using an RTOS is one of the approaches that has In [3], an example is given to illustrate the importance of gained increasing popularity. As the code complexity RTOS in small system design – a printer system. Without grows, an RTOS is an efficient tool to manage the an RTOS, there is one single chunk of code to manage all software, and to distribute the tasks among developers. the activities, from paper feeding, user-input reading, to Using an RTOS will allow the entire software to be printing control. By having an RTOS, individual task will partitioned into modular tasks that can be taken care of manage each of these activities. Except for passing of status by individual programmer. Moreover, low-level driver information, each task does not need to know much about development can be done by other developers. what other tasks are performing. Hence, having an RTOS in x Better and safer synchronization: In small embedded place can help in partitioning the software in time domain system development without using any RTOS, global (tasks are running concurrently) and in terms of variables are often used for synchronization and functionalities (each task performs a specific operation). communication among modules/functions. However, especially in highly interrupt-driven system, using global variables lead to bugs and software safety issues [5]. These global variables are often shared and accessed among the functions; hence there are high chances of them being corrupted at any time during the program execution. As the code begins to grow, these bugs become hidden deeper and more difficult to be uncovered. Consequently, development time can be lengthened even for such small-scale system development. With an RTOS in place, synchronization Figure 1: RTOS usage, embedded market survey is safely managed and tasks can pass messages or (CMP, EE Times) 2004 [4] synchronize with each other without any corruption problems. RTOS usage is gaining popularity in the past few years as x Resource management: Most RTOSes provide APIs clearly indicated in the CMP, EE Times embedded system for developers to manage the system resources [5]. survey for 2004 - 2006 [4, 5, 6]. Figure 1 shows the embedded These include task management, memory pool market survey conducted by CMP, EE Times in 2004 on the management, time management, interrupt management, number of developers that have used and would consider communication and synchronization methods. These using RTOS in the current and next projects. The number of features provide the abstraction layer for developers to developers who “have used” RTOS takes up more than 49%. freely structure the software, to achieve cleaner code This percentage rises to 80.9% in the 2005 survey, and 71% in and to even quickly port across different hardware the 2006 survey. The number of developers who “would platforms with little code modifications. Especially consider” to use RTOS in the next project in 2004 is 66.6%, with small system development - cost of hardware is of and in 2005 is 86%, which shows a steady trend towards critical constraint, and development time is usually employing RTOS. Definitely, more and more developers and short. designers are adopting RTOS in long run. x Timing can be easily managed by RTOS: With time Table 1 indicates there is another trend in RTOS selection - management functions, software designers can achieve companies are moving towards open-source RTOS - from task delay, timer handling or time-triggered processing 16% in current projects to 19% in the next projects in 2006) or without resorting to understanding the underlying commercial distribution of an open-source RTOS - from 12% hardware mechanisms. As compared with a small in current projects to 17% in the next projects in 2006. system that does not use any RTOS, achieving timing Commercial OS and in-house OS, though currently being related features can be tricky as the software designer extensively used, are declining - from 51% in current projects needs to understand the underlying peripherals (such as to 47% in next projects in 2006 for the case of commercial timers), how to use it, and how to link it with the top- OS, and from 21% to 17% for the case of in-house OS. In the level application code. Any modification, such as to latest 2007 survey [7], the percentage for commercial OS lengthen the delay time would requires the developer to drops further to 41%. Also according to the 2007 survey, the examine the code and peripheral again to make changes key influencing factors in RTOS selection for commercial OS appropriately.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us