The present invention relates to a system having multiple execution units and a method for its changeover, the system having multiple execution units having at least two execution units which may be changed over between a performance operating mode, in which the execution units execute different programs, and a comparison operating mode, in which the execution units execute the same program.
In embedded systems, in particular in automobile technology or automation technology, there are applications or application programs in which an error in the hardware of the processor or the microcontroller hardware may have fatal consequences. To reduce this danger, monitoring measures are used to detect errors. In many applications or application programs, monitoring of this type is necessary almost continuously, while in other applications a monitoring function regularly, for example, periodically, or upon a specific request, for example, as a result of an interrupt, monitors whether the processor system or also other components are still functioning correctly.
German Patent Application No. DE 103 32 700 describes a method for changing over between at least two operating modes of a processor unit. The processor unit described therein has two execution units. A computer architecture of this type is also referred to as a dual-core computer architecture. The processor system described in German Patent Application No. DE 103 32 700 may be changed over between a performance operating mode and a comparison operating mode. In the performance operating mode, the execution units simultaneously execute different programs to increase the performance or the computing power. In contrast to performance operating mode PM, in comparison operating mode VM, the execution units execute identical programs and the result or the signals output by the execution units are compared to one another. If the comparison results in a deviation between the signals, this subsequently triggers an error signal. Comparison operating mode VM is used in particular in safety-critical programs to increase the safety. To increase the computing power, it is fundamentally advisable to have as many applications or programs as possible running in a mode having the highest possible performance, i.e., in performance operating mode PM. On the other hand, for safety-critical applications, almost all tasks or programs must be computed with high error recognition, i.e., in comparison operating mode VM.
An operating system BS performs the changeover between performance operating mode PM and comparison operating mode VM. Operating system BS decides on the basis of a program-specific identifier in which operating mode the program code is to be executed. This identifier may be assigned both statically and dynamically. There is also the possibility that a program is permanently assigned to a specific operating mode.
Multiple programs may be processed simultaneously on a system having multiple execution units. A so-called scheduler, which forms a part of operating system BS, decides which programs are actually executed. In a system having multiple execution units, the scheduler is executed separately on each execution unit. Therefore, multiple schedulers or operating system instances exist. The instances largely operate on the basis of the same data. A running program is also interrupted in certain circumstances by a so-called interrupt service routine ISR, as well as by the scheduler. Each interrupt service routine ISR is assigned to a specific event. If this event occurs, the instantaneously running program is interrupted and associated interrupt service routine ISR is executed. Each interrupt service routine ISR has an identifier which establishes the associated operating mode in which the interrupt service routine is to be executed.
In a system having multiple execution units which may be changed over between a performance operating mode PM and a comparison operating mode VM, it is necessary to identify and initiate the required operating mode change reliably. This procedure itself also costs computing time and computing power and may not be interrupted at any instant. If it is established by an operating system instance that a mode change into comparison operating mode VM is necessary, a changeover may not be performed immediately. Only in the case in which programs having a lower priority are executed on the further execution units or cores may the execution unit be withdrawn from the particular program for changeover into comparison operating mode VM. The ascertainment of the priority of programs on the remaining execution units is made more difficult in that in a system having multiple execution units, all active programs or interrupt service routines and the programs of the operating system itself are actually processed simultaneously. In contrast thereto, in a typical single-processor system, programs are processed in sequence by the single execution unit.
In a system having multiple execution units, there is a danger that an operating system instance, for example, an instance of the scheduler, will prompt or perform an operating mode change while the operating system instances running on the other execution units remain in the current operating mode. Because at least two execution units are required for an operating mode change in a system, in particular upon a change into comparison operating mode VM, the affected execution unit may therefore only be blocked for a specific time.
A simple example shall explain this. The totality of the programs includes four tasks T1, T2, T3, T4, for example, having the corresponding priorities, i.e., T1 has the highest priority “prio 3”, T2 has the second-highest priority “prio 2”, T3 has the third-highest priority “prio 1”, and last task T4 has the lowest priority “prio 0”, and tasks T1 through T4 are identified in such a way that tasks T1, T2 are to be executed in performance operating mode PM, while tasks T3, T4 are to be executed in comparison operating mode VM. For example, the system having multiple execution units has two execution units or CPUs. First execution unit CPU1 first executes highest-priority task T1 in performance operating mode PM and the other execution unit or CPU executes task T2 having the second-highest priority. Thus, as soon as task T1 is ended, operating system BS is called by first execution unit CPU1 and the scheduler decides which task T is to be executed next. In the given example, the scheduler decides on task T3, because it has the next highest priority “prio 1”. This task T3 has an attribute or an identification, however, which indicates that this task T3 is to be executed in comparison operating mode VM. The system having multiple execution units is thus to be changed over into a comparison operating mode VM. Task T2 still runs on second execution unit CPU2. The scheduler therefore waits until task T2 has ended on CPU2. As soon as task T2 has ended on CPU2, the scheduler or operating system BS switches both execution units into comparison operating mode VM and starts task T3. No conflict arises in this case. However, in a further example, if task T2 has a lower priority than task T3, for example, if task T2 has a “prio 1”, while task T3 has a “priority 2”, in a given scenario operating system BS must, after ending task T1, which has been executed on CPU1, immediately interrupt task T2 still running on CPU2 and have task T3 run on both execution units. However, operating system BS itself must be executed on an execution unit. In the given example, operating system BS is executed on first execution unit CPU1, which has become free, and may start task T3. For this purpose, the operating system must determine the priority of task T2 which is currently running on execution unit CPU2. The comparison of the priorities of tasks T2 and T3 on first execution unit CPU1 requires a certain amount of time, however. During the time span or duration required for the priority comparison, however, the case may arise that second execution unit CPU2 ends task T2 and in turn calls the operating system or the scheduler. In the given example, the second execution unit would call remaining task T4, which is to be executed in comparison operating mode VM, and a collision would occur between tasks T3 and T4, which both require first and second execution units CPU1, CPU2. The occurring collision may always occur if a called task T has to run in a comparison operating mode VM.
It is an object of the present invention to provide a system having multiple execution units and a method for its changeover, in which collisions are avoided when changing over into a comparison operating mode.
The present invention provides an example method for changing over a system having multiple execution units, which has at least two execution units, from a performance operating mode PM, in which the execution units execute different programs, into a comparison operating mode VM, in which the execution units execute the same program, having the following steps, namely
calling of a scheduler by an execution unit, the called scheduler ascertaining the next program to be executed,
prompting the remaining execution units to also call the scheduler if the next program to be executed is to be executed in comparison operating mode VM, and
changing over the system having multiple execution units from performance operating mode PM into comparison operating mode VM, if the program to be executed ascertained by the last called scheduler is to be performed in comparison operating mode VM, this program to be executed ascertained by the last called scheduler being executed as the program having the highest priority by all execution units in comparison operating mode VM of the system having multiple execution units.
In a preferred specific embodiment of the method according to the present invention, the execution unit which first calls the scheduler to ascertain the program to be executed next waits until all remaining execution units have also ascertained a program to be executed next by the call of the scheduler, and it is only then checked whether the program ascertained by the last called scheduler, which forms the program having the highest priority, is to be ascertained in a comparison operating mode VM.
In one specific embodiment of the method according to the present invention, the execution unit which first called the scheduler calls the scheduler again if the program ascertained by the last called scheduler is not to be performed in comparison operating mode VM.
In one specific embodiment of the method according to the present invention, the program to be executed is executed directly without changing over if the called scheduler ascertains a program, which is not to be executed in a comparison operating mode VM, but rather in a performance operating mode PM, as the next program to be executed.
In one specific embodiment of the method according to the present invention, an execution unit which calls the scheduler to ascertain the next program to be executed compares the priority of the ascertained program to the priorities of all programs currently being executed on the other execution units, if the ascertained program is to be executed in a comparison operating mode VM.
In one specific embodiment of the method according to the present invention, the execution unit which first called the scheduler passes into an idle operating mode (IDLE) and waits until the remaining execution units have each ended their programs if a program currently being performed on another execution unit has a higher priority than the program to be executed next ascertained by the first called scheduler.
In one specific embodiment of the method according to the present invention, the execution unit which calls the scheduler to ascertain the program to be executed next prompts the other execution units to also call the scheduler in that it transmits a request signal to the other execution units if the program to be executed next is to be executed in a comparison operating mode VM.
In one specific embodiment of the method according to the present invention, the request signal is formed by an interrupt signal.
In one specific embodiment of the method according to the present invention, the execution units are each formed by a processor, a coprocessor, a floating-point calculation unit, an arithmetic logic unit, or by a digital signal processor.
In one possible specific embodiment of the method according to the present invention, an execution unit calls the scheduler after ending an executed program.
The present invention also provides an example system having at least two execution units, which may be changed over between a performance operating mode PM, in which the execution units execute different programs, and a comparison operating mode VM, in which the execution units execute the same program, having
a scheduler which is called by an execution unit to ascertain the next program to be executed, the remaining execution units being prompted to also call the scheduler, if the program ascertained by the first called scheduler is to be executed in comparison operating mode VM, and having
a changeover unit, which changes the system having multiple execution units over from performance operating mode PM into comparison operating mode VM, if the program to be executed ascertained by the last called scheduler is to be executed in comparison operating mode VM, this ascertained program to be executed being executed as the program having the highest priority by all execution units after the changeover of the system having multiple execution units into comparison operating mode VM.
Preferred specific embodiments of the system according to the present invention having multiple execution units and of the method according to the present invention for its changeover are described below with reference to the figures to explain features of the present invention.
As may be seen from
In the simple example described above having four tasks T1, T2, T3, T4, T1 having the highest priority (prio 3), T2 having the second-highest priority (prio 2), T3 having the third-highest priority (prio 1), and T4 having the lowest priority (prio 0), T1, T2 being executed in performance operating mode PM and T3, T4 being executed in comparison operating mode VM, execution unit 2A calls the operating system scheduler after ending task T1, which prompts execution unit 2B to interrupt the program or task T2 currently running and to in turn call the operating system scheduler. As shown in
In the specific embodiment shown in
In one possible specific embodiment, an interrupt service routine has precedence over the execution of an application program. If an interrupt service routine ISR is processed in a comparison operating mode VM, interrupt controller 4 is programmed in such a way that an interrupt request which interrupt controller 4 receives via line 5 from system bus 6 is transmitted to both execution units 2A, 2B via lines 12A, 12B. In an execution unit or a processor core which executes a program code of operating system BS, no interrupt queries or interrupt requests may be processed on this execution unit or processor. If a hardware interrupt occurs, the following steps are executed: firstly the current processor state including the operating mode is secured and/or saved. Subsequently, the operating mode in which associated interrupt service routine ISR is to be executed is ascertained and if needed a changeover is performed into comparison operating mode VM. All interrupts having higher priority are then released. Subsequently, interrupt service routine ISR is executed and the secured and/or saved processor state is produced again. If needed, a changeover into performance operating mode PM is subsequently performed again.
In system 1 having multiple execution units according to the present invention shown in
If system 1 is in performance operating mode PM, multiple scheduler instances exist, i.e., scheduler instance SCH-A exists on first execution unit 2A and scheduler instance SCH-B is on second execution unit 2B.
For example, if scheduler instance SCH-B ascertains next task Tx having the highest priority and ascertained program or task Tx requires execution in comparison operating mode VM, the scheduling data structures are initially not changed. Instead, the priority of the program or task Ty on processor 2B is ascertained by scheduling instance SCH-A. If this task Ty has a lower priority than next task Tx, execution unit 2B is signaled via interrupt that a changeover request exists. If this task Ty has a higher priority than task Tx, scheduler SCH-A activates a so-called IDLE task, which produces an idle operating state. After the signaling, scheduling instance SCH-A waits for scheduling instance SCH-B to be finished (barrier). If an interrupt service routine ISR is executed on execution unit 2A, the processing of the changeover request query is first begun when all interrupts have been processed on processor 2A. If execution unit 2A activates operating system BS because of the changeover request of scheduler instance SCH-A, scheduler instance SCH-B is also called by execution unit 2A. If scheduler instance SCH-B which runs on execution unit 2B also comes to the result that task Tx, must be executed, scheduling instance SCH-B releases scheduling instance SCH-A, which runs on execution unit 2A, from the block or barrier.
If scheduling instance SCH-B comes to the result that not task Tx, but rather a task Tz, must be executed in performance operating mode PM, i.e., the priority of task Tz, is greater than the priority of task Tx, scheduling instance SCH-A is also released from the barrier. Scheduling instance SCH-B then prompts the execution of task Tz, and scheduling instance SCH-A once again ascertains a task or a program having the highest priority (reschedule).
If scheduling instance SCH-B comes to the result that not task Tx, but rather a task Tz must be executed in comparison operating mode VM, i.e., the priority of task Tz is greater than the priority of task Tx, scheduling instance SCH is also released from the barrier. Scheduling instances SCH-A, SCH-B then prompt the execution of task Tz on both execution units.
In one possible embodiment, an internal operating flag may be set by scheduling instance SCH-A. This flag then signals the changeover request. If execution unit 2B is simultaneously processing a program of operating system BS, scheduling instance SCH-A must wait until second execution unit 2B leaves operating system BS and receives the changeover request by the interrupt. Second execution unit 2B may query the flag at a suitable point and if needed call scheduler SCH-B or perform a reschedule without having to leave operating system BS.
In the method according to the present invention for a changeover into comparison operating mode VM, the scheduler is thus called not only by one execution unit, but also by the other execution units. The changeover procedure only occurs when the program to be executed ascertained by last called scheduler SCH is to be performed in comparison operating mode VM. This program to be executed ascertained by the last called scheduler is then executed as the program having the highest priority by all execution units 2 in comparison operating mode VM of system 1. Execution unit 2 which first called scheduler SCH to ascertain the program to be executed next waits until all remaining execution units 2 have also ascertained a program to be executed next by the call to the scheduler. It is only then checked whether the program ascertained by last called scheduler SCH, which is the program having the highest priority, is to be executed in comparison operating mode VM.
If the case occurs that the program ascertained by last called scheduler SCH is not to be performed in comparison operating mode VM, execution unit 2 which first called scheduler SCH calls the scheduler again. This case may occur if an event which requires another prioritization of tasks T has occurred in the period of time between the call to scheduler SCH by first execution unit 2 and the call to scheduler SCH by last execution unit 2.
For the case in which called scheduler SCH ascertains a program as the next program to be executed which is not to be executed in a comparison operating mode VM, but rather in a performance operating mode PM, the program or task T to be executed is executed directly without changeover.
In one specific embodiment of the method according to the present invention, execution unit 2 which first called scheduler SCH passes into an idle operating mode (IDLE) until remaining execution units 2 have ended their programs if a program just performed by another execution unit 2 has a higher priority than the program to be executed next ascertained by the first called scheduler.
In one specific embodiment of the method according to the present invention, execution unit 2 which first called the scheduler to ascertain the program to be executed next prompts other execution units 2 to also call the scheduler in that it transmits a request signal to the other execution units if the next program to be executed is to be executed in a comparison operating mode VM. This request signal is preferably formed by an interrupt signal.
The program sequences shown in
The example method according to the present invention prevents blocking of execution units 2 upon changeover into a comparison operating mode VM in every case. The example method according to the present invention is particularly suitable for systems having two or more execution units. For example, if system 1 has two execution units 2, in the method according to the present invention, the scheduling is performed twice, because the task ascertained by the last called scheduling instance has the current highest priority and is accordingly to be executed. The two scheduling instances are synchronized to one another because of the barrier contained in the sequence.
Number | Date | Country | Kind |
---|---|---|---|
102006048173.9 | Oct 2006 | DE | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/EP2007/059900 | 9/19/2007 | WO | 00 | 7/12/2010 |