Cyclic executive

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Guy Macon (talk | contribs) at 17:19, 26 September 2016 (Clearly notable, and it has enough references for a stub article.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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. For example, let us 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)
{
   // initialization code here
 
   while (1)
   {
      currTemp = tempRead();
      lcdWrite(currTemp);

      // waste CPU cycles until 50 ms
      lcdWrite(currTemp);
      // do other stuff

      // waste CPU cycles until 100 ms
   }
}

The outer 100 ms cycle is called the major cycle. In this case, there is also an inner minor cycle of 50 ms.

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.