JP2017107394A - Vehicle controller - Google Patents

Vehicle controller Download PDF

Info

Publication number
JP2017107394A
JP2017107394A JP2015240566A JP2015240566A JP2017107394A JP 2017107394 A JP2017107394 A JP 2017107394A JP 2015240566 A JP2015240566 A JP 2015240566A JP 2015240566 A JP2015240566 A JP 2015240566A JP 2017107394 A JP2017107394 A JP 2017107394A
Authority
JP
Japan
Prior art keywords
core
storage unit
semaphore
exclusive control
execution history
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2015240566A
Other languages
Japanese (ja)
Other versions
JP6512087B2 (en
Inventor
英治 松岡
Eiji Matsuoka
英治 松岡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2015240566A priority Critical patent/JP6512087B2/en
Priority to DE102016224206.7A priority patent/DE102016224206A1/en
Publication of JP2017107394A publication Critical patent/JP2017107394A/en
Application granted granted Critical
Publication of JP6512087B2 publication Critical patent/JP6512087B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a vehicle controller capable of preventing interruption delay or increase of load on a calculation unit.SOLUTION: A vehicle controller 100 is mounted on a vehicle, which includes: a first core 10 and a second core 20; a first share storage part 33 and a second share storage part 41 to which the first core 10 and the second core 20 commonly access; and programs 31a and 31b each of which includes a plurality of core exclusion controls for preventing conflict between the first core 10 and the second core 20. In the plurality of core exclusion controls, with respect to a core exclusion control that stores no execution history representing an execution by both of first core 10 and second core 20, the first core 10 and the second core 20 do not execute the core exclusion control.SELECTED DRAWING: Figure 1

Description

本発明は、車両に搭載されるものであり、複数の演算部と複数の演算部が共通にアクセスする共有データが格納された共有記憶部とを有した車両用制御装置に関する。   The present invention is mounted on a vehicle, and relates to a vehicle control device including a plurality of calculation units and a shared storage unit in which shared data that is commonly accessed by the plurality of calculation units is stored.

従来、上記のような構成の車両用制御装置の一例として、特許文献1に開示されたものがある。   Conventionally, as an example of a vehicle control device having the above-described configuration, there is one disclosed in Patent Document 1.

特許文献1には、複数の演算部と、複数の演算部が共通にアクセスする共有データが冗長に格納される共有記憶部とを備えた車両用制御装置が開示されている。この車両用制御装置は、共有記憶部へのアクセスが競合することを避けるために、データ更新処理部を実行していない演算部に対して最高優先度の割り込み信号を入力している。   Patent Document 1 discloses a vehicle control device that includes a plurality of arithmetic units and a shared storage unit that redundantly stores shared data accessed in common by the plurality of arithmetic units. This vehicle control device inputs an interrupt signal with the highest priority to a computing unit that is not executing a data update processing unit in order to avoid contention for access to the shared storage unit.

特開2013−171547号公報JP 2013-171547 A

しかしながら、特許文献1では、共有データを更新するたびに割り込みが発生するため、共有データが多い場合には割り込みが多発する。よって、特許文献1では、共有データを更新するための割り込みによって、他の割り込みが遅延されるという問題がある。さらに、特許文献1では、共有記憶部の通知処理などのための処理時間によっても演算部のロードが増加する。   However, in Patent Document 1, an interrupt is generated every time shared data is updated. Therefore, when there is a large amount of shared data, many interrupts occur. Therefore, in patent document 1, there exists a problem that another interrupt is delayed by the interrupt for updating shared data. Furthermore, in Patent Document 1, the load on the arithmetic unit also increases depending on the processing time for the notification processing of the shared storage unit.

本発明は、上記問題点に鑑みなされたものであり、割り込み遅延や演算部のロード増加を低減した車両用制御装置を提供することを目的とする。   The present invention has been made in view of the above-described problems, and an object of the present invention is to provide a vehicle control device that reduces an interrupt delay and an increase in load on a calculation unit.

上記目的を達成するために本発明は、
車両に搭載されるものであり、複数の演算部(10、20)と、複数の演算部が共通にアクセスする共有記憶部(33、41)と、を備えた車両用制御装置であって、
複数の演算部によって実行されるものであり、複数の演算部による共有記憶部への競合を抑制するための複数の排他制御を含むプログラム(31a、31b)と、
各排他制御が各演算部によって実行されたか否かを示す、各排他制御に対応した実行履歴を記憶している記憶部(32、32a)と、
各演算部は、排他制御を実行するものであり、複数の排他制御のうち複数の演算部で実行されたことを示す実行履歴が記憶された排他制御に関しては排他制御を実行し、複数の排他制御のうち複数の演算部で実行されたことを示す実行履歴が記憶されていない排他制御に関しては排他制御を実行しないことを特徴とする。
In order to achieve the above object, the present invention provides:
A vehicle control device that is mounted on a vehicle and includes a plurality of calculation units (10, 20) and a shared storage unit (33, 41) that is accessed by a plurality of calculation units in common.
A program (31a, 31b) that is executed by a plurality of arithmetic units and includes a plurality of exclusive controls for suppressing competition to the shared storage unit by the plurality of arithmetic units;
A storage unit (32, 32a) for storing an execution history corresponding to each exclusive control, indicating whether each exclusive control has been executed by each computing unit;
Each computing unit executes exclusive control, and with respect to exclusive control in which an execution history indicating that execution has been performed by a plurality of computing units among a plurality of exclusive controls is executed, exclusive control is executed and a plurality of exclusive controls are performed. The exclusive control is not executed with respect to the exclusive control in which the execution history indicating that the control is executed by a plurality of arithmetic units is not stored.

このように、本発明は、各排他制御が各演算部によって実行されたか否かを示す実行履歴を記憶している記憶部を有している。よって、本発明は、複数の排他制御の夫々を実行した演算部がわかるように構成されている。そして、複数の演算部で実行された排他制御は、複数の演算部による共有記憶部への競合が発生する可能性がある。このため、各演算部は、複数の排他制御のうち複数の演算部で実行されたことを示す実行履歴が記憶された排他制御に関しては排他制御を実行する。一方、複数の演算部で実行されていない排他制御は、複数の演算部による共有記憶部への競合が発生する可能性がない。このため、各演算部は、複数の排他制御のうち複数の演算部で実行されたことを示す実行履歴が記憶されていない排他制御に関しては排他制御を実行しない。   As described above, the present invention includes a storage unit that stores an execution history indicating whether each exclusive control has been executed by each arithmetic unit. Therefore, the present invention is configured so that a calculation unit that executes each of a plurality of exclusive controls can be identified. Then, in the exclusive control executed by the plurality of arithmetic units, there is a possibility that a plurality of arithmetic units compete with the shared storage unit. For this reason, each calculating part performs exclusive control regarding the exclusive control in which the execution log | history which shows having been performed by the several calculating part among several exclusive control was memorize | stored. On the other hand, in the exclusive control that is not executed by the plurality of arithmetic units, there is no possibility that the plural arithmetic units compete with the shared storage unit. For this reason, each calculating part does not perform exclusive control regarding the exclusive control in which the execution log | history which shows having been performed by the several calculating part among several exclusive control is not memorize | stored.

よって、本発明は、複数の演算部による共有記憶部への競合が発生する可能性がない場合に排他制御が実行されることを抑制できる。従って、本発明は、必要以上に排他制御を行うことを抑制できる。なお、これによって、本発明は、演算部によるロード増加の低減が期待できる。さらに、本発明は、排他制御を実行するために割り込みを行ったとしても、割り込みによる遅延の低減が期待できる。   Therefore, the present invention can suppress exclusive control from being executed when there is no possibility of contention with the shared storage unit by a plurality of arithmetic units. Therefore, this invention can suppress performing exclusive control more than necessary. As a result, the present invention can be expected to reduce the increase in load caused by the calculation unit. Furthermore, the present invention can be expected to reduce delay due to an interrupt even when an interrupt is performed to execute exclusive control.

なお、特許請求の範囲、及びこの項に記載した括弧内の符号は、ひとつの態様として後述する実施形態に記載の具体的手段との対応関係を示すものであって、発明の技術的範囲を限定するものではない。   The reference numerals in parentheses described in the claims and in this section indicate the correspondence with the specific means described in the embodiments described later as one aspect, and the technical scope of the invention is as follows. It is not limited.

第1実施形態における車両用制御装置の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of the control apparatus for vehicles in 1st Embodiment. 第1実施形態におけるプラットフォームプログラム実行時のフローチャートである。It is a flowchart at the time of the platform program execution in 1st Embodiment. 第1実施形態におけるセマフォ獲得処理を示すフローチャートである。It is a flowchart which shows the semaphore acquisition process in 1st Embodiment. 第1実施形態におけるスピンロック処理を示すフローチャートである。It is a flowchart which shows the spin lock process in 1st Embodiment. 第1実施形態におけるセマフォ解放処理を示すフローチャートである。It is a flowchart which shows the semaphore release process in 1st Embodiment. 第1実施形態における実行履歴を示すイメージ図である。It is an image figure which shows the execution log | history in 1st Embodiment. 第1実施形態における各共有記憶部とセマフォとの関係を示すイメージ図である。It is an image figure which shows the relationship between each shared memory | storage part and semaphore in 1st Embodiment. 変形例1における各共有記憶部とセマフォとの関係を示すイメージ図である。FIG. 10 is an image diagram illustrating a relationship between each shared storage unit and a semaphore in Modification 1; 変形例2における各共有記憶部とセマフォとの関係を示すイメージ図である。It is an image figure which shows the relationship between each shared storage part and semaphore in the modification 2. 第2実施形態における車両用制御装置の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of the control apparatus for vehicles in 2nd Embodiment.

以下において、図面を参照しながら、発明を実施するための形態を説明する。   Hereinafter, embodiments for carrying out the invention will be described with reference to the drawings.

(第1実施形態)
本実施形態では、図1に示す車両用制御装置100に適用した例を採用する。また、車両用制御装置100は、車両に搭載される制御装置であり、例えばエンジン制御装置、ハイブリッド制御装置などに適用できる。本実施形態では、一例として、車両用制御装置100をエンジン制御装置に適用した例を採用する。
(First embodiment)
In the present embodiment, an example applied to the vehicle control device 100 shown in FIG. 1 is adopted. The vehicle control device 100 is a control device mounted on a vehicle, and can be applied to, for example, an engine control device, a hybrid control device, and the like. In the present embodiment, as an example, an example in which the vehicle control device 100 is applied to an engine control device is employed.

車両用制御装置100は、複数のセンサから検出信号を取得可能に構成されており、取得した検出信号を用いてエンジンの状態に応じた最適な燃料噴射を行うための演算を実行する。図1では、センサの一例としてクランク角センサ210を図示している。また、車両用制御装置100は、各種アクチュエータが接続されている。図1では、アクチュエータの一例としてインジェクタ220を図示している。そして、車両用制御装置100は、演算結果である制御信号を出力することで、インジェクタ220などのアクチュエータを制御する。このようにして、車両用制御装置100は、エンジン制御を行う。   The vehicle control device 100 is configured to be able to acquire detection signals from a plurality of sensors, and uses the acquired detection signals to perform calculations for optimal fuel injection according to the state of the engine. FIG. 1 illustrates a crank angle sensor 210 as an example of the sensor. The vehicle control device 100 is connected to various actuators. In FIG. 1, an injector 220 is illustrated as an example of an actuator. And the vehicle control apparatus 100 controls actuators, such as the injector 220, by outputting the control signal which is a calculation result. In this way, the vehicle control device 100 performs engine control.

車両用制御装置100は、マイコンなどを備えて構成されている。詳述すると、車両用制御装置100は、第1コア10、第2コア20、第1記憶部31、第2記憶部32、第1共有記憶部33、入出力回路40などを備えて構成されている。また、車両用制御装置100は、第1コア10と第2コア20、及び、第1コア10と第2コア20とが共通にアクセスする第1共有記憶部33と後程説明する第2共有記憶部41とを備えて構成されている。なお、以下においては、第1共有記憶部33と後程説明する第2共有記憶部41とを纏めて共有記憶部と称することもある。   The vehicle control device 100 includes a microcomputer and the like. More specifically, the vehicle control device 100 includes a first core 10, a second core 20, a first storage unit 31, a second storage unit 32, a first shared storage unit 33, an input / output circuit 40, and the like. ing. In addition, the vehicle control apparatus 100 includes a first shared storage unit 33 that is commonly accessed by the first core 10 and the second core 20, and the first core 10 and the second core 20, and a second shared storage that will be described later. Part 41 is provided. In the following, the first shared storage unit 33 and the second shared storage unit 41 described later may be collectively referred to as a shared storage unit.

第1コア10は、第1CPU11、第1レジスタ12、第1メモリ13を備えて構成されている。第1メモリ13は、第1コア10の第1コアIDが記憶されている。第1コアIDは、第1コア10であることを示す情報、すなわち識別情報である。IDは、Identificationの略称である。   The first core 10 includes a first CPU 11, a first register 12, and a first memory 13. The first memory 13 stores the first core ID of the first core 10. The first core ID is information indicating the first core 10, that is, identification information. ID is an abbreviation for Identification.

第2コア20は、第1コア10と同様に、第2CPU21、第2レジスタ22、第2メモリ23を備えて構成されている。第2コアIDは、第2コア20であることを示す識別情報である。第1コアIDと第2コアIDとは、重複することなく設けられている。   Similar to the first core 10, the second core 20 includes a second CPU 21, a second register 22, and a second memory 23. The second core ID is identification information indicating the second core 20. The first core ID and the second core ID are provided without overlapping.

このように、本実施形態では、複数の演算部として、第1コア10と第2コア20とを採用している。しかしながら、本発明は、これに限定されず、三つ以上のコアを備えていても目的を達成できる。なお、CPUは、Central Processing Unitの略称である。   Thus, in this embodiment, the 1st core 10 and the 2nd core 20 are employ | adopted as a some calculating part. However, the present invention is not limited to this, and the object can be achieved even if three or more cores are provided. CPU is an abbreviation for Central Processing Unit.

第1コア10と第2コア20は、後程説明するアプリケーションプログラム及びプラットフォームプログラムを実行することで、共有記憶部に記憶された共有データにアクセスしつつ、上記のように演算や入出力回路40を介して制御信号の出力を行う。また、第1コア10と第2コア20は、アプリケーションプログラム及びプラットフォームプログラムを実行することで、第2記憶部32にアクセスする。第1コア10と第2コア20は、第2記憶部32にアクセスした場合、セマフォの獲得及び解放や、コア実行履歴の更新などを行う。このように、車両用制御装置100は、コア排他制御の一例として、セマフォを用いたコア排他制御を行う。しかしながら、本発明は、これに限定されず、ミューテックスなどの排他制御を採用できる。なお、コア排他制御は、特許請求の範囲における排他制御に相当する。   The first core 10 and the second core 20 execute the application program and the platform program, which will be described later, thereby accessing the shared data stored in the shared storage unit and executing the arithmetic and input / output circuit 40 as described above. The control signal is output via Further, the first core 10 and the second core 20 access the second storage unit 32 by executing the application program and the platform program. When accessing the second storage unit 32, the first core 10 and the second core 20 acquire and release semaphores, update the core execution history, and the like. Thus, the vehicle control apparatus 100 performs core exclusion control using a semaphore as an example of core exclusion control. However, the present invention is not limited to this, and exclusive control such as mutex can be adopted. The core exclusive control corresponds to the exclusive control in the claims.

以下においては、第1コア10と第2コア20とを区別する必要がない場合、単にコアとも記載する。同様に、第1コアIDと第2コアIDとを区別する必要がない場合、単にコアIDとも記載する。   Below, when it is not necessary to distinguish the 1st core 10 and the 2nd core 20, it only describes as a core. Similarly, when it is not necessary to distinguish the first core ID and the second core ID, they are also simply referred to as a core ID.

第1記憶部31は、例えばROMを採用できる。第1記憶部31には、第1コア10及び第2コア20で実行されるプログラムが記憶されている。このプログラムは、アプリケーションプログラムとプラットフォームプログラムに分離されている。つまり、第1記憶部31には、アプリケーションプログラムやプラットフォームプログラムが記憶されている。アプリケーションプログラムは、例えば、車両状態に応じて燃料を噴射するエンジン位置や噴射量の要求値などを演算するプログラムである。プラットフォームプログラムは、例えば、アプリケーションプログラムからの要求値に基づき、要求されたエンジン位置、噴射量で燃料を噴射するように入出力回路40を駆動するプログラムである。   The first storage unit 31 can employ a ROM, for example. The first storage unit 31 stores programs executed by the first core 10 and the second core 20. This program is separated into an application program and a platform program. That is, the first storage unit 31 stores application programs and platform programs. The application program is, for example, a program that calculates an engine position for injecting fuel, a required value for the injection amount, and the like according to the vehicle state. The platform program is a program that drives the input / output circuit 40 to inject fuel at a requested engine position and injection amount based on a request value from an application program, for example.

なお、第1記憶部31に記憶されたプログラムは、例えば、プラットフォームプログラムを車両制御装置サプライヤが開発し、アプリケーションプログラムを完成車両メーカが開発することが考えられる。また、プラットフォームプログラムの開発資産は、複数の車両システムで再利用されることが一般的である。一方、アプリケーションプログラムは、車両システムごとに異なることがありうる。このため、プラットフォームプログラムを実行するCPU割り当ては、車両システムによって異なる可能性がある。このような場合、プラットフォームプログラムは、どのようにCPU割り当てがされても、共有記憶部の競合を避けられるように、コア間の排他制御(以下、コア排他制御)が行われるようにする必要がある。   In addition, as for the program memorize | stored in the 1st memory | storage part 31, it is possible that a vehicle control apparatus supplier develops a platform program and a completed vehicle manufacturer develops an application program, for example. Further, the development assets of the platform program are generally reused in a plurality of vehicle systems. On the other hand, the application program may be different for each vehicle system. For this reason, the CPU allocation for executing the platform program may differ depending on the vehicle system. In such a case, the platform program needs to perform exclusive control between the cores (hereinafter referred to as core exclusive control) so as to avoid contention for the shared storage unit regardless of the CPU allocation. is there.

つまり、プラットフォームプログラムは、共有記憶部へアクセスされる全てのタイミングでコア排他制御が行われるように構成されている。言い換えると、プラットフォームプログラムは、共有記憶部へアクセスされる全ての処理に対応してコア排他制御が行われるように構成されている。また、プラットフォームプログラムは、フルにコア排他制御が設けられているとも言える。さらに、プログラムは、第1コア10と第2コア20による共有記憶部への競合を抑制するための複数の排他制御を含んでいると言える。しかしながら、第1コア10と第2コア20は、全てのタイミングで共有記憶部へアクセスするとは限らない。   That is, the platform program is configured such that core exclusive control is performed at every timing when the shared storage unit is accessed. In other words, the platform program is configured such that core exclusive control is performed in correspondence with all processes accessed to the shared storage unit. It can also be said that the platform program has full core exclusive control. Further, it can be said that the program includes a plurality of exclusive controls for suppressing competition between the first core 10 and the second core 20 to the shared storage unit. However, the first core 10 and the second core 20 do not always access the shared storage unit at all timings.

また、第1記憶部31には、第1コア10及び第2コア20で実行されるプログラムとして、複数のコア排他制御を含む第1プログラムと、第1プログラムとは異なる第2プログラムとが記憶されていると言うこともできる。   Further, the first storage unit 31 stores a first program including a plurality of core exclusive controls and a second program different from the first program as programs executed by the first core 10 and the second core 20. It can also be said that it has been.

第2記憶部32は、例えばRAMを採用できる。第2記憶部32には、セマフォやコア実行履歴が記憶されている。第2記憶部32は、特許請求の範囲における記憶部に相当する。   The second storage unit 32 can employ a RAM, for example. The second storage unit 32 stores semaphores and core execution history. The second storage unit 32 corresponds to the storage unit in the claims.

セマフォは、周知のように、複数コアと共有記憶部を持つ装置におけるコア排他制御に用いられる。つまり、セマフォは、第1コア10と第2コア20による、第1共有記憶部33や第2共有記憶部41へのアクセスが競合することを避けるためのコア排他制御に用いられる。また、コア排他制御は、第1コア10が共有データにアクセスするタイミングと、第2コア20が共有データにアクセスするタイミングとが同時にならないことを実現するための手法とも言える。   As is well known, the semaphore is used for core exclusive control in an apparatus having a plurality of cores and a shared storage unit. That is, the semaphore is used for core exclusive control for avoiding contention between accesses to the first shared storage unit 33 and the second shared storage unit 41 by the first core 10 and the second core 20. The core exclusive control can also be said to be a method for realizing that the timing at which the first core 10 accesses the shared data and the timing at which the second core 20 accesses the shared data do not coincide with each other.

セマフォは、解放中の状態と、獲得中の状態を持つ。詳述すると、セマフォは、獲得中のコアID、及び解放中を示すことができる。例えば、第2記憶部32は、セマフォ獲得中であるかセマフォ解放中であるかを示す情報と、セマフォ獲得中であるコアのコアIDとを含むものである。なお、セマフォ獲得中であるかセマフォ解放中であるかを示す情報と獲得中であるコアのコアIDは、纏めてセマフォ情報と称することができる。よって、図1の第2記憶部32に記載したセマフォは、セマフォ情報に相当するとも言える。   A semaphore has a released state and an acquired state. Specifically, the semaphore can indicate the core ID that is being acquired and that it is being released. For example, the second storage unit 32 includes information indicating whether the semaphore is being acquired or the semaphore is being released, and the core ID of the core that is acquiring the semaphore. Note that the information indicating whether the semaphore is being acquired or the semaphore is being released and the core ID of the core being acquired can be collectively referred to as semaphore information. Therefore, it can be said that the semaphore described in the second storage unit 32 in FIG. 1 corresponds to semaphore information.

また、セマフォを獲得中のコアは、唯一となるように構成されている。すなわち、セマフォを獲得中のコアは、第1コア10と第2コア20のいずれか一方のみである。そして、コア排他制御では、セマフォを参照しながら第1共有記憶部33や第2共有記憶部41にアクセスすることによりコア間での排他が可能になる。例えば、第1コア10は、セマフォを参照しながら第1共有記憶部33にアクセスすることにより、自身がセマフォを解放するまで、第2コア20による第1共有記憶部33へのアクセス禁止が可能になる。   Also, the core that is acquiring the semaphore is configured to be unique. That is, only one of the first core 10 and the second core 20 is acquiring the semaphore. In the core exclusion control, the cores can be excluded by accessing the first shared storage unit 33 and the second shared storage unit 41 while referring to the semaphore. For example, by accessing the first shared storage unit 33 while referring to the semaphore, the first core 10 can prohibit the second core 20 from accessing the first shared storage unit 33 until the first core 10 releases the semaphore. become.

また、セマフォは、一つであってもよいし、複数であってもよい。図7は、セマフォが一つの場合の各共有記憶部とセマフォとの関係を示している。つまり、セマフォXは、複数の共有記憶部の夫々に共通である。なお、本実施形態では、共有記憶部として、第1共有記憶部33と第2共有記憶部41のみを有した車両用制御装置100を採用している。しかしながら、共有記憶部とセマフォとの関係の説明では、第1共有記憶部33及び第2共有記憶部41に加えて、第3共有記憶部を備えている場合を採用している。   Further, there may be one semaphore or a plurality of semaphores. FIG. 7 shows the relationship between each shared storage unit and semaphore when there is one semaphore. That is, the semaphore X is common to each of the plurality of shared storage units. In the present embodiment, the vehicle control device 100 having only the first shared storage unit 33 and the second shared storage unit 41 is employed as the shared storage unit. However, in the description of the relationship between the shared storage unit and the semaphore, a case where a third shared storage unit is provided in addition to the first shared storage unit 33 and the second shared storage unit 41 is employed.

一方、コア実行履歴は、コア排他制御を実行したプログラム、すなわちコア排他制御を実行した演算部の実行履歴を記憶する領域である。このコア実行履歴は、セマフォ獲得処理を実行した履歴と言い換えることができる。また、コア実行履歴は、各コアがセマフォ獲得処理を実行したか否かを示すデータと言い換えることもできる。さらに、コア実行履歴は、各コア排他制御が第1コア10と第2コア20によって実行されたか否かを示す、各排他制御に対応した実行履歴を含んでいる。   On the other hand, the core execution history is an area for storing the execution history of the program that executed the core exclusive control, that is, the arithmetic unit that executed the core exclusive control. This core execution history can be rephrased as a history of executing the semaphore acquisition process. The core execution history can be paraphrased as data indicating whether or not each core has executed the semaphore acquisition process. Further, the core execution history includes an execution history corresponding to each exclusive control indicating whether or not each core exclusive control is executed by the first core 10 and the second core 20.

コア実行履歴は、図6に示すように、第1コア10と第2コア20の夫々における実行履歴を含んでおり、0が実行履歴なしを示しており、1が実行履歴ありを示している。図6の例では、第1コア10が実行履歴ありで、第2コア20が実行履歴なしを示している。なお、コア実行履歴は、セマフォと1対1の関係にある。つまり、上記のように、複数のセマフォがある場合、コア実行履歴は、複数のセマフォの夫々に対応して設けられている。また、第2記憶部32は、複数のコア実行履歴を記憶していると言える。   As shown in FIG. 6, the core execution history includes the execution history in each of the first core 10 and the second core 20, 0 indicates no execution history, and 1 indicates that there is an execution history. . In the example of FIG. 6, the first core 10 has an execution history, and the second core 20 has no execution history. The core execution history has a one-to-one relationship with the semaphore. That is, as described above, when there are a plurality of semaphores, the core execution history is provided corresponding to each of the plurality of semaphores. Further, it can be said that the second storage unit 32 stores a plurality of core execution histories.

複数のセマフォがある場合、複数の共有記憶部の夫々は、一つのセマフォが対応していることが必要である。言い換えると、複数の共有記憶部の夫々は、対応するセマフォを唯一持つようになっている。   When there are a plurality of semaphores, it is necessary for each of the plurality of shared storage units to correspond to one semaphore. In other words, each of the plurality of shared storage units has a corresponding semaphore only.

例えば、図8は、セマフォが二つの場合の各共有記憶部とセマフォとの関係を示している。この場合、第1共有記憶部33は、セマフォXのみが対応している。第2共有記憶部41と第3共有記憶部の夫々は、セマフォYのみが対応している。よって、第1共有記憶部33にアクセスする際は、セマフォXで排他する。そして、第2共有記憶部41及び第3共有記憶部にアクセスする際は、セマフォYで排他する。   For example, FIG. 8 shows the relationship between each shared storage unit and semaphore when there are two semaphores. In this case, only the semaphore X corresponds to the first shared storage unit 33. Only the semaphore Y corresponds to each of the second shared storage unit 41 and the third shared storage unit. Therefore, when accessing the first shared storage unit 33, the semaphore X is used exclusively. When the second shared storage unit 41 and the third shared storage unit are accessed, the semaphore Y is used exclusively.

また、図9は、セマフォが三つの場合の各共有記憶部とセマフォとの関係を示している。この場合、第1共有記憶部33は、セマフォXのみが対応している。第2共有記憶部41は、セマフォYのみが対応している。第3共有記憶部は、セマフォZのみが対応している。よって、第1共有記憶部33にアクセスする際は、セマフォXで排他する。第2共有記憶部41にアクセスする際は、セマフォYで排他する。そして、第3共有記憶部にアクセスする際は、セマフォZで排他する。   FIG. 9 shows the relationship between each shared storage unit and semaphore when there are three semaphores. In this case, only the semaphore X corresponds to the first shared storage unit 33. Only the semaphore Y corresponds to the second shared storage unit 41. Only the semaphore Z corresponds to the third shared storage unit. Therefore, when accessing the first shared storage unit 33, the semaphore X is used exclusively. When accessing the second shared storage unit 41, the semaphore Y is used exclusively. When accessing the third shared storage unit, the semaphore Z is used exclusively.

しかしながら、車両用制御装置100は、図9に示すように、複数の共有記憶部の夫々に対して、異なるセマフォX,Y,Zを設ける場合、記憶部リソーセスの制約を満たすことが厳しくなる。また、車両用制御装置100は、図7に示すように、複数の共有記憶部に対して一つのセマフォXを設ける場合、競合確率が高くなる可能性がある。よって、車両用制御装置100は、図8に示すように、複数の共有記憶部と複数のセマフォを設けることが好ましい。この場合、車両用制御装置100は、リソーセスの制約を満たしつつ、競合確率を低減できる。   However, as shown in FIG. 9, when the vehicle control apparatus 100 provides different semaphores X, Y, and Z for each of the plurality of shared storage units, it becomes difficult to satisfy the constraints of the storage unit resources. Moreover, as shown in FIG. 7, when the vehicle control apparatus 100 provides one semaphore X for a plurality of shared storage units, there is a possibility that the competition probability is increased. Therefore, as shown in FIG. 8, the vehicle control apparatus 100 preferably includes a plurality of shared storage units and a plurality of semaphores. In this case, the vehicle control device 100 can reduce the competition probability while satisfying the resource constraints.

この実行履歴は、第2記憶部32として、不揮発性メモリに記憶されていると好ましい。つまり、第2記憶部32は、不揮発性メモリであると好ましい。これによって、車両用制御装置100は、車両のイグニッションスイッチがオフになって、自身に対する電源の供給が停止された場合であっても、実行履歴を記憶しておくことができる。   This execution history is preferably stored in the nonvolatile memory as the second storage unit 32. In other words, the second storage unit 32 is preferably a nonvolatile memory. Thus, the vehicle control apparatus 100 can store the execution history even when the ignition switch of the vehicle is turned off and the supply of power to the vehicle is stopped.

なお、第1記憶部31と第2記憶部32は、メモリ空間として、一連のアドレスで管理されていてもよい。ROMは、Read Only Memoryの略称である。RAMは、Random Access Memoryの略称である。   The first storage unit 31 and the second storage unit 32 may be managed as a memory space with a series of addresses. ROM is an abbreviation for Read Only Memory. RAM is an abbreviation for Random Access Memory.

第1共有記憶部33は、例えばRAMを採用できる。第1共有記憶部33は、第1コア10と第2コア20が更新及び参照するデータを記憶するための領域である。第1共有記憶部33には、第1コア10と第2コア20が共にアクセスする共有データが含まれている。   The first shared storage unit 33 can employ a RAM, for example. The first shared storage unit 33 is an area for storing data that is updated and referred to by the first core 10 and the second core 20. The first shared storage unit 33 includes shared data that is accessed by both the first core 10 and the second core 20.

入出力回路40は、車両用制御装置100とクランク角センサ210などのセンサ及びインジェクタ220などのアクチュエータとの間で信号のやり取りをするインターフェースである。また、入出力回路40は、第2共有記憶部41を備えて構成されている。第2共有記憶部41は、例えばレジスタを採用できる。第2共有記憶部41は、第1共有記憶部33と同様であるため、説明を省略する。   The input / output circuit 40 is an interface for exchanging signals between the vehicle control device 100 and sensors such as the crank angle sensor 210 and actuators such as the injector 220. Further, the input / output circuit 40 includes a second shared storage unit 41. The second shared storage unit 41 can employ a register, for example. Since the second shared storage unit 41 is the same as the first shared storage unit 33, the description thereof is omitted.

このように、本実施形態では、共有記憶部として、第1共有記憶部33と第2共有記憶部41とを採用している。しかしながら、本発明は、これに限定されず、少なくとも一つの共有記憶部を備えていれば目的を達成できる。   Thus, in this embodiment, the 1st shared storage part 33 and the 2nd shared storage part 41 are employ | adopted as a shared storage part. However, the present invention is not limited to this, and the object can be achieved as long as at least one shared storage unit is provided.

ここで、図2〜図5を用いて、車両用制御装置100の処理動作に関して説明する。車両用制御装置100の第1コア10及び第2コア20は、図2〜図5に示す処理を行う。   Here, the processing operation of the vehicle control device 100 will be described with reference to FIGS. The first core 10 and the second core 20 of the vehicle control device 100 perform the processes shown in FIGS.

まず、図2を用いて、プラットフォームプログラム実行時の処理動作に関して説明する。特に、ここでは、コア排他制御を用いて、共有記憶部にアクセスする際の処理動作に関して説明する。   First, the processing operation when the platform program is executed will be described with reference to FIG. In particular, the processing operation when accessing the shared storage unit using the core exclusive control will be described here.

ステップS10では、セマフォ獲得処理を行う。第1コア10及び第2コア20は、コア排他制御を行う場合、すなわち共有記憶部にアクセスする場合、セマフォ獲得処理を行う。第1コア10及び第2コア20のうちコア排他制御を行う方は、セマフォ獲得処理を行う。例えば、第1コア10は、第1共有記憶部33にアクセスする場合、セマフォ獲得処理を行う。つまり、第1コア10は、最初に、セマフォ獲得処理を呼び出し、第1共有記憶部33に対するアクセスをロックする。この場合、第2コア20は、セマフォを獲得できていないので、第1共有記憶部33にアクセスできない。   In step S10, semaphore acquisition processing is performed. The first core 10 and the second core 20 perform semaphore acquisition processing when performing core exclusive control, that is, when accessing the shared storage unit. One of the first core 10 and the second core 20 that performs core exclusive control performs semaphore acquisition processing. For example, the first core 10 performs a semaphore acquisition process when accessing the first shared storage unit 33. That is, the first core 10 first calls a semaphore acquisition process to lock access to the first shared storage unit 33. In this case, since the second core 20 has not acquired a semaphore, it cannot access the first shared storage unit 33.

ステップS12では、共有記憶部にアクセスする。第1コア10及び第2コア20のうちステップS10でセマフォを獲得した方は、共有記憶部にアクセスする。例えば、第1コア10は、セマフォを獲得した場合、第1共有記憶部33にアクセスして、第1共有記憶部33に記憶されたデータの更新や参照を行う。このとき、第2コア20は、セマフォを獲得できていないので、第1共有記憶部33にアクセスできない。   In step S12, the shared storage unit is accessed. One of the first core 10 and the second core 20 that has acquired the semaphore in step S10 accesses the shared storage unit. For example, when the first core 10 acquires a semaphore, the first core 10 accesses the first shared storage unit 33 to update or reference data stored in the first shared storage unit 33. At this time, since the second core 20 has not acquired a semaphore, it cannot access the first shared storage unit 33.

ステップS14では、セマフォ解放処理を行う。つまり、第1コア10及び第2コア20は、セマフォ解放処理を行う。第1コア10及び第2コア20のうちステップS10でセマフォを獲得した方は、獲得していたセマフォを解放する。例えば、第1コア10は、セマフォを獲得していた場合、第1共有記憶部33に記憶されたデータの更新や参照を行うと、セマフォを解放する。第2コア20は、第1コア10がセマフォを解放すると、セマフォを獲得可能となる。なお、セマフォの解放処理は、セマフォを獲得したコアしかできない。よって、第1コア10がセマフォを獲得した場合、セマフォの解放処理は、第1コア10のみが行うことができる。   In step S14, semaphore release processing is performed. That is, the first core 10 and the second core 20 perform semaphore release processing. One of the first core 10 and the second core 20 that has acquired the semaphore in step S10 releases the acquired semaphore. For example, when the first core 10 has acquired a semaphore, the first core 10 releases the semaphore when updating or referring to data stored in the first shared storage unit 33. The second core 20 can acquire the semaphore when the first core 10 releases the semaphore. The semaphore release process can be performed only by the core that has acquired the semaphore. Therefore, when the first core 10 acquires a semaphore, only the first core 10 can perform the semaphore release process.

ここで、共有記憶部に対して第1コア10と第2コア20のアクセスが競合する一例を説明する。   Here, an example in which accesses of the first core 10 and the second core 20 compete for the shared storage unit will be described.

まず、一つ目の例は、第1共有記憶部33がRAMの場合である。第1コア10は、カウンタインクリメントして時間を計測する。また、第1コア10は、第1共有記憶部33にアクセスして、第1共有記憶部33に記憶されたカウント値をインクリメントすることで時間を計測するとも言える。一方、第2コア20は、ある条件が成立するとカウンタクリアして計測時間をクリアする。また、第2コア20は、ある条件が成立すると第1共有記憶部33にアクセスして、第1共有記憶部33に記憶されたカウント値をクリアすることで計測時間をクリアするとも言える。   First, the first example is a case where the first shared storage unit 33 is a RAM. The first core 10 increments the counter and measures time. It can also be said that the first core 10 measures the time by accessing the first shared storage unit 33 and incrementing the count value stored in the first shared storage unit 33. On the other hand, the second core 20 clears the counter and clears the measurement time when a certain condition is satisfied. It can also be said that the second core 20 clears the measurement time by accessing the first shared storage unit 33 when a certain condition is satisfied and clearing the count value stored in the first shared storage unit 33.

この例の場合、競合が発生すると、第1コア10によるカウンタインクリメントの間に、第2コア20によるカウンタクリアが行われてしまう。つまり、第1共有記憶部33のカウント値は、第1コア10によってインクリメントしている間に、第2コア20によってクリアされてしまう。よって、第1コア10は、意図せず計測し続けてしまうという懸念がある。そのため、第1コア10及び第2コア20は、カウンタを操作する際、コア排他制御を行って第1共有記憶部33にアクセスする。   In the case of this example, when a conflict occurs, the counter clear by the second core 20 is performed during the counter increment by the first core 10. That is, the count value of the first shared storage unit 33 is cleared by the second core 20 while being incremented by the first core 10. Therefore, there is a concern that the first core 10 will continue to measure unintentionally. Therefore, the first core 10 and the second core 20 access the first shared storage unit 33 by performing core exclusion control when operating the counter.

次の例は、第2共有記憶部41がレジスタの場合である。第1コア10及び第2コア20は、第2共有記憶部41の値を用いて、複数の端子における夫々の出力レベルを設定する。つまり、第1コア10及び第2コア20は、同一の第2共有記憶部41を操作して、複数端子の出力レベルを個別に設定する。また、ある端子の出力レベル変更時には、他の端子の出力レベルを変更しないように、現在の出力設定状態を読み出し、該当する端子のビットのみ変更して再度書き込む必要がある。この例の場合、競合が発生すると、第1コア10と第2コア20で第2共有記憶部41における別端子の出力レベルを変更することがおこり得る。そして、第1コア10による書き込みと第2コア20による書き込みとが干渉すると、あるコアで更新した出力レベルは、反映されない懸念がある。そのため、第1コア10及び第2コア20は、第2共有記憶部41を操作する際は、コア排他制御を行って第2共有記憶部41にアクセスする。   The next example is a case where the second shared storage unit 41 is a register. The first core 10 and the second core 20 set respective output levels at a plurality of terminals using the value of the second shared storage unit 41. That is, the first core 10 and the second core 20 operate the same second shared storage unit 41 to individually set the output levels of the plurality of terminals. Further, when changing the output level of a certain terminal, it is necessary to read the current output setting state so as not to change the output level of other terminals, change only the bit of the corresponding terminal, and write again. In the case of this example, when a conflict occurs, the output level of another terminal in the second shared storage unit 41 can be changed between the first core 10 and the second core 20. When the writing by the first core 10 and the writing by the second core 20 interfere, there is a concern that the output level updated by a certain core is not reflected. Therefore, the first core 10 and the second core 20 access the second shared storage unit 41 by performing core exclusion control when operating the second shared storage unit 41.

次に、図3を用いて、セマフォ獲得処理時の処理動作に関して説明する。以下においては、主に、第1コア10の処理動作を用いて説明する。当然ながら、第2コア20でも同様の処理動作を行う。   Next, the processing operation during the semaphore acquisition process will be described with reference to FIG. In the following, description will be made mainly using the processing operation of the first core 10. Of course, the second core 20 performs the same processing operation.

ステップS20では、セマフォ獲得処理を実行しているコアIDを取得する。第1コア10及び第2コア20は、セマフォ獲得処理を実行しているコアIDを取得する。例えば、第1コア10がセマフォ獲得処理を実行した場合、第1CPU11は、第1メモリ13から自身の第1コアIDを取得する。   In step S20, the core ID executing the semaphore acquisition process is acquired. The first core 10 and the second core 20 acquire the core ID that is executing the semaphore acquisition process. For example, when the first core 10 executes the semaphore acquisition process, the first CPU 11 acquires its own first core ID from the first memory 13.

ステップS22では、セマフォ獲得処理を実行したコアの履歴を更新する。第1コア10及び第2コア20は、図6に示すコア実行履歴を更新する。例えば、第1コア10は、図3のフローチャートで示すセマフォ獲得処理を実行した場合、自身の実行履歴を1とする。言い換えると、第1コア10及び第2コア20は、セマフォ獲得処理を実行した場合、コア実行履歴における自身に対応する値を、実行履歴ありを示す値にする。   In step S22, the history of the core that executed the semaphore acquisition process is updated. The first core 10 and the second core 20 update the core execution history shown in FIG. For example, when the first core 10 executes the semaphore acquisition process shown in the flowchart of FIG. In other words, when the first core 10 and the second core 20 execute the semaphore acquisition process, the value corresponding to itself in the core execution history is set to a value indicating that there is an execution history.

つまり、第1記憶部31に記憶されているプログラムは、セマフォ獲得処理を実行したコアのコアIDを取得する手順(ステップS20)と、取得したコアIDに対応する実行履歴を更新する手順(ステップS22)を含んでいると言える。   That is, the program stored in the first storage unit 31 acquires the core ID of the core that has executed the semaphore acquisition process (step S20), and updates the execution history corresponding to the acquired core ID (step S20). It can be said that S22) is included.

このように、第1コア10と第2コア20は、自身がコア排他制御を実行した場合、実行したコア排他制御と、自身に割り振られたコアIDとを関連付けた情報を実行履歴として第2記憶部32に記憶することで、実行履歴を更新する(更新部)と言える。つまり、更新部は、コア排他制御を実行した演算部(第1コア10と第2コア20のいずれか)に対応するコア実行履歴を更新すると言える。   As described above, when the first core 10 and the second core 20 execute the core exclusive control, the second core 20 uses the information associating the executed core exclusive control and the core ID assigned to the second core 20 as the execution history. By storing in the storage unit 32, it can be said that the execution history is updated (update unit). That is, it can be said that the update unit updates the core execution history corresponding to the arithmetic unit (one of the first core 10 and the second core 20) that has executed the core exclusive control.

なお、車両用制御装置100は、第1コア10及び第2コア20の夫々が、セマフォ獲得処理を実行した場合、自身のコア実行履歴を更新できれば目的を達成できる。よって、本発明は、ステップS20を含まなくても目的を達成できる。つまり、第1記憶部31に記憶されているプログラムは、コア実行履歴を更新するためにコアIDを取得する手順を含むことなく、セマフォ獲得処理を実行したコアが、自身に対応するコア実行履歴を更新する手順を含んでいるものであってもよい。   In addition, the vehicle control apparatus 100 can achieve the object if each of the first core 10 and the second core 20 executes the semaphore acquisition process and can update its own core execution history. Therefore, the present invention can achieve the object without including step S20. That is, the program stored in the first storage unit 31 does not include a procedure for acquiring the core ID in order to update the core execution history, and the core that has executed the semaphore acquisition process corresponds to itself. It may include a procedure for updating.

ステップS24では、複数コアでの実行履歴があるかを判定する。つまり、第1コア10及び第2コア20は、コア実行履歴において、第1コア10及び第2コア20の両方で実行履歴ありを示す値であるか否かを判定する。そして、第1コア10及び第2コア20は、両コアでの実行履歴があると判定した場合はステップS26へ進み、両コアでの実行履歴があると判定しなかった場合は図3の処理を終了する。後程説明するが、第1コア10及び第2コア20は、ステップS26でスピンロック処理を行う。   In step S24, it is determined whether there is an execution history in a plurality of cores. That is, the first core 10 and the second core 20 determine whether or not the core execution history is a value indicating that there is an execution history in both the first core 10 and the second core 20. If the first core 10 and the second core 20 determine that there is an execution history in both cores, the process proceeds to step S26, and if it is not determined that there is an execution history in both cores, the process of FIG. Exit. As will be described later, the first core 10 and the second core 20 perform a spin lock process in step S26.

例えば、第1コア10は、コア実行履歴における第1コア10に対応する値が1で、第2コア20に対応する値が1の場合、複数コアでの実行履歴があると判定し、すなわち、スピンロック処理が必要であるとみなして、ステップS26へ進む。また、第1コア10は、コア実行履歴における第1コア10に対応する値が1で、第2コア20に対応する値が0の場合、複数コアでの実行履歴があると判定せず、スピンロック処理が必要であるとみなして、図3の処理を終了する。つまり、第1コア10と第2コア20は、コア実行履歴における第1コア10に対応する値がと第2コア20に対応する値の少なくとも一方が0の場合、複数コアでの実行履歴があると判定せずに、図3の処理を終了する。   For example, when the value corresponding to the first core 10 in the core execution history is 1 and the value corresponding to the second core 20 is 1, the first core 10 determines that there is an execution history in multiple cores, that is, Since it is considered that the spin lock process is necessary, the process proceeds to step S26. In addition, when the value corresponding to the first core 10 in the core execution history is 1 and the value corresponding to the second core 20 is 0, the first core 10 does not determine that there is an execution history in a plurality of cores. Considering that the spin lock process is necessary, the process of FIG. 3 is terminated. In other words, the first core 10 and the second core 20 have an execution history in a plurality of cores when at least one of the value corresponding to the first core 10 and the value corresponding to the second core 20 in the core execution history is 0. The processing of FIG. 3 is terminated without determining that there is any.

ステップS26では、スピンロック処理を実行する。スピンロック処理に関しては、図4のフローチャートを用いて説明する。   In step S26, a spin lock process is executed. The spin lock process will be described with reference to the flowchart of FIG.

ステップS30では、セマフォを獲得する。詳述すると、第1コア10及び第2コア20は、複数コアでの実行履歴があると判定した場合、セマフォの獲得を試みる。例えば、第1コア10がステップS24でYES判定した場合、第1コア10は、セマフォを獲得しようとする。第1コア10は、例えば第1共有記憶部33へのアクセスが第2コア20と競合しないようにするために、セマフォを獲得しようとする。このとき、セマフォが解放中であった場合、第1コア10は、第2記憶部32にアクセスして、セマフォ解放中をセマフォ獲得中に書き換え、セマフォ獲得中であるコアのコアIDを、自身のコアIDに書き換える。一方、セマフォが獲得中であった場合、第1コア10は、その状態を継続する。つまり、第2記憶部32は、セマフォ獲得中の状態が維持され、且つ、セマフォ獲得中であるコアのコアIDが書き換えられることなく維持される。なお、セマフォ解放中をセマフォ獲得中に書き換えるとは、セマフォ情報を、セマフォ解放中を示す内容からセマフォ獲得中を示す内容に書き換えることである。   In step S30, a semaphore is acquired. More specifically, the first core 10 and the second core 20 attempt to acquire a semaphore when it is determined that there is an execution history in a plurality of cores. For example, if the first core 10 makes a YES determination in step S24, the first core 10 attempts to acquire a semaphore. For example, the first core 10 tries to acquire a semaphore so that access to the first shared storage unit 33 does not compete with the second core 20. At this time, if the semaphore is being released, the first core 10 accesses the second storage unit 32 and rewrites the semaphore being released to acquire the semaphore, and sets the core ID of the core that is acquiring the semaphore to itself. Rewrite to the core ID. On the other hand, when the semaphore is being acquired, the first core 10 continues that state. That is, in the second storage unit 32, the state in which the semaphore is being acquired is maintained, and the core ID of the core being acquired is maintained without being rewritten. Note that “rewriting semaphore release during semaphore acquisition” means rewriting semaphore information from content indicating that semaphore is being released to content indicating that semaphore is being acquired.

ステップS32では、セマフォ獲得が成功したか否かを判定する。例えば、第1コア10は、セマフォ獲得を試みた後における、第2記憶部32の記憶内容を確認し、セマフォ獲得中であるコアのコアIDが自身のものと一致するか否かによって、成功したか否かを判定する。そして、第1コア10は、コアIDが自身のものと一致すると判定した場合に成功したとみなして図4の処理を終了し、コアIDが自身のものと一致しないと判定した場合に失敗したとみなしてステップS30へ戻る。第1コア10は、一致するまで、ステップS30、S32を繰り返す。つまり、スピンロック処理を行うコアは、他コアがセマフォを獲得していないと判定した場合にセマフォ獲得に成功したとみなし、他コアがセマフォを獲得していると判定した場合にセマフォ獲得に失敗したとみなす、とも言える。ここで、セマフォ獲得は、セマフォ状態を確認してセマフォを書き換えるまで、アトミック(不可分)に行われ、一連の処理に他コアの処理が割り込めないようになっている。   In step S32, it is determined whether the semaphore acquisition is successful. For example, after the first core 10 tries to acquire the semaphore, the first core 10 confirms the storage contents of the second storage unit 32 and determines whether or not the core ID of the core that is acquiring the semaphore matches its own. Determine whether or not. When the first core 10 determines that the core ID matches that of the own core, the first core 10 determines that the core ID has succeeded and ends the process of FIG. 4. When the core ID does not match the own core, the first core 10 fails. And return to step S30. The first core 10 repeats steps S30 and S32 until they match. In other words, the core that performs the spin lock process considers that the semaphore has been successfully acquired if it is determined that the other core has not acquired the semaphore, and fails to acquire the semaphore if it is determined that the other core has acquired the semaphore. It can be said that Here, the semaphore acquisition is performed atomically (inseparable) until the semaphore state is confirmed and the semaphore is rewritten, so that the processing of other cores cannot interrupt the series of processing.

このように、第1コア10と第2コア20は、ステップS24でYES判定の場合、すなわち、複数の排他制御のうち第1コア10及び第2コア20の両方で実行されたことを示す実行履歴が記憶されたコア排他制御に関してはコア排他制御を実行する。しかしながら、第1コア10と第2コア20は、ステップS24でNO判定の場合、すなわち複数のコア排他制御のうち第1コア10及び第2コア20の両方で実行されたことを示す実行履歴が記憶されていないコア排他制御に関してはコア排他制御を実行しない。   As described above, when the first core 10 and the second core 20 are determined as YES in step S24, that is, the execution indicating that the first core 10 and the second core 20 are executed by both the first core 10 and the second core 20 among the plurality of exclusive controls. The core exclusive control is executed for the core exclusive control in which the history is stored. However, if the first core 10 and the second core 20 are NO in step S24, that is, the execution history indicating that the first core 10 and the second core 20 are executed by both the first core 10 and the second core 20 among the plurality of core exclusive controls. Core exclusion control is not executed for core exclusion control that is not stored.

次に、図5を用いて、セマフォ解放処理時の処理動作に関して説明する。   Next, the processing operation during the semaphore release process will be described with reference to FIG.

ステップS40では、複数コアでの実行履歴があるかを判定する。つまり、第1コア10及び第2コア20は、ステップS22で更新したコア実行履歴において、第1コア10及び第2コア20の両方で実行履歴ありを示す値であるか否かを判定する。そして、第1コア10及び第2コア20は、両コアでの実行履歴があると判定した場合はステップS42へ進み、両コアでの実行履歴があると判定しなかった場合は図4の処理を終了する。例えば、第1コア10は、コア実行履歴における第1コア10に対応する値が1で、第2コア20に対応する値が1の場合、複数コアでの実行履歴があると判定して、ステップS42へ進む。そして、ステップS42では、セマフォを解放する。例えば、第1コア10は、第2記憶部32にアクセスして、セマフォ獲得中をセマフォ解放中に書き換える。つまり、第1コア10は、セマフォ情報を、セマフォ獲得中を示す内容からセマフォ解放中を示す内容に書き換える。このように、セマフォを獲得しているコアは、第2記憶部32の記憶内容を、セマフォ解放中を示す内容に書き換えることで、セマフォを解放する。   In step S40, it is determined whether there is an execution history in a plurality of cores. That is, the first core 10 and the second core 20 determine whether or not the core execution history updated in step S22 is a value indicating that there is an execution history in both the first core 10 and the second core 20. If the first core 10 and the second core 20 determine that there is an execution history in both cores, the process proceeds to step S42, and if it is not determined that there is an execution history in both cores, the process of FIG. Exit. For example, if the value corresponding to the first core 10 in the core execution history is 1 and the value corresponding to the second core 20 is 1, the first core 10 determines that there is an execution history in multiple cores, Proceed to step S42. In step S42, the semaphore is released. For example, the first core 10 accesses the second storage unit 32 and rewrites the semaphore acquisition to the semaphore release. That is, the first core 10 rewrites the semaphore information from the content indicating that the semaphore is being acquired to the content indicating that the semaphore is being released. Thus, the core that has acquired the semaphore releases the semaphore by rewriting the storage content of the second storage unit 32 to the content indicating that the semaphore is being released.

このように、車両用制御装置100は、各コア排他制御が第1コア10と第2コアによって実行されたか否かを示す実行履歴を記憶している第2記憶部32を有している。よって、車両用制御装置100は、複数のコア排他制御の夫々を実行したコアがわかるように構成されている。そして、第1コア10と第2コア20で実行されたコア排他制御は、第1コア10と第2コア20による共有記憶部への競合が発生する可能性がある。このため、第1コア10と第2コア20は、複数のコア排他制御のうち第1コア10と第2コア20とで実行されたことを示す実行履歴が記憶されたコア排他制御に関してはコア排他制御を実行する。一方、第1コア10と第2コア20で実行されていないコア排他制御は、第1コア10と第2コア20による共有記憶部への競合が発生する可能性がない。このため、第1コア10と第2コア20は、複数のコア排他制御のうち第1コア10と第2コア20の両方で実行されたことを示す実行履歴が記憶されていないコア排他制御に関してはコア排他制御を実行しない。   As described above, the vehicle control apparatus 100 includes the second storage unit 32 that stores an execution history indicating whether or not each core exclusive control is executed by the first core 10 and the second core. Therefore, the vehicle control apparatus 100 is configured so as to know the core that has executed each of the plurality of core exclusive controls. The core exclusive control executed by the first core 10 and the second core 20 may cause contention for the shared storage unit by the first core 10 and the second core 20. For this reason, the first core 10 and the second core 20 are the cores related to the core exclusive control in which the execution history indicating that the first core 10 and the second core 20 are executed among the plurality of core exclusive controls is stored. Execute exclusive control. On the other hand, in the core exclusive control that is not executed by the first core 10 and the second core 20, there is no possibility that the first core 10 and the second core 20 compete with the shared storage unit. For this reason, the first core 10 and the second core 20 are related to the core exclusive control in which the execution history indicating that the first core 10 and the second core 20 are executed in both of the plurality of core exclusive controls is not stored. Does not perform core exclusive control.

よって、車両用制御装置100は、第1コア10と第2コアによる共有記憶部への競合が発生する可能性がない場合にコア排他制御が実行されることを抑制できる。従って、車両用制御装置100は、必要以上にコア排他制御を行うことを抑制できる。   Therefore, the vehicle control apparatus 100 can suppress the core exclusive control from being executed when there is no possibility of contention for the shared storage unit between the first core 10 and the second core. Therefore, the vehicle control device 100 can suppress performing the core exclusive control more than necessary.

なお、これによって、車両用制御装置100は、コアによるロード増加の低減が期待できる。このため、車両用制御装置100は、コアによるロードリソーセス制約を守りやすくなる。   As a result, the vehicle control apparatus 100 can be expected to reduce the increase in load due to the core. For this reason, it becomes easy for the vehicle control apparatus 100 to observe the load resource restriction by the core.

ところで、上記のように車両用制御装置100は、一例としてエンジン制御装置を採用できる。通常、エンジン制御装置は、厳しいリアルタイム時間が設けられて制御を行う。しかしながら、車両用制御装置100は、必要以上にコア排他制御を行うことを抑制できるため、厳しいリアルタイム時間であり、且つ、コア排他制御を実行するために割り込みを行ったとしても、割り込みによる遅延の低減が期待できる。   By the way, as mentioned above, the vehicle control apparatus 100 can employ | adopt an engine control apparatus as an example. Normally, the engine control apparatus performs control by providing a strict real-time time. However, since the vehicle control device 100 can suppress performing the core exclusive control more than necessary, it is a strict real-time time, and even if an interrupt is performed to execute the core exclusive control, a delay due to the interrupt is not generated. Reduction can be expected.

また、プラットフォームプログラムは、上記のように、共有記憶部へアクセスされる全ての処理に対応してコア排他制御が行われるように構成されている。しかしながら、車両用制御装置100は、複数のコア排他制御のうち第1コア10と第2コア20の両方で実行されたことを示す実行履歴が記憶されていないコア排他制御に関してはコア排他制御を実行しない。このため、車両用制御装置100は、フルでコア排他制御が行われるように構成されたプラットフォームプログラムであっても、第1コア10と第2コア20による共有記憶部への競合が発生する可能性がない場合、コア排他制御が実行されることを抑制できる。   Further, as described above, the platform program is configured such that core exclusive control is performed in correspondence with all processes accessed to the shared storage unit. However, the vehicle control apparatus 100 performs the core exclusive control for the core exclusive control in which the execution history indicating that it is executed by both the first core 10 and the second core 20 among the plurality of core exclusive controls is not stored. Do not execute. For this reason, even if the vehicle control device 100 is a platform program configured to perform full core exclusive control, contention to the shared storage unit by the first core 10 and the second core 20 may occur. If there is no such property, it is possible to prevent the core exclusive control from being executed.

以上、本発明の好ましい実施形態について説明した。しかしながら、本発明は、上記実施形態に何ら制限されることはなく、本発明の趣旨を逸脱しない範囲において、種々の変形が可能である。   The preferred embodiments of the present invention have been described above. However, the present invention is not limited to the above embodiment, and various modifications can be made without departing from the spirit of the present invention.

(第2実施形態)
第2実施形態の車両用制御装置100aは、車両用制御装置100と同様の個所が多いため、車両用制御装置100と異なる点を主に説明する。車両用制御装置100aは、図10に示すように、第2記憶部32のかわりに排他制御部32aが設けられている点が、車両用制御装置100と異なる。さらに、車両用制御装置100aは、第1コア10及び第2コア20の処理内容が車両用制御装置100と異なる。
(Second Embodiment)
Since the vehicular control device 100a of the second embodiment has many parts similar to the vehicular control device 100, differences from the vehicular control device 100 will be mainly described. As shown in FIG. 10, the vehicle control device 100 a is different from the vehicle control device 100 in that an exclusive control unit 32 a is provided instead of the second storage unit 32. Further, the vehicle control device 100 a differs from the vehicle control device 100 in the processing contents of the first core 10 and the second core 20.

排他制御部32aは、上記のようなセマフォ情報とコア実行履歴を備えて構成されている。この排他制御部32aは、特許請求の範囲における記憶部に相当する。そして、排他制御部32aは、第1コア10と第2コア20のかわりに、コア実行履歴の管理を行う。つまり、排他制御部32aは、第1コア10が図3に示すセマフォ獲得処理を実行しようとした場合、ステップS22でコア実行履歴を更新する。   The exclusive control unit 32a includes the semaphore information and the core execution history as described above. The exclusive control unit 32a corresponds to a storage unit in the claims. The exclusive control unit 32 a manages the core execution history instead of the first core 10 and the second core 20. That is, when the first core 10 tries to execute the semaphore acquisition process shown in FIG. 3, the exclusive control unit 32a updates the core execution history in step S22.

このように、排他制御部32aは、コア排他制御を実行したコアを判断する。そして、排他制御部32aは、実行されたコア排他制御と、このコア排他制御を実行したコアのコアIDとを関連付けた情報を実行履歴として記憶する。例えば、第1コア10があるコア排他制御を実行した場合、排他制御部32aは、実行されたコア排他制御と、第1コアIDとを関連付けた情報を実行履歴として記憶する。   In this way, the exclusive control unit 32a determines the core that has executed the core exclusive control. And the exclusive control part 32a memorize | stores the information which linked | related the executed core exclusive control and the core ID of the core which performed this core exclusive control as an execution log | history. For example, when the core exclusive control with the first core 10 is executed, the exclusive control unit 32a stores information associating the executed core exclusive control with the first core ID as an execution history.

また、排他制御部32aは、第1コア10と第2コア20のかわりに、セマフォ情報の書き換えを行ってもよい。この場合、排他制御部32aは、第1コア10が図4のスピンロック処理を実行する場合、セマフォ解放中をセマフォ獲得中に書き換え、セマフォ獲得中であるコアのコアIDを、第1コア10のコアIDに書き換える。しかしながら、排他制御部32aは、上記と同様に、ステップS30でセマフォが獲得中であった場合、セマフォ情報の書き換えは行なわない。そして、排他制御部32aは、第1コア10が図5のセマフォ解放処理を実行する場合、セマフォ獲得中をセマフォ解放中に書き換える。   Further, the exclusive control unit 32 a may rewrite the semaphore information instead of the first core 10 and the second core 20. In this case, when the first core 10 executes the spin lock process of FIG. 4, the exclusive control unit 32 a rewrites the semaphore release to the semaphore acquisition, and changes the core ID of the core that is acquiring the semaphore to the first core 10. Rewrite to the core ID. However, as described above, when the semaphore is being acquired in step S30, the exclusive control unit 32a does not rewrite the semaphore information. Then, when the first core 10 executes the semaphore release process of FIG. 5, the exclusive control unit 32a rewrites the semaphore acquisition to the semaphore release.

車両用制御装置100aは、車両用制御装置100と同様の効果を奏することができる。   The vehicle control device 100a can achieve the same effects as the vehicle control device 100.

10…第1コア、11…第1CPU、12…第1レジスタ、13…第1メモリ、20…第2コア、21…第2CPU、22…第2レジスタ、23…第2メモリ、31…第1記憶部、32…第2記憶部、32a…排他制御部、33…第1共有記憶部、40…入出力回路、41…第2共有記憶部、100,100a…車両制御装置、210…クランク角センサ、220…インジェクタ   DESCRIPTION OF SYMBOLS 10 ... 1st core, 11 ... 1st CPU, 12 ... 1st register, 13 ... 1st memory, 20 ... 2nd core, 21 ... 2nd CPU, 22 ... 2nd register, 23 ... 2nd memory, 31 ... 1st Storage unit 32 ... Second storage unit 32a ... Exclusive control unit 33 ... First shared storage unit 40 ... Input / output circuit 41 ... Second shared storage unit 100, 100a ... Vehicle control device 210 ... Crank angle Sensor, 220 ... injector

Claims (6)

車両に搭載されるものであり、複数の演算部(10、20)と、複数の演算部が共通にアクセスする共有記憶部(33、41)と、を備えた車両用制御装置であって、
複数の前記演算部によって実行されるものであり、複数の前記演算部による前記共有記憶部への競合を抑制するための複数の排他制御を含むプログラム(31a、31b)と、
各排他制御が各演算部によって実行されたか否かを示す、各排他制御に対応した実行履歴を記憶している記憶部(32、32a)と、
各演算部は、前記排他制御を実行するものであり、複数の前記排他制御のうち複数の前記演算部で実行されたことを示す前記実行履歴が記憶された前記排他制御に関しては前記排他制御を実行し、複数の前記排他制御のうち複数の前記演算部で実行されたことを示す前記実行履歴が記憶されていない前記排他制御に関しては前記排他制御を実行しない車両用制御装置。
A vehicle control device that is mounted on a vehicle and includes a plurality of calculation units (10, 20) and a shared storage unit (33, 41) that is accessed by a plurality of calculation units in common.
A program (31a, 31b) that is executed by a plurality of the arithmetic units, and includes a plurality of exclusive controls for suppressing competition from the plurality of arithmetic units to the shared storage unit;
A storage unit (32, 32a) for storing an execution history corresponding to each exclusive control, indicating whether each exclusive control has been executed by each computing unit;
Each computing unit executes the exclusive control, and the exclusive control is performed with respect to the exclusive control in which the execution history indicating that the exclusive control is executed by a plurality of the computing units among the plurality of exclusive controls. A vehicle control device that executes and does not execute the exclusive control with respect to the exclusive control in which the execution history indicating that the exclusive control is executed by a plurality of the arithmetic units is not stored.
前記プログラムは、アプリケーションプログラムとプラットフォームプログラムとに分離されて構成されている請求項1に記載の車両用制御装置。   The vehicle control device according to claim 1, wherein the program is configured to be separated into an application program and a platform program. 各演算部は、重複しない識別情報が割り振られており、自身が前記排他制御を実行した場合、実行した前記排他制御と、自身に割り振られた前記識別情報とを関連付けた情報を前記実行履歴として前記記憶部に記憶することで、前記実行履歴を更新する更新部を含む請求項1又は2に記載の車両用制御装置。   Each calculation unit is assigned identification information that does not overlap, and when the execution unit itself executes the exclusive control, information that associates the executed exclusive control with the identification information assigned to the calculation unit as the execution history. The vehicle control device according to claim 1, further comprising an update unit configured to update the execution history by storing in the storage unit. 各演算部は、重複しない識別情報が割り振られており、
前記記憶部(32a)は、前記排他制御を実行した前記演算部を判断し、前記演算部で実行された前記排他制御と、前記排他制御を実行した前記演算部の前記識別情報とを関連付けた情報を前記実行履歴として記憶することで、前記実行履歴を更新する更新部を含む請求項1又は2に記載の車両用制御装置。
Each calculation unit is assigned unique identification information,
The storage unit (32a) determines the calculation unit that has executed the exclusive control, and associates the exclusive control executed by the calculation unit with the identification information of the calculation unit that has executed the exclusive control. The vehicle control device according to claim 1, further comprising an update unit that updates the execution history by storing information as the execution history.
前記記憶部は、複数の前記実行履歴を記憶しており、
前記更新部は、前記排他制御を実行した前記演算部に対応する前記実行履歴を更新する請求項3又は4に記載の車両用制御装置。
The storage unit stores a plurality of the execution histories,
The vehicle control device according to claim 3 or 4, wherein the update unit updates the execution history corresponding to the arithmetic unit that has executed the exclusive control.
前記実行履歴は、前記記憶部として、不揮発性メモリに記憶されている請求項1乃至5のいずれか一項に記載の車両用制御装置。   6. The vehicle control device according to claim 1, wherein the execution history is stored in a nonvolatile memory as the storage unit.
JP2015240566A 2015-12-09 2015-12-09 Vehicle control device Active JP6512087B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2015240566A JP6512087B2 (en) 2015-12-09 2015-12-09 Vehicle control device
DE102016224206.7A DE102016224206A1 (en) 2015-12-09 2016-12-06 VEHICLE CONTROL DEVICE

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015240566A JP6512087B2 (en) 2015-12-09 2015-12-09 Vehicle control device

Publications (2)

Publication Number Publication Date
JP2017107394A true JP2017107394A (en) 2017-06-15
JP6512087B2 JP6512087B2 (en) 2019-05-15

Family

ID=58773597

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015240566A Active JP6512087B2 (en) 2015-12-09 2015-12-09 Vehicle control device

Country Status (2)

Country Link
JP (1) JP6512087B2 (en)
DE (1) DE102016224206A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180137762A (en) * 2017-06-19 2018-12-28 현대오트론 주식회사 Mult master system, power controller and operating methed thereof
US10994718B2 (en) 2018-06-27 2021-05-04 Hyundai Autron Co., Ltd. Multi-master system, power controller and operating method of the multi-master system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314871A (en) * 1995-05-23 1996-11-29 Kofu Nippon Denki Kk Lock request control mechanism
JP2000003287A (en) * 1998-06-12 2000-01-07 Nec Corp Exclusive controller for shared resource, method therefor and recording medium for recording exclusive control program
JP2010061522A (en) * 2008-09-05 2010-03-18 Internatl Business Mach Corp <Ibm> Computer system for permitting exclusive access to shared data, method for the computer system, and computer readable recording medium
JP2013171547A (en) * 2012-02-23 2013-09-02 Hitachi Automotive Systems Ltd Vehicle control device
JP2015111439A (en) * 2005-06-23 2015-06-18 インテル コーポレイション Primitives to enhance thread-level speculation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314871A (en) * 1995-05-23 1996-11-29 Kofu Nippon Denki Kk Lock request control mechanism
JP2000003287A (en) * 1998-06-12 2000-01-07 Nec Corp Exclusive controller for shared resource, method therefor and recording medium for recording exclusive control program
JP2015111439A (en) * 2005-06-23 2015-06-18 インテル コーポレイション Primitives to enhance thread-level speculation
JP2010061522A (en) * 2008-09-05 2010-03-18 Internatl Business Mach Corp <Ibm> Computer system for permitting exclusive access to shared data, method for the computer system, and computer readable recording medium
JP2013171547A (en) * 2012-02-23 2013-09-02 Hitachi Automotive Systems Ltd Vehicle control device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180137762A (en) * 2017-06-19 2018-12-28 현대오트론 주식회사 Mult master system, power controller and operating methed thereof
KR101967442B1 (en) * 2017-06-19 2019-04-09 현대오트론 주식회사 Mult master system, power controller and operating methed thereof
US10994718B2 (en) 2018-06-27 2021-05-04 Hyundai Autron Co., Ltd. Multi-master system, power controller and operating method of the multi-master system

Also Published As

Publication number Publication date
DE102016224206A1 (en) 2017-06-14
JP6512087B2 (en) 2019-05-15

Similar Documents

Publication Publication Date Title
US8234476B2 (en) Information processing apparatus and method of updating stack pointer
JP2015518605A (en) Functional architecture patterns for safety applications
CN103329102A (en) Multiprocessor system
JP5533789B2 (en) In-vehicle electronic control unit
JP6512087B2 (en) Vehicle control device
JP5999216B2 (en) Data processing device
JP6323235B2 (en) Electronic control unit
KR102235142B1 (en) Handling time intensive instructions
JP6183251B2 (en) Electronic control unit
US20180068501A1 (en) Multiprocessor system and vehicle control system
CN109358903B (en) Data access device and access error notification method
JP2017204083A (en) Memory protection system
JP5978873B2 (en) Electronic control unit
JP5942904B2 (en) Processing equipment
CN108369558B (en) Method for operating a microcontroller
JP6555184B2 (en) In-vehicle control device
JP2002312334A (en) Multiprocessor system
JP6252259B2 (en) Electronic control unit
JP2015121953A (en) Microcomputer and electronic control device
WO2017002939A1 (en) Electronic control device and stack usage method
JP5703505B2 (en) Computer with bus partition structure
JP6596455B2 (en) Electronic control unit for automobile
JP2018005851A (en) Electronic equipment
JP2020004448A (en) Automotive electronic control device
JP2023009818A (en) Electronic control device for vehicle and control method by electronic control device for vehicle

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180227

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180907

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20181106

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20181225

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20190312

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190325

R151 Written notification of patent or utility model registration

Ref document number: 6512087

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250