To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Cyclic executive

From Wikipedia, the free encyclopedia

A cyclic executive[1][2] is an alternative to a real-time operating system. It is a form of cooperative multitasking, in which there is only one task. The sole task is typically realized as an infinite loop in main(), e.g. in C.

The basic scheme is to cycle through a repeating sequence of activities, at a set frequency (AKA time-triggered cyclic executive). For example, consider the example of an embedded system designed to monitor a temperature sensor and update an LCD display. The LCD may need to be written twenty times a second (i.e., every 50 ms). If the temperature sensor must be read every 100 ms for other reasons, we might construct a loop of the following appearance:

int main(void)
{
   while (1)
   {
      // This loop is designed to take 100 ms, meaning
      // all steps add up to 100 ms.
      // Since this is demo code and we don't know how long
      // tempRead or lcdWrite take to execute, we assume
      // they take zero time.
      // As a result, the delays are responsible for the task scheduling / timing.

      // Read temp once per cycle (every 100 ms)
      currTemp = tempRead();

      // Write to LCD twice per cycle (every 50 ms)
      lcdWrite(currTemp);
      delay(50);
      lcdWrite(currTemp);
      delay(50);

      // Now 100 ms (delay(50) + delay(50) + tempRead + lcdWrite + lcdWrite)
      // has passed so we repeat the cycle.
   }
}

The outer 100 ms cycle is called the major cycle. In this case, there is also an inner minor cycle of 50 ms. In this first example the outer versus inner cycles aren't obvious. We can use a counting mechanism to clarify the major and minor cycles.

int main(void)
{
   unsigned int i = 0;
   while (1)
   {
      // This loop is designed to take 50 ms.
      // Since this is demo code and we don't know how long
      // tempRead or lcdWrite take to execute, we assume
      // they take zero time.
      // Since we only want tempRead to execute every 100ms, we use
      // an if statement to check whether a counter is odd or even, 
      // and decide whether to execute tempRead.

      // Read temp every other cycle (every 100 ms)
      if ( (i%2) == 0)
      {
         currTemp = tempRead();
      }

      // Write to LCD once per cycle (every 50 ms)
      lcdWrite(currTemp);
      delay(50);

      i++;
      // Now 50 ms has passed so we repeat the cycle.
   }
}

YouTube Encyclopedic

  • 1/3
    Views:
    632
    67 671
    79 671
  • 27AR - Cyclic Executives
  • Lecture - 21 Scheduling Policies
  • Lecture 20 - Fundamentals of Embedded Operating Systems

Transcription

See also

References

  1. ^ Bruce Powell Douglass (2003). Real-Time Design Patterns: Robust Scalable Architecture for Real-Time Systems. Addison-Wesley Longman Publishing Co., Inc. pp. 232–237. ISBN 0201699567.
  2. ^ Laplante, Phillip A.; Ovaska, Seppo J. (2012). Real-Time System Design and Analysis (4th ed.). Hoboken, NJ: John Wiley & Sons, Inc. pp. 84–85, 100–102. ISBN 978-0-470-76864-8.
This page was last edited on 29 March 2024, at 01:40
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.