Cyclic executive
Encyclopedia
A cyclic executive is an alternative to a real-time operating system
Real-time operating system
A real-time operating system is an operating system intended to serve real-time application requests.A key characteristic of a RTOS is the level of its consistency concerning the amount of time it takes to accept and complete an application's task; the variability is jitter...

. It is a form of cooperative multitasking, in which there is only one task
Task (computers)
A task is an execution path through address space. In other words, a set of program instructions that are loaded in memory. The address registers have been loaded with the initial address of the program. At the next clock cycle, the CPU will start execution, in accord with the program. The sense is...

. The sole task is typically realized as an infinite loop in main, e.g. in C/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
Embedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...

 designed to monitor a temperature sensor and update an LCD display. The LCD may need to be written ten times a second (i.e., every 100 ms). If the temperature sensor must be read every 50 ms for other reasons, we might construct a loop of the following appearance:


main
{
// initialization code here

while (1)
{
currTemp = tempRead;
lcdWrite(currTemp);

// waste CPU cycles until 50 ms
currTemp = tempRead;
// 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.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK