Download ThreadX User Guide
Transcript
44 Functional Components of ThreadX Execution Overview There are four types of program execution within a ThreadX application: Initialization, Thread Execution, Interrupt Service Routines (ISRs), and Application Timers. Figure 2 on page 45 shows each different type of program execution. More detailed information about each of these types is found in subsequent sections of this chapter. Initialization As the name implies, this is the first type of program execution in a ThreadX application. Initialization includes all program execution between processor reset and the entry point of the thread scheduling loop. Thread Execution After initialization is complete, ThreadX enters its thread scheduling loop. The scheduling loop looks for an application thread ready for execution. When a ready thread is found, ThreadX transfers control to it. After the thread is finished (or another higher-priority thread becomes ready), execution transfers back to the thread scheduling loop to find the next highest priority ready thread. This process of continually executing and scheduling threads is the most common type of program execution in ThreadX applications. Interrupt Service Routines (ISR) Interrupts are the cornerstone of real-time systems. Without interrupts it would be extremely difficult to respond to changes in the external world in a timely manner. On detection of an interrupt, the processor saves key information about the current program execution (usually on the stack), then transfers User Guide