CHAPTER 3 Porting of Micro C/OS-II kernel in ARM powered microcontroller


CHAPTER 3
REAL TIME OPERATING SYSTEM
3.1. Real-Time System
         Definition:
A real-time system (defined by IEEE) is a system whose correctness includes its response time as well as its functional correctness.
In other words, in a real-time system, it not only matters that the answers are correct, but it matters when the answers are produced [4].
A Late Answer is a Wrong Answer!
3.1.1. Real-Time Systems – Categories
1. Hard Real-Time Systems
2. Soft Real-Time Systems
Hard Real-Time Systems
Hard real-time means that the system (i.e., the entire system including OS, middleware, application, HW, communications, etc.) must be designed to GUARANTEE that response requirements are met. Hard Real-Time doesn’t mean fast execution. Examples:Electronic Engines, Automotive and Flight Control Systems, Medical Systems, Industrial Control Systems, Robotics.
Soft-Real Time Systems 
Soft real-time is exactly the same as hard real-time in its infrastructure requirements, but it is not necessary for system success that EVERY time constraint be met. Example:Telecommunication Systems, Internet Video, ATM
kernel-in-ARM-powered-microcontroller3
 Fig 3.1: The Real-Time Spectrum 
3.1.2. Real-Time Design Approaches
          There are two primary techniques used in real-time designs
                        - Super- loops
                                    One program running
                        -Multitasking
                                    Many programs running, taking turns.
Super-Loops
   Super loops also called Foreground/Background Systems.There is a background loop that is always running anytime an ISR isn’t executing.The CPU is always busy. Small system of low complexity is generally designed as shown figure [1]. An application consists of an infinite loop that calls modules to perform the desired operation (background). Interrupt services routine handle asynchronous events (foreground). Foreground is also called interrupt level; background is called task level. Critical operation must be performed by the ISR is ensure that they are dealt with in a timely fashion. Because of this ISR have a tendency to take longer than they should. Also, information for a background module made available by an ISR is not processed until the background routine gets its turn to execute. This is called the task level response. The worst-case task level response time depends on how long the background loop takes to executes. Because of the execution time of typical code is not constant; the time for successive passes through a portion of the loop is nondeterministic.
kernel-in-ARM-powered-microcontroller4
Foreground/Background System
 Disadvantage
  • Background response time is the background execution time
        Non-deterministic
§ Affected by if, for, while ...
        May not be responsive enough
        Changes as you change your code
  • All ‘tasks’/functions () have the same priority!
        Code executes in sequence
        If an important event occurs it’s handled at the same priority as everything else!
        You may need to execute the same code often to avoid missing an event.
3.2. Introduction to RTOS
real time operating system (RTOS) is key to many embedded systems today and, provides a software platform upon which to build applications [1]. Not all embedded systems, however, are designed with an RTOS. Some embedded systems with relatively simple hardware or a small amount of software application code might not require an RTOS. Many embedded systems, however, with moderate-to-large software applications require some form of scheduling, and these systems require an RTOS. This chapter sets the stage for all subsequent chapters in this section. It describes the key concepts upon which most real-time operating systems are based.
3.2.1. Defining an RTOS
A real-time operating system (RTOS) is a program that schedules execution in a timely manner, manages system resources, and provides a consistent foundation for developing application code. For example, in some applications, an RTOS comprises only a kernel, which is the core supervisory software that provides minimal logic, scheduling, and resource-management algorithms.
Although many RTOSes can scale up or down to meet application requirements, this book focuses on the common element at the heart of all RTOSes-the kernel [3]. Most RTOS kernels contain the following components:
kernel-in-ARM-powered-microcontroller5
Scheduler-is contained within each kernel and follows a set of algorithms that determines which task executes when.
Objects-are special kernel constructs that help developers create applications for real-time embedded systems. Common kernel objects include tasks, semaphores, and message queues.
Services-are operations that the kernel performs on an object or, generally operations such as timing, interrupt handling, and resource management.
Common components in an RTOS kernel that including objects, the scheduler, and some services. This diagram is highly simplified; remember that not all RTOS kernels conform to this exact set of objects, scheduling algorithms, and services.
kernel-in-ARM-powered-microcontroller6
3.3. Commercial RTOSs
 C/OS-IIVxWorks, pSOS SystemNucleusWindows CE
3.4. RTOS Advantages
      Software that manages the time of a microprocessor or microcontroller
     Ensures that the most important code runs first
      Allows Multitasking
     Do more than one thing at the same time
     Application is broken down into multiple tasks, each handling one aspect of your application
     It’s like having multiple CPUs
      Provides valuable services to your application
     Time delays, Resource sharing.

0 comments:

Post a Comment