JP2019003415A - Information processing device, information processing method, and information processing program - Google Patents
Information processing device, information processing method, and information processing program Download PDFInfo
- Publication number
- JP2019003415A JP2019003415A JP2017117703A JP2017117703A JP2019003415A JP 2019003415 A JP2019003415 A JP 2019003415A JP 2017117703 A JP2017117703 A JP 2017117703A JP 2017117703 A JP2017117703 A JP 2017117703A JP 2019003415 A JP2019003415 A JP 2019003415A
- Authority
- JP
- Japan
- Prior art keywords
- task
- counter
- execution
- value
- processor
- 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
Links
Images
Abstract
Description
本発明は、スピンロックによる排他制御を行う情報処理装置、情報処理方法および情報処理プログラムに関する。 The present invention relates to an information processing apparatus, an information processing method, and an information processing program that perform exclusive control by spin lock.
ソフトウェアにおける最小の実行単位であるタスクと、そのタスクの実行中に発生する割り込みとの間の排他制御の方式として、一般に、スピンロック(Spinlock)が用いられる。スピンロックでは、1つの資源に対して1つのロック変数がメモリに用意される(スピンロック初期化)。そして、タスクを実行するCPU(Central Processing Unit)またはCPUコアのうち、ロック変数を取得(スピンロック取得)できたCPUまたはCPUコアのみが、資源にアクセス可能となる。 As a method of exclusive control between a task, which is the minimum execution unit in software, and an interrupt that occurs during the execution of the task, a spin lock (Spinlock) is generally used. In the spin lock, one lock variable is prepared in the memory for one resource (spin lock initialization). Of the CPU (Central Processing Unit) or CPU core that executes the task, only the CPU or CPU core that can acquire the lock variable (acquire spin lock) can access the resource.
CPUまたはCPUコアは、資源へのアクセスが完了した際にロック変数を解放する(スピンロック解放)。これにより、他のCPUまたはCPUコアが、資源にアクセス可能となる。CPUまたはCPUコアは、他のCPUまたはCPUコアが資源にアクセスしている場合、ロック変数を取得できるまでループしながらその資源が解放されるのを待ち続ける。なお、以降の説明では、ロック変数の取得または解放を、それぞれスピンロックの取得または解放とも表記する。 The CPU or CPU core releases the lock variable when the access to the resource is completed (spin lock release). As a result, other CPUs or CPU cores can access the resources. If another CPU or CPU core is accessing the resource, the CPU or CPU core keeps waiting until the resource is released while looping until the lock variable can be acquired. In the following description, acquisition or release of a lock variable is also expressed as acquisition or release of a spin lock, respectively.
図15は、関数A、Bの処理について説明する図である。図15に示すように、関数A、Bにおいて、それぞれ処理A、Bは、排他が必要な処理であるため、その処理A、Bの前後に、それぞれスピンロックの取得と解放が行われる。 FIG. 15 is a diagram for explaining the processing of the functions A and B. As shown in FIG. 15, in the functions A and B, since the processes A and B are processes that need to be excluded, the spin lock is acquired and released before and after the processes A and B, respectively.
図16は、関数A、Bの処理の実行について説明する図である。図16において、矢印tで示す方向は、各関数の実行中の時間経過を示す。関数Aの実行中に関数Bが実行された場合、関数Bにおけるスピンロックの取得は、関数Aにおいて取得されたスピンロックが解放されるまでの間、ループしながら待機される。よって、同じスピンロックを取得する処理が、同時に複数実行されることはない。また、スピンロックを取得して処理を実行しているCPUまたはCPUコアでは、他のタスクや割り込みは実行されない。 FIG. 16 is a diagram for explaining the execution of the functions A and B. In FIG. 16, the direction indicated by the arrow t indicates the passage of time during the execution of each function. When the function B is executed during the execution of the function A, the acquisition of the spin lock in the function B waits while looping until the spin lock acquired in the function A is released. Therefore, a plurality of processes for acquiring the same spin lock are not executed simultaneously. In addition, other tasks and interrupts are not executed in the CPU or CPU core that is executing processing by acquiring the spin lock.
ここで、特許文献1には、共有リソースに対する排他制御を確実に実行しながら、排他制御によるマイクロコントローラの処理負荷を低減し、処理性能を効率的に利用できる電子制御装置が開示されている。
Here,
図17は、あるソフトウェアに含まれるタスク1の実行中にデッドロックが発生する例について説明する図である。タスク1には、関数A、Bが含まれる。関数Aでは、スピンロックが取得された後、関数Bの呼び出しが行われる。関数Bの呼び出しが行われると、関数Bでは、スピンロックを取得する処理が実行される。このとき、関数Aによってスピンロックは取得されているので、タスク1内で、同じスピンロックを多重に取得する処理が発生し、デッドロックによりソフトウェアの実行が停止する。このように、あるタスク内で発生するデッドロックを、自己デッドロックとも称する。
FIG. 17 is a diagram illustrating an example in which a deadlock occurs during execution of
ソフトウェアの構造の変更により、関数のコールツリーが変わると、上述のように、同じスピンロックを多重に取得する処理の発生により、デッドロックが発生し、ソフトウェアの実行が停止するおそれがあるという課題がある。 If the function call tree changes due to a change in the structure of the software, as described above, a deadlock may occur due to the occurrence of processing to acquire the same spin lock multiple times, and there is a possibility that execution of the software may stop There is.
特許文献1には、演算処理の実行順序を変更することにより排他制御に関わる処理時間を短くすることは開示されているが、不要な排他制御によるデッドロックの発生を防ぐ技術は開示されていない。
本発明は、上記課題を鑑みてなされたものであり、タスク実行中の不要な排他制御によるデッドロックの発生を防ぐことができる情報処理装置等を提供することを主要な目的とする。 The present invention has been made in view of the above problems, and has as its main object to provide an information processing apparatus and the like that can prevent the occurrence of deadlock due to unnecessary exclusive control during task execution.
本発明の一態様に係る情報処理装置は、タスクの実行中にアクセスする資源を排他するために作成されるロック情報ごとに、前記タスクを実行可能なプロセッサにそれぞれ対応するカウンタを作成し、当該カウンタの値を初期化する初期化手段と、前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する実行手段とを備える。 The information processing apparatus according to an aspect of the present invention creates a counter corresponding to each processor capable of executing the task for each lock information created to exclude resources accessed during the execution of the task, In the execution of the initialization unit that initializes the value of the counter and the processing dedicated to the resource in the task, when the value of the counter of the processor assigned to the execution of the task is an initial value, the lock information And the process is executed by counting up the counter value of the processor. If the counter value of the processor is not the initial value, the counter value of the processor is counted up without acquiring the lock information. And executing means for executing the processing.
本発明の一態様に係る情報処理方法は、タスクの実行中にアクセスする資源を排他するために作成されるロック情報ごとに、前記タスクを実行可能なプロセッサにそれぞれ対応するカウンタを作成し、当該カウンタの値を初期化し、前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する。 An information processing method according to an aspect of the present invention creates a counter corresponding to each processor capable of executing a task for each lock information created to exclude resources accessed during the execution of the task, When the counter value of the processor assigned to execute the task is an initial value in the execution of the process dedicated to the resource in the task, the counter value is acquired and the lock information is acquired. The processor counter is incremented to execute the process. When the processor counter is not the initial value, the processor counter is incremented without acquiring the lock information. Run.
本発明の一態様に係る情報処理プログラムは、タスクの実行中にアクセスする資源を排他するために作成されるロック情報ごとに、前記タスクを実行可能なプロセッサにそれぞれ対応するカウンタを作成し、当該カウンタの値を初期化する処理と、前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する処理とを、コンピュータに実行させる。 An information processing program according to an aspect of the present invention creates a counter corresponding to each processor capable of executing the task for each lock information created to exclude resources accessed during execution of the task, The lock information is acquired when the counter value of the processor to which the execution of the task is assigned is the initial value in the process of initializing the value of the counter and the process dedicated to the resource in the task. At the same time, the value of the counter of the processor is counted up and the process is executed. If the value of the counter of the processor is not the initial value, the value of the counter of the processor is counted up without acquiring the lock information. The computer executes the process for executing the process.
本発明によれば、タスク実行中の不要な排他制御によるデッドロックの発生を防ぐことができるという効果が得られる。 According to the present invention, it is possible to prevent the occurrence of deadlock due to unnecessary exclusive control during task execution.
以下、本発明の実施形態について図面を参照して詳細に説明する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
第1の実施形態
図1は、本発明の第1の実施形態に係る情報処理装置100の構成を示す図である。図1に示すように、情報処理装置100は、初期化部110および実行部120を備える。
First Embodiment FIG. 1 is a diagram showing a configuration of an
初期化部110は、タスクの実行中にアクセスする資源を排他するために作成されるロック情報ごとに、タスクを実行可能なプロセッサ(コア)にそれぞれ対応するカウンタを作成し、そのカウンタの値を初期化する。
The
実行部120は、タスクにおける資源を専有する処理の実行において、そのタスクの実行を割り当てられているプロセッサのカウンタの値が初期値である場合、ロック情報を取得すると共にプロセッサのカウンタの値をカウントアップして処理を実行し、プロセッサのカウンタの値が初期値でない場合、ロック情報を取得せずにプロセッサのカウンタの値をカウントアップして処理を実行する。
The
なお、初期化部110および実行部120は、それぞれ一例として、以降の実施形態において説明するスピンロック初期化部220およびタスク実行部230により実現される。
Note that the
上記構成を採用することにより、本第1の実施形態によれば、タスク実行中にそのタスク内でロック情報を取得している場合は、多重にロック情報を取得することなく処理を実行できるので、タスク実行中の不要な排他制御によるデッドロックの発生を防ぐことができるという効果が得られる。 By adopting the above configuration, according to the first embodiment, when lock information is acquired in a task during task execution, processing can be executed without acquiring multiple lock information. Thus, it is possible to prevent the occurrence of deadlock due to unnecessary exclusive control during task execution.
第2の実施形態
図2は、本発明の第2の実施形態に係る情報処理装置200の構成を模式的に示す図である。図2に示すように、情報処理装置200は、CPU501を備える。CPU501は、番号1乃至Nの複数のプロセッサ(以降、「コア」とも称する)が動作するマルチコア構成を有する。
Second Embodiment FIG. 2 is a diagram schematically showing a configuration of an
ソフトウェア520は、ユーザ等により作成されたソフトウェアであるとする。OS(Operating System)530は、情報処理装置200の動作を制御する。ソフトウェア520およびOS530は、例えば後述する情報処理装置200の記憶装置等に格納されていてもよい。ソフトウェア520は、OS530上で、番号1乃至Nのコア(以降、「コア1乃至コアN」とも称する)を含むCPU501により実行される。
The
図3は、図2に示した情報処理装置200の構成を機能単位に示す機能ブロック図である。図3に示すように、情報処理装置200は、スピンロック初期化部220、タスク実行部230およびカウンタ記憶部240を備える。
FIG. 3 is a functional block diagram showing the configuration of the
タスク実行部230は、スピンロック取得部231、処理部232、スピンロック解放部233およびコア番号記憶部234を備える。タスク実行部230は、ソフトウェア520に含まれるプログラムの最小の実行単位であるタスクを実行する機能を有する。
The
図4は、本実施形態および他の実施形態に示す情報処理装置を実現するコンピュータ装置500のハードウェア構成の一例を示す図である。情報処理装置の各構成要素は、例えば図4に示すようなコンピュータ装置500とソフトウェアとの任意の組み合わせにより実現することができる。
FIG. 4 is a diagram illustrating an example of a hardware configuration of a
図4に示すように、コンピュータ装置500は、CPU501、ROM(Read Only Memory)502、RAM(Random Access Memory)503、記憶装置505、ドライブ装置507、通信インタフェース508、入出力インタフェース510およびバス511を備える。
As shown in FIG. 4, the
記憶装置505は、プログラム504を格納する。プログラム504には、図2に示した、作成されたソフトウェア520や、OS530等が含まれる。ドライブ装置507は、記録媒体506の読み書きを行う。通信インタフェース508は、ネットワーク509と接続する。入出力インタフェース510は、データの入出力を行う。バス511は、各構成要素を接続する。
The
CPU501は、図2に示したように、マルチコア構成を有する。CPU501は、RAM503を用いてプログラム504を実行する。プログラム504は、ROM502に記憶されていてもよい。また、プログラム504は、記録媒体506に記録され、ドライブ装置507によって読み出されてもよいし、外部装置からネットワーク509を介して送信されてもよい。通信インタフェース508は、ネットワーク509を介して外部装置とデータをやり取りする。入出力インタフェース510は、周辺機器(キーボード、マウス、表示装置など)とデータをやり取りする。通信インタフェース508および入出力インタフェース510は、データを取得または出力する手段として機能することができる。出力情報などのデータは、記憶装置505に記憶されていてもよいし、プログラム504に含まれていてもよい。
As shown in FIG. 2, the
図2に示したソフトウェア520は、OS530上でCPU501により実行される際に、プログラムの最小の実行単位であるタスクを生成する。ソフトウェア520は、タスク生成時に、そのタスクで実行する関数と実行優先度を指定する。実行優先度は、例えば0以上の数字であり、数字が小さいほど優先度が高いように設定されてもよい。OS530は、作成されたタスクごとに、そのタスクを実行するコアを指定する。タスクは、OS530により指定されたコア1乃至コアNのいずれかにより実行される。
When the
図3に示したスピンロック初期化部220、およびタスク実行部230のスピンロック取得部231、処理部232およびスピンロック解放部233は、例えば、ソフトウェア520(プログラムコード)を、CPU501のコア1乃至コアNのいずれかが、情報処理装置200のRAM503に読み出して実行することにより、実現される。また、図3に示したカウンタ記憶部240、およびコア番号記憶部234は、例えばRAM503により実現されてもよい。
The spin
タスク実行部230は、OS530上で、スピンロックにより排他制御を行いながらタスクを実行する。
The
スピンロックによる排他制御では、タスク実行部230によるタスクの実行中にアクセスされる資源を排他するためのロック情報が作成される。資源を排他するためのロック情報を作成することを、スピンロックを作成(または初期化)する、とも称する。スピンロック(ロック情報)を取得できたコアのみが、資源にアクセスできる。
In exclusive control using spin lock, lock information for exclusive use of resources accessed during task execution by the
図5は、情報処理装置200におけるタスク実行部230のスピンロック初期化部220によるスピンロックの初期化処理を説明するフローチャートである。図5を参照して、スピンロック初期化部220によるスピンロックの初期化処理について説明する。なお、タスク実行中、OS530によりそのタスクの実行を割り当てられているコアの番号は、コア番号記憶部234に記憶されているとする。
FIG. 5 is a flowchart for explaining spin lock initialization processing by the spin
スピンロック初期化部220は、タスクで資源にアクセスする前に、スピンロックを初期化する(ステップS110)。
The spin
続いて、スピンロック初期化部220は、動作中のCPUのコアのそれぞれに対応するカウンタを作成し、それぞれを0で初期化して、カウンタ記憶部240に格納する(ステップS120)。カウンタは、0以上の整数を示す値を有する。図6は、スピンロック初期化部220により作成されたカウンタの例を示す図である。図6に示すように、例えば、スピンロック初期化部220は、RAM503のアドレス1乃至Nに、それぞれコア1乃至Nの初期値0のカウンタを作成する。
Subsequently, the spin
図7は、タスク実行部230のスピンロック取得部231によるスピンロック取得処理を説明するフローチャートである。
FIG. 7 is a flowchart for explaining spin lock acquisition processing by the spin
タスク実行部230は、タスク実行中に、ある資源を専有する処理(処理Eと称する)を実行する際、スピンロック取得部231において、図7に示すスピンロック取得処理を実行する。
The
スピンロック取得部231は、自タスクが動作中のコアの番号をコア番号記憶部234から取得する(ステップS210)。スピンロック取得部231は、カウンタ記憶部240に記憶される、取得した番号のコアのカウンタ値を判定する。
The spin
スピンロック取得部231は、カウンタ値が「0」(初期値)の場合(ステップS220においてYes)、スピンロックを取得する(ステップS230)。そして、スピンロック取得部231は、カウンタ記憶部240に記憶される、動作中のコアのカウンタ値に「1」を加算(カウントアップ)する(ステップS240)。
When the counter value is “0” (initial value) (Yes in Step S220), the spin
一方、スピンロック取得部231は、カウンタ値が「0」でない場合(ステップS220においてNo)、スピンロックを取得せずに、カウンタ記憶部240に記憶される、動作中のコアのカウンタ値に「1」を加算する。
On the other hand, when the counter value is not “0” (No in step S220), the spin
処理S220においてカウンタ値が「0」の場合、スピンロック取得部231がスピンロックを取得してカウンタ値に「1」を加算した後、処理部232は、処理Eを実行する。処理S220においてカウンタ値が0でない場合、すでに同じスピンロックが取得されているので、スピンロック取得部231はスピンロックの取得処理を行わずにカウンタ値に「1」を加算した後、処理部232は、処理Eを実行する。
When the counter value is “0” in the process S220, the spin
図8は、タスク実行部230のスピンロック解放部233によるスピンロック解放処理を説明するフローチャートである。図8を参照して、スピンロック解放部233によるスピンロック解放処理を説明する。
FIG. 8 is a flowchart for explaining spin lock release processing by the spin
処理部232による排他した資源へのアクセスが完了すると、スピンロック解放部233は、自タスクが動作中のコアの番号を、コア番号記憶部234から取得する(ステップS310)。
When the access to the exclusive resource by the
続いて、スピンロック解放部233は、取得した番号のコアのカウンタ値をカウンタ記憶部240から読み出し、判定する。カウンタ値が「0」の場合(ステップS320においてYes)、スピンロック解放部233は、処理を終了する。これは、スピンロック未取得時に、スピンロック解放処理が実行された場合を考慮した処理である。
Subsequently, the spin
カウンタ値が「0」でない場合(ステップS320においてNo)、スピンロック解放部233は、カウンタ記憶部240に記憶される、動作中のコアのカウンタ値から「1」を減算(カウントダウン)し(ステップS330)、再度、カウンタ値を判定する(ステップS340)。
When the counter value is not “0” (No in Step S320), the spin
カウンタ値が「0」である場合(ステップS340においてYes)、スピンロック解放部233は、スピンロックを解放する(ステップS350)。一方、カウンタ値が「0」でない場合は、スピンロック解放部233は、スピンロックの解放を行わない。その後、タスク実行部230によりタスクの実行が継続される。
When the counter value is “0” (Yes in Step S340), the spin
ここで、図9は、情報処理装置200において作成されるスピンロックとカウンタの構成を、模式的に示す図である。必要なスピンロックの数がM個(Mは整数)の場合、M個のスピンロックが、OS530により作成される。図9では、例えば、スピンロック1、スピンロックMは、それぞれ、資源1、資源2を排他するために作成されたスピンロックである。スピンロックが作成されるごとに、ソフトウェア520により、コア1乃至コアNにそれぞれ対応するカウンタが作成される。
[具体例]
上述した動作を、具体例を用いて説明する。図10は、タスクTにおける処理の流れを説明する図である。図10において矢印tで示す方向は、関数実行中の時間経過を示すとする。タスクTは、関数A、Bを含む。関数A、Bは、ともにアクセスする資源の排他制御が必要な処理を含む。
Here, FIG. 9 is a diagram schematically illustrating the configuration of the spin lock and the counter created in the
[Concrete example]
The operation described above will be described using a specific example. FIG. 10 is a diagram illustrating the flow of processing in task T. In FIG. 10, the direction indicated by the arrow t indicates the passage of time during function execution. The task T includes functions A and B. Functions A and B include processes that require exclusive control of resources that are accessed together.
関数Aにおいて、スピンロックが取得された後、関数Bの呼び出しが行われる。関数Bが呼び出されると、関数Bにおいても、再度スピンロックの取得が行われる。このため、図10の流れの場合、関数Bにおけるスピンロック取得時に自己デッドロックが発生する。しかし、関数Bにおけるスピンロック取得は、関数Aでスピンロックを取得中に実行されるので、関数Bにおけるスピンロックの取得と解放は、不要な処理であると考えられる。 In the function A, after the spin lock is acquired, the function B is called. When the function B is called, the spin lock is again acquired in the function B. For this reason, in the case of the flow of FIG. 10, a self deadlock occurs when the spin lock in the function B is acquired. However, since the spin lock acquisition in the function B is executed while the spin lock is acquired in the function A, the acquisition and release of the spin lock in the function B is considered to be an unnecessary process.
そこで、本実施形態では、上記のように不要と考えられるスピンロックの取得処理と解放処理を行わないように、以下に示すように、スピンロックの初期化、取得および解放の各処理を行うことを説明する。 Therefore, in the present embodiment, the spin lock initialization, acquisition, and release processes are performed as described below so that the spin lock acquisition process and the release process that are considered unnecessary as described above are not performed. Will be explained.
ここでは、図10に示すタスクTが、コア1乃至コアNのうち、コア1において実行される例について説明する。このとき、情報処理装置200のコア番号記憶部234には、タスクTの実行を割り当てられたコアの番号として「1」が記憶されているとする。
Here, an example in which the task T illustrated in FIG. 10 is executed in the
また、タスクTの実行前に、図5に示したように、スピンロック初期化部220により、スピンロックの初期化と、コア1乃至コアNの各カウンタの作成が行われているとする。図11は、図10に示す関数Aにおけるスピンロック取得処理の実行前と実行後の、コア1乃至コアNの各カウンタの値を例示する図である。関数Aにおけるスピンロック取得処理の実行前は、コア1を含むすべてのコアのカウンタ値は「0」である。これらのカウンタが、情報処理装置200のカウンタ記憶部240に記憶されているとする。
Further, it is assumed that before the task T is executed, as shown in FIG. 5, the spin
タスクTにおける関数Aの実行にあたり、スピンロック取得部231は、アクセスする資源を排他するため、図7に示すスピンロック取得処理を実行する。すなわち、処理S210に示すように、スピンロック取得部231は、タスクTが動作中のコアの番号を取得する。ここでは、スピンロック取得部231は、「1」を取得する。
In executing the function A in the task T, the spin
続いて、処理S210に示すように、スピンロック取得部231は、カウンタ記憶部240に記憶される、コア1のカウンタ値を判定すると、コア1のカウンタ値は「0」である。したがって、スピンロック取得部231は、処理S230に示すようにスピンロックを取得すると共に、コア1のカウンタ値に「1」を加算する。これにより、図11に示すように、関数Aのスピンロック取得処理実行後のコア1のカウンタ値は、「1」となる。
Subsequently, as illustrated in process S <b> 210, when the spin
スピンロック取得後、図10に示すように、関数Aでは、関数Bの呼び出しが行われる。図12は、関数Bにおけるスピンロック取得処理の実行前と実行後の、コア1乃至コアNの各カウンタの値を例示する図である。図12に示すように、関数Bのスピンロック取得処理の実行前のコア1のカウンタ値は「1」である。この状態で、関数Bが実行されると、スピンロック取得部231は、図7に示すスピンロック取得処理を実行する。
After the spin lock is acquired, the function A is called in the function A as shown in FIG. FIG. 12 is a diagram illustrating the values of the counters of the
処理S210で取得されるコアの番号は「1」であり、このときのコア1のカウンタ値は、図12に示すように「1」である。したがって、処理S220においてカウンタ値は0でないので、スピンロック取得部231は、スピンロックの取得は行わず、カウンタに「1」を加算する。これにより、コア1のカウンタ値は、「2」になる。このように、関数Aにより取得されているスピンロックと同じスピンロックの取得処理を、関数Bでは行われないので、自己デッドロックは発生しない。
The core number acquired in step S210 is “1”, and the counter value of the
関数Bでは、スピンロックの取得は行わずに、処理Bが処理部232により実行される。処理Bにおいて、資源へのアクセスが完了すると、スピンロック解放部233は、図8に示すスピンロック解放処理を実行する。図13は、図10に示す関数Bにおけるスピンロック解放処理の実行前と実行後の、コア1乃至コアNの各カウンタの値を例示する図である。図13に示すように、関数Bのスピンロック解放処理の実行前のコア1のカウンタ値は「2」である。
In the function B, the process B is executed by the
処理S310で取得されるコアの番号は「1」であり、このときのコア1のカウンタ値は、図13に示すように「2」である。したがって、処理S320においてカウンタ値は「0」でないので、スピンロック解放部233は、処理S330に示すように、動作中のコアのカウンタ値から「1」を減算する。これにより、コア1のカウンタ値は、「1」になる。
The core number acquired in step S310 is “1”, and the counter value of the
処理S340においても、コア1のカウンタ値は「0」ではないので、スピンロック解放部233は、スピンロックの解放を行わない。
Also in the process S340, since the counter value of the
続いて、図10に示すタスクTでは、関数Aの実行に戻り、関数Aにおける処理Aが処理部232により実行される。その後、スピンロック解放部233は、スピンロック解放処理を実行する。
Subsequently, in the task T illustrated in FIG. 10, the process A is returned to the execution of the function A, and the processing A in the function A is executed by the
図14は、図10に示す関数Aにおけるスピンロック解放処理の実行前と実行後の、コア1乃至コアNの各カウンタの値を例示する図である。図14に示すように、関数Aのスピンロック解放処理の実行前のコア1のカウンタ値は「1」である。
FIG. 14 is a diagram illustrating the values of the counters of the
処理S310で取得されるコアの番号は「1」であり、このときのコア1のカウンタ値は、図14に示すように「1」である。したがって、処理S320においてカウンタ値は「0」でないので、スピンロック解放部233は、処理S330に示すように、動作中のコアのカウンタ値から「1」を減算する。これにより、コア1のカウンタ値は、「0」になる。よって、処理S350に示すように、スピンロック解放部233は、スピンロックを解放する。
The core number acquired in step S310 is “1”, and the counter value of the
これにより、排他される資源にアクセスする処理が完了し、引き続いて、関数Aにおける処理が実行される。 Thereby, the process for accessing the exclusive resource is completed, and the process in the function A is subsequently executed.
以上のように、本第2の実施形態によれば、スピンロック初期化部220は、スピンロックの作成ごとに、各コアに対応するカウンタを作成してその値を初期化する。タスク実行部230は、タスク実行中に、資源を専有する処理を実行する際、そのタスクが動作中のコアのカウンタの値が「0」でない場合、スピンロックを取得せずにカウンタの値をカウントアップして、上記処理を実行する。
As described above, according to the second embodiment, the spin
上記構成を採用することにより、本第2の実施形態によれば、カウンタの値が「0」でないとき、すなわち、タスクが動作しているコアで、すでにそのタスクにおいてスピンロックが取得されているときは、多重にスピンロックを取得することなく、処理を進める。これにより、タスク実行中の不要な排他制御によるデッドロックの発生を防ぐことができるという効果が得られる。 By adopting the above configuration, according to the second embodiment, when the counter value is not “0”, that is, in the core where the task is operating, the spin lock has already been acquired in the task. In some cases, the process proceeds without acquiring multiple spin locks. As a result, it is possible to prevent the occurrence of deadlock due to unnecessary exclusive control during task execution.
また、上記デッドロックを防ぐことができるので、ソフトウェアの変更等により関数のコールツリーが変更されたとしても、排他制御の有無の再確認や修正が不要となるという効果が得られる。 In addition, since the deadlock can be prevented, even if the call tree of the function is changed due to a software change or the like, there is an effect that it is unnecessary to reconfirm or correct the presence or absence of exclusive control.
なお、スピンロックのカウンタをコアごとに用意しているので、異なるコアでスピンロックによる排他制御が必要な処理を実行する場合は、コアごとにスピンロックの取得が行われる。 Since a spin lock counter is prepared for each core, when a process that requires exclusive control by spin lock is executed in a different core, the spin lock is acquired for each core.
上記各実施形態における情報処理装置の実現方法には様々な変形例がある。例えば、情報処理装置は、複数の装置の組み合わせにより実現することができる。 There are various modifications to the method for realizing the information processing apparatus in each of the above embodiments. For example, the information processing apparatus can be realized by a combination of a plurality of apparatuses.
また、情報処理装置におけるスピンロック初期化部220、スピンロック取得部231、処理部232およびスピンロック解放部233は、上述したように、例えば、プログラム制御に従って処理を実行するCPU501によって実現されてもよい。
Further, as described above, the spin
また、これらの機能を実現するように動作させるプログラムを記録媒体506に記録させ、その記録媒体506に記録されたプログラムをコードとして読み出し、コンピュータにおいて実行する処理方法も各実施形態の範疇に含まれる。すなわち、コンピュータ読取可能な記録媒体506も各実施形態の範囲に含まれる。また、上述のプログラムが記録された記録媒体506はもちろん、そのプログラム自体も各実施形態に含まれる。
Also, the category of each embodiment includes a processing method in which a program for operating these functions is recorded in the
以上、上述した実施形態を参照して本発明を説明した。しかしながら、本発明は、上述した実施形態には限定されない。即ち、本発明は、本発明のスコープ内において、種々の上記開示要素の多様な組み合わせ乃至選択など、当業者が理解し得る様々な態様を適用することができる。 The present invention has been described above with reference to the above-described embodiment. However, the present invention is not limited to the above-described embodiment. That is, the present invention can apply various modes that can be understood by those skilled in the art, such as various combinations and selections of the various disclosed elements, within the scope of the present invention.
100、200 情報処理装置
110 初期化部
120 実行部
220 スピンロック初期化部
230 タスク実行部
231 スピンロック取得部
232 処理部
233 スピンロック解放部
234 コア番号記憶部
240 カウンタ記憶部
500 コンピュータ装置
504 プログラム
505 記憶装置
506 記録媒体
507 ドライブ装置
508 通信インタフェース
509 ネットワーク
510 入出力インタフェース
511 バス
100, 200
Claims (9)
前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する実行手段と
を備えた情報処理装置。 For each lock information created to exclude resources to be accessed during the execution of a task, an initialization unit that creates a counter corresponding to each processor capable of executing the task and initializes the value of the counter;
In the execution of the process dedicated to the resource in the task, if the value of the counter of the processor assigned to the execution of the task is an initial value, the lock information is acquired and the value of the counter of the processor is counted Execution means for executing the processing by counting up the counter value of the processor without acquiring the lock information when the counter value of the processor is not an initial value. Information processing equipment.
請求項1記載の情報処理装置。 The execution means counts down the value of the counter of the processor to which the execution of the task is assigned when the access to the resource is completed in the execution of the process dedicated to the resource in the task. The information processing apparatus according to claim 1, wherein when the value is an initial value, the lock information is released and the execution of the task is continued.
請求項2記載の情報処理装置。 The information processing apparatus according to claim 2, wherein the execution unit continues the execution of the task without releasing the lock information when a value of the counted down counter is not an initial value.
前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する
情報処理方法。 For each lock information created to exclude resources accessed during task execution, create a counter corresponding to each processor capable of executing the task, initialize the value of the counter,
In the execution of the process dedicated to the resource in the task, if the value of the counter of the processor assigned to the execution of the task is an initial value, the lock information is acquired and the value of the counter of the processor is counted An information processing method for executing the processing by counting up the value of the counter of the processor without acquiring the lock information when the value of the counter of the processor is not an initial value.
請求項4記載の情報処理方法。 In the execution of the process dedicated to the resource in the task, when access to the resource is completed, the value of the counter of the processor assigned to execute the task is counted down, and the value of the counter that has been counted down is the initial value. The information processing method according to claim 4, wherein if there is, the lock information is released and the execution of the task is continued.
請求項5記載の情報処理方法。 The information processing method according to claim 5, wherein when the counted down counter value is not an initial value, the execution of the task is continued without releasing the lock information.
前記タスクにおける前記資源を専有する処理の実行において、当該タスクの実行を割り当てられている前記プロセッサのカウンタの値が初期値である場合、前記ロック情報を取得すると共に当該プロセッサのカウンタの値をカウントアップして前記処理を実行し、前記プロセッサのカウンタの値が初期値でない場合、前記ロック情報を取得せずに前記プロセッサのカウンタの値をカウントアップして前記処理を実行する処理とを、
コンピュータに実行させる情報処理プログラム。 For each lock information created to exclude resources to be accessed during the execution of a task, a process corresponding to each processor capable of executing the task is created, and a process for initializing the value of the counter;
In the execution of the process dedicated to the resource in the task, if the value of the counter of the processor assigned to the execution of the task is an initial value, the lock information is acquired and the value of the counter of the processor is counted And executing the process by counting up the value of the processor counter without obtaining the lock information when the counter value of the processor is not an initial value.
An information processing program to be executed by a computer.
コンピュータに実行させる請求項7記載の情報処理プログラム。 In the execution of the process dedicated to the resource in the task, when access to the resource is completed, the value of the counter of the processor assigned to execute the task is counted down, and the value of the counter that has been counted down is the initial value. If there is, processing to release the lock information and continue execution of the task,
The information processing program according to claim 7, which is executed by a computer.
コンピュータに実行させる請求項8記載の情報処理プログラム。 In the execution of the process dedicated to the resource in the task, when the access to the resource is completed, the value of the counter of the processor assigned to execute the task is counted down, and the value of the counter that has been counted down is not the initial value The information processing program according to claim 8, wherein the computer executes the task without releasing the lock information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017117703A JP6962717B2 (en) | 2017-06-15 | 2017-06-15 | Information processing equipment, information processing methods and information processing programs |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017117703A JP6962717B2 (en) | 2017-06-15 | 2017-06-15 | Information processing equipment, information processing methods and information processing programs |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2019003415A true JP2019003415A (en) | 2019-01-10 |
JP6962717B2 JP6962717B2 (en) | 2021-11-05 |
Family
ID=65006012
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017117703A Active JP6962717B2 (en) | 2017-06-15 | 2017-06-15 | Information processing equipment, information processing methods and information processing programs |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6962717B2 (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04127260A (en) * | 1990-09-18 | 1992-04-28 | Toshiba Corp | Exclusive control circuit for multiprocessor system |
JPH05210559A (en) * | 1991-12-06 | 1993-08-20 | Nec Corp | Deadlock evading process system |
JPH07200321A (en) * | 1993-12-31 | 1995-08-04 | Nec Corp | Integrated exclusive control system |
JP2010108179A (en) * | 2008-10-29 | 2010-05-13 | Kyocera Corp | Electronic apparatus |
WO2012046300A1 (en) * | 2010-10-05 | 2012-04-12 | 富士通株式会社 | Information processing device, information processing program, and information processing method |
-
2017
- 2017-06-15 JP JP2017117703A patent/JP6962717B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH04127260A (en) * | 1990-09-18 | 1992-04-28 | Toshiba Corp | Exclusive control circuit for multiprocessor system |
JPH05210559A (en) * | 1991-12-06 | 1993-08-20 | Nec Corp | Deadlock evading process system |
JPH07200321A (en) * | 1993-12-31 | 1995-08-04 | Nec Corp | Integrated exclusive control system |
JP2010108179A (en) * | 2008-10-29 | 2010-05-13 | Kyocera Corp | Electronic apparatus |
WO2012046300A1 (en) * | 2010-10-05 | 2012-04-12 | 富士通株式会社 | Information processing device, information processing program, and information processing method |
Also Published As
Publication number | Publication date |
---|---|
JP6962717B2 (en) | 2021-11-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10891158B2 (en) | Task scheduling method and apparatus | |
CN109669772B (en) | Parallel execution method and equipment of computational graph | |
CN106569891B (en) | Method and device for scheduling and executing tasks in storage system | |
US9563474B2 (en) | Methods for managing threads within an application and devices thereof | |
KR101618476B1 (en) | Distributed resource management in a portable computing device | |
EP3230860B1 (en) | Technologies for efficient synchronization barriers with work stealing support | |
CN110678847A (en) | Continuous analysis task for GPU task scheduling | |
WO2015101091A1 (en) | Distributed resource scheduling method and device | |
CN102567090B (en) | The method and system of execution thread is created in computer processor | |
EP3113020A1 (en) | Data processing device and method for processing serial tasks | |
US20200226227A1 (en) | Mapping software constructs to synchronous digital circuits that do not deadlock | |
US6295602B1 (en) | Event-driven serialization of access to shared resources | |
CN112182452A (en) | Page component rendering processing method, device, equipment and computer readable medium | |
CN113485840A (en) | Multi-task parallel processing device and method based on Go language | |
JP7122299B2 (en) | Methods, apparatus, devices and storage media for performing processing tasks | |
CN112153114A (en) | Method, system, equipment and medium for time-sharing access to shared device | |
CN112068960A (en) | CPU resource allocation method, device, storage medium and equipment | |
JP6962717B2 (en) | Information processing equipment, information processing methods and information processing programs | |
JP2017062540A (en) | Uni-directional inter-operating-system communication system, and program | |
CN113806055A (en) | Lightweight task scheduling method, system, device and storage medium | |
US11474868B1 (en) | Sharded polling system | |
CN115904644A (en) | Task scheduling method, electronic device and computer program product | |
KR20180082560A (en) | Method and apparatus for time-based scheduling of tasks | |
JP6462521B2 (en) | An API that prevents a normal part failure from propagating to a safety part and its processing part | |
EP3495960A1 (en) | Program, apparatus, and method for communicating data between parallel processor cores |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20200515 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20210519 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20210615 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20210707 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20210720 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20210901 |
|
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: 20210921 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20211014 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6962717 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |