RTUEE / EC / EEEYr 2020 · Sem 82020

Q5Microcontroller and Embedded Systems

Question

16 marks

Q.5. (a) What is Real Time Operating System? Explain the basic features of commercial RTOS. [8]

(b) Explain the architecture and requirements for development process of embedded system. [8]

Answer

A Real Time Operating System is a specialized operating system explicitly designed to guarantee that specific tasks complete their execution within precisely defined, bounded time constraints (deadlines), rather than merely aiming for good average-case or best-effort responsiveness as a general-purpose desktop operating system does; an RTOS is distinguished by the predictability and determinism of its scheduling and resource-management behavior, meaning the worst-case time required for the RTOS to respond to an event or complete a scheduling decision can be rigorously analyzed and bounded in advance, which is essential in embedded control applications (such as automotive engine control, industrial process control, and medical device control) where missing a critical task deadline could have serious safety or functional consequences, in sharp contrast to a general-purpose operating system, where an occasional slow response is merely an inconvenience rather than a potential system failure.

Basic Features of Commercial RTOS

  • Preemptive, priority-based scheduling: a commercial RTOS almost universally implements a preemptive scheduler that always runs the highest-priority ready task at any given instant, immediately preempting a lower-priority task the moment a higher-priority task becomes ready to run, ensuring that critical, time-sensitive tasks are never indefinitely delayed by lower-priority background processing.
  • Deterministic, bounded interrupt latency and context-switch time: commercial RTOS kernels are engineered and rigorously characterized to guarantee a known, bounded worst-case time between an interrupt event occurring and the corresponding task actually beginning to execute in response, an essential property for meeting hard real-time deadlines.
  • Inter-task synchronization and communication primitives: commercial RTOS kernels provide a standard set of primitives such as semaphores, mutexes (mutual exclusion locks), message queues, and event flags, allowing multiple concurrently running tasks to safely coordinate access to shared resources and to exchange data without corrupting shared state.
  • Memory management appropriate to embedded constraints: many commercial RTOS kernels support fixed-size memory pool allocation (avoiding the unpredictable timing and fragmentation risk of general-purpose dynamic heap allocation) in addition to, or instead of, a conventional heap, since predictable memory allocation timing is as important to real-time behavior as predictable CPU scheduling.
  • Small memory footprint and configurability: commercial RTOS kernels intended for resource-constrained microcontroller applications are typically designed to be highly modular and configurable, allowing unused kernel features to be excluded from the final compiled firmware image to minimize program and data memory consumption on cost-sensitive, memory-limited microcontrollers.
  • Priority inheritance and priority inversion avoidance mechanisms: since a naive priority-based scheduling scheme can suffer from priority inversion (where a high-priority task is indirectly blocked for an unbounded time by a lower-priority task holding a shared resource, itself delayed by an unrelated medium-priority task), robust commercial RTOS kernels implement priority inheritance or similar protocols to bound this otherwise unpredictable blocking delay.

Embedded System Architecture and Development Process Requirements

The architecture of a typical embedded system consists of the target microcontroller or microprocessor hardware, its associated program and data memory, its peripheral interface circuitry connecting it to sensors, actuators, and communication interfaces relevant to the specific application, and the embedded software itself, which may range from simple bare-metal (no operating system) firmware, through a lightweight cooperative or preemptive multi-tasking kernel, up to a full-featured commercial or open-source RTOS of the kind discussed above, depending on the complexity and real-time requirements of the specific application. The development process for an embedded system, in contrast to conventional desktop software development, must additionally account for the tight coupling between the software and the specific target hardware, requiring cross-development tools (a compiler and toolchain running on a general-purpose development host computer, but generating executable machine code for the entirely different target microcontroller's instruction set), hardware-software co-design (since embedded hardware and firmware are frequently developed concurrently, requiring careful specification of the hardware-software interface, such as memory-mapped peripheral registers and interrupt vector assignments, well before either the hardware or the firmware is fully complete), and specialized debugging tools such as in-circuit emulators, JTAG hardware debuggers, or logic analyzers that allow the developer to observe and control the target embedded system's internal execution state directly on the actual target hardware, since a full-featured, interactive software debugger of the kind available on a desktop development platform is generally not available to run directly on the resource-constrained target microcontroller itself. Embedded system development also typically requires careful attention to real-time performance verification (rigorously testing that all timing deadlines are met under worst-case, not merely typical, operating conditions), resource-usage verification (confirming the final compiled firmware fits within the target device's available program and data memory with adequate margin), and, for safety-critical applications, formal verification or certification processes appropriate to the specific application domain's regulatory requirements.

It is further worth noting that the choice of whether to use a full commercial RTOS, a lightweight open-source RTOS kernel, or a simple bare-metal (no operating system) architecture for a given embedded application is itself an important early architectural decision in the embedded system development process discussed above, driven by factors including the complexity and number of concurrent activities the application must manage, the strictness of its real-time deadline requirements, the available program and data memory budget on the target microcontroller, and the development team's familiarity with RTOS-based concurrent programming techniques, since introducing an RTOS (with its associated task-switching and synchronization overhead) is not automatically the correct choice for every embedded application, particularly very simple applications that can be adequately and more efficiently implemented using a straightforward polling loop or a small set of interrupt service routines without any underlying multi-tasking kernel at all.

It is further worth noting that the hardware-software co-design and cross-development toolchain requirements discussed above for embedded system development apply with particular force whenever a commercial RTOS is being integrated into a new embedded design, since the RTOS itself must typically be ported (adapted) to the specific target microcontroller's interrupt vector structure, timer hardware, and memory layout before any application-level task code can be developed on top of it, meaning the initial RTOS porting and validation effort is itself an important, often underestimated, phase of the overall embedded system development process that must be completed and thoroughly tested before application-specific task development can proceed with confidence.

This closing summary confirms that RTOS features and the embedded system development architecture have both been addressed in full as required by this examination question.

Back to Paper