xPC Target | ![]() ![]() |
Interrupt Mode
Interrupt mode is the default real-time execution mode for the xPC Target kernel. This mode provides the greatest flexibility and is the mode you should choose for any application that executes at the given base sample time without overloading the CPU.
The scheduler assures real-time single-tasking and multitasking execution of single-rate or multirate systems including asynchronous events (interrupts). Additionally, background tasks like host-target communication or updating the target screen run in parallel with the sample-time-based model tasks. This allows you to interact with the target system while the target application is executing in real time at high sample rates. This is made possible by an interrupt-driven real-time scheduler that is responsible for executing the various tasks according to their priority. The base sample time task can interrupt any other task (larger sample time tasks or background tasks) and execution of the interrupted tasks resumes as soon as the base sample time task completes operation. This gives a quasi-parallel execution scheme with consideration to the priorities of the tasks.
Latencies Introduced by Interrupt Mode
Compared to other modes, interrupt mode has more advantages. The exception is the disadvantage of introducing a constant overhead or latency, which reduces the minimal possible base sample time to a constant number. The overhead is the sum of various factors related to the interrupt-driven execution scheme and can be referred to as overall interrupt latency. The overall latency consists of the following parts, assuming that the currently executing task is not executing a critical section and has therefore not disabled any interrupt sources.
The xPC Target real-time kernel in interrupt mode is close to optimal for executing code on a PC-compatible system. However, interrupt mode introduces an overall latency of about 8 us. This is a significant amount of time when considering that a 1 GHz CPU can execute thousands of instructions within 8 us. This time is equivalent to a Simulink model containing a hundred nontrivial blocks. Additionally, because lower priority tasks have to be serviced as well, a certain amount of headroom (at least 5%) is necessary, which can cause additional cache misses and therefore nonoptimal execution speed.
![]() | xPC Target Kernel Polling Mode | Polling Mode | ![]() |