JP2012108582A - Information processing device - Google Patents

Information processing device Download PDF

Info

Publication number
JP2012108582A
JP2012108582A JP2010254749A JP2010254749A JP2012108582A JP 2012108582 A JP2012108582 A JP 2012108582A JP 2010254749 A JP2010254749 A JP 2010254749A JP 2010254749 A JP2010254749 A JP 2010254749A JP 2012108582 A JP2012108582 A JP 2012108582A
Authority
JP
Japan
Prior art keywords
task
information processing
processing apparatus
global variable
executes
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
JP2010254749A
Other languages
Japanese (ja)
Other versions
JP5798314B2 (en
Inventor
Masaya Taki
雅也 滝
Nobuhiko Makino
信彦 牧野
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 JP2010254749A priority Critical patent/JP5798314B2/en
Priority to DE201110055205 priority patent/DE102011055205A1/en
Publication of JP2012108582A publication Critical patent/JP2012108582A/en
Application granted granted Critical
Publication of JP5798314B2 publication Critical patent/JP5798314B2/en
Expired - Fee Related 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PROBLEM TO BE SOLVED: To ensure the simultaneity of data in an information processing device in which a task of a processing program refers to data to be updated by a task with a priority different from that of the task.SOLUTION: An ECU as an information processing device sets a priority for each task as an execution unit of a processing program. An upper level task S is preferentially executed during execution of a lower level task V. In a case where the upper level task S updates a global variable c to be commonly used between the upper level task S and the lower level task V and sub-tasks X and Y in the lower level task V refer to it, after execution of the sub-task X, when the upper level task S updates the data before execution of the sub-task Y, the simultaneity of the data fails (N101). Therefore, the global variable c is copied from a working area C1 to a public area C2 at a start time ti of the lower level task V, and both of the sub-tasks X and Y refer to the copied data, so that the simultaneity of the data can be ensured (N111).

Description

本発明は、処理プログラムにおいて、優先度が相対的に高い上位タスクと優先度が相対的に低い下位タスクとの間で共通のデータを使用する情報処理装置に関する。   The present invention relates to an information processing apparatus that uses common data between an upper task having a relatively high priority and a lower task having a relatively low priority in a processing program.

例えば車両に搭載される電子制御装置(以下「ECU」という)に用いられる処理プログラムでは、制御応答性や安全性の確保等から所定の処理をリアルタイムに実行する必要性がある。このようなリアルタイム性が要求される処理では、一般に、「割り込み」を実行する。すなわち、メインルーチンの実行中にイベントの発生等があると、メインルーチンの実行を一時的に中断して割り込みルーチンを実行し、割り込みルーチンの終了後にメインルーチンを再開する。これにより、リアルタイム性を要求する優先度の高い処理を優先的に実行する。   For example, in a processing program used in an electronic control device (hereinafter referred to as “ECU”) mounted on a vehicle, it is necessary to execute predetermined processing in real time in order to ensure control responsiveness and safety. In such a process that requires real-time performance, an “interrupt” is generally executed. That is, if an event occurs during the execution of the main routine, the execution of the main routine is temporarily interrupted, the interrupt routine is executed, and the main routine is resumed after the interrupt routine ends. As a result, high priority processing that requires real-time processing is preferentially executed.

このような処理では、処理プログラムは、実行単位としてのタスク毎に優先度が設定される。上記の例では、メインルーチンは、優先度が相対的に低い「下位タスク」に相当し、割り込みルーチンは、優先度が相対的に高い「上位タスク」に相当する。ここで、上位タスクと下位タスクとの間で共通に使用されるデータを「グローバル変数」という。割り込みがされるとき、グローバル変数の更新および参照に伴う「同時性」が問題となることがある。例えば、更新および参照処理において、割り込みの発生によって、一つのタスクが同時に参照すべき複数のデータが別々に参照される場合や、複数のタスク間で共通に参照されるべきデータが同一とならない場合には、「データの同時性」が問題となる。   In such processing, the processing program sets a priority for each task as an execution unit. In the above example, the main routine corresponds to a “lower task” having a relatively low priority, and the interrupt routine corresponds to a “higher task” having a relatively high priority. Here, data used in common between the upper task and the lower task is referred to as a “global variable”. When interrupted, the “simultaneity” associated with updating and referencing global variables can be a problem. For example, in update and reference processing, when an interrupt occurs, multiple data that should be referenced simultaneously by a single task is referenced separately, or data that should be referenced commonly among multiple tasks is not the same The problem is “data simultaneity”.

この問題に対処するため、従来、下位タスクの実行中に割り込み禁止処理を実行する情報処理装置が知られている。すなわち、下位タスクで複数のグローバル変数が更新または参照される間に上位タスクの割り込みを禁止する。
また、特許文献1には、グローバル変数を「公開領域」と「作業領域」の2つの領域に重複させて記憶させ、グローバル変数の参照と更新とを別々の領域で行い、参照が終了した時点で作業領域と公開領域とを切り替える「領域切換処理」を実行する情報処理装置が開示されている。
In order to cope with this problem, an information processing apparatus that executes an interrupt prohibition process during execution of a lower-level task is conventionally known. That is, the interrupt of the upper task is prohibited while a plurality of global variables are updated or referenced in the lower task.
In Patent Document 1, global variables are stored in two areas, “public area” and “work area”, and the global variables are referenced and updated in separate areas. Discloses an information processing apparatus that executes “area switching processing” for switching between a work area and a public area.

特許第3783553号公報Japanese Patent No. 3783553

しかしながら、割り込み禁止処理をすると、本来優先度の高い上位タスクの実行開始が下位タスクの処理完了まで待たされることとなり、リアルタイム性を損なう。
また、特許文献1の方法は、現在どちらの領域が作業領域でありどちらの領域が公開領域であるかの情報を管理する「領域情報記憶手段」が必要となる上、グローバル変数の参照時にその管理情報をも確認せねばならず、処理負荷が増大するという問題がある。
加えて、何らかの理由で上位タスクがグローバル変数の更新を停止した場合、下位タスクは更新前の古いデータを使用し、さらに更新停止が続くと、更新後の最新データと更新前の過去データとを交互に参照して使用するという、いわゆるデータハンチングの問題が生じる。
かかる問題は、公開領域と作業領域とを動的に切り替えることによって発生する問題である。
However, if the interrupt prohibition process is performed, the start of the execution of the higher-order task, which originally has a high priority, is waited until the processing of the lower-order task is completed, which impairs the real-time property.
In addition, the method of Patent Document 1 requires “area information storage means” for managing information about which area is a work area and which area is a public area. Management information must also be confirmed, which increases the processing load.
In addition, if the upper task stops updating the global variable for some reason, the lower task uses the old data before update, and if the update stop continues, the latest data after update and the past data before update are displayed. There arises a problem of so-called data hunting, that is, referring to them alternately.
Such a problem is a problem caused by dynamically switching between a public area and a work area.

本発明は、このような点に鑑みて創作されたものであり、その目的は、処理プログラムのタスクが当該タスクとは優先度が異なるタスクにて更新されるデータを参照する情報処理装置において、処理負荷の増大やデータハンチングを生じることなく、データの同時性を確保することにある。   The present invention was created in view of the above points, and its purpose is in an information processing apparatus for referring to data in which a task of a processing program is updated by a task having a different priority from the task. The purpose is to ensure data simultaneity without increasing processing load and data hunting.

請求項1から12に記載の情報処理装置は、処理プログラムの実行単位となる複数のタスクを当該複数のタスク毎に設定される優先度に基づき実行することによって一連の機能を実現する情報処理装置である。この情報処理装置は、優先度が相対的に高い上位タスクと優先度が相対的に低い下位タスクとの間で共通に使用されるグローバル変数を記憶する2つの記憶領域を設定する。   The information processing apparatus according to claim 1, wherein the information processing apparatus realizes a series of functions by executing a plurality of tasks as an execution unit of a processing program based on a priority set for each of the plurality of tasks. It is. This information processing apparatus sets two storage areas for storing global variables used in common between a higher-order task having a relatively high priority and a lower-order task having a relatively low priority.

ここで、「下位タスクによるグローバル変数の参照途中で上位タスクによってグローバル変数が更新される可能性のあるケース」を「第1のケース」という。請求項1から6に記載の情報処理装置は、「第1のケース」を対象とする。
上位タスクは、2つの記憶領域の一方である作業領域を使用してグローバル変数を更新する上位更新処理を実行する。下位タスクは、2つの記憶領域の他方である公開領域を使用してグローバル変数を参照する下位参照処理を実行する。そして、下位タスク中の下位参照処理の実行時を除く所定の時期に、作業領域から公開領域へグローバル変数を複製する複製処理を実行する。
Here, “a case in which a global variable may be updated by an upper task in the middle of referring to a global variable by a lower task” is referred to as a “first case”. The information processing apparatus according to any one of claims 1 to 6 targets a “first case”.
The upper task executes upper update processing for updating the global variable using a work area that is one of the two storage areas. The lower task executes lower reference processing for referring to the global variable using the public area that is the other of the two storage areas. Then, at a predetermined time excluding the execution time of the lower level reference process in the lower level task, a replication process for copying the global variable from the work area to the public area is executed.

例えば、下位タスクに含まれる第1サブタスクと第2サブタスクとが、あるグローバル変数を共通に使用する場合を考える。仮に、第1サブタスクがグローバル変数を参照した後、第2サブタスクがグローバル変数を参照する前に上位更新処理が実行されると、第1サブタスクは更新前の古いデータを参照し、第2サブタスクは更新後の新しいデータを参照することとなり、データの同時性が破綻する。その結果、第1サブタスクと第2サブタスクとが同一のデータを必要とする場合、演算が破綻する。   For example, consider a case where the first subtask and the second subtask included in the lower task commonly use a certain global variable. If, after the first subtask refers to the global variable, the upper update process is executed before the second subtask refers to the global variable, the first subtask refers to the old data before the update, and the second subtask The new data after the update is referred to, and the data simultaneity breaks down. As a result, when the first subtask and the second subtask require the same data, the calculation fails.

そこで、作業領域と公開領域とを静的に決定し、下位タスク中の所定の時期に作業領域から公開領域への複製処理を実行する。そして、第1サブタスクおよび第2サブタスクが、公開領域に複製されたグローバル変数を共に参照するようにする。ここで、各タスクは、例えばタイマに設定した周期で発生し、基本的に開始タイミングが変動することはないため、タイマの設定により、所定の時期に複製処理を実行することができる。   Therefore, the work area and the public area are statically determined, and the replication process from the work area to the public area is executed at a predetermined time in the lower task. Then, both the first subtask and the second subtask refer to the global variable copied to the public area. Here, each task occurs, for example, in a cycle set in the timer, and basically the start timing does not fluctuate. Therefore, the duplication process can be executed at a predetermined time by setting the timer.

これにより、下位タスク中に実行される上位更新処理の影響を受けることなく、第1サブタスクと第2サブタスクとの間でデータの同時性を確保することができる。
拡張して言えば、下位参照処理における複数のサブタスク間でのデータの同時性を確保することができる。
As a result, data simultaneity can be ensured between the first subtask and the second subtask without being affected by the upper update process executed during the lower task.
In other words, data simultaneity can be ensured among a plurality of subtasks in the lower reference processing.

また、従来技術の領域切換処理のように領域情報記憶手段を必要としないので、処理負荷を低減することができる。
さらに、領域切換処理においては、何らかの理由で上位更新処理が停止した場合、その後の領域切換処理で、更新後の最新データと更新前の過去データとが交互に繰り返し公開領域に記憶される。すると、下位タスクは、最新データと過去データとを交互に参照して使用するというデータハンチングが生じ、制御上重大な問題を招くおそれがある。それに対し、本発明による複製処理では、上位更新処理が停止した場合でも、下位タスクは、常に最新データを参照することができ、データハンチングは発生しない。
Further, since no area information storage means is required unlike the area switching process of the prior art, the processing load can be reduced.
Further, in the area switching process, when the upper update process is stopped for some reason, the updated latest data and the past data before the update are alternately and repeatedly stored in the public area in the subsequent area switching process. As a result, data hunting occurs in which the lower-level task refers to and uses the latest data and the past data alternately, which may cause a serious problem in terms of control. On the other hand, in the replication process according to the present invention, even when the upper update process is stopped, the lower task can always refer to the latest data, and data hunting does not occur.

請求項2に記載の情報処理装置は、さらに、上位更新処理が複製処理の実行中に実行されることを禁止する割り込み禁止処理を実行する。
仮に、複数のグローバル変数についての複製処理の実行途中に上位更新処理が実行された場合、下位タスクは、一部のグローバル変数については更新前のデータを参照し、残りのグローバル変数については更新後のデータを参照するためデータの同時性が破綻する。そこで、割り込み禁止処理により、複数のグローバル変数についての複製処理が上位更新処理の前後に跨らないようにすることで、データの同時性破綻を回避することができる。
The information processing apparatus according to claim 2 further executes an interrupt prohibition process for prohibiting the upper update process from being executed during the execution of the replication process.
If the upper update process is executed during the replication process for multiple global variables, the lower task refers to the pre-update data for some global variables, and the remaining global variables are updated. Data simultaneity breaks down because the data is referenced. Thus, by preventing interruption processing from replicating a plurality of global variables before and after the upper update processing, it is possible to avoid data simultaneity failure.

請求項3に記載の情報処理装置は、さらに、下位タスクに含まれる複数の下位参照処理で参照される複数のグローバル変数について共通の割り込み禁止処理を実行する。
複数のグローバル変数について、共通の割り込み禁止処理を実行することで、各グローバル変数について個々に割り込み禁止処理を実行する場合に比べ、情報処理装置の処理負荷を低減することができる。
さらに、割り込み禁止処理は、優先度の高い上位タスクの実行を遅らせるためリアルタイム性を損なうというデメリットを伴う。そのため、割り込み禁止処理を共通にして回数を減らすことで、リアルタイム性への影響を最小限に抑えることができる。
The information processing apparatus according to claim 3 further executes a common interrupt prohibition process for a plurality of global variables referred to by a plurality of lower reference processes included in the lower task.
By executing a common interrupt prohibition process for a plurality of global variables, the processing load on the information processing apparatus can be reduced as compared with a case where an interrupt prohibition process is individually executed for each global variable.
Furthermore, the interrupt prohibition process has a demerit that it impairs real-time performance because it delays the execution of a higher priority task. Therefore, by reducing the number of times by sharing interrupt prohibition processing, it is possible to minimize the effect on real-time performance.

請求項4に記載の情報処理装置は、下位タスク中の下位参照処理を開始する前に複製処理を実行する。
従来技術の領域切換処理によると、下位参照処理では直前の領域切換処理で公開領域に記憶されたデータを参照する。そのため、領域切換処理を実行する下位タスクの実行周期よりも上位更新処理の実行周期が速い場合、領域切換処理後に上位更新処理で更新された最新のデータを参照することができない。よって、参照データの遅延が発生する。
それに対し、下位タスク中の下位参照処理を開始する前に複製処理を実行することで、下位参照処理において最新のデータを使用することができる。
The information processing apparatus according to claim 4 executes the duplication process before starting the lower-level reference process in the lower-level task.
According to the area switching process of the prior art, the lower reference process refers to the data stored in the public area in the immediately preceding area switching process. For this reason, when the execution cycle of the upper update process is faster than the execution cycle of the lower task that executes the area switching process, the latest data updated in the upper update process after the area switching process cannot be referred to. Thus, a reference data delay occurs.
On the other hand, the latest data can be used in the lower reference process by executing the duplication process before starting the lower reference process in the lower task.

請求項5に記載の情報処理装置は、下位タスク中の下位参照処理が完了した後に複製処理を実行する。
このように、下位タスク中の下位参照処理が完了した後に複製処理を実行してもよい。
The information processing apparatus according to claim 5 executes the duplication process after the lower reference process in the lower task is completed.
In this way, the replication process may be executed after the lower level reference process in the lower level task is completed.

請求項6に記載の情報処理装置は、複数の下位タスク毎に複数の公開領域を割り当て、複製処理において、それぞれの下位タスクで使用されるグローバル変数を作業領域から複数の公開領域へ複製する。   The information processing apparatus according to claim 6 allocates a plurality of public areas for each of a plurality of subordinate tasks, and duplicates global variables used in the subordinate tasks from the work area to the plurality of public areas in the duplication processing.

複数の下位タスクが存在する場合、仮に、複製処理を実行する下位タスクよりも優先度が高い下位タスクの実行周期が速い場合、優先度が高い下位タスクは、最新のデータを参照することができない。そこで、本請求項に係る構成を採用し、それぞれの下位タスクが複製処理を実行すれば、各下位タスクの実行周期に応じて、最新データを参照することができる。   When there are multiple subordinate tasks, if the execution cycle of a subordinate task with a higher priority than the subordinate task that executes the replication process is faster, the subordinate task with the higher priority cannot refer to the latest data. . Therefore, when the configuration according to this claim is employed and each lower task executes a replication process, the latest data can be referred to according to the execution cycle of each lower task.

また、複数の下位タスクが存在する場合、仮に、優先度が相対的に低い下位タスクの実行途中に優先度が相対的に高い別の下位タスクによって複製処理が実行されると、優先度が相対的に低い下位タスクは、一部のグローバル変数については更新前のデータを参照し、残りのグローバル変数については更新後のデータを参照するためデータの同時性が破綻する。そこで、本請求項に係る構成を採用することにより、データの同時性破綻を回避することができる。   Also, if there are multiple subordinate tasks, if the duplication process is executed by another subordinate task with a relatively high priority during the execution of a subordinate task with a relatively low priority, the priority will be relative. The lower-level tasks refer to data before update for some global variables and refer to data after update for the remaining global variables, so data simultaneity breaks down. Therefore, by adopting the configuration according to the present claim, it is possible to avoid the simultaneous failure of data.

次に、上述の「第1のケース」に対し、「下位タスクによるグローバル変数の更新途中で上位タスクによってグローバル変数が参照される可能性のあるケース」を「第2のケース」という。請求項7〜12に記載の情報処理装置は、「第2のケース」を対象とする。
下位タスクは、2つの記憶領域の一方である作業領域を使用してグローバル変数を更新する下位更新処理を実行する。上位タスクは、2つの記憶領域の他方である公開領域を使用してグローバル変数を参照する上位参照処理を実行する。そして、下位タスク中の下位更新処理の実行時を除く所定の時期に、作業領域から公開領域へグローバル変数を複製する複製処理を実行する。
Next, in contrast to the “first case” described above, a “case in which a global variable may be referred to by a higher-level task during the update of a global variable by a lower-level task” is referred to as a “second case”. The information processing apparatus according to claims 7 to 12 targets a “second case”.
The lower task executes lower update processing for updating the global variable using a work area that is one of the two storage areas. The upper task executes an upper reference process for referring to the global variable using the public area which is the other of the two storage areas. Then, at a predetermined time excluding the execution time of the lower update process in the lower task, a replication process for replicating the global variable from the work area to the public area is executed.

例えば、下位タスクが、第1グローバル変数を更新する第1サブタスクと第2グローバル変数を更新する第2サブタスクとを含み、上位タスクが第1グローバル変数および第2グローバル変数を共に使用する場合を考える。仮に、第1サブタスクが第1グローバル変数を更新した後、第2サブタスクが第2グローバル変数を更新する前に上位参照処理が実行されると、上位タスクは、第1グローバル変数については更新後の新しいデータを参照し、第2グローバル変数については更新前の古いデータを参照することとなり、データの同時性が破綻する。その結果、第1グローバル変数と第2グローバル変数とに関連性があり、同じタイミングで更新されたデータを必要とする場合、演算が破綻する。   For example, consider a case where a lower task includes a first subtask that updates a first global variable and a second subtask that updates a second global variable, and the upper task uses both the first global variable and the second global variable. . If the upper reference processing is executed after the first subtask updates the first global variable and before the second subtask updates the second global variable, the upper task is updated for the first global variable. The new data is referred to, and the second global variable is referred to the old data before the update, and the data synchronism is broken. As a result, when the first global variable and the second global variable are related and require updated data at the same timing, the calculation fails.

そこで、作業領域と公開領域とを静的に決定し、下位タスク中の所定の時期に作業領域から公開領域への複製処理を実行する。そして、上位タスクが、公開領域に複製された第1グローバル変数および第2グローバル変数を共に参照するようにする。ここで、各タスクは、例えばタイマに設定した周期で発生し、基本的に開始タイミングが変動することはないため、タイマの設定により、所定の時期に複製処理を実行することができる。   Therefore, the work area and the public area are statically determined, and the replication process from the work area to the public area is executed at a predetermined time in the lower task. Then, the upper task refers to both the first global variable and the second global variable copied to the public area. Here, each task occurs, for example, in a cycle set in the timer, and basically the start timing does not fluctuate. Therefore, the replication process can be executed at a predetermined time by setting the timer.

これにより、上位参照処理において、第1グローバル変数と第2グローバル変数との同時性を確保することができる。
拡張して言えば、上位参照処理における複数のグローバル変数の同時性を確保することができる。
Thereby, it is possible to ensure the simultaneity of the first global variable and the second global variable in the upper reference process.
In other words, simultaneity of a plurality of global variables in the upper reference process can be ensured.

請求項8に記載の情報処理装置は、さらに、上位参照処理が複製処理の実行中に実行されることを禁止する割り込み禁止処理を実行する。
仮に、複数のグローバル変数についての複製処理の実行途中に上位参照処理が実行された場合、上位タスクは、一部のグローバル変数については更新前のデータを参照し、残りのグローバル変数については更新後のデータを参照するためデータの同時性が破綻する。そこで、割り込み禁止処理により、複数のグローバル変数についての複製処理が上位参照処理の前後に跨らないようにすることで、データの同時性破綻を回避することができる。
The information processing apparatus according to claim 8 further executes an interrupt prohibition process that prohibits the upper reference process from being executed during the execution of the replication process.
If high-level reference processing is executed during replication processing for multiple global variables, the high-level task refers to the data before update for some global variables, and after update for the remaining global variables Data simultaneity breaks down because the data is referenced. Therefore, by preventing the duplication processing for a plurality of global variables from crossing before and after the upper reference processing by the interrupt prohibition processing, it is possible to avoid data simultaneity failure.

請求項9に記載の情報処理装置は、さらに、下位タスクに含まれる複数の下位更新処理で更新される複数のグローバル変数について共通の割り込み禁止処理を実行する。
複数のグローバル変数について、共通の割り込み禁止処理を実行することで、各グローバル変数について個々に割り込み禁止処理を実行する場合に比べ、情報処理装置の処理負荷を低減することができる。
さらに、割り込み禁止処理は、優先度の高い上位タスクの実行を遅らせるためリアルタイム性を損なうというデメリットを伴う。そのため、割り込み禁止処理を共通にして回数を減らすことで、リアルタイム性への影響を最小限に抑えることができる。
The information processing apparatus according to claim 9 further executes a common interrupt prohibition process for a plurality of global variables updated by a plurality of lower update processes included in the lower task.
By executing a common interrupt prohibition process for a plurality of global variables, the processing load on the information processing apparatus can be reduced as compared with a case where an interrupt prohibition process is individually executed for each global variable.
Furthermore, the interrupt prohibition process has a demerit that it impairs real-time performance because it delays the execution of a higher priority task. Therefore, by reducing the number of times by sharing interrupt prohibition processing, it is possible to minimize the effect on real-time performance.

請求項10に記載の情報処理装置は、下位タスク中の下位更新処理を開始する前に複製処理を実行する。
これにより、複製処理後の下位タスクの処理時間のばらつきなどに関係なく、下位更新処理で更新されたデータを常に一定のタイミングで公開領域に複製し、上位タスクが参照可能な状態にすることができる。すなわち、外的要因に対し安定した特性を維持するロバスト性に優れる。
The information processing apparatus according to claim 10 executes the duplication process before starting the lower update process in the lower task.
This makes it possible to always copy the data updated in the lower update process to the public area at a fixed timing so that the upper task can be referenced regardless of variations in the processing time of the lower task after the replication process. it can. That is, it is excellent in robustness that maintains stable characteristics against external factors.

請求項11に記載の情報処理装置は、下位タスク中の下位更新処理が完了した後に複製処理を実行する。
これにより、下位タスクの実行後に最初に実行される上位参照処理において、常に最新のデータを参照することができる。
The information processing apparatus according to an eleventh aspect executes the replication process after the lower update process in the lower task is completed.
As a result, the latest data can always be referred to in the upper reference process executed first after the lower task is executed.

請求項12に記載の情報処理装置は、複数の上位タスク毎に複数の公開領域を割り当て、複製処理において、それぞれの上位タスクで使用されるグローバル変数を作業領域から複数の公開領域へ複製する。
これにより、例えば、上位タスク毎に、割り当てられた公開領域への複製処理のタイミングをずらすことができる。仮に、第1上位タスクが「常に一定のタイミングで更新されるデータを要求するタスク」であり、第2上位タスクが「常に最新のデータを要求するタスク」であるとする。そこで、第1上位タスク用の公開領域への複製は、下位タスク中の下位更新処理を開始する前に実行することでロバスト性を向上させる。一方、第2上位タスク用の公開領域への複製は、下位タスク中の下位更新処理を完了した後に実行することで最新のデータを参照可能とする。このように、上位タスクの特性に応じて複製処理を実行することができる。
An information processing apparatus according to a twelfth aspect assigns a plurality of public areas to a plurality of upper tasks, and duplicates global variables used in the respective upper tasks from the work area to the plurality of public areas in the duplication processing.
Thereby, for example, the timing of the replication process to the assigned public area can be shifted for each higher-level task. Assume that the first upper task is “a task that always requests data updated at a constant timing” and the second upper task is “a task that always requests the latest data”. Therefore, the replication to the public area for the first upper task is performed before starting the lower update process in the lower task, thereby improving the robustness. On the other hand, the replication to the public area for the second upper task is executed after the lower update process in the lower task is completed, so that the latest data can be referred to. In this way, the replication process can be executed according to the characteristics of the upper task.

本発明の第1〜第8実施形態による情報処理装置を適用した電動パワーステアリング装置の概略構成図。The schematic block diagram of the electric power steering apparatus to which the information processing apparatus by 1st-8th embodiment of this invention is applied. 本発明の第1〜第8実施形態による情報処理装置のシステム図。The system diagram of the information processor by the 1st-the 8th embodiment of the present invention. (a):本発明の第1実施形態に対する比較例を説明する説明図、(b):本発明の第1実施形態(第1のケース)による上位更新/下位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 1st Embodiment of this invention, (b): Explanatory drawing explaining the high-order update / low-order reference process by 1st Embodiment (1st case) of this invention. 本発明の第1実施形態に対する別の比較例(従来技術)を説明する説明図。Explanatory drawing explaining another comparative example (prior art) with respect to 1st Embodiment of this invention. (a):本発明の第1実施形態に対する別の比較例(従来技術)を説明する説明図、(b):本発明の第1実施形態による上位更新/下位参照処理を説明する説明図。(A): Explanatory drawing explaining another comparative example (prior art) with respect to 1st Embodiment of this invention, (b): Explanatory drawing explaining the high-order update / low-order reference process by 1st Embodiment of this invention. (a):本発明の第2実施形態に対する比較例を説明する説明図、(b):本発明の第2実施形態(第1のケース)による上位更新/下位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 2nd Embodiment of this invention, (b): Explanatory drawing explaining the high-order update / low-order reference process by 2nd Embodiment (1st case) of this invention. 本発明の第3実施形態(第1のケース)による上位更新/下位参照処理を説明する説明図。Explanatory drawing explaining the high-order update / low-order reference process by 3rd Embodiment (1st case) of this invention. (a):本発明の第4実施形態に対する比較例を説明する説明図、(b):本発明の第4実施形態(第1のケース)による上位更新/下位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 4th Embodiment of this invention, (b): Explanatory drawing explaining the high-order update / low-order reference process by 4th Embodiment (1st case) of this invention. (a):本発明の第5実施形態に対する比較例を説明する説明図、(b):本発明の第5実施形態(第2のケース)による下位更新/上位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 5th Embodiment of this invention, (b): Explanatory drawing explaining the low-order update / high-order reference process by 5th Embodiment (2nd case) of this invention. (a):本発明の第6実施形態に対する比較例を説明する説明図、(b):本発明の第6実施形態(第2のケース)による下位更新/上位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 6th Embodiment of this invention, (b): Explanatory drawing explaining the low-order update / high-order reference process by 6th Embodiment (2nd case) of this invention. 本発明の第7実施形態(第2のケース)による下位更新/上位参照処理を説明する説明図。Explanatory drawing explaining the low-order update / high-order reference process by 7th Embodiment (2nd case) of this invention. (a):本発明の第8実施形態に対する比較例を説明する説明図、(b):本発明の第8実施形態(第2のケース)による下位更新/上位参照処理を説明する説明図。(A): Explanatory drawing explaining the comparative example with respect to 8th Embodiment of this invention, (b): Explanatory drawing explaining the low-order update / high-order reference process by 8th Embodiment (2nd case) of this invention.

自動車等のハンドル操作をアシストするための電動パワーステアリング装置に本発明の情報処理装置を適用した実施形態を図面に基づいて説明する。
(第1実施形態)
図1は、電動パワーステアリング装置を備えたステアリングシステムの全体構成を示す。ステアリングシステム90に備えられる電動パワーステアリング装置1は、ハンドル91に接続されたステアリングシャフト92に操舵トルクを検出するためのトルクセンサ94を設置している。
ステアリングシャフト92の先端にはピニオンギア96が設けられており、ピニオンギア96はラック軸97に噛み合っている。ラック軸97の両端には、タイロッド等を介して一対の車輪98が回転可能に連結されている。
An embodiment in which an information processing apparatus of the present invention is applied to an electric power steering apparatus for assisting steering operation of an automobile or the like will be described with reference to the drawings.
(First embodiment)
FIG. 1 shows the overall configuration of a steering system provided with an electric power steering device. In the electric power steering apparatus 1 provided in the steering system 90, a torque sensor 94 for detecting a steering torque is installed on a steering shaft 92 connected to a handle 91.
A pinion gear 96 is provided at the tip of the steering shaft 92, and the pinion gear 96 meshes with the rack shaft 97. A pair of wheels 98 are rotatably connected to both ends of the rack shaft 97 via tie rods or the like.

これにより、運転者がハンドル91を回転させると、ハンドル91に接続されたステアリングシャフト92が回転し、ステアリングシャフト92の回転運動は、ピニオンギア96によってラック軸97の直線運動に変換され、ラック軸97の直線運動変位に応じた角度について一対の車輪98が操舵される。   As a result, when the driver rotates the handle 91, the steering shaft 92 connected to the handle 91 rotates, and the rotational motion of the steering shaft 92 is converted into the linear motion of the rack shaft 97 by the pinion gear 96. The pair of wheels 98 are steered at an angle corresponding to 97 linear motion displacement.

電動パワーステアリング装置1は、操舵アシストトルクを発生するモータ80、モータ80の回転を減速してステアリングシャフト92に伝える減速ギア89、及び、モータ駆動装置2を備える。モータ80は3相ブラシレスモータであり、減速ギア89を正逆回転させる。モータ駆動装置2は、「情報処理装置」としてのECU(電子制御装置)10を備える。モータ駆動装置2は、また、モータ80の回転角を検出する回転角センサ85、上述のトルクセンサ94、車速を検出する車速センサ95を含む。
この構成により、電動パワーステアリング装置1は、ハンドル91の操舵を補助するための操舵アシストトルクを発生し、ステアリングシャフト92に伝達する。
The electric power steering apparatus 1 includes a motor 80 that generates a steering assist torque, a reduction gear 89 that reduces the rotation of the motor 80 and transmits the rotation to the steering shaft 92, and the motor driving apparatus 2. The motor 80 is a three-phase brushless motor, and rotates the reduction gear 89 forward and backward. The motor drive device 2 includes an ECU (electronic control device) 10 as an “information processing device”. The motor drive device 2 also includes a rotation angle sensor 85 that detects the rotation angle of the motor 80, the above-described torque sensor 94, and a vehicle speed sensor 95 that detects the vehicle speed.
With this configuration, the electric power steering apparatus 1 generates a steering assist torque for assisting the steering of the handle 91 and transmits the steering assist torque to the steering shaft 92.

図2にECUのシステム概略図を示す。ECU10は、マイクロコンピュータ(以下「マイコン」という)11、入力回路16および出力回路17を備えている。
マイコン11は、処理プログラムを実行するCPU(中央演算処理装置)12、CPU12によって実行される処理プログラムを記憶するROM13、CPU12による演算結果等を記憶するためのRAM14、及び、入力回路16および出力回路17との間で信号をやり取りするためのI/O15を備えている。
FIG. 2 shows a schematic system diagram of the ECU. The ECU 10 includes a microcomputer (hereinafter referred to as “microcomputer”) 11, an input circuit 16, and an output circuit 17.
The microcomputer 11 includes a CPU (Central Processing Unit) 12 that executes a processing program, a ROM 13 that stores a processing program executed by the CPU 12, a RAM 14 that stores calculation results and the like by the CPU 12, and an input circuit 16 and an output circuit. An I / O 15 for exchanging signals with 17 is provided.

RAM14には、後述するグローバル変数を記憶する2つの記憶領域として、作業領域および公開領域が設けられている。本実施形態では、グローバル変数をcと表し、作業領域をC1と表し、公開領域をC2と表す。なお、複数のグローバル変数を使用する他の実施形態では、各グローバル変数について作業領域および公開領域が設けられる。   The RAM 14 is provided with a work area and a public area as two storage areas for storing global variables to be described later. In the present embodiment, the global variable is represented as c, the work area is represented as C1, and the public area is represented as C2. In another embodiment using a plurality of global variables, a work area and a public area are provided for each global variable.

入力回路16は、マイコン11の制御の条件とするための各種センサからの信号を入力する。出力回路17は、マイコン11の制御に応じてアクチュエータを駆動する。
本実施形態では、入力回路16は、上述の回転角センサ85、トルクセンサ94および車速センサ95からの信号を入力し、出力回路17は、マイコン11の制御に応じてモータ80を駆動する。
The input circuit 16 inputs signals from various sensors for making the microcomputer 11 control conditions. The output circuit 17 drives the actuator according to the control of the microcomputer 11.
In the present embodiment, the input circuit 16 inputs signals from the rotation angle sensor 85, the torque sensor 94 and the vehicle speed sensor 95 described above, and the output circuit 17 drives the motor 80 in accordance with the control of the microcomputer 11.

以上の構成によるECU10において、マイコン11が実行する処理プログラムは、実行単位である複数のタスクに細分化されて記述されている。複数のタスクには優先度が設定されており、ECU10は、複数のタスクを優先度に基づき実行することによって、一連の機能を実現する。優先度が相対的に高いタスクを「上位タスク」といい、優先度が相対的に低いタスクを「下位タスク」という。   In the ECU 10 having the above configuration, the processing program executed by the microcomputer 11 is described by being subdivided into a plurality of tasks which are execution units. Priorities are set for the plurality of tasks, and the ECU 10 implements a series of functions by executing the plurality of tasks based on the priorities. A task having a relatively high priority is referred to as a “higher task”, and a task having a relatively low priority is referred to as a “lower task”.

上位タスクは、例えば、制御応答性や安全性の確保等からリアルタイムに処理を実行する必要性の高いタスクである。そのため、上位タスクは一般的に「割り込みルーチン」として設定され、イベントの発生等をトリガとして、下位タスクである「メインルーチン」の実行中に優先して実行される。すなわち、上位タスクの実行により下位タスクの実行が一時的に中断され、上位タスク終了後に下位タスクが中断位置から再開される。   The higher-order task is a task that is highly necessary to execute processing in real time in order to ensure control responsiveness and safety, for example. For this reason, the upper task is generally set as an “interrupt routine” and is preferentially executed during the execution of the “main routine”, which is a lower task, triggered by the occurrence of an event or the like. That is, the execution of the lower task is temporarily interrupted by the execution of the upper task, and the lower task is resumed from the interruption position after the upper task is terminated.

ここで、上位タスクと下位タスクとの間で共通に使用されるデータを「グローバル変数」という。グローバル変数は、上位タスクで更新され下位タスクで参照される場合、あるいは、下位タスクで更新され上位タスクで参照される場合がある。このような更新および参照処理において、割り込みの発生によって、一つのタスクが同時に参照すべき複数のデータが別々に参照される場合や、複数のタスク間で共通に参照されるべきデータが同一とならない場合には、「データの同時性」が問題となる。   Here, data used in common between the upper task and the lower task is referred to as a “global variable”. A global variable may be updated by a higher task and referenced by a lower task, or may be updated by a lower task and referenced by a higher task. In such updating and reference processing, when an interrupt occurs, a plurality of data that should be referred to simultaneously by one task is referred to separately, or data that should be referred to in common among a plurality of tasks is not the same. In some cases, "data simultaneity" becomes a problem.

この問題に対処するため、本発明では、作業領域と公開領域とを静的に決定し、下位タスク中の所定の時期に、作業領域から公開領域にグローバル変数を複製する「複製処理」を実行することを特徴とする。ここで、各タスクは、例えばタイマに設定した周期で発生し、基本的に開始タイミングが変動することはないため、タイマの設定により、所定の時期に複製処理を実行することができる。
以下、実施形態ごとに、上位タスクと下位タスクとの間でのグローバル変数の更新および参照処理について説明する。
In order to deal with this problem, the present invention statically determines the work area and the public area, and executes a “duplication process” that duplicates the global variable from the work area to the public area at a predetermined time in the lower task. It is characterized by doing. Here, each task occurs, for example, in a cycle set in the timer, and basically the start timing does not fluctuate. Therefore, the duplication process can be executed at a predetermined time by setting the timer.
Hereinafter, update and reference processing of global variables between the upper task and the lower task will be described for each embodiment.

最初に説明する第1〜第4実施形態は、「下位タスクによるグローバル変数の参照途中で上位タスクによってグローバル変数が更新される可能性がある」場合の処理に係る実施形態である。このケースを「第1のケース」という。
本発明の第1実施形態による処理を図3〜5に基づいて説明する。第1実施形態は、第1のケースで、下位タスクの開始時に複製処理を実行する。
The first to fourth embodiments to be described first are embodiments related to processing in a case where “a global variable may be updated by a higher-level task in the middle of referring to a global variable by a lower-level task”. This case is referred to as a “first case”.
Processing according to the first embodiment of the present invention will be described with reference to FIGS. The first embodiment is a first case, and executes replication processing at the start of a lower task.

図3(a)は、第1実施形態に対する比較例として、複製処理がされない場合を示す。上位タスクSによる上位更新処理では、公開領域Cのグローバル変数cを更新する。下位タスクVのサブタスクXおよびサブタスクYによる下位参照処理では、公開領域Cのグローバル変数cを参照する。
以下、サブタスクXおよびサブタスクYは、下位タスクVを構成し、グローバル変数を更新または参照するタスクである。また、図中、下位タスクVのうちサブタスクXおよびサブタスクYを除く部分は、グローバル変数を使用しないタスクを意味する。下位タスクVのうち破線で指示する部分は、上位タスクSの割り込みによって下位タスクVの実行が中断されることを意味する。
FIG. 3A shows a case where the duplication process is not performed as a comparative example with respect to the first embodiment. In the upper update process by the upper task S, the global variable c in the public area C is updated. In the lower reference processing by the subtask X and the subtask Y of the lower task V, the global variable c in the public area C is referred.
Hereinafter, the subtask X and the subtask Y are tasks that constitute the lower task V and update or refer to global variables. In the figure, the portion of the lower task V excluding the subtask X and the subtask Y means a task that does not use a global variable. A portion indicated by a broken line in the lower task V means that the execution of the lower task V is interrupted by the interrupt of the upper task S.

下位タスクV1においては、サブタスクXおよびサブタスクYによる下位参照処理後に、上位タスクS1による上位更新処理が行われるため、下位タスクVに参照されるグローバル変数cの同時性に関する問題はない。
一方、下位タスクV2においては、サブタスクXによる下位参照処理後、サブタスクYによる下位参照処理の実行前に上位タスクS2による上位更新処理が行われる。この事例は、例えば、サブタスクXの処理時間が長くかかる場合に起こり得る。この場合、サブタスクXは更新前の古いデータを参照し、サブタスクYは更新後の新しいデータを参照することとなり、サブタスクXとサブタスクYとの間でのグローバル変数cの同時性が破綻する(N101)。
In the lower task V1, since the upper update processing by the upper task S1 is performed after the lower reference processing by the subtask X and the subtask Y, there is no problem regarding the simultaneity of the global variable c referred to by the lower task V.
On the other hand, in the lower task V2, higher update processing by the higher task S2 is performed after the lower reference processing by the subtask X and before execution of the lower reference processing by the subtask Y. This case may occur, for example, when the processing time of the subtask X takes a long time. In this case, the subtask X refers to the old data before the update, and the subtask Y refers to the new data after the update, and the simultaneity of the global variable c between the subtask X and the subtask Y fails (N101). ).

図3(b)は、第1実施形態により、下位タスクの開始時に複製処理を実行する場合を示す。上位タスクSは、作業領域C1のグローバル変数cを更新する。下位タスクVは、開始時tiに作業領域C1のグローバル変数cを公開領域C2に複製する。下位タスクVのサブタスクXおよびサブタスクYは、それぞれ公開領域C2のグローバル変数cを参照する。なお、図中「c」は複製されるグローバル変数を表し、「(c)」は参照されるグローバル変数を表す。以下、各図にて、適宜、グローバル変数を同様に表示する。   FIG. 3B shows a case where the replication process is executed at the start of the lower task according to the first embodiment. The upper task S updates the global variable c in the work area C1. The lower task V copies the global variable c in the work area C1 to the public area C2 at the start time ti. The subtask X and subtask Y of the lower task V each refer to the global variable c in the public area C2. In the figure, “c” represents a global variable to be duplicated, and “(c)” represents a global variable to be referenced. In the following, global variables are similarly displayed as appropriate in each figure.

下位タスクV2において、サブタスクXおよびサブタスクYは、下位タスクV2の開始時tiに複製されたグローバル変数cを共に参照する。したがって、下位タスクV2中に発生する上位タスクS2に影響されることなく、サブタスクXおよびサブタスクYの下位参照処理におけるグローバル変数cの同時性が確保される(N111)。   In the lower task V2, the subtask X and the subtask Y refer to the global variable c copied at the start time ti of the lower task V2. Therefore, the simultaneity of the global variable c in the lower reference processing of the subtask X and the subtask Y is ensured without being affected by the upper task S2 generated in the lower task V2 (N111).

次に、図4および図5(a)は、第1実施形態に対する別の比較例として、特許文献1の従来技術による「領域切換処理」を示す。図4に示すように、上位タスクSは、作業領域Z1のグローバル変数zを更新する。また、下位タスクV1のサブタスクYの完了時に作業領域Z1と公開領域Z2とを切り換える。その次の周期の下位タスクV2では、サブタスクXおよびサブタスクYは、公開領域Z2のグローバル変数zを参照する。   Next, FIG. 4 and FIG. 5A show “region switching processing” according to the prior art of Patent Document 1 as another comparative example with respect to the first embodiment. As shown in FIG. 4, the higher-order task S updates the global variable z in the work area Z1. In addition, when the subtask Y of the lower task V1 is completed, the work area Z1 and the public area Z2 are switched. In the lower task V2 of the next cycle, the subtask X and the subtask Y refer to the global variable z in the public area Z2.

この領域切換処理では、サブタスクXおよびサブタスクYは、1周期前のサブタスクYの完了時以前に作業領域Z1に記憶されていたデータを参照することとなる。その結果、上位タスクSの実行周期が下位タスクVの実行周期よりも速い場合には、下位タスクVの下位参照処理において下位タスクVの1周期分のデータ遅延が発生する。
これに対し、第1実施形態では、図3(b)に示すように、下位タスクVの開始時tiにおける最新データを参照することができ、1周期分のデータ遅延は発生しない。
In this area switching process, the subtask X and the subtask Y refer to the data stored in the work area Z1 before the completion of the subtask Y one cycle before. As a result, when the execution cycle of the upper task S is faster than the execution cycle of the lower task V, a data delay corresponding to one cycle of the lower task V occurs in the lower reference processing of the lower task V.
On the other hand, in the first embodiment, as shown in FIG. 3B, the latest data at the start time ti of the lower task V can be referred to, and a data delay for one cycle does not occur.

また、従来技術による領域切換処理で、図5(a)に示すように、何らかの理由で上位タスクSが作業領域Z1でのデータ更新を停止した場合を想定する。上位タスクS1で更新された最新データは下位タスクV1のサブタスクYの完了時に公開領域Z2に記憶され、下位タスクV1の次周期の下位タスクV2ではこの最新データを参照する。しかし、次周期の下位タスクV3では、2周期前に公開領域Z2にあったデータ、すなわち、下位タスクV1が参照した過去データを参照することとなる。そして、下位タスクV3の次周期の下位タスクV4では、再び最新データを参照し、その後、過去データと最新データとを交互に繰り返し参照し使用するため、データハンチングが生じ、制御上重大な問題を招くおそれがある。
これに対し、第1実施形態では、図5(b)に示すように、上位タスクSが作業領域C1でのデータ更新を停止した場合でも、下位タスクVは、常に最新データを参照することができ、データハンチングは発生しない。
Further, in the area switching process according to the conventional technique, it is assumed that the upper task S stops updating data in the work area Z1 for some reason as shown in FIG. The latest data updated in the upper task S1 is stored in the public area Z2 when the subtask Y of the lower task V1 is completed, and this latest data is referred to in the lower task V2 in the next cycle of the lower task V1. However, in the lower task V3 in the next cycle, the data that was in the public area Z2 two cycles ago, that is, the past data that the lower task V1 referred to is referred to. In the lower task V4 in the next cycle of the lower task V3, the latest data is referred again, and then the past data and the latest data are alternately referred to and used repeatedly. There is a risk of inviting.
On the other hand, in the first embodiment, as shown in FIG. 5B, even when the upper task S stops updating the data in the work area C1, the lower task V can always refer to the latest data. Data hunting does not occur.

以上のように、第1実施形態は、複製処理を行うことにより、複数のデータ間の同時性を確保することができる。
また、従来技術による領域切換処理と比較すると、下位タスクの1周期分のデータ遅延が発生しない。また、データハンチングの問題がないため、特にデータハンチングが問題となるようなシステムでは有効である。
As described above, according to the first embodiment, simultaneity between a plurality of data can be ensured by performing replication processing.
Further, as compared with the area switching process according to the prior art, a data delay for one cycle of the lower task does not occur. Further, since there is no problem of data hunting, it is effective particularly in a system where data hunting is a problem.

(第2実施形態)
本発明の第2実施形態による処理を図6に基づいて説明する。第2実施形態は、第1のケースで、複数のグローバル変数についての複製処理の実行中に、上位更新処理の割り込みを禁止する「割り込み禁止処理」を実行する。
図6(a)は、第2実施形態に対する比較例として、割り込み禁止処理がされない場合を示す。上位タスクSは作業領域C1、D1のグローバル変数c、dを更新する。下位タスクVのサブタスクXおよびサブタスクYは、下位タスクVの開始時tiの後、公開領域C2、D2からグローバル変数c、dを参照する。
(Second Embodiment)
Processing according to the second embodiment of the present invention will be described with reference to FIG. In the first case, the second embodiment executes an “interrupt prohibition process” that prohibits an interrupt of a higher level update process during execution of a replication process for a plurality of global variables.
FIG. 6A shows a case where interrupt prohibition processing is not performed as a comparative example to the second embodiment. The upper task S updates the global variables c and d in the work areas C1 and D1. Subtask X and subtask Y of lower task V refer to global variables c and d from public areas C2 and D2 after the start time ti of lower task V.

下位タスクV1においては、上位タスクSの影響を受けることなく、サブタスクXおよびサブタスクYが参照するグローバル変数c、dの同時性が確保される。また、下位タスクV2においても、実行途中で発生する上位タスクS2は、作業領域C1、D1から公開領域C2、D2への複製処理に影響しないため、グローバル変数c、dの同時性が確保される(N202)。   In the lower task V1, the simultaneity of the global variables c and d referred to by the subtask X and the subtask Y is ensured without being affected by the upper task S. Also, in the lower task V2, the upper task S2 that occurs in the middle of execution does not affect the replication process from the work areas C1 and D1 to the public areas C2 and D2, so that the simultaneity of the global variables c and d is ensured. (N202).

一方、下位タスクV3では、グローバル変数cの複製後、グローバル変数dの複製前に上位タスクS3が発生してデータが更新される。したがって、サブタスクXおよびサブタスクYは、グローバル変数cについては更新前の古いデータを参照し、グローバル変数dについては更新後の新しいデータを参照することとなる。その結果、下位参照処理におけるグローバル変数c、dの同時性が破綻する(N203)。   On the other hand, in the lower task V3, after copying the global variable c, the upper task S3 is generated and the data is updated before the global variable d is copied. Therefore, the subtask X and the subtask Y refer to the old data before the update for the global variable c, and refer to the new data after the update for the global variable d. As a result, the simultaneity of the global variables c and d in the lower reference processing is broken (N203).

図6(b)は、第2実施形態により、複製処理の実行時に割り込み禁止処理を行う場合を示す。下位タスクVの開始時tiの後、2点鎖線で示すように、上位タスクSによる上位更新処理の割り込みが禁止される割り込み禁止期間Pintが、サブタスクXおよびサブタスクYについて共通に設定される。そして、割り込み禁止期間Pint中に複製処理が実行される。
下位タスクV3では、下位タスクVの開始時tiの後、割り込み禁止期間Pintが終了するまで上位タスクS3の実行開始が待たされる。その結果、上位タスクS3の影響を受けずに作業領域C1、D1から公開領域C2、D2への複製処理がされるため、グローバル変数c、dの同時性が確保される(N213)。
FIG. 6B shows a case where the interrupt prohibition process is performed when the replication process is executed according to the second embodiment. After the start time ti of the lower task V, as indicated by a two-dot chain line, the interrupt prohibition period Pint in which the interrupt of the upper update process by the upper task S is prohibited is set in common for the subtask X and the subtask Y. Then, the duplication process is executed during the interrupt inhibition period Pint.
In the lower task V3, after the start time ti of the lower task V, the execution start of the upper task S3 is waited until the interruption prohibition period Pint ends. As a result, since the duplication processing from the work areas C1 and D1 to the public areas C2 and D2 is performed without being affected by the upper task S3, the simultaneity of the global variables c and d is ensured (N213).

これにより、第2実施形態では、複数のグローバル変数についての複製処理が上位更新処理の前後に跨らないようにすることで、データの同時性破綻を回避することができる。
また、グローバル変数c、dについて、共通の割り込み禁止処理を実行するため、各グローバル変数について個々に割り込み禁止処理を実行する場合に比べ、ECU10の処理負荷を低減することができる。
さらに、割り込み禁止処理は、優先度の高い上位タスクの実行を遅らせるためリアルタイム性を損なうというデメリットを伴う。そのため、割り込み禁止処理を共通にして回数を減らすことで、リアルタイム性への影響を最小限に抑えることができる。
As a result, in the second embodiment, it is possible to avoid a data simultaneity failure by preventing the replication processing for a plurality of global variables from extending before and after the higher level update processing.
Further, since the common interrupt prohibition process is executed for the global variables c and d, the processing load on the ECU 10 can be reduced as compared with the case where the interrupt prohibition process is executed individually for each global variable.
Furthermore, the interrupt prohibition process has a demerit that it impairs real-time performance because it delays the execution of a higher priority task. Therefore, by reducing the number of times by sharing interrupt prohibition processing, it is possible to minimize the effect on real-time performance.

(第3実施形態)
本発明の第3実施形態による処理を図7に基づいて説明する。第3実施形態は、第1のケースで、下位タスクの完了時に複製処理を実行する。
下位タスクV1では、サブタスクXおよびサブタスクYによる下位参照処理の実行後に上位タスクS1による上位更新処理がされるため、データの同時性に関する問題はない。一方、下位タスクV2では、サブタスクXによる下位参照処理の実行後、サブタスクYによる下位参照処理の実行前に上位タスクS2が発生する。しかし、作業領域C1から公開領域C2への複製処理は下位タスクV2の完了時tfにされるため、サブタスクYは更新前のデータを参照し、サブタスクXとの間でデータの同時性が確保される(N312)。
第3実施形態では、第1実施形態と同様に、複数のデータ間の同時性を確保することができる。
(Third embodiment)
Processing according to the third embodiment of the present invention will be described with reference to FIG. The third embodiment is a first case, and executes a replication process when a lower task is completed.
In the lower task V1, since the upper update processing by the upper task S1 is performed after the lower reference processing by the subtask X and the subtask Y is executed, there is no problem regarding data simultaneity. On the other hand, in the lower task V2, the upper task S2 occurs after the lower reference processing by the subtask X and before the lower reference processing by the subtask Y. However, since the duplication processing from the work area C1 to the public area C2 is performed at the time tf when the lower task V2 is completed, the subtask Y refers to the data before the update, and data synchronism with the subtask X is ensured. (N312).
In the third embodiment, as in the first embodiment, simultaneity between a plurality of data can be ensured.

(第4実施形態)
本発明の第4実施形態による処理を図8に基づいて説明する。第4実施形態は、第1のケースで、複数の下位タスク毎に複数の公開領域を割り当て、複製処理において、それぞれの下位タスクで使用されるグローバル変数を作業領域から公開領域へ複製する。
図8(a)は、第4実施形態に対する比較例として、複数の下位タスクが1つの公開領域を共用する場合を示す。上位タスクSは作業領域C1のグローバル変数cを更新する。下位タスクは、優先度が高い順に3つの下位タスクU、V、Wを含み、優先度が相対的に高い下位タスクは、優先度が相対的に低い下位タスクの実行中に割り込んで実行される。下位タスクUは、下位タスクVよりも実行周期が速い。下位タスクWのうち破線で指示する部分は、上位タスクSまたは下位タスクU、Vの割り込みによって下位タスクWの実行が中断されることを意味する。
また、下位タスクVの開始時tiにグローバル変数cの複製処理が実行される。下位タスクU、V、Wは、いずれもグローバル変数cを参照する。
(Fourth embodiment)
Processing according to the fourth embodiment of the present invention will be described with reference to FIG. In the first case, the fourth embodiment allocates a plurality of public areas for each of a plurality of lower tasks, and duplicates global variables used in the respective lower tasks from the work area to the public area in the duplication process.
FIG. 8A shows a case where a plurality of lower tasks share one public area as a comparative example with respect to the fourth embodiment. The upper task S updates the global variable c in the work area C1. A lower task includes three lower tasks U, V, and W in descending order of priority, and a lower task having a relatively high priority is interrupted and executed during execution of a lower task having a relatively low priority. . The lower task U has a faster execution cycle than the lower task V. A portion indicated by a broken line in the lower task W means that the execution of the lower task W is interrupted by the interrupt of the upper task S or the lower tasks U and V.
Also, at the start time ti of the lower task V, the replication process of the global variable c is executed. The lower tasks U, V, and W all refer to the global variable c.

この場合、問題点が2つある。問題点の1つめは、下位タスクUが参照するデータの遅延に関する。上位タスクS2の後に発生する下位タスクU2は、本来最新のグローバル変数cを参照するのが望ましい。しかし、下位タスクV2による複製処理が下位タスクU2の後に実行されるため、下位タスクU2は、1周期前の下位タスクV1で複製された古いデータを参照することとなる(N401)。   In this case, there are two problems. The first problem relates to the delay of data referred to by the lower task U. It is desirable that the lower task U2 generated after the upper task S2 originally refers to the latest global variable c. However, since the replication process by the lower task V2 is executed after the lower task U2, the lower task U2 refers to the old data copied by the lower task V1 one cycle before (N401).

問題点の2つめは、下位タスクWが参照するデータの同時性に関する。下位タスクW1の実行中には下位タスクV1による複製処理がされないため、データの同時性に関する問題はない。一方、下位タスクW2の実行中には下位タスクV2による複製処理がされる。すると、下位タスクW2では、グローバル変数cについて、下位タスクV2の実行前には更新前の古いデータを参照し、下位タスクV2の実行後には更新後の新しいデータを参照することとなり、データの同時性が破綻する(N402)。   The second problem relates to the simultaneity of data referred to by the lower task W. During the execution of the lower task W1, there is no problem regarding data simultaneity because the replication processing by the lower task V1 is not performed. On the other hand, during the execution of the lower task W2, the replication processing by the lower task V2 is performed. Then, in the lower task W2, with respect to the global variable c, the old data before the update is referred to before the execution of the lower task V2, and the new data after the update is referred to after the execution of the lower task V2. Sexuality breaks down (N402).

図8(b)は、第4実施形態により、下位タスクU、V、Wにそれぞれ公開領域C2、C3、C4を割り当てる場合を示す。下位タスクU、V、Wのそれぞれの開始時tiu、tiv、tiwに、作業領域C1から各公開領域C2、C3、C4へのグローバル変数cの複製処理を行う。すなわち、各下位タスクは、各実行周期に応じて複製処理を行う。
これにより、下位タスクU2は、下位タスクU2の開始時tiuに複製された最新のデータを参照することができる(N411)。
FIG. 8B shows a case where public areas C2, C3, and C4 are allocated to the lower tasks U, V, and W, respectively, according to the fourth embodiment. At the start time tiu, tiv, tiw of each of the lower tasks U, V, W, the global variable c is copied from the work area C1 to the public areas C2, C3, C4. That is, each lower task performs a replication process according to each execution cycle.
Thereby, the lower task U2 can refer to the latest data copied at the start time tiu of the lower task U2 (N411).

また、下位タスクW2では、下位タスクV2の割り込みに影響されることなく、下位タスクW2の開始時tiwに参照した同一のデータを参照するため、データの同時性が確保される(N412)。
これにより、第4実施形態では、優先度が相対的に低い下位タスクの実行途中に、優先度が相対的に高い別の下位タスクによって複製処理が実行されることによるデータの同時性破綻を回避することができる。
Further, since the lower task W2 refers to the same data referred to at the start time tiw of the lower task W2 without being affected by the interrupt of the lower task V2, the data synchronism is ensured (N412).
As a result, in the fourth embodiment, the simultaneous failure of data due to the replication process being executed by another lower task having a relatively high priority during the execution of the lower task having a relatively low priority is avoided. can do.

(第5実施形態)
次に説明する第5〜第8実施形態は、「下位タスクによるグローバル変数の更新途中で上位タスクによってグローバル変数が参照される可能性がある」場合の処理に係る実施形態である。このケースを「第2のケース」という。
本発明の第5実施形態による処理を図9に基づいて説明する。第5実施形態は、第2のケースで、下位タスクの開始時に複製処理を実行する。
(Fifth embodiment)
The fifth to eighth embodiments to be described next are embodiments related to processing in a case where “a global variable may be referred to by an upper task in the middle of updating a global variable by a lower task”. This case is referred to as a “second case”.
Processing according to the fifth embodiment of the present invention will be described with reference to FIG. In the second case, the fifth embodiment executes the duplication process at the start of the lower task.

図9(a)は、第5実施形態に対する比較例として、複製処理がされない場合を示す。下位タスクVのサブタスクXは、X公開領域Eのグローバル変数eを更新し、下位タスクVのサブタスクYは、Y公開領域Fのグローバル変数fを更新する。
上位タスクS1による上位参照処理は、サブタスクXおよびサブタスクYの実行後に行われるため、データの同時性に関する問題はない。一方、上位タスクS2による上位参照処理は、サブタスクXによるグローバル変数eの下位更新処理後、サブタスクYによるグローバル変数fの下位更新処理の実行前に行われる。この事例は、例えば、サブタスクXの処理時間が長くかかる場合に起こり得る。この場合、上位タスクS2は、グローバル変数eについては更新後の新しいデータを参照し、グローバル変数fについては更新前の古いデータを参照することとなり、グローバル変数eとグローバル変数fとの同時性が破綻する(N502)。
FIG. 9A shows a case where the duplication process is not performed as a comparative example with respect to the fifth embodiment. The subtask X of the lower task V updates the global variable e in the X public area E, and the subtask Y of the lower task V updates the global variable f in the Y public area F.
Since the upper reference processing by the upper task S1 is performed after the execution of the subtask X and the subtask Y, there is no problem regarding data simultaneity. On the other hand, the upper reference process by the upper task S2 is performed after the lower update process of the global variable e by the subtask X and before the lower update process of the global variable f by the subtask Y. This case may occur, for example, when the processing time of the subtask X takes a long time. In this case, the upper task S2 refers to the new data after the update for the global variable e, and refers to the old data before the update for the global variable f, and the simultaneity between the global variable e and the global variable f is increased. It fails (N502).

図9(b)は、第5実施形態により、下位タスクの開始時に複製処理を実行する場合を示す。下位タスクVのサブタスクXは、X作業領域E1のグローバル変数eを更新し、下位タスクVのサブタスクYは、Y作業領域F1のグローバル変数fを更新する。下位タスクVは、開始時tiに、X作業領域E1からX公開領域E2へグローバル変数eを複製し、かつ、Y作業領域F1からY公開領域F2へグローバル変数fを複製する。そして、上位タスクSは、X公開領域E2のグローバル変数eを参照し、Y公開領域F2のグローバル変数fを参照する。   FIG. 9B shows a case where the replication processing is executed at the start of the lower task according to the fifth embodiment. The subtask X of the lower task V updates the global variable e in the X work area E1, and the subtask Y of the lower task V updates the global variable f in the Y work area F1. The lower task V duplicates the global variable e from the X work area E1 to the X public area E2 at the start time ti, and duplicates the global variable f from the Y work area F1 to the Y public area F2. Then, the upper task S refers to the global variable e in the X public area E2 and refers to the global variable f in the Y public area F2.

上位タスクS2は、下位タスクV2の開始時tiに複製されたグローバル変数e、fを共に参照する。したがって、上位タスクS2で参照されるグローバル変数e、fの同時性が確保される(N512)。   The upper task S2 refers to both the global variables e and f copied at the start time ti of the lower task V2. Therefore, the simultaneity of the global variables e and f referred to by the higher-order task S2 is ensured (N512).

これにより、第5実施形態は、上位参照処理における複数のデータの同時性を確保することができる。
また、下位タスクVの開始時tiに複製処理を実行するため、その後の下位タスクVの処理時間のばらつきなどに関係なく、下位更新処理で更新されたデータを常に一定のタイミングで公開領域に複製し、上位タスクが参照可能な状態にすることができる。すなわち、外的要因に対し安定した特性を維持するロバスト性に優れる。
Thereby, 5th Embodiment can ensure the simultaneity of several data in a high-order reference process.
In addition, since the replication process is executed at the time ti at the start of the lower task V, the data updated by the lower update process is always replicated to the public area at a constant timing regardless of variations in the processing time of the subsequent lower task V. Then, it is possible to make it possible to refer to the upper task. That is, it is excellent in robustness that maintains stable characteristics against external factors.

(第6実施形態)
本発明の第6実施形態による処理を図10に基づいて説明する。第6実施形態は、第2のケースで、複製処理の実行中に上位参照処理の割り込みを禁止する「割り込み禁止処理」を実行する。
図10(a)は、第6実施形態に対する比較例として、割り込み禁止処理がされない場合を示す。下位タスクVのサブタスクXは、X作業領域E1のグローバル変数eを更新し、下位タスクVのサブタスクYは、Y作業領域F1のグローバル変数fを更新する。下位タスクVは、開始時tiに、X作業領域E1からX公開領域E2へグローバル変数eを複製し、かつ、Y作業領域F1からY公開領域F2へグローバル変数fを複製する。そして、上位タスクSは、X公開領域E2のグローバル変数eを参照し、Y公開領域F2のグローバル変数fを参照する。
(Sixth embodiment)
Processing according to the sixth embodiment of the present invention will be described with reference to FIG. In the second case, the sixth embodiment executes an “interrupt prohibition process” that prohibits an interrupt of the upper reference process during the execution of the replication process.
FIG. 10A shows a case where interrupt prohibition processing is not performed as a comparative example to the sixth embodiment. The subtask X of the lower task V updates the global variable e in the X work area E1, and the subtask Y of the lower task V updates the global variable f in the Y work area F1. The lower task V duplicates the global variable e from the X work area E1 to the X public area E2 at the start time ti, and duplicates the global variable f from the Y work area F1 to the Y public area F2. Then, the upper task S refers to the global variable e in the X public area E2 and refers to the global variable f in the Y public area F2.

上位タスクS1による上位参照処理においては、下位タスクV1の開始時tiの後、公開領域E2、F2に複製されたグローバル変数e、fを共に参照するため、グローバル変数e、fの同時性が確保される。また、下位タスクV2の実行途中に発生する上位タスクS2による上位参照処理においても、同様に、下位タスクV2の開始時tiの後、公開領域E2、F2に複製されたグローバル変数e、fを共に参照するため、グローバル変数e、fの同時性が確保される(N602)。   In the upper reference processing by the upper task S1, since the global variables e and f copied to the public areas E2 and F2 are referred to after the start time ti of the lower task V1, the simultaneity of the global variables e and f is ensured. Is done. Similarly, in the upper reference processing by the upper task S2 that occurs in the middle of the execution of the lower task V2, the global variables e and f copied to the public areas E2 and F2 are both set after the start time ti of the lower task V2. For reference, the simultaneity of the global variables e and f is ensured (N602).

一方、上位タスクS3による上位更新処理は、X作業領域E1からX公開領域E2へのグローバル変数eの複製処理の後、Y作業領域F1からY公開領域F2へのグローバル変数fの複製処理の前に行われる。そのため、上位タスクS3は、グローバル変数eについては更新前の古いデータを参照し、グローバル変数fについては更新後の新しいデータを参照することとなる。その結果、グローバル変数e、fの同時性が破綻する(N603)。   On the other hand, the higher level update process by the higher level task S3 is performed after the global variable e is copied from the X work area E1 to the X public area E2, and before the global variable f is copied from the Y work area F1 to the Y public area F2. To be done. Therefore, the upper task S3 refers to the old data before the update for the global variable e, and refers to the new data after the update for the global variable f. As a result, the simultaneity of the global variables e and f breaks down (N603).

図10(b)は、第6実施形態により、複製処理の実行時に割り込み禁止処理を行う場合を示す。下位タスクVの開始時tiの後、2点鎖線で示すように、上位タスクSによる上位参照処理の割り込みが禁止される割り込み禁止期間Pintが、サブタスクXおよびサブタスクYについて共通に設定される。そして、割り込み禁止期間Pint中に複製処理が実行される。
上位タスクS3は、下位タスクV3の開始時tiの後、割り込み禁止期間Pintが終了するまで上位参照処理の実行開始が待たされる。したがって、公開領域E2、F2への複製処理の完了後にグローバル変数e、fが参照されるため、グローバル変数e、fの同時性が確保される(N613)。
FIG. 10B shows a case where the interrupt prohibition process is performed when the replication process is executed according to the sixth embodiment. After the start time ti of the lower task V, as indicated by a two-dot chain line, the interrupt prohibition period Pint in which the upper reference processing interrupt by the upper task S is prohibited is set in common for the subtask X and the subtask Y. Then, the duplication process is executed during the interrupt inhibition period Pint.
After the start time ti of the lower task V3, the upper task S3 waits for the start of the upper reference process until the interrupt inhibition period Pint ends. Accordingly, since the global variables e and f are referred to after the completion of the replication process to the public areas E2 and F2, the simultaneity of the global variables e and f is ensured (N613).

これにより、第6実施形態では、複数のグローバル変数についての複製処理が上位参照処理の前後に跨らないようにすることで、データの同時性破綻を回避することができる。
また、グローバル変数e、fについて、共通の割り込み禁止処理を実行するため、各グローバル変数について個々に割り込み禁止処理を実行する場合に比べ、ECU10の処理負荷を低減することができる。
さらに、割り込み禁止処理は、優先度の高い上位タスクの実行を遅らせるためリアルタイム性を損なうというデメリットを伴う。そのため、割り込み禁止処理を共通にして回数を減らすことで、リアルタイム性への影響を最小限に抑えることができる。
As a result, in the sixth embodiment, it is possible to avoid a data simultaneity failure by preventing the duplication processing for a plurality of global variables from extending before and after the upper reference processing.
Further, since the common interrupt prohibition process is executed for the global variables e and f, the processing load on the ECU 10 can be reduced as compared with the case where the interrupt prohibition process is individually executed for each global variable.
Furthermore, the interrupt prohibition process has a demerit that it impairs real-time performance because it delays the execution of a higher priority task. Therefore, by reducing the number of times by sharing interrupt prohibition processing, it is possible to minimize the effect on real-time performance.

(第7実施形態)
本発明の第7実施形態による処理を図11に基づいて説明する。第7実施形態は、第2のケースで、下位タスクの完了時に複製処理を実行する。
下位タスクV1では、サブタスクXおよびサブタスクYによる下位更新処理の実行後に、上位タスクS1による上位参照処理がされるため、データの同時性に関する問題はない。一方、下位タスクV2では、サブタスクXによる下位更新処理の実行後、サブタスクYによる下位更新処理の実行前に上位タスクS2が発生する。しかし、上位タスクS2は、1周期前の下位タスクV1の完了時tfにX公開領域E2およびY公開領域F2に複製されたグローバル変数e、fを共に参照するため、上位参照処理におけるグローバル変数e、fの同時性が確保される(N712)。
(Seventh embodiment)
Processing according to the seventh embodiment of the present invention will be described with reference to FIG. The seventh embodiment is a second case, and executes a replication process when a lower task is completed.
In the lower task V1, since the upper reference processing by the upper task S1 is performed after the lower update processing by the subtask X and the subtask Y is executed, there is no problem regarding data simultaneity. On the other hand, in the lower task V2, the upper task S2 occurs after the lower update process by the subtask X and before the lower update process by the subtask Y. However, since the upper task S2 refers to both the global variables e and f replicated in the X public area E2 and the Y public area F2 at the time tf of the lower task V1 one cycle before, the global variable e in the upper reference process , F are ensured (N712).

第7実施形態では、第5実施形態等と同様に、上位参照処理における複数のデータの同時性を確保することができる。
また、下位タスクV1の実行後に最初に発生する上位タスクS1’による上位参照処理において、第5実施形態では、下位タスク1周期分遅れたデータを参照する(図9(b)参照)のに対し、第7実施形態では、下位タスクVの完了時tfに複製処理を実行するため、常に最新のデータを参照することができる。
In the seventh embodiment, as in the fifth embodiment, the simultaneity of a plurality of data in the upper reference process can be ensured.
In the upper reference process by the upper task S1 ′ that occurs first after the execution of the lower task V1, in the fifth embodiment, data delayed by one cycle of the lower task is referred to (see FIG. 9B). In the seventh embodiment, since the duplication process is executed at the time tf when the lower task V is completed, the latest data can always be referred to.

(第8実施形態)
本発明の第8実施形態による処理を図12に基づいて説明する。第8実施形態は、第2のケースで、複数の上位タスク毎に複数の公開領域を割り当て、複製処理において、それぞれの上位タスクで使用されるグローバル変数を作業領域から公開領域へ複製する。さらに、それぞれの公開領域への複製処理のタイミングを、下位タスクの開始時と下位タスクの完了時とに分ける。
(Eighth embodiment)
Processing according to the eighth embodiment of the present invention will be described with reference to FIG. In the second case, in the second case, a plurality of public areas are assigned to a plurality of upper tasks, and in the duplication process, global variables used in the respective upper tasks are duplicated from the work area to the public area. Furthermore, the timing of the replication processing to each public area is divided into the time when the lower task is started and the time when the lower task is completed.

図12(a)は、第8実施形態に対する比較例として、複数の上位タスクが1つの公開領域を共用する場合を示す。下位タスクVは作業領域E1のグローバル変数eを更新する。2つの上位タスクS、Tは、上位タスクSが上位タスクTに先行して同周期で実行され、いずれも公開領域E2のグローバル変数eを参照する。また、下位タスクVの開始時tiに、作業領域E1から公開領域E2へグローバル変数eが複製される。   FIG. 12A shows a case where a plurality of higher-level tasks share one public area as a comparative example with respect to the eighth embodiment. The lower task V updates the global variable e in the work area E1. The two upper tasks S and T are executed in the same cycle as the upper task S preceding the upper task T, and both refer to the global variable e in the public area E2. Further, at the start time ti of the lower task V, the global variable e is copied from the work area E1 to the public area E2.

この場合、上位タスクS1および上位タスクT1は、いずれも、下位タスクV1の開始時tiに複製されたグローバル変数eを参照するため、同時性に関する問題はない。ただし、下位タスクV1の実行中にグローバル変数eが更新され、上位タスクT1が下位タスクV1の終了後に発生する場合には、上位タスクT1は、常に1周期遅れたデータを参照することとなる(N801)。   In this case, since the upper task S1 and the upper task T1 both refer to the global variable e that is copied at the start time ti of the lower task V1, there is no problem regarding simultaneity. However, if the global variable e is updated during execution of the lower task V1 and the upper task T1 occurs after the lower task V1 ends, the upper task T1 always refers to data delayed by one cycle ( N801).

図12(b)は、第8実施形態により、上位タスクS、TにそれぞれS用公開領域E2、T用公開領域E3を割り当てる場合を示す。下位タスクVの開始時tiに作業領域E1からS用公開領域E2への複製処理を行い、下位タスクVの完了時tfに作業領域E1からT用公開領域A3への複製処理を行う。
したがって、下位タスクV1の終了後に発生する上位タスクT1は、下位タスクV1の実行中に更新された最新のグローバル変数eを参照することができる(N811)。
FIG. 12B shows a case where the S public area E2 and the T public area E3 are allocated to the upper tasks S and T, respectively, according to the eighth embodiment. The duplication processing from the work area E1 to the S public area E2 is performed at the time ti when the lower task V is started, and the duplication processing from the work area E1 to the T public area A3 is performed at the time tf when the lower task V is completed.
Accordingly, the upper task T1 generated after the lower task V1 ends can refer to the latest global variable e updated during the execution of the lower task V1 (N811).

第5実施形態の効果で説明したように、下位タスクVの開始時tiに複製処理を実行する場合にはロバスト性が向上し、また、第7実施形態の効果で説明したように、下位タスクVの完了時tfに複製処理を実行する場合には最新のデータを参照することができる。したがって、上位タスクの特性に応じて、「常に一定のタイミングで更新されるデータを要求するタスク」を上位タスクSとし、「常に最新のデータを要求するタスク」を上位タスクTとすることで、両方のタスクの要求を共に満たすことができる。   As described in the effect of the fifth embodiment, the robustness is improved when the replication process is executed at the start time ti of the lower task V, and as described in the effect of the seventh embodiment, the lower task When the replication process is executed at the time of completion of V, the latest data can be referred to. Therefore, according to the characteristics of the upper task, the “task that always requests data updated at a constant timing” is the upper task S, and the “task that always requests the latest data” is the upper task T. The requirements of both tasks can be met together.

(その他の実施形態)
(ア)上記の第1、2、3、5、6、7実施形態では、下位タスクが2つのサブタスクX、Yを含む場合を例示するが、下位タスクのサブタスクは3つ以上であってもよい。
(イ)上記の第4実施形態では、3つの下位タスクU、V、Wを例示する。また、上記の第8実施形態では、2つの上位タスクS、Tを例示する。これら複数の下位タスク、上位タスクの数はこれに限らない。
(Other embodiments)
(A) In the first, second, third, fifth, sixth, and seventh embodiments described above, the lower task includes two subtasks X and Y. However, even if the lower task has three or more subtasks, Good.
(A) In the fourth embodiment, three subordinate tasks U, V, and W are illustrated. In the eighth embodiment, two upper tasks S and T are illustrated. The number of the plurality of lower tasks and upper tasks is not limited to this.

(ウ)上記の第1、第5実施形態等では、下位タスクVの開始時tiに複製処理を実行する。この複製タイミングは、開始時tiに限らず、下位タスクVの実行中最初にグローバル変数を参照または更新するサブタスクXの開始前であればよい。
また、上記の第3、第7実施形態等では、下位タスクVの完了時tfに複製処理を実行する。この複製タイミングは、完了時tfに限らず、下位タスクVの実行中最後にグローバル変数を参照または更新するサブタスクYの完了後であればよい。
(C) In the first and fifth embodiments described above, the duplication process is executed at the start time ti of the lower task V. This duplication timing is not limited to the start time ti, but may be any time before the start of the subtask X that references or updates the global variable first during the execution of the lower task V.
In the third and seventh embodiments, the duplication process is executed at the time tf when the lower task V is completed. This duplication timing is not limited to the completion time tf, but may be any time after completion of the subtask Y that refers to or updates the global variable at the end of execution of the lower-level task V.

(エ)本発明の情報処理装置は、電動パワーステアリング装置の他、例えば、VGRS(ギア比可変ステアリング)、ARS(アクティブリアステアリング)等、様々な用途に適用することができる。
以上、本発明はこのような実施形態に限定されるものではなく、発明の趣旨を逸脱しない範囲において、種々の形態で実施することができる。
(D) The information processing apparatus of the present invention can be applied to various uses such as VGRS (variable gear ratio steering) and ARS (active rear steering) in addition to the electric power steering apparatus.
As mentioned above, this invention is not limited to such embodiment, In the range which does not deviate from the meaning of invention, it can implement with a various form.

1 ・・・電動パワーステアリング装置、
10 ・・・ECU(情報処理装置)、
11 ・・・マイコン、
12 ・・・CPU、
S、T ・・・上位タスク、
U、V、W ・・・下位タスク、
X、Y ・・・サブタスク、
C1、D1 ・・・(第1のケースの)作業領域、
C2、C3、C4、D2・・・(第1のケースの)公開領域、
c、d ・・・(第1のケースの)グローバル変数、
E1、F1 ・・・(第2のケースの)作業領域、
E2、E3、F2・・・(第2のケースの)公開領域、
e、f ・・・(第2のケースの)グローバル変数、
Pint ・・・割り込み禁止期間。
1 ... Electric power steering device,
10: ECU (information processing device),
11: Microcomputer,
12 ... CPU,
S, T ... upper task,
U, V, W ... subordinate tasks,
X, Y ... subtasks,
C1, D1 ... work area (in the first case),
C2, C3, C4, D2 ... open area (in the first case),
c, d ... global variables (in the first case),
E1, F1 ... work area (in the second case),
E2, E3, F2 ... public area (in the second case),
e, f ... global variables (in the second case),
Pint ... Interrupt disable period.

Claims (12)

処理プログラムの実行単位となる複数のタスクを当該複数のタスク毎に設定される優先度に基づき実行することによって一連の機能を実現する情報処理装置であって、
前記優先度が相対的に高い上位タスクと前記優先度が相対的に低い下位タスクとの間で共通に使用されるグローバル変数を記憶する2つの記憶領域を設定し、
前記下位タスクによる前記グローバル変数の参照途中で前記上位タスクによって前記グローバル変数が更新される可能性のある第1のケースにおいて、
前記上位タスクは、前記2つの記憶領域の一方である作業領域を使用して前記グローバル変数を更新する上位更新処理を実行し、
前記下位タスクは、前記2つの記憶領域の他方である公開領域を使用して前記グローバル変数を参照する下位参照処理を実行し、
前記下位タスク中の前記下位参照処理の実行時を除く所定の時期に、前記作業領域から前記公開領域へ前記グローバル変数を複製する複製処理を実行することを特徴とする情報処理装置。
An information processing apparatus that realizes a series of functions by executing a plurality of tasks as execution units of a processing program based on a priority set for each of the plurality of tasks,
Two storage areas for storing global variables that are used in common between the upper task having a relatively high priority and the lower task having a relatively low priority are set,
In a first case where the global variable may be updated by the upper task in the middle of referring to the global variable by the lower task,
The upper task executes an upper update process for updating the global variable using a work area that is one of the two storage areas,
The lower task executes a lower reference process that refers to the global variable using a public area that is the other of the two storage areas,
An information processing apparatus that executes a duplication process for duplicating the global variable from the work area to the public area at a predetermined time except when the lower-level reference process in the lower-level task is executed.
請求項1に記載の情報処理装置において、
前記上位更新処理が前記複製処理の実行中に実行されることを禁止する割り込み禁止処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to claim 1,
An information processing apparatus that executes an interrupt prohibition process that prohibits the upper update process from being executed during the execution of the replication process.
請求項2に記載の情報処理装置において、
前記下位タスクに含まれる複数の前記下位参照処理で参照される複数の前記グローバル変数について共通の前記割り込み禁止処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to claim 2,
An information processing apparatus that executes the common interrupt prohibition process for a plurality of the global variables referred to in a plurality of the lower reference processes included in the lower task.
請求項1〜3のいずれか一項に記載の情報処理装置において、
前記下位タスク中の前記下位参照処理を開始する前に前記複製処理を実行することを特徴とする情報処理装置。
In the information processing apparatus according to any one of claims 1 to 3,
An information processing apparatus that executes the duplication process before starting the lower-level reference process in the lower-level task.
請求項1〜3のいずれか一項に記載の情報処理装置において、
前記下位タスク中の前記下位参照処理が完了した後に前記複製処理を実行することを特徴とする情報処理装置。
In the information processing apparatus according to any one of claims 1 to 3,
An information processing apparatus, wherein the duplication process is executed after the lower reference process in the lower task is completed.
請求項1〜5のいずれか一項に記載の情報処理装置において、
複数の前記下位タスク毎に複数の前記公開領域を割り当て、
前記複製処理において、それぞれの前記下位タスクで使用される前記グローバル変数を前記作業領域から複数の前記公開領域へ複製することを特徴とする情報処理装置。
In the information processing apparatus according to any one of claims 1 to 5,
Assigning a plurality of the public areas to a plurality of the subordinate tasks,
In the duplication processing, the global variable used in each of the lower tasks is duplicated from the work area to a plurality of public areas.
処理プログラムの実行単位となる複数のタスクを当該複数のタスク毎に設定される優先度に基づき実行することによって一連の機能を実現する情報処理装置であって、
前記優先度が相対的に高い上位タスクと前記優先度が相対的に低い下位タスクとの間で共通に使用されるグローバル変数を記憶する2つの記憶領域を設定し、
前記下位タスクによる前記グローバル変数の更新途中で前記上位タスクによって前記グローバル変数が参照される可能性のある第2のケースにおいて、
前記下位タスクは、前記2つの記憶領域の一方である作業領域を使用して前記グローバル変数を更新する下位更新処理を実行し、
前記上位タスクは、前記2つの記憶領域の他方である公開領域を使用して前記グローバル変数を参照する上位参照処理を実行し、
前記下位タスク中の前記下位更新処理の実行時を除く所定の時期に、前記作業領域から前記公開領域へ前記グローバル変数を複製する複製処理を実行することを特徴とする情報処理装置。
An information processing apparatus that realizes a series of functions by executing a plurality of tasks as execution units of a processing program based on a priority set for each of the plurality of tasks,
Two storage areas for storing global variables that are used in common between the upper task having a relatively high priority and the lower task having a relatively low priority are set,
In a second case in which the global variable may be referred to by the upper task during the update of the global variable by the lower task,
The lower task executes a lower update process for updating the global variable using a work area that is one of the two storage areas,
The upper task executes an upper reference process that refers to the global variable using a public area that is the other of the two storage areas,
An information processing apparatus that executes a duplication process for duplicating the global variable from the work area to the public area at a predetermined time excluding the execution time of the lower update process in the lower task.
請求項7に記載の情報処理装置において、
前記上位参照処理が前記複製処理の実行中に実行されることを禁止する割り込み禁止処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to claim 7,
An information processing apparatus that executes an interrupt prohibition process that prohibits the upper reference process from being executed during execution of the replication process.
請求項8に記載の情報処理装置において、
前記下位タスクに含まれる複数の前記下位更新処理で更新される複数の前記グローバル変数について共通の前記割り込み禁止処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to claim 8,
An information processing apparatus that executes the common interrupt prohibition process for a plurality of the global variables updated by a plurality of the lower update processes included in the lower task.
請求項7〜9のいずれか一項に記載の情報処理装置において、
前記下位タスク中の前記下位更新処理を開始する前に前記複製処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to any one of claims 7 to 9,
An information processing apparatus that executes the duplication process before starting the lower-level update process in the lower-level task.
請求項7〜9のいずれか一項に記載の情報処理装置において、
前記下位タスク中の前記下位更新処理が完了した後に前記複製処理を実行することを特徴とする情報処理装置。
The information processing apparatus according to any one of claims 7 to 9,
An information processing apparatus that executes the duplication process after the lower update process in the lower task is completed.
請求項7〜11のいずれか一項に記載の情報処理装置において、
複数の前記上位タスク毎に複数の前記公開領域を割り当て、
前記複製処理において、それぞれの前記上位タスクで使用される前記グローバル変数を前記作業領域から複数の前記公開領域へ複製することを特徴とする情報処理装置。
The information processing apparatus according to any one of claims 7 to 11,
Assigning a plurality of public areas to each of the plurality of upper tasks,
In the duplication processing, the global variable used in each upper task is duplicated from the work area to a plurality of public areas.
JP2010254749A 2010-11-15 2010-11-15 Information processing device Expired - Fee Related JP5798314B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2010254749A JP5798314B2 (en) 2010-11-15 2010-11-15 Information processing device
DE201110055205 DE102011055205A1 (en) 2010-11-15 2011-11-10 Electronic control unit for use in electrical servo steering device of steering wheel system of vehicle, has microcomputer comprising CPU for storing global variable, where task of low order executes duplication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010254749A JP5798314B2 (en) 2010-11-15 2010-11-15 Information processing device

Publications (2)

Publication Number Publication Date
JP2012108582A true JP2012108582A (en) 2012-06-07
JP5798314B2 JP5798314B2 (en) 2015-10-21

Family

ID=45999055

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010254749A Expired - Fee Related JP5798314B2 (en) 2010-11-15 2010-11-15 Information processing device

Country Status (2)

Country Link
JP (1) JP5798314B2 (en)
DE (1) DE102011055205A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180012600A (en) * 2016-07-27 2018-02-06 엘에스산전 주식회사 Apparatus for monitoring and controlling

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59206972A (en) * 1983-05-10 1984-11-22 Toshiba Corp Shared memory
JPH06149751A (en) * 1992-11-10 1994-05-31 Seiko Epson Corp Shared data updating device
JP2002149421A (en) * 2000-11-15 2002-05-24 Denso Corp Information processor
JP2002157131A (en) * 2000-11-20 2002-05-31 Denso Corp Information processor
JP2002189704A (en) * 2000-12-22 2002-07-05 Yaskawa Electric Corp Shared memory with block transfer function

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59206972A (en) * 1983-05-10 1984-11-22 Toshiba Corp Shared memory
JPH06149751A (en) * 1992-11-10 1994-05-31 Seiko Epson Corp Shared data updating device
JP2002149421A (en) * 2000-11-15 2002-05-24 Denso Corp Information processor
JP2002157131A (en) * 2000-11-20 2002-05-31 Denso Corp Information processor
JP2002189704A (en) * 2000-12-22 2002-07-05 Yaskawa Electric Corp Shared memory with block transfer function

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180012600A (en) * 2016-07-27 2018-02-06 엘에스산전 주식회사 Apparatus for monitoring and controlling
KR102492399B1 (en) * 2016-07-27 2023-01-26 엘에스일렉트릭(주) Apparatus for monitoring and controlling

Also Published As

Publication number Publication date
DE102011055205A1 (en) 2012-05-16
JP5798314B2 (en) 2015-10-21

Similar Documents

Publication Publication Date Title
DE69627807T2 (en) Data processor for simultaneous data loading and execution of a multiply-add operation
EP3077912B1 (en) Control device for a motor vehicle
JP2009274569A (en) Vehicle controlling device
JP5798314B2 (en) Information processing device
JP2005050208A (en) Memory managing system in multi-task system and task controller
JP4960344B2 (en) Switching method and device in storage device of control device
CN103003763B (en) The computer installation of the access coordination of internal storage and operation method
JP7271973B2 (en) VEHICLE CONTROL DEVICE AND OPERATING CLOCK SWITCHING METHOD
JP2008090455A (en) Multiprocessor signal processor
JP4596488B2 (en) Method, drive system, and computing device for processing computer program
WO2020230586A1 (en) Hypervisor and control device
DE102011006283A1 (en) Systems and methods to control many peripheral devices with a single peripheral application code
JP6183251B2 (en) Electronic control unit
JP2004046857A (en) Method for controlling progress of multi-tasking possible computer program, and controller
JP6623191B2 (en) In-vehicle control device
JP2007241570A (en) Setting system of shared memory for communication between programmable controller
JP5561294B2 (en) Microcomputer
JP2019212032A (en) Electronic control device with multi-core microcomputer
JP5703860B2 (en) Fault tolerant system, memory control method, and program
JP2015060551A (en) Cache memory control device
JP2012079193A (en) Electronic controller, motor drive device using the same, and control method of electronic controller
JPH03102530A (en) Control method for interruption processing
EP1915674B1 (en) Method and device for controlling a computer system comprising at least two execution units and at least two groups of internal states
JP5194360B2 (en) Information processing apparatus and control method thereof
JP2024062067A (en) Virtualization control device and virtualization control method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120223

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130716

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130726

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130902

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140401

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140626

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20140703

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20140828

A912 Re-examination (zenchi) completed and case transferred to appeal board

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20140905

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150623

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150821

R151 Written notification of patent or utility model registration

Ref document number: 5798314

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

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees