JP2013168103A - Information processor and information processing method - Google Patents

Information processor and information processing method Download PDF

Info

Publication number
JP2013168103A
JP2013168103A JP2012032474A JP2012032474A JP2013168103A JP 2013168103 A JP2013168103 A JP 2013168103A JP 2012032474 A JP2012032474 A JP 2012032474A JP 2012032474 A JP2012032474 A JP 2012032474A JP 2013168103 A JP2013168103 A JP 2013168103A
Authority
JP
Japan
Prior art keywords
shared resource
processor
variable
update
resource
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
JP2012032474A
Other languages
Japanese (ja)
Other versions
JP5890194B2 (en
Inventor
Masahiko Takato
雅彦 高遠
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.)
NEC Computertechno Ltd
Original Assignee
NEC Computertechno Ltd
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 NEC Computertechno Ltd filed Critical NEC Computertechno Ltd
Priority to JP2012032474A priority Critical patent/JP5890194B2/en
Publication of JP2013168103A publication Critical patent/JP2013168103A/en
Application granted granted Critical
Publication of JP5890194B2 publication Critical patent/JP5890194B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Hardware Redundancy (AREA)

Abstract

PROBLEM TO BE SOLVED: To achieve the use of a shared resource by reducing performance deterioration without using any special instruction.SOLUTION: An information processor includes: a resource control part for storing control information showing the update state of a shared resource; a first processing part for updating the control information of the resource control part before updating the shared resource, and for further updating the control information of the resource control part after updating the shared resource; and a second processing part for determining whether or not the shared resource is being updated by the first processing part on the basis of the control information of the resource control part, and for, when the shared resource is being updated, referring to the shared resource after the update of the shared resource ends, and for, when the shared resource is not being updated, referring to the shared resource as it is, and for, after the referring to the shared resource, determining whether or not the update of the shared resource is being generated while referring to the shared resource on the basis of the control information of the resource control part, and for, when the update of the shared resource is generated, referring to the shared resource again.

Description

本発明は、情報処理に関し、特に、複数の処理部からアクセスする資源(リソース)管理に関する。   The present invention relates to information processing, and more particularly, to management of resources accessed from a plurality of processing units.

情報処理システム、又は、情報処理装置は、各処理を実行する複数の処理単位(例えば、処理装置、プロセッサ、又は、プロセス。以下、これら処理単位をまとめてプロセッサと言う)が動作している。このように、複数(マルチ)のプロセッサを含むシステムは、マルチプロセッサシステムを言われる。マルチプロセッサシステムは、複数のプロセッサがアクセスする(共有する)資源(リソース)の整合性を保つため、排他制御の機能を備える。   In the information processing system or the information processing apparatus, a plurality of processing units (for example, a processing apparatus, a processor, or a process. These processing units are collectively referred to as a processor) are operating. Thus, a system including multiple (multi) processors is referred to as a multiprocessor system. The multiprocessor system has an exclusive control function in order to maintain consistency of resources (resources) accessed (shared) by a plurality of processors.

ここで、共有リソースは、例えば、ホストメモリ、外部記憶装置、出力装置、又は、入力装置である。   Here, the shared resource is, for example, a host memory, an external storage device, an output device, or an input device.

共有リソースの排他制御として用いられる同期の基本(プリミティブ)構造としては、ミューテックスやセマフォのようなロックを用いた不可分(アトミック)操作がある。(例えば、特許文献1及び特許文献2を参照)
上記の特許文献1及び特許文献2のシステムのプロセッサは、共有リソースを使用する場合、次のように動作する。
As the basic (primitive) structure of synchronization used for exclusive control of shared resources, there is an atomic operation using a lock such as a mutex or a semaphore. (For example, see Patent Document 1 and Patent Document 2)
When the shared resources are used, the processors of the systems disclosed in Patent Literature 1 and Patent Literature 2 operate as follows.

まず、プロセッサは、共有リソースのロックの有無を確認する。   First, the processor confirms whether or not the shared resource is locked.

ロックされていない(解除状態の)場合、プロセッサは、共有リソースのロックを取得する。そして、プロセッサは、共有リソースを処理し、処理後ロックを解除する。   If not locked (released), the processor obtains a lock on the shared resource. Then, the processor processes the shared resource and releases the lock after processing.

ロックされている(ロック設定の)場合、プロセッサは、ロックが解除されるまで待ち、ロック解除後に共有リソースのロックを取得し、処理を継続する。   If it is locked (lock setting), the processor waits until the lock is released, acquires the shared resource lock after the lock is released, and continues the processing.

あるいは、マルチプロセッサシステムを構成するプロセッサ、特に個別の命令を処理するCPU(Central Processing Unit)が、アトミック性を備えた特別な命令を備え、アトミックな操作を実現し、排他制御を実現する。このような命令は、例えば、テスト・アンド・セット(TAS:Test And Set)命令やコンペア・アンド・スワップ(CAS:Compare And Swap)命令である。   Alternatively, a processor constituting the multiprocessor system, particularly a CPU (Central Processing Unit) that processes individual instructions, includes a special instruction having atomicity, realizes an atomic operation, and realizes exclusive control. Such an instruction is, for example, a test and set (TAS) instruction or a compare and swap (CAS) instruction.

特開平07−084851JP 07/084851 特開2010−140290JP2010-140290

上記のTAS命令やCAS命令を用いるシステムは、これらの命令を備えた特別なCPU又はハードウェアが必要であるという問題点があった。   The system using the above TAS instruction and CAS instruction has a problem that a special CPU or hardware provided with these instructions is required.

また、特許文献1及び特許文献2に記載のシステムは、アクセスの内容に関係せずに、共有リソースの処理においてロック取得が必要である問題点があった。   In addition, the systems described in Patent Literature 1 and Patent Literature 2 have a problem that it is necessary to acquire a lock in the processing of shared resources regardless of the contents of access.

この問題点のため、特許文献1及び特許文献2に記載のシステムは、ロック取得の競合が増加し、次のような性能低下を発生させる問題点があった。   Because of this problem, the systems described in Patent Document 1 and Patent Document 2 have a problem in that competition for lock acquisition increases and the following performance degradation occurs.

(1)ロックの競合が増加すると、ロック取得の失敗の頻度が高くなる。その結果、プロセッサは、ロック待ちとなる場合が増加する。   (1) When lock contention increases, the frequency of lock acquisition failures increases. As a result, the number of cases where the processor is waiting for a lock increases.

(2)ロック待ちが増加すると、キャッシュがページアウトされて無効(インバリッド)となる頻度が高くなる。つまり、キャッシュミス率が高くなる。その結果、プロセッサは、処理におけるページインの頻度が高くなり、処理時間が多くなる。   (2) When the lock wait time increases, the frequency at which the cache is paged out and invalidated (invalid) increases. That is, the cache miss rate increases. As a result, the processor has a high page-in frequency in processing, and processing time increases.

(3)共有リソースを参照するプロセッサが並列に処理できない。   (3) Processors that reference shared resources cannot process in parallel.

これらの問題点は、大規模マルチプロセッサの構成において、特に著しい性能悪化の原因となる。   These problems cause significant performance deterioration particularly in a large-scale multiprocessor configuration.

本発明の目的は、上記問題点を解決し、特別な命令を用いずに、性能の低下を削減した共有リソースの利用を実現する、情報処理装置、及び、情報処理方法を提供することにある。   An object of the present invention is to provide an information processing apparatus and an information processing method that solves the above-described problems and realizes use of a shared resource with reduced performance reduction without using a special instruction. .

本発明の情報処理装置は、共有資源の更新状態を示す制御情報を保持する資源制御部と、前記共有資源を更新する前に前記資源制御部の制御情報を更新し、前記共有資源を更新後に前記資源制御部の制御情報をさらに更新する第1の処理部と、前記資源制御部の制御情報を基に前記第1の処理部が前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記資源制御部の制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する第2の処理部とを含む。   An information processing apparatus according to the present invention includes a resource control unit that holds control information indicating an update state of a shared resource, and updates the control information of the resource control unit before updating the shared resource, and after updating the shared resource A first processing unit that further updates control information of the resource control unit, and a determination as to whether or not the first processing unit is updating the shared resource based on the control information of the resource control unit. If the update is not in progress, the shared resource is referred to.If the update is in progress, the shared resource is referred to after the update is completed. After the shared resource is referred to, the reference is made based on the control information of the resource control unit. And a second processing unit that performs a second determination, which is a determination as to whether or not the update of the shared resource has occurred, and refers to the shared resource again when the update has occurred.

本発明の情報処理方法は、共有資源の更新状態を示す制御情報を保持し、前記共有資源を更新する場合、前記共有資源を更新する前に前記制御情報を更新し、前記共有資源を更新後に前記制御情報をさらに更新し、前記共有資源を参照する場合、前記制御情報を基に前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する。   The information processing method of the present invention holds control information indicating an update state of a shared resource, and when updating the shared resource, updates the control information before updating the shared resource, and after updating the shared resource. When the control information is further updated and the shared resource is referred to, a first determination is made as to whether or not the shared resource is being updated based on the control information. If the update is in progress, the shared resource is referred to after the update is completed, and after the reference to the shared resource, it is determined whether the shared resource is updated during the reference based on the control information. A second determination is made and if an update occurs, the shared resource is referenced again.

本発明のプログラムは、共有資源の更新状態を示す制御情報を保持する処理と、前記共有資源を更新する場合、前記共有資源の更新の前に前記制御情報を更新し、前記共有資源の更新後に前記制御情報をさらに更新する処理と、前記共有資源を参照する場合、前記制御情報を基に前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する処理とをコンピュータに実行させる。   The program of the present invention includes a process for holding control information indicating an update state of a shared resource, and, when updating the shared resource, updates the control information before updating the shared resource, and after updating the shared resource. When the process further updates the control information and the shared resource is referenced, a first determination is made as to whether or not the shared resource is being updated based on the control information. Refer to the shared resource, and if the update is in progress, refer to the shared resource after the update is completed, and after the reference to the shared resource, determine whether the update of the shared resource occurs during the reference based on the control information When the update occurs, the computer is caused to execute a process of referring to the shared resource again.

本発明によれば、特別な命令を用いずに、性能の低下を削減した共有リソースの利用を実現できる。   According to the present invention, it is possible to realize use of shared resources with reduced performance reduction without using a special instruction.

図1は、本発明における第1の実施形態に係る情報処理装置の構成の一例を示すブロック図である。FIG. 1 is a block diagram showing an example of the configuration of the information processing apparatus according to the first embodiment of the present invention. 図2は、第1の実施形態に係る資源制御部の構成一例を示すブロック図である。FIG. 2 is a block diagram illustrating an example of the configuration of the resource control unit according to the first embodiment. 図3は、第1の実施形態に係る情報処理装置の共有データの更新動作の一例を示すフローチャートである。FIG. 3 is a flowchart illustrating an example of the update operation of the shared data of the information processing apparatus according to the first embodiment. 図4は、第1の実施形態に係る情報処理装置の更新動作の一例を示すシーケンス図である。FIG. 4 is a sequence diagram illustrating an example of an update operation of the information processing apparatus according to the first embodiment. 図5は、第1の実施形態に係る情報処理装置の共有データの参照動作の一例を示すフローチャートである。FIG. 5 is a flowchart illustrating an example of the shared data reference operation of the information processing apparatus according to the first embodiment. 図6は、第1の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 6 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the first embodiment. 図7は、第1の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 7 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the first embodiment. 図8は、第1の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 8 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the first embodiment. 図9は、第1の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 9 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the first embodiment. 図10は、第1の実施形態の係る情報処理装置の別の構成の一例を示すブロック図である。FIG. 10 is a block diagram illustrating an example of another configuration of the information processing apparatus according to the first embodiment. 図11は、第1の実施形態の係る情報処理装置の参照動作の別の一例を示すフローチャートである。FIG. 11 is a flowchart illustrating another example of the reference operation of the information processing apparatus according to the first embodiment. 図12は、第2の実施形態に係る資源制御部の構成一例を示すブロック図である。FIG. 12 is a block diagram illustrating an example of the configuration of the resource control unit according to the second embodiment. 図13は、第2の実施形態に係る情報処理装置の共有データの更新動作の一例を示すフローチャートである。FIG. 13 is a flowchart illustrating an example of the shared data update operation of the information processing apparatus according to the second embodiment. 図14は、第2の実施形態に係る情報処理装置の更新動作の一例を示すシーケンス図である。FIG. 14 is a sequence diagram illustrating an example of an update operation of the information processing apparatus according to the second embodiment. 図15は、第2の実施形態に係る情報処理装置の共有データの参照動作の一例を示すフローチャートである。FIG. 15 is a flowchart illustrating an example of a shared data reference operation of the information processing apparatus according to the second embodiment. 図16は、第2の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 16 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the second embodiment. 図17は、第2の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 17 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the second embodiment. 図18は、第2の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 18 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the second embodiment. 図19は、第2の実施形態に係る情報処理装置の参照動作の一例を示すシーケンス図である。FIG. 19 is a sequence diagram illustrating an example of a reference operation of the information processing apparatus according to the second embodiment.

次に、本発明の実施形態について図面を参照して説明する。   Next, embodiments of the present invention will be described with reference to the drawings.

なお、各図面は、本発明の実施形態を説明するものである。そのため、本発明は、各図面の記載に限られるわけではない。また、各図面の同様の構成には、同じ番号を付し、その繰り返しの説明は、省略する場合がある。   Each drawing explains an embodiment of the present invention. Therefore, the present invention is not limited to the description of each drawing. Moreover, the same number is attached | subjected to the same structure of each drawing, and the repeated description may be abbreviate | omitted.

(第1の実施形態)
図1は、本発明おける第1の実施形態に係る情報処理装置10の構成の一例を示すブロック図である。なお、図1において、本実施形態の説明に関係しない構成(例えば、入出力部)は、省略した。
(First embodiment)
FIG. 1 is a block diagram showing an example of the configuration of the information processing apparatus 10 according to the first embodiment of the present invention. In FIG. 1, configurations that are not related to the description of the present embodiment (for example, input / output units) are omitted.

情報処理装置10は、プロセッサ20aと、プロセッサ20bと、資源制御部30とを含む。   The information processing apparatus 10 includes a processor 20a, a processor 20b, and a resource control unit 30.

プロセッサ20aとプロセッサ20bとをまとめて、プロセッサ20と言う。   The processor 20a and the processor 20b are collectively referred to as a processor 20.

プロセッサ20は、資源制御部30を用いて、図示しない共有リソースを使用する。   The processor 20 uses a shared resource (not shown) using the resource control unit 30.

より詳細な動作は、後ほど説明するが、プロセッサ20は、資源制御部30を、次のように用いる。   Although more detailed operation will be described later, the processor 20 uses the resource control unit 30 as follows.

プロセッサ20は、共有リソースを更新(例えば、データを更新)する場合、資源制御部30が含む情報(以下、「制御情報30a」と言う)を更新して変更処理を進める。つまり、プロセッサ20は、制御情報30aの変化に基づいて、共有リソースの更新を検出できる。   When updating the shared resource (for example, updating data), the processor 20 updates information included in the resource control unit 30 (hereinafter referred to as “control information 30a”) and proceeds with the change process. That is, the processor 20 can detect the update of the shared resource based on the change of the control information 30a.

なお、図1において、プロセッサ20a及びプロセッサ20bを2つ示した例示である。情報処理装置10は、3つ以上のプロセッサ20を含んでも良い。   In FIG. 1, two processors 20a and 20b are illustrated. The information processing apparatus 10 may include three or more processors 20.

また、プロセッサ20は、情報処理装置10の処理の単位の一例である。プロセッサ20は、CPUのように単独のプロセッサでもよく、CPUとROM(Read Only Memory)とRAM(Random Access Memory)と記憶装置と含むコンピュータのような装置でもよく、CPU上で実行されるプロセス、スレッド又はタスクでもよい。そのため、プロセッサ20は、「処理部」と言うこともできる。   The processor 20 is an example of a unit of processing of the information processing apparatus 10. The processor 20 may be a single processor such as a CPU, or may be a device such as a computer including a CPU, a ROM (Read Only Memory), a RAM (Random Access Memory), and a storage device, and a process executed on the CPU. It may be a thread or a task. Therefore, the processor 20 can also be referred to as a “processing unit”.

資源制御部30は、共有リソースに対応する制御情報30aを保持する。既に説明しているが、制御情報30aは、共有リソースの更新の状態を示す情報である。なお、制御情報30aは、更新を示す情報として変数(制御用の変数)を含む。   The resource control unit 30 holds control information 30a corresponding to the shared resource. As already described, the control information 30a is information indicating the update state of the shared resource. The control information 30a includes a variable (control variable) as information indicating update.

なお、情報処理装置10は、共有資源(リソース)毎に資源制御部30を含んでも良い。あるいは、資源制御部30は、複数の共有リソースに対応しても良い。   Note that the information processing apparatus 10 may include a resource control unit 30 for each shared resource (resource). Alternatively, the resource control unit 30 may support a plurality of shared resources.

ただし、以下では、説明を明確にするため、資源制御部30及び対象となる共有リソースを1つとして説明する。   However, in the following description, the resource control unit 30 and the target shared resource are described as one for the sake of clarity.

次に、本実施形態の情報処理装置10の動作について説明する。   Next, the operation of the information processing apparatus 10 of this embodiment will be described.

本実施形態の資源制御部30の制御情報30aが含む制御用の変数に特に制限はない。ただし、本実施形態は、図2に示すように、制御情報30aとして開始変数31と終了変数32とを含むとして説明する。   There is no particular limitation on the control variables included in the control information 30a of the resource control unit 30 of the present embodiment. However, the present embodiment will be described on the assumption that the control information 30a includes a start variable 31 and an end variable 32 as shown in FIG.

共有リソースを更新するプロセッサ20は、更新処理の開始時に開始変数31を更新する。   The processor 20 that updates the shared resource updates the start variable 31 at the start of the update process.

また、共有リソースを更新するプロセッサ20は、更新処理の終了時に終了変数32を更新する。   The processor 20 that updates the shared resource updates the end variable 32 at the end of the update process.

なお、開始変数31及び終了変数32の更新内容は、予め、情報処理装置10において、共有リソースを参照するプロセッサ20が判別できるように決めておけば特に制限はない。本実施形態の説明では、一例として、開始変数31及び終了変数32の初期値をどちらも「0」とし、更新を「1加算」として説明する。つまり、開始変数31と終了変数32は、更新中ではない場合、同じ値となり、更新中の場合、異なる値となる。   The update contents of the start variable 31 and the end variable 32 are not particularly limited as long as the information processing apparatus 10 determines in advance that the processor 20 that refers to the shared resource can be determined. In the description of the present embodiment, as an example, the initial values of the start variable 31 and the end variable 32 are both “0”, and the update is described as “1 addition”. That is, the start variable 31 and the end variable 32 have the same value when not being updated, and have different values when being updated.

また、共有リソースの変更及び参照は、いずれのプロセッサ20が行っても良い。ただし、以下、説明の便宜のため、特に断らない限り、プロセッサ20aが共有リソースを更新し、プロセッサ20bが共有リソースを参照する。   In addition, any processor 20 may change and reference the shared resource. However, for convenience of explanation, the processor 20a updates the shared resource and the processor 20b refers to the shared resource unless otherwise specified.

まず、共有リソースの更新動作について説明する。   First, the shared resource update operation will be described.

プロセッサ20aは、共有リソースを更新する場合、共有リソースが他のプロセッサから更新されることを防ぐため、排他機構を用いて占有する。この占有は、特に制限はない。例えば、プロセッサ20aは、資源制御部30を占有(ロック設定)しても良い。あるいは、プロセッサ20aは、一般的な排他機構(例えば、共有リソースのロック機構)を用いてもよい。そのため、共有リソースの占有についての詳細な説明は、省略する。   When updating the shared resource, the processor 20a occupies the shared resource using an exclusive mechanism in order to prevent the shared resource from being updated by another processor. This occupation is not particularly limited. For example, the processor 20a may occupy (lock setting) the resource control unit 30. Alternatively, the processor 20a may use a general exclusion mechanism (for example, a shared resource locking mechanism). Therefore, a detailed description about the occupation of the shared resource is omitted.

そして、プロセッサ20aは、共有リソースを更新するときに、次に説明する動作を行う。   Then, the processor 20a performs the operation described below when updating the shared resource.

図3は、本実施形態の情報処理装置10の更新動作の一例を示すフローチャートである。   FIG. 3 is a flowchart illustrating an example of the update operation of the information processing apparatus 10 according to the present embodiment.

プロセッサ20aは、開始変数31を更新(1加算)する(ステップ101)。   The processor 20a updates (adds 1) the start variable 31 (step 101).

次に、プロセッサ20aは、共有リソースの仕様を基に更新に必要な保護機構を設定する(ステップ102)。プロセッサ20aは、この動作を、共有リソースの仕様に従って行う。例えば、共有リソースがメモリの場合、プロセッサ20aは、メモリの順序性を保障するメモリバリア(メモリフェンス)を設定する。なお、既にプロセッサ20aが、共有リソースを占有しているため、更なる保護機構が不要な場合、プロセッサ20aは、ステップ102を省略しても良い。   Next, the processor 20a sets a protection mechanism necessary for updating based on the shared resource specification (step 102). The processor 20a performs this operation according to the specification of the shared resource. For example, when the shared resource is a memory, the processor 20a sets a memory barrier (memory fence) that ensures the order of the memory. Note that, since the processor 20a already occupies the shared resource, the processor 20a may omit step 102 when no further protection mechanism is required.

保護を設定後、プロセッサ20aは、共有リソースを更新する(ステップ103)。   After setting the protection, the processor 20a updates the shared resource (step 103).

更新後、プロセッサ20aは、保護機構を解除する(ステップ104)。なお、ステップ102を省略した場合、プロセッサ20aは、ステップ104を省略する。   After the update, the processor 20a releases the protection mechanism (Step 104). When step 102 is omitted, the processor 20a omits step 104.

その後、プロセッサ20aは、終了変数32を更新(1加算)する(ステップ105)。   Thereafter, the processor 20a updates (adds 1) the end variable 32 (step 105).

全ての更新が終了すると、プロセッサ20aは、共有リソースの占有を解除(ロック解除)する。   When all the updates are completed, the processor 20a releases (unlocks) the shared resource.

図4は、情報処理装置10の更新動作の一例のシーケンス図である。図4において、共有リソースの保護機能についての動作を省略した。   FIG. 4 is a sequence diagram illustrating an example of the update operation of the information processing apparatus 10. In FIG. 4, the operation of the shared resource protection function is omitted.

プロセッサ20aは、開始変数31を更新する(1001)。   The processor 20a updates the start variable 31 (1001).

そして、プロセッサ20aは、共有リソースを更新する(1002)。   Then, the processor 20a updates the shared resource (1002).

その後、プロセッサ20aは、終了変数32を更新する(1003)。   Thereafter, the processor 20a updates the end variable 32 (1003).

このような動作を基に、情報処理装置10は、共有リソースの更新に関して、次の状態を実現する。   Based on such an operation, the information processing apparatus 10 realizes the following state regarding the update of the shared resource.

(1)更新中、開始変数31の値と終了変数32の値とが異なる。   (1) During update, the value of the start variable 31 and the value of the end variable 32 are different.

(2)更新の後の開始変数31及び終了変数32の値が、更新前の開始変数31及び終了変数32の値と異なる。   (2) The values of the start variable 31 and the end variable 32 after the update are different from the values of the start variable 31 and the end variable 32 before the update.

このように、共有リソースを更新するプロセッサ20aは、更新の前に開始変数31を更新し、更新終了後に終了変数32を更新する。   As described above, the processor 20a that updates the shared resource updates the start variable 31 before the update, and updates the end variable 32 after the update ends.

なお、図4には、参考として、プロセッサ20bが、共有リソースを更新する場合のシーケンス(1004−1006)も示している。プロセッサ20bは、プロセッサ20aのロック解除後、共有リソースのロックを設定してから、図4に示す動作を実行する。   FIG. 4 also shows, as a reference, a sequence (1004 to 1006) when the processor 20b updates the shared resource. After unlocking the processor 20a, the processor 20b sets the shared resource lock, and then executes the operation shown in FIG.

次に、本実施形態の情報処理装置10が、共有リソースを参照する場合の動作について説明する。   Next, an operation when the information processing apparatus 10 according to the present embodiment refers to a shared resource will be described.

図5は、情報処理装置10の参照動作の一例を示すフローチャートである。   FIG. 5 is a flowchart illustrating an example of a reference operation of the information processing apparatus 10.

共有リソースを参照するプロセッサ20bは、参照の前に開始変数31と終了変数32(以下、合わせて「両変数」と言う)を読み出す(ステップ201)。以下、ステップ201で読み出した変数を「第1の変数」と言う。   The processor 20b referring to the shared resource reads the start variable 31 and the end variable 32 (hereinafter collectively referred to as “both variables”) before the reference (step 201). Hereinafter, the variable read in step 201 is referred to as “first variable”.

プロセッサ20bは、第1の開始変数31と第1の終了変数32との値を確認する(ステップ202)。具体的には、プロセッサ20bは、第1の開始変数31と第1の終了変数32とが同じか否かを判定する。この判定は、上記のとおり、共有リソースが更新中であるか否かの判定である。   The processor 20b checks the values of the first start variable 31 and the first end variable 32 (step 202). Specifically, the processor 20b determines whether or not the first start variable 31 and the first end variable 32 are the same. This determination is a determination as to whether or not the shared resource is being updated as described above.

第1の開始変数31と第1の終了変数32とが異なる、つまり、更新中の場合(ステップ202でNO)、プロセッサ20bは、ステップ201に戻り、更新が終了するまで待つ。プロセッサ20bは、この待ちを、ステップ201と202との繰り返し(スピンロック)として待つ。ただし、本実施形態の情報処理装置10は、スピンロックに限る必要はない。例えば、プロセッサ20bは、図示しないウェイト管理機構を備え、ウェイト状態として再開を待っても良い。   When the first start variable 31 and the first end variable 32 are different, that is, when updating is in progress (NO in step 202), the processor 20b returns to step 201 and waits until the update is completed. The processor 20b waits for this wait as a repetition (spin lock) of steps 201 and 202. However, the information processing apparatus 10 according to the present embodiment is not limited to the spin lock. For example, the processor 20b may include a wait management mechanism (not shown) and wait for resumption as a wait state.

第1の開始変数31と第1の終了変数32とが一致、つまり更新中でない場合(ステップ202でYES)、プロセッサ20bは、共有データを参照、例えば、データを読み出す(ステップ203)。   If the first start variable 31 and the first end variable 32 match, that is, not being updated (YES in step 202), the processor 20b refers to the shared data, for example, reads the data (step 203).

参照が終了すると、プロセッサ20bは、両変数を読み出す(ステップ204)。ステップ204で読み出した変数を「第2の変数」と言う。   When the reference is completed, the processor 20b reads both variables (step 204). The variable read in step 204 is referred to as a “second variable”.

次に、プロセッサ20bは、第1の終了変数32と第2の終了変数32とを確認する(ステップ205)。具体的には、プロセッサ20bは、第1の終了変数32と第2の終了変数32とが同じか否かを判定する。この判定は、第1の両変数を読み出した後、終了した更新処理が発生したか否かの判定である。   Next, the processor 20b checks the first end variable 32 and the second end variable 32 (step 205). Specifically, the processor 20b determines whether or not the first end variable 32 and the second end variable 32 are the same. This determination is a determination as to whether or not an updating process that has ended after reading both first variables has occurred.

第1の終了変数32と第2の終了変数32が異なる、つまり、終了した更新が発生した場合(ステップ205でNO)、プロセッサ20bは、ステップ201に戻り、最初から参照動作を始める。ステップ201に戻るのは、共有リソースが更新されているため、ステップ203での参照が無効の可能性があるためである。   When the first end variable 32 and the second end variable 32 are different, that is, when an end update has occurred (NO in step 205), the processor 20b returns to step 201 and starts the reference operation from the beginning. The reason for returning to step 201 is that the reference in step 203 may be invalid because the shared resource has been updated.

第1の終了変数32と第2の終了変数32とが同じ場合(ステップ205でYES)、プロセッサ20bは、第2の開始変数31と第2の終了変数32とを確認する(ステップ206)。具体的には、プロセッサ20bは、第2の開始変数31と第2の終了変数32が同じか否かを判定する。この判定は、新しい更新動作中であるか否かの判定である。   If the first end variable 32 and the second end variable 32 are the same (YES in step 205), the processor 20b checks the second start variable 31 and the second end variable 32 (step 206). Specifically, the processor 20b determines whether or not the second start variable 31 and the second end variable 32 are the same. This determination is a determination as to whether or not a new update operation is being performed.

第2の開始変数31と第2の終了変数32とが異なる、つまり、更新中の場合(ステップ206でNO)、プロセッサ20bは、ステップ201に戻り、最初から参照動作を始める。ステップ201に戻るのは、共有リソースの更新が開始されているため、ステップ203での参照が無効の可能性があるためである。   When the second start variable 31 and the second end variable 32 are different, that is, during update (NO in step 206), the processor 20b returns to step 201 and starts the reference operation from the beginning. The reason for returning to step 201 is that the update in the shared resource has started, and therefore the reference in step 203 may be invalid.

第2の開始変数31と第2の終了変数32とが同じ場合(ステップ206でYES)、プロセッサ20bは、参照動作を終了する。その後、プロセッサ20bは、適宜、次の動作に移る。   If the second start variable 31 and the second end variable 32 are the same (YES in step 206), the processor 20b ends the reference operation. Thereafter, the processor 20b proceeds to the next operation as appropriate.

なお、ステップ205とステップ206は、どちらも変数の判定の動作である。そのため、情報処理装置10は、この動作を分けず、1つの判定動作としても良い。   Step 205 and step 206 are both variable determination operations. Therefore, the information processing apparatus 10 may perform one determination operation without dividing this operation.

このように、共有リソースを参照するプロセッサ20bは、共有リソースに排他機構を設定されているか否かに係わらず、開始変数31と終了変数32とを基に、共有リソースを参照できる。   As described above, the processor 20b that refers to the shared resource can refer to the shared resource based on the start variable 31 and the end variable 32 regardless of whether or not the exclusion mechanism is set for the shared resource.

次に、情報処理装置10が、適切に共有リソースを参照できることを、図6−図9を参照して説明する。なお、図面の煩雑さを避けるため、図6−図9において、図5のステップ205とステップ206との判断は、1つの判断として示す。   Next, the fact that the information processing apparatus 10 can appropriately refer to the shared resource will be described with reference to FIGS. In order to avoid the complexity of the drawings, in FIGS. 6 to 9, the determinations of step 205 and step 206 in FIG. 5 are shown as one determination.

まず、共有リソースの更新動作と参照動作とが重ならない場合について説明する。   First, a case where the shared resource update operation and the reference operation do not overlap will be described.

図6は、プロセッサ20aが共有リソースの更新後に、プロセッサ20bが参照動作を開始した場合のシーケンス図である。   FIG. 6 is a sequence diagram when the processor 20b starts the reference operation after the processor 20a updates the shared resource.

プロセッサ20bは、第1の両変数を読み出す(2001)。この場合、第1の開始変数31及び終了変数32は、同じ値(図6では「01」)となる。   The processor 20b reads both first variables (2001). In this case, the first start variable 31 and the end variable 32 have the same value (“01” in FIG. 6).

そのため、第1の開始変数31と第1の終了変数32との判定(図5のステップ202)は、YESとなる(2002)。   Therefore, the determination (step 202 in FIG. 5) between the first start variable 31 and the first end variable 32 is YES (2002).

そして、プロセッサ20bは、共有リソースを参照する(2003)。   Then, the processor 20b refers to the shared resource (2003).

参照後、プロセッサ20bは、第2の両変数を読み出す(2004)。この場合、第2の開始変数31及び終了変数32は、第1の開始変数31及び終了変数32と同じ値(図6では「01」)となる。   After the reference, the processor 20b reads both the second variables (2004). In this case, the second start variable 31 and the end variable 32 have the same values as the first start variable 31 and the end variable 32 (“01” in FIG. 6).

そのため、ステップ205及び206に対応する変数の判定は、どちらもYESとなる(2005)。   Therefore, the determination of the variables corresponding to steps 205 and 206 is both YES (2005).

その結果、プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   As a result, the processor 20b makes the referenced shared resource valid and ends the reference operation.

次に、プロセッサ20aが更新動作中に、プロセッサ20bが参照動作を開始した場合について説明する。   Next, a case where the processor 20b starts the reference operation while the processor 20a is performing the update operation will be described.

図7は、プロセッサ20aが更新動作中に、プロセッサ20bが参照動作を開始した場合のシーケンス図である。   FIG. 7 is a sequence diagram when the processor 20b starts the reference operation during the update operation of the processor 20a.

プロセッサ20bは、第1の両変数を読み出す(3001)。この場合、プロセッサ20aは、更新中である。そのため、第1の開始変数31及び第1の終了変数32は、異なる値(図7では、開始変数31が「01」、終了変数32が「00」)となる。   The processor 20b reads both first variables (3001). In this case, the processor 20a is being updated. Therefore, the first start variable 31 and the first end variable 32 have different values (in FIG. 7, the start variable 31 is “01” and the end variable 32 is “00”).

そのため、第1の開始変数31と第1の終了変数32との判定(図5のステップ202)は、NOとなる(3002)。   Therefore, the determination (step 202 in FIG. 5) between the first start variable 31 and the first end variable 32 is NO (3002).

プロセッサ20aの更新動作が終了するまで、第1の開始変数31と終了変数32とが異なる。そのため、プロセッサ20bは、図5のステップ201−202(図7では、3001−3002)を繰り返す。   Until the update operation of the processor 20a ends, the first start variable 31 and the end variable 32 are different. Therefore, the processor 20b repeats Steps 201-202 in FIG. 5 (3001-3002 in FIG. 7).

プロセッサ20aが更新動作を終了すると、第1の開始変数31と終了変数32とが同じ値となる。   When the processor 20a finishes the update operation, the first start variable 31 and the end variable 32 have the same value.

その後、プロセッサ20bが、第1の両変数を読み出す(3003)と、第1の開始変数31及び第1の終了変数32は、同じ値(図7では「01」)である。   After that, when the processor 20b reads both first variables (3003), the first start variable 31 and the first end variable 32 have the same value ("01" in FIG. 7).

そのため、第1の開始変数31と第1の終了変数32との判定(図5のステップ202)は、YESとなる(3004)。   Therefore, the determination (step 202 in FIG. 5) between the first start variable 31 and the first end variable 32 is YES (3004).

これ以降、プロセッサ20bは、図6の2003−2005と同様に動作する。   Thereafter, the processor 20b operates in the same manner as 2003-2005 in FIG.

つまり、プロセッサ20bは、共有リソースを参照する(3005)。   That is, the processor 20b refers to the shared resource (3005).

参照後、プロセッサ20bは、第2の両変数を読み出す(3006)。この場合、第2の開始変数31及び終了変数32は、第1の開始変数31及び終了変数32と同じ値(図7では「01」)である。   After the reference, the processor 20b reads both the second variables (3006). In this case, the second start variable 31 and the end variable 32 are the same values as the first start variable 31 and the end variable 32 (“01” in FIG. 7).

そのため、ステップ205及び206に対応する変数の判定は、どちらもYESとなる(3007)。   Therefore, the determination of the variable corresponding to steps 205 and 206 is both YES (3007).

その結果、プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   As a result, the processor 20b makes the referenced shared resource valid and ends the reference operation.

次に、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始した場合について説明する。まず、プロセッサ20bの第2の変数の確認前に、プロセッサ20aの更新動作が終了した場合について説明する。   Next, the case where the processor 20a starts the update operation after the processor 20b starts the reference operation will be described. First, the case where the update operation of the processor 20a is completed before the second variable of the processor 20b is confirmed will be described.

図8は、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の変数の確認前に、プロセッサ20aの更新動作が終了した場合のシーケンス図である。   FIG. 8 is a sequence diagram when the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a ends before the second variable of the processor 20b is confirmed. .

プロセッサ20bは、第1の両変数を読み込む(4001)。この場合、第1の開始変数31及び終了変数32は、同じ値(図8では「00」)である。   The processor 20b reads both first variables (4001). In this case, the first start variable 31 and the end variable 32 have the same value (“00” in FIG. 8).

そのため、第1の開始変数31と第1の終了変数32との判定(図5のステップ202)は、YESとなる(4002)。   Therefore, the determination (step 202 in FIG. 5) between the first start variable 31 and the first end variable 32 is YES (4002).

プロセッサ20bは、共有リソースを参照する(4003)。   The processor 20b refers to the shared resource (4003).

ただし、プロセッサ20aは、プロセッサ20bが共有リソースを参照中に、共有リソースを更新する。そのため、開始変数31及び終了変数32は、どちらも更新(図8ではどちらも「01」)される。   However, the processor 20a updates the shared resource while the processor 20b is referring to the shared resource. Therefore, both the start variable 31 and the end variable 32 are updated (both are “01” in FIG. 8).

参照後、プロセッサ20bは、第2の両変数を読み出す(4004)。上記のとおり、第2の両変数は、更新された後のため、第1の両変数とは異なる。   After the reference, the processor 20b reads both the second variables (4004). As described above, both the second variables are different from the first variables because they have been updated.

そのため、プロセッサ20bの変数の判定、具体的には、図5のステップ205の判定がNOとなる(4005)。   Therefore, the determination of the variable of the processor 20b, specifically, the determination of step 205 in FIG. 5 is NO (4005).

その結果、プロセッサ20bは、参照動作の最初(図5のステップ201)に戻り、参照動作をやり直す。つまり、プロセッサ20bは、図6の2001−2005に相当する図8の4006−4010を実行する。   As a result, the processor 20b returns to the beginning of the reference operation (step 201 in FIG. 5) and redoes the reference operation. That is, the processor 20b executes 4006-4010 in FIG. 8 corresponding to 2001-2005 in FIG.

具体的に説明すると次のとおりである。   Specifically, it is as follows.

プロセッサ20bは、第1の両変数を読み出す(4006)。第1の開始変数31及び終了変数32は、同じ値(図8では、「01」)となる。   The processor 20b reads both first variables (4006). The first start variable 31 and the end variable 32 have the same value (“01” in FIG. 8).

プロセッサ20bは、第1の開始変数31と終了変数32を判定する(4007)。   The processor 20b determines the first start variable 31 and the end variable 32 (4007).

第1の両変数が同じため、プロセッサ20bは、共有リソースを参照する(4008)。   Since both the first variables are the same, the processor 20b refers to the shared resource (4008).

参照後、プロセッサ20bは、第2の両変数を読み出す(4009)。この場合、第2の両変数は、第1の両変数と同じ値(図8では「01」)である。   After the reference, the processor 20b reads both the second variables (4009). In this case, both the second variables are the same value as the first both variables (“01” in FIG. 8).

そのため、プロセッサ20bの変数の判定は、YESとなる(4010)。   Therefore, the determination of the variable of the processor 20b is YES (4010).

プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   The processor 20b terminates the reference operation because the referenced shared resource is valid.

続いて、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の変数の確認時に、プロセッサ20aの更新動作が終了していない場合について説明する。   Next, a case will be described in which the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a is not completed when the second variable of the processor 20b is confirmed.

図9は、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の変数の確認時に、プロセッサ20aの更新動作が終了していない場合のシーケンス図である。   FIG. 9 is a sequence diagram in the case where the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a is not completed when the second variable of the processor 20b is confirmed. is there.

プロセッサ20bは、第1の両変数を読み出す(5001)。この場合、第1の開始変数31及び終了変数32は、同じ値(図9では「00」)である。   The processor 20b reads both first variables (5001). In this case, the first start variable 31 and the end variable 32 have the same value (“00” in FIG. 9).

そのため、第1の開始変数31と第1の終了変数32との判定(図5のステップ202)は、YESとなる(5002)。   Therefore, the determination (step 202 in FIG. 5) between the first start variable 31 and the first end variable 32 is YES (5002).

プロセッサ20bは、共有リソースを参照する(5003)。   The processor 20b refers to the shared resource (5003).

ただし、プロセッサ20aは、プロセッサ20bが共有リソースを参照中に、共有リソースの更新を開始している。そのため、開始変数31は、更新(図9では「01」)されている。   However, the processor 20a starts updating the shared resource while the processor 20b is referring to the shared resource. Therefore, the start variable 31 is updated (“01” in FIG. 9).

参照後、プロセッサ20bは、第2の両変数を読み出す(5004)。上記のとおり、第2の開始変数31は、更新されたため、第2の終了変数32と異なる。   After the reference, the processor 20b reads both the second variables (5004). As described above, since the second start variable 31 has been updated, it differs from the second end variable 32.

そのため、プロセッサ20bの変数の判定、具体的には、図5のステップ206の判定がNOとなる(5005)。   Therefore, the determination of the variable of the processor 20b, specifically, the determination of step 206 in FIG. 5 is NO (5005).

そのため、プロセッサ20bは、参照動作の最初(図5のステップ201)に戻り、参照動作をやり直す。   Therefore, the processor 20b returns to the beginning of the reference operation (step 201 in FIG. 5) and redoes the reference operation.

これ以降の動作は、図7と同様の動作になる。   Subsequent operations are the same as those in FIG.

つまり、プロセッサ20bは、第1の開始変数31と終了変数32が一致するまで、両変数の読み出しと判定を繰り返す。   That is, the processor 20b repeats reading and determination of both variables until the first start variable 31 and the end variable 32 match.

プロセッサ20aが、更新を終了すると、開始変数31と終了変数32とが同じ値(図9では「01」)となる。   When the processor 20a finishes updating, the start variable 31 and the end variable 32 have the same value ("01" in FIG. 9).

その後、プロセッサ20bが、第1の両変数を読み出す(5006)と、第1の開始変数31及び終了変数32は、同じ値(図9では、「01」)である。   After that, when the processor 20b reads both the first variables (5006), the first start variable 31 and the end variable 32 have the same value (“01” in FIG. 9).

プロセッサ20bは、第1の開始変数31と終了変数32を判定する(5007)。   The processor 20b determines the first start variable 31 and the end variable 32 (5007).

第1の変数が同じため、プロセッサ20bは、共有リソースを参照する(5008)。   Since the first variable is the same, the processor 20b refers to the shared resource (5008).

参照後、プロセッサ20bは、第2の両変数を読み出す(5009)。この場合、第2の両変数は、第1の両変数と同じ値(図9では「01」)である。   After the reference, the processor 20b reads both the second variables (5009). In this case, both the second variables are the same value as the first both variables (“01” in FIG. 9).

そのため、プロセッサ20bの変数の判定は、YESとなる(5010)。   Therefore, the determination of the variable of the processor 20b is YES (5010).

プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   The processor 20b terminates the reference operation because the referenced shared resource is valid.

このように構成された第1の実施形態の情報処理装置10は、特別な命令を用いずに、性能の低下を削減した排他制御を実現する効果を得ることができる。   The information processing apparatus 10 according to the first embodiment configured as described above can obtain an effect of realizing exclusive control with reduced performance reduction without using a special instruction.

その理由は、次のとおりである。   The reason is as follows.

情報処理装置10は、制御情報30aとして開始変数31及び終了変数32を含む。   The information processing apparatus 10 includes a start variable 31 and an end variable 32 as the control information 30a.

そして、共有リソースを更新するプロセッサ20aは、占有している共有リソースの更新を開始するときに開始変数31を更新し、更新を終了したときに終了変数32を更新する。   Then, the processor 20a that updates the shared resource updates the start variable 31 when the update of the occupied shared resource is started, and updates the end variable 32 when the update is completed.

プロセッサ20bに基づく共有リソースの参照は、共有リソースに影響を与えない。そのため、プロセッサ20bは、いつでも共有リソースを参照できる。さらに、プロセッサ20bは、開始変数31及び終了変数32を基に、共有リソースが更新中であるか否か、及び、参照中に更新が発生したか否かを判定できる。   The reference to the shared resource based on the processor 20b does not affect the shared resource. Therefore, the processor 20b can refer to the shared resource at any time. Further, the processor 20b can determine whether or not the shared resource is being updated based on the start variable 31 and the end variable 32 and whether or not the update has occurred during the reference.

つまり、プロセッサ20bは、更新が発生していない場合、常に共有リソースを参照できる。そして、更新中の場合、プロセッサ20bは、更新終了後に共有リソースを参照できる。また、参照中に更新が発生した場合、プロセッサ20bは、参照後に、更新の発生を検出できるため、再度参照し、更新後の共有リソースを参照できる。   That is, the processor 20b can always refer to the shared resource when no update has occurred. When updating, the processor 20b can refer to the shared resource after the update is completed. Further, when an update occurs during the reference, the processor 20b can detect the occurrence of the update after the reference, so that it can refer again and refer to the shared resource after the update.

このように、共有リソースを参照するプロセッサ20bは、共有リソースが更新するプロセッサ20aに占有されている場合でも、共有リソースを参照できる。   Thus, the processor 20b that refers to the shared resource can refer to the shared resource even when the shared resource is occupied by the processor 20a to be updated.

つまり、本実施形態の情報処理装置10の共有リソースを参照するプロセッサ20bは、共有リソースを占有しているプロセッサ20aの占有解除を待たなくても、共有リソースを参照できる。   That is, the processor 20b that refers to the shared resource of the information processing apparatus 10 according to this embodiment can refer to the shared resource without waiting for the processor 20a that occupies the shared resource to wait for the occupation to be released.

このため、本実施形態の情報処理装置10は、共有リソースの参照において、占有の解除の待ち時間を削減できる。その結果、情報処理装置10は、占有解除の待ち時間に基づく性能低下を削減できる。   For this reason, the information processing apparatus 10 according to the present embodiment can reduce the waiting time for releasing the occupation when referring to the shared resource. As a result, the information processing apparatus 10 can reduce performance degradation based on the waiting time for exclusive release.

また、本実施形態の情報処理装置10の共有リソースを参照するプロセッサ20bは、開始変数31及び終了変数32を用い、ロック設定及び解除せずに共有リソースを参照できる。   In addition, the processor 20b that refers to the shared resource of the information processing apparatus 10 according to the present embodiment can refer to the shared resource without using the start variable 31 and the end variable 32 without setting and releasing the lock.

そのため、共有リソースを参照するプロセッサ20bは、ロックの取得や解除などの処理を必要としない。そのため、情報処理装置10は、さらに、性能低下の低減できる。また、情報処理装置10は、ロックの競合を低減できる。   Therefore, the processor 20b that refers to the shared resource does not need processing such as acquisition or release of the lock. Therefore, the information processing apparatus 10 can further reduce performance degradation. Further, the information processing apparatus 10 can reduce lock contention.

さらに、共有リソースを参照するプロセッサ20bは、ロック取得が必要ないため、並列処理が可能である。その結果、情報処理装置10の処理性能が、さらに向上できるためである。   Furthermore, since the processor 20b that refers to the shared resource does not need to acquire a lock, it can perform parallel processing. As a result, the processing performance of the information processing apparatus 10 can be further improved.

なお、本実施形態の情報処理装置10の構成は、これまでの説明に限らない。情報処理装置10は、複数の構成を1つの構成としても良い。あるいは、情報処理装置10は、1つの構成を複数の構成に分けても良い。また、情報処理装置10は、CPU(Central Processing Unit)と、ROM(Read Only Memory)と、RAM(Random Access Memory)とを含むコンピュータとして実現しても良い。   Note that the configuration of the information processing apparatus 10 of the present embodiment is not limited to the above description. The information processing apparatus 10 may have a plurality of configurations as one configuration. Alternatively, the information processing apparatus 10 may divide one configuration into a plurality of configurations. The information processing apparatus 10 may be realized as a computer including a CPU (Central Processing Unit), a ROM (Read Only Memory), and a RAM (Random Access Memory).

図10は、本実施形態の別の構成である情報処理装置60の構成の一例を示す図である。   FIG. 10 is a diagram illustrating an example of a configuration of an information processing apparatus 60 that is another configuration of the present embodiment.

情報処理装置60は、CPU610aと、CPU610bと、ROM620と、RAM630と、IO(Input/Output)640と、内部記憶装置650と、キーボード660と、マウス670と、ディスプレイ680と、NIC690とを含み、コンピュータを構成している。   The information processing device 60 includes a CPU 610a, a CPU 610b, a ROM 620, a RAM 630, an IO (Input / Output) 640, an internal storage device 650, a keyboard 660, a mouse 670, a display 680, and a NIC 690. The computer is configured.

CPU610a及びCPU610bは、ROM620、又は、IO640を介して内部記憶装置650からプログラムを読み込む。そして、CPU610a及びCPU610bは、読み込んだプログラムに基づいて、既に説明した本実施形態の情報処理装置10のプロセッサ20として各機能を実現する。CPU610a及びCPU610bは、各機能を実現する際に、RAM630及び内部記憶装置650を一時記憶として使用する。また、CPU610a及びCPU610bは、資源制御部30としてRAM630又は内部記憶装置650を用いる。また、CPU610a及びCPU610bは、NIC690を介して、図示しない他の処理装置と情報をやり取りする。さらに、CPU610a及びCPU610bは、IO640を介して、キーボード660及びマウス670から入力データを受信し、ディスプレイ680に表示データを表示する。   The CPU 610 a and the CPU 610 b read a program from the internal storage device 650 via the ROM 620 or the IO 640. Then, the CPU 610a and the CPU 610b realize each function as the processor 20 of the information processing apparatus 10 of the present embodiment already described based on the read program. The CPU 610a and the CPU 610b use the RAM 630 and the internal storage device 650 as temporary storage when realizing each function. Further, the CPU 610 a and the CPU 610 b use the RAM 630 or the internal storage device 650 as the resource control unit 30. Further, the CPU 610 a and the CPU 610 b exchange information with other processing apparatuses (not shown) via the NIC 690. Further, the CPU 610 a and the CPU 610 b receive input data from the keyboard 660 and the mouse 670 via the IO 640 and display the display data on the display 680.

なお、CPU610a又はCPU610bは、コンピュータで読み取り可能にプログラムを記憶した記憶媒体700が含むプログラムを、図示しない記憶媒体読み取り装置を用いて読み込んでも良い。あるいは、CPU610a又はCPU610bは、NIC690を介してネットワークに接続された図示しない外部記憶装置からプログラムを読み込んでも良い。   Note that the CPU 610a or the CPU 610b may read the program included in the storage medium 700 that stores the program so as to be readable by a computer using a storage medium reading device (not shown). Alternatively, the CPU 610a or the CPU 610b may read a program from an external storage device (not shown) connected to the network via the NIC 690.

ROM620は、CPU610a及びCPU610bが実行するプログラム、及び、固定的なデータを記憶する。ROM620は、例えば、P−ROM(Programmable-ROM)やフラッシュROMである。   The ROM 620 stores programs executed by the CPU 610a and the CPU 610b and fixed data. The ROM 620 is, for example, a P-ROM (Programmable-ROM) or a flash ROM.

RAM630は、CPU610a及びCPU610bが実行するプログラムやデータを一時的に記憶する。RAM630は、資源制御部30として動作しても良い。RAM630は、例えば、D−RAM(Dynamic-RAM)である。   The RAM 630 temporarily stores programs and data executed by the CPU 610a and the CPU 610b. The RAM 630 may operate as the resource control unit 30. The RAM 630 is, for example, a D-RAM (Dynamic-RAM).

IO640は、内部記憶装置650やキーボード660などとCPU610a及びCPU610bとのデータを仲介する。IO640は、例えば、IOインターフェースカードである。   The IO 640 mediates data between the internal storage device 650 and the keyboard 660 and the CPU 610a and CPU 610b. The IO 640 is, for example, an IO interface card.

内部記憶装置650は、情報処理装置60の長期的に保存するデータやプログラムを保存する。また、内部記憶装置650は、資源制御部30として動作してもよい。さらに、内部記憶装置650は、CPU610a及びCPU610bの一時記憶装置として動作しても良い。内部記憶装置650は、例えば、ハードディスク装置、光磁気ディスク装置、SSD(Solid State Drive)、又は、ディスクアレイ装置である。   The internal storage device 650 stores data and programs stored in the information processing device 60 for a long time. Further, the internal storage device 650 may operate as the resource control unit 30. Further, the internal storage device 650 may operate as a temporary storage device for the CPU 610a and the CPU 610b. The internal storage device 650 is, for example, a hard disk device, a magneto-optical disk device, an SSD (Solid State Drive), or a disk array device.

キーボード660及びマウス670は、情報処理装置60の操作者からの入力指示を受信する入力部である。キーボード660及びマウス670は、受信した入力指示のデータをCPU610a又はCPU610bに送信する。   The keyboard 660 and the mouse 670 are input units that receive input instructions from an operator of the information processing apparatus 60. The keyboard 660 and the mouse 670 transmit the received input instruction data to the CPU 610a or the CPU 610b.

ディスプレイ680は、情報処理装置60の表示部である。CPU610a又はCPU610bは、操作者に必要な情報を、ディスプレイ680に表示する。   The display 680 is a display unit of the information processing apparatus 60. The CPU 610a or the CPU 610b displays information necessary for the operator on the display 680.

NIC690は、ネットワークを介した他の装置との情報のやり取りを中継する。NIC690は、例えば、LANカードである。   The NIC 690 relays information exchange with other devices via the network. The NIC 690 is, for example, a LAN card.

このように構成された情報処理装置60は、情報処理装置10と同様の効果を得ることができる。   The information processing apparatus 60 configured as described above can obtain the same effects as the information processing apparatus 10.

その理由は、情報処理装置60のCPU610a及びCPU610bが、プログラムに基づいて情報処理装置10のプロセッサ20と同様の動作を実現できるためである。
(変形例1)
第1の実施形態の情報処理装置10は、開始変数31と終了変数32とを基に、共有リソースの更新を検出する。ただし、本実施形態の情報処理装置10の参照動作は、図5を用いた説明の動作に限らない。
This is because the CPU 610a and CPU 610b of the information processing device 60 can realize the same operation as the processor 20 of the information processing device 10 based on the program.
(Modification 1)
The information processing apparatus 10 according to the first embodiment detects an update of the shared resource based on the start variable 31 and the end variable 32. However, the reference operation of the information processing apparatus 10 of the present embodiment is not limited to the operation described with reference to FIG.

図11は、第1の実施形態に係る情報処理装置10の参照動作の別の動作の一例を示すフローチャートである。   FIG. 11 is a flowchart illustrating an example of another operation of the reference operation of the information processing apparatus 10 according to the first embodiment.

図11において、図5との差は、図5のステップ205とステップ206を、ステップ305に変更した点である。そのため、ステップ305について説明し、他の説明は省略する。   In FIG. 11, the difference from FIG. 5 is that step 205 and step 206 in FIG. Therefore, step 305 will be described, and other description will be omitted.

図5に示した参照動作において、プロセッサ20bは、次を確認した。   In the reference operation illustrated in FIG. 5, the processor 20 b confirmed the following.

ステップ205において、プロセッサ20bは、第1の終了変数32と第2の終了変数32が一致する否か、つまり、参照開始時に終了した更新と、参照終了後に終了した更新とが、一致するか否かを判定する。   In step 205, the processor 20b determines whether or not the first end variable 32 and the second end variable 32 match, that is, whether or not the update completed at the start of reference matches the update ended after the reference ends. Determine whether.

ステップ206において、プロセッサ20bは、第2の開始変数31と第2の終了変数32が一致するか否か、つまり、参照終了時に更新中か否かを判定する。   In step 206, the processor 20b determines whether or not the second start variable 31 and the second end variable 32 match, that is, whether or not updating is in progress at the end of reference.

しかし、プロセッサ20bは、ステップ202において、更新中でないことを確認してから参照動作を開始している。   However, the processor 20b starts the reference operation after confirming in step 202 that the update is not in progress.

そのため、プロセッサ20bは、参照終了時に、参照中に更新が発生したか否かを判定しても良い。   Therefore, the processor 20b may determine whether or not an update has occurred during the reference at the end of the reference.

そのため、本変形例のプロセッサ20bは、ステップ305において、第1の開始変数31と第2の開始変数31が一致する否か、つまり、参照終了時に、更新が発生したか否かを判定する。   Therefore, in step 305, the processor 20b of the present modification determines whether or not the first start variable 31 and the second start variable 31 match, that is, whether or not an update has occurred at the end of the reference.

更新が発生した場合(ステップ305のNO)、プロセッサ20bは、ステップ201に戻り、参照動作を最初から再開する。   If an update has occurred (NO in step 305), the processor 20b returns to step 201 and restarts the reference operation from the beginning.

更新が発生していない場合(ステップ305でYES)、プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   If no update has occurred (YES in step 305), the processor 20b determines that the referenced shared resource is valid and ends the reference operation.

変形例1の情報処理装置10は、第1の実施形態の情報処理装置10と同様の効果を得ることができる。   The information processing apparatus 10 of Modification 1 can obtain the same effects as the information processing apparatus 10 of the first embodiment.

その理由は、変形例1の情報処理装置10は、第1の実施形態の情報処理装置10と同様に、共有リソースの参照中に発生した更新を検出でき、更新が発生した場合に、再度、参照動作が可能なためである。   The reason is that the information processing apparatus 10 according to the first modification can detect an update that occurred while referring to the shared resource, as in the information processing apparatus 10 according to the first embodiment. This is because the reference operation is possible.

(第2の実施形態)
本実施形態の情報処理装置10の制御情報30aは、図2に示す開始変数31及び終了変数32に限らない。
(Second Embodiment)
The control information 30a of the information processing apparatus 10 according to the present embodiment is not limited to the start variable 31 and the end variable 32 illustrated in FIG.

第2の実施形態に係る情報処理装置10の資源制御部30は、図12に示すように、制御情報30bとして制御変数33を含む。その他の構成は、第1の実施形態の同様のため、詳細な説明は省略し、制御変数33に関係する構成について説明する。   As shown in FIG. 12, the resource control unit 30 of the information processing apparatus 10 according to the second embodiment includes a control variable 33 as control information 30b. Since the other configuration is the same as that of the first embodiment, a detailed description is omitted, and a configuration related to the control variable 33 will be described.

制御変数33は、共有リソースの更新状態を示す。なお、制御変数33は、初期値として特に制限はないが、以下の説明では、初期値を0(偶数)として説明する。なお、初期値を奇数とした場合、以下の説明において、偶数と奇数を入れ替えればよい。   The control variable 33 indicates the update state of the shared resource. The control variable 33 is not particularly limited as an initial value, but in the following description, the initial value is assumed to be 0 (even). When the initial value is an odd number, the even number and the odd number may be interchanged in the following description.

共有リソースを更新するプロセッサ20aは、共有リソースの更新の開始時と終了時に制御変数33を更新(例えば、1加算)する。   The processor 20a that updates the shared resource updates (for example, adds 1) the control variable 33 at the start and end of the update of the shared resource.

共有リソースを参照するプロセッサ20bは、共有リソースの参照前と参照後の制御変数33の値を基に、更新中、及び、参照中の更新の発生の有無を判定する。   Based on the value of the control variable 33 before and after referring to the shared resource, the processor 20b that refers to the shared resource determines whether or not the update during the reference and occurrence of the update is being performed.

第2の実施形態の情報処理装置10の動作について図を参照して説明する。   The operation of the information processing apparatus 10 according to the second embodiment will be described with reference to the drawings.

図13は、第2の実施形態の情報処理装置10の更新動作の一例を示すフローチャートである。   FIG. 13 is a flowchart illustrating an example of an update operation of the information processing apparatus 10 according to the second embodiment.

プロセッサ20aの更新における排他制御は、第1の実施形態の同様のため、詳細な説明は省略する。   Since the exclusive control in the update of the processor 20a is the same as that of the first embodiment, detailed description thereof is omitted.

プロセッサ20aは、制御変数33を更新(1加算)する(ステップ401)。つまり、制御変数33は、奇数になる。   The processor 20a updates (adds 1) the control variable 33 (step 401). That is, the control variable 33 is an odd number.

次に、プロセッサ20aは、必要に応じて共有リソースに保護機構を設定する(ステップ402)。   Next, the processor 20a sets a protection mechanism for the shared resource as necessary (step 402).

保護を設定後、プロセッサ20aは、共有リソースを更新する(ステップ403)。   After setting the protection, the processor 20a updates the shared resource (step 403).

更新後、プロセッサ20aは、保護機構を解除する(ステップ404)。   After the update, the processor 20a releases the protection mechanism (Step 404).

その後、プロセッサ20aは、制御変数33を更新(1加算)する(ステップ405)。つまり、制御変数33は、偶数に戻る。   Thereafter, the processor 20a updates (adds 1) the control variable 33 (step 405). That is, the control variable 33 returns to an even number.

図14は、第2の実施形態の情報処理装置10の更新動作の一例のシーケンス図である。図14においても、共有リソースの保護機能についての動作は、省略した。   FIG. 14 is a sequence diagram illustrating an example of an update operation of the information processing apparatus 10 according to the second embodiment. Also in FIG. 14, the operation for the shared resource protection function is omitted.

プロセッサ20aは、制御変数33を(奇数に)更新する(1007)。   The processor 20a updates the control variable 33 (to an odd number) (1007).

そして、プロセッサ20aは、共有リソースを更新する(1008)。   Then, the processor 20a updates the shared resource (1008).

その後、プロセッサ20aは、制御変数33を(偶数に)更新する(1009)。   Thereafter, the processor 20a updates the control variable 33 (to an even number) (1009).

このような動作を基に、情報処理装置10は、共有リソースの更新に関して、次の状態を実現する。   Based on such an operation, the information processing apparatus 10 realizes the following state regarding the update of the shared resource.

(1)更新中、制御変数33は、奇数である。   (1) During the update, the control variable 33 is an odd number.

(2)更新の前後において、制御変数33は、偶数であるが、値が異なる。   (2) Before and after the update, the control variable 33 is an even number but has a different value.

なお、図14には、参考として、他のプロセッサ20の例として、プロセッサ20bが、共有リソースを更新する場合のシーケンス(1010−1012)も示している。   For reference, FIG. 14 also shows a sequence (1010-1012) when the processor 20b updates the shared resource as an example of the other processor 20.

このように、共有リソースを更新するプロセッサ20aは、更新の前後において、制御変数33を更新する。   As described above, the processor 20a that updates the shared resource updates the control variable 33 before and after the update.

次に、本実施形態の情報処理装置10が、共有リソースを参照する場合の動作について説明する。   Next, an operation when the information processing apparatus 10 according to the present embodiment refers to a shared resource will be described.

図15は、第2の実施形態の情報処理装置10の参照動作の一例を示すフローチャートである。   FIG. 15 is a flowchart illustrating an example of a reference operation of the information processing apparatus 10 according to the second embodiment.

共有リソースを参照するプロセッサ20bは、参照の前に制御変数33を読み出す(ステップ501)。以下、ステップ501で読み出した変数を「第1の制御変数33」と言う。   The processor 20b that refers to the shared resource reads the control variable 33 before referencing (step 501). Hereinafter, the variable read in step 501 is referred to as “first control variable 33”.

プロセッサ20bは、第1の制御変数33の値を確認する(ステップ502)。具体的には、プロセッサ20bは、第1の制御変数33が偶数か否かを判定する。この判定は、上記のとおり、共有リソースが更新中であるか否かの判定である。   The processor 20b confirms the value of the first control variable 33 (step 502). Specifically, the processor 20b determines whether or not the first control variable 33 is an even number. This determination is a determination as to whether or not the shared resource is being updated as described above.

第1の制御変数33が偶数でない(奇数の)場合(ステップ502でNO)、プロセッサ20bは、ステップ501に戻る。プロセッサ20bは、第1の制御変数33が偶数になるまで、待つ。この動作は、第1の実施形態と同様に、ステップ501と502との繰り返しでよいし、ウェイト状態を用いても良い。   If the first control variable 33 is not even (odd) (NO in step 502), the processor 20b returns to step 501. The processor 20b waits until the first control variable 33 becomes an even number. Similar to the first embodiment, this operation may be a repetition of steps 501 and 502, or a wait state may be used.

第1の制御変数33が偶数、つまり更新中でない場合(ステップ502でYES)、プロセッサ20bは、共有データを参照する(ステップ503)。   If the first control variable 33 is an even number, that is, not being updated (YES in step 502), the processor 20b refers to the shared data (step 503).

参照後、プロセッサ20bは、制御変数33を読み出す(ステップ504)。ステップ504で読み出した変数を「第2の制御変数33」と言う。   After the reference, the processor 20b reads the control variable 33 (step 504). The variable read in step 504 is referred to as “second control variable 33”.

次に、プロセッサ20bは、第1の制御変数33と第2の制御変数33とを確認する(ステップ505)。具体的には、プロセッサ20bは、第1の制御変数33と第2の制御変数33とが同じか否かを判定する。この判定は、第1の制御変数33を読み出した後、終了した更新処理が発生したか否かの判定である。   Next, the processor 20b checks the first control variable 33 and the second control variable 33 (step 505). Specifically, the processor 20b determines whether or not the first control variable 33 and the second control variable 33 are the same. This determination is a determination as to whether or not an update process that has ended after reading the first control variable 33 has occurred.

第1の制御変数33と第2の制御変数33が異なる、つまり、終了した更新が発生した場合(ステップ505でNO)、プロセッサ20bは、ステップ501に戻り、最初から参照動作を始める。ステップ501に戻るのは、共有リソースが更新されているため、ステップ503での参照が無効の可能性があるためである。   When the first control variable 33 and the second control variable 33 are different, that is, when the completed update has occurred (NO in step 505), the processor 20b returns to step 501 and starts the reference operation from the beginning. The reason for returning to step 501 is that the reference in step 503 may be invalid because the shared resource has been updated.

第1の制御変数33と第2の制御変数33が同じ値の場合(ステップ505でYES)、プロセッサ20bは、第2の制御変数33の値を確認する(ステップ506)。具体的には、プロセッサ20bは、第2の制御変数33が偶数か否かを判定する。この判定は、更新動作中か否かの判定である。   When the first control variable 33 and the second control variable 33 have the same value (YES in step 505), the processor 20b checks the value of the second control variable 33 (step 506). Specifically, the processor 20b determines whether or not the second control variable 33 is an even number. This determination is a determination as to whether or not an update operation is being performed.

第2の制御変数33が奇数、つまり、更新中の場合(ステップ506でNO)、プロセッサ20bは、ステップ501に戻り、最初から参照動作を始める。ステップ501に戻るのは、共有リソースの更新が開始されているため、ステップ503での参照が無効の可能性があるためである。   When the second control variable 33 is an odd number, that is, being updated (NO in step 506), the processor 20b returns to step 501 and starts the reference operation from the beginning. The reason for returning to step 501 is that the reference in step 503 may be invalid because the update of the shared resource has started.

第2の制御変数33が偶数の場合(ステップ506でYES)、プロセッサ20bは、参照動作を終了する。プロセッサ20bは、適宜、次の動作に移る。   If the second control variable 33 is an even number (YES in step 506), the processor 20b ends the reference operation. The processor 20b proceeds to the next operation as appropriate.

なお、ステップ505とステップ506は、どちらも変数の判定の動作である。そのため、情報処理装置10は、この動作を分けずに、1つの判定動作として実行しても良い。   Steps 505 and 506 are both variable determination operations. Therefore, the information processing apparatus 10 may execute this determination operation as one determination operation without dividing the operation.

また、プロセッサ20bは、ステップ502で制御変数33が偶数である場合に処理を進めている。つまり、第1の制御変数33は、偶数である。更新中の制御変数33は、奇数となる。奇数と偶数は、異なる値である。つまり、更新中の場合も、プロセッサ20bは、ステップ505の判定がNOとなる。したがって、プロセッサ20bは、ステップ506を省略しても良い。   The processor 20b proceeds with the process when the control variable 33 is an even number in step 502. That is, the first control variable 33 is an even number. The control variable 33 being updated is an odd number. Odd and even numbers are different values. That is, even when updating is in progress, the processor 20b makes a negative determination in step 505. Therefore, the processor 20b may omit step 506.

このように、共有リソースを参照するプロセッサ20bは、共有リソースに排他機構を設定されているか否かに係わらず、制御変数33を基に共有リソースを参照できる。   As described above, the processor 20b that refers to the shared resource can refer to the shared resource based on the control variable 33 regardless of whether or not the exclusive mechanism is set for the shared resource.

次に、情報処理装置10が、適切に共有リソースを参照できることを、図16−19を参照して説明する。なお、図面の煩雑さを避けるため、図16−図19において、図15のステップ505とステップ506との判断は、1つの判断として示す。   Next, the fact that the information processing apparatus 10 can appropriately refer to the shared resource will be described with reference to FIGS. Note that, in order to avoid the complexity of the drawings, in FIG. 16 to FIG. 19, the determinations of step 505 and step 506 in FIG. 15 are shown as one determination.

まず、共有リソースの更新動作と参照動作とが重ならない場合について説明する。   First, a case where the shared resource update operation and the reference operation do not overlap will be described.

図16は、プロセッサ20aが共有リソースの更新を終了後、プロセッサ20bが参照動作を開始した場合のシーケンス図である。   FIG. 16 is a sequence diagram when the processor 20b starts the reference operation after the processor 20a finishes updating the shared resource.

プロセッサ20bは、第1の制御変数33を読み出す(6001)。この場合、第1の制御変数33は、偶数(図16では「02」)となる。   The processor 20b reads the first control variable 33 (6001). In this case, the first control variable 33 is an even number (“02” in FIG. 16).

そのため、第1の制御変数33の判定(図15のステップ502)は、YESとなる(6002)。   Therefore, the determination of the first control variable 33 (step 502 in FIG. 15) is YES (6002).

そして、プロセッサ20bは、共有リソースを参照する(6003)。   Then, the processor 20b refers to the shared resource (6003).

プロセッサ20bは、第2の制御変数33を読み出す(6004)。この場合、第2の制御変数33は、第1の制御変数33と同じ値(図16では「02」)となる。   The processor 20b reads the second control variable 33 (6004). In this case, the second control variable 33 has the same value as the first control variable 33 (“02” in FIG. 16).

そのため、ステップ505及び506に対応する変数の判定は、どちらもYESとなる(6005)。   Therefore, the determination of the variable corresponding to steps 505 and 506 is both YES (6005).

その結果、プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   As a result, the processor 20b makes the referenced shared resource valid and ends the reference operation.

次に、プロセッサ20aが更新動作中に、プロセッサ20bが参照動作を開始した場合について説明する。   Next, a case where the processor 20b starts the reference operation while the processor 20a is performing the update operation will be described.

図17は、プロセッサ20aが更新動作中に、プロセッサ20bが参照動作を開始した場合のシーケンス図である。   FIG. 17 is a sequence diagram when the processor 20b starts the reference operation during the update operation of the processor 20a.

プロセッサ20bは、第1の制御変数33を読み出す(7001)。この場合、プロセッサ20aは、更新中である。そのため、第1の制御変数33は、奇数(図17では、「01」)となる。   The processor 20b reads the first control variable 33 (7001). In this case, the processor 20a is being updated. Therefore, the first control variable 33 is an odd number (“01” in FIG. 17).

そのため、第1の制御変数33の判定(図15のステップ502)は、NOとなる(7002)。   Therefore, the determination of the first control variable 33 (step 502 in FIG. 15) is NO (7002).

プロセッサ20aの更新動作が終了するまで、第1の制御変数33は、奇数である。そのため、プロセッサ20bは、図15のステップ501−502(図17では、7001−7002)を繰り返す。   Until the update operation of the processor 20a ends, the first control variable 33 is an odd number. Therefore, the processor 20b repeats steps 501 to 502 in FIG. 15 (7001 to 7002 in FIG. 17).

プロセッサ20aが更新動作を終了すると、第1の制御変数33は、偶数になる。   When the processor 20a finishes the update operation, the first control variable 33 becomes an even number.

その後、プロセッサ20bが、第1の制御変数33を読み出す(7003)と、第1の制御変数33は、偶数(図17では「02」)となる。   Thereafter, when the processor 20b reads the first control variable 33 (7003), the first control variable 33 becomes an even number ("02" in FIG. 17).

そのため、第1の制御変数33の判定(図15のステップ502)は、YESとなる(7004)。   Therefore, the determination of the first control variable 33 (step 502 in FIG. 15) is YES (7004).

これ以降、プロセッサ20bは、図16の6003−6005と同様に動作する。   Thereafter, the processor 20b operates in the same manner as 6003 to 6005 in FIG.

つまり、プロセッサ20bは、共有リソースを参照する(7005)。   That is, the processor 20b refers to the shared resource (7005).

プロセッサ20bは、第2の制御変数33を読み出す(7006)。この場合、第2の制御変数33は、第1の制御変数33と同じ値(図17では「02」)である。   The processor 20b reads the second control variable 33 (7006). In this case, the second control variable 33 is the same value as the first control variable 33 (“02” in FIG. 17).

そのため、ステップ505及び506に対応する変数の判定は、どちらもYESとなる(7007)。   Therefore, the determination of the variables corresponding to steps 505 and 506 are both YES (7007).

その結果、プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   As a result, the processor 20b makes the referenced shared resource valid and ends the reference operation.

次に、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始した場合について説明する。まず、プロセッサ20bの第2の制御変数33の確認前に、プロセッサ20aの更新動作が終了した場合について説明する。   Next, the case where the processor 20a starts the update operation after the processor 20b starts the reference operation will be described. First, a case where the update operation of the processor 20a is completed before the second control variable 33 of the processor 20b is confirmed will be described.

図18は、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の制御変数33の確認前に、プロセッサ20aの更新動作が終了した場合のシーケンス図である。   FIG. 18 is a sequence diagram when the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a is completed before the second control variable 33 of the processor 20b is confirmed. It is.

プロセッサ20bは、第1の制御変数33を読み込む(8001)。この場合、第1の制御変数33は、偶数(図18では「00」)である。   The processor 20b reads the first control variable 33 (8001). In this case, the first control variable 33 is an even number (“00” in FIG. 18).

そのため、第1の制御変数33の判定(図15のステップ502)は、YESとなる(8002)。   Therefore, the determination of the first control variable 33 (step 502 in FIG. 15) is YES (8002).

プロセッサ20bは、共有リソースを参照する(8003)。   The processor 20b refers to the shared resource (8003).

ただし、プロセッサ20aは、プロセッサ20bが共有リソースを参照中に、共有リソースを更新している。そのため、制御変数33は、更新(図18では「02」)されている。   However, the processor 20a updates the shared resource while the processor 20b is referring to the shared resource. Therefore, the control variable 33 is updated (“02” in FIG. 18).

プロセッサ20bは、第2の制御変数33を読み出す(8004)。上記のとおり、第2の制御変数33は、更新された後のため、第1の制御変数33とは異なる。   The processor 20b reads the second control variable 33 (8004). As described above, the second control variable 33 is different from the first control variable 33 because it has been updated.

そのため、プロセッサ20bの変数の判定、具体的には、図15のステップ505の判定がNOとなる(8005)。   Therefore, the determination of the variable of the processor 20b, specifically, the determination of step 505 in FIG. 15 is NO (8005).

そのため、プロセッサ20bは、参照動作の最初(図15のステップ501)に戻り、参照動作をやり直す。つまり、プロセッサ20bは、図16の6001−6005に相当する図18の8006−8010を実行する。   Therefore, the processor 20b returns to the beginning of the reference operation (step 501 in FIG. 15) and redoes the reference operation. That is, the processor 20b executes 8006-8010 in FIG. 18 corresponding to 6001 to 6005 in FIG.

具体的に説明すると次のとおりである。   Specifically, it is as follows.

プロセッサ20bは、第1の制御変数33を読み出す(8006)。第1の制御変数33は、偶数(図18では、「02」)である。   The processor 20b reads the first control variable 33 (8006). The first control variable 33 is an even number (“02” in FIG. 18).

プロセッサ20bは、第1の制御変数33を判定する(8007)。   The processor 20b determines the first control variable 33 (8007).

第1の制御変数33が偶数のため、プロセッサ20bは、共有リソースを参照する(8008)。   Since the first control variable 33 is an even number, the processor 20b refers to the shared resource (8008).

プロセッサ20bは、第2の制御変数33を読み出す(8009)。この場合、第2の制御変数33は、第1の制御変数33と同じ偶数の値(図18では「02」)である。   The processor 20b reads the second control variable 33 (8009). In this case, the second control variable 33 is the same even value as the first control variable 33 (“02” in FIG. 18).

そのため、プロセッサ20bの変数の判定は、YESとなる(8010)。   Therefore, the determination of the variable of the processor 20b is YES (8010).

プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   The processor 20b terminates the reference operation because the referenced shared resource is valid.

続いて、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の制御変数33の確認時に、プロセッサ20aの更新動作が終了していない場合について説明する。   Next, a case will be described in which the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a is not completed when the second control variable 33 of the processor 20b is confirmed. .

図19は、プロセッサ20bが参照動作を開始してから、プロセッサ20aが更新動作を開始し、プロセッサ20bの第2の制御変数33の確認時に、プロセッサ20aの更新動作が終了していない場合のシーケンス図である。   FIG. 19 shows a sequence when the processor 20a starts the update operation after the processor 20b starts the reference operation, and the update operation of the processor 20a is not finished when the second control variable 33 of the processor 20b is confirmed. FIG.

プロセッサ20bは、第1の制御変数33を読み出す(9001)。この場合、第1の制御変数33は、偶数(図19では「00」)である。   The processor 20b reads the first control variable 33 (9001). In this case, the first control variable 33 is an even number (“00” in FIG. 19).

そのため、第1の制御変数33の判定(図15のステップ502)は、YESとなる(9002)。   Therefore, the determination of the first control variable 33 (step 502 in FIG. 15) is YES (9002).

プロセッサ20bは、共有リソースを参照する(9003)。   The processor 20b refers to the shared resource (9003).

ただし、プロセッサ20aは、プロセッサ20bが共有リソースを参照中に、共有リソースの更新を開始している。そのため、制御変数33は、更新(図19では「01」)されている。   However, the processor 20a starts updating the shared resource while the processor 20b is referring to the shared resource. For this reason, the control variable 33 has been updated (“01” in FIG. 19).

プロセッサ20bは、第2の制御変数33を読み出す(9004)。上記のとおり、第2の制御変数33は、更新されたため、第1の制御変数33とは異なる。   The processor 20b reads the second control variable 33 (9004). As described above, since the second control variable 33 has been updated, it is different from the first control variable 33.

そのため、プロセッサ20bの制御変数33の判定、具体的には、図15のステップ505の判定がNOとなる(5005)。   Therefore, the determination of the control variable 33 of the processor 20b, specifically, the determination of step 505 in FIG. 15 is NO (5005).

そのため、プロセッサ20bは、参照動作の最初(図15のステップ501)に戻り、参照動作をやり直す。   Therefore, the processor 20b returns to the beginning of the reference operation (step 501 in FIG. 15) and redoes the reference operation.

これ以降の動作は、図17と同様の動作になる。   Subsequent operations are the same as those in FIG.

つまり、プロセッサ20bは、第1の制御変数33が偶数になるまで、制御変数33の読み出しと判定を繰り返す。   That is, the processor 20b repeats the reading and determination of the control variable 33 until the first control variable 33 becomes an even number.

プロセッサ20aが、更新を終了すると、制御変数33が偶数(図19では「02」)となる。   When the processor 20a finishes the update, the control variable 33 becomes an even number ("02" in FIG. 19).

その後、プロセッサ20bが、第1の制御変数33を読み出す(9006)と、第1の制御変数33は、偶数(図19では、「02」)である。   Thereafter, when the processor 20b reads the first control variable 33 (9006), the first control variable 33 is an even number ("02" in FIG. 19).

プロセッサ20bは、第1の制御変数33を判定する(9007)。   The processor 20b determines the first control variable 33 (9007).

第1の制御変数33が偶数のため、プロセッサ20bは、共有リソースを参照する(9008)。   Since the first control variable 33 is an even number, the processor 20b refers to the shared resource (9008).

プロセッサ20bは、第2の制御変数33を読み出す(9009)。この場合、第2の制御変数33は、第1の制御変数33と同じ偶数(図19では「02」)である。   The processor 20b reads the second control variable 33 (9009). In this case, the second control variable 33 is the same even number as the first control variable 33 (“02” in FIG. 19).

そのため、プロセッサ20bの変数の判定は、YESとなる(9010)。   Therefore, the determination of the variable of the processor 20b is YES (9010).

プロセッサ20bは、参照した共有リソースが有効として、参照動作を終了する。   The processor 20b terminates the reference operation because the referenced shared resource is valid.

このように構成された第2の実施形態の情報処理装置10は、第1の実施形態の情報処理装置10と同様の効果を得ることができる。   The information processing apparatus 10 of the second embodiment configured as described above can obtain the same effects as the information processing apparatus 10 of the first embodiment.

その理由は、第2の実施形態の情報処理装置10は、制御変数33を用いて、開始変数31と終了変数32とを用いる第1の実施形態の情報処理装置10と同様に動作できるためである。   The reason is that the information processing apparatus 10 of the second embodiment can operate in the same manner as the information processing apparatus 10 of the first embodiment using the start variable 31 and the end variable 32 using the control variable 33. is there.

以上、実施形態を参照して本願発明を説明したが、本願発明は上記実施形態に限定されるものではない。本願発明の構成や詳細には、本願発明のスコープ内で当業者が理解し得る様々な変更をすることができる。   While the present invention has been described with reference to the embodiments, the present invention is not limited to the above embodiments. Various changes that can be understood by those skilled in the art can be made to the configuration and details of the present invention within the scope of the present invention.

10 情報処理装置
20 プロセッサ
20a プロセッサ
20b プロセッサ
30 資源制御部
30a 制御情報
30b 制御情報
31 開始変数
32 終了変数
33 制御変数
60 情報処理装置
610a CPU
610b CPU
620 ROM
630 RAM
640 IO
650 内部記憶装置
660 キーボード
670 マウス
680 ディスプレイ
690 NIC
700 記憶媒体
DESCRIPTION OF SYMBOLS 10 Information processing apparatus 20 Processor 20a Processor 20b Processor 30 Resource control part 30a Control information 30b Control information 31 Start variable 32 End variable 33 Control variable 60 Information processing apparatus 610a CPU
610b CPU
620 ROM
630 RAM
640 IO
650 Internal storage device 660 Keyboard 670 Mouse 680 Display 690 NIC
700 storage media

Claims (6)

共有資源の更新状態を示す制御情報を保持する資源制御部と、
前記共有資源を更新する前に前記資源制御部の制御情報を更新し、前記共有資源を更新後に前記資源制御部の制御情報をさらに更新する第1の処理部と、
前記資源制御部の制御情報を基に前記第1の処理部が前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記資源制御部の制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する第2の処理部と
を含む情報処理装置。
A resource control unit that holds control information indicating an update state of the shared resource;
A first processing unit that updates control information of the resource control unit before updating the shared resource, and further updates control information of the resource control unit after updating the shared resource;
Based on the control information of the resource control unit, the first processing unit performs a first determination as to whether or not the shared resource is being updated. If the shared resource is not being updated, the shared resource is referred to and updated. When the update is completed, the shared resource is referred to after the update is completed, and after the reference to the shared resource, it is determined whether the update of the shared resource occurs during the reference based on the control information of the resource control unit. And a second processing unit that refers to the shared resource again when an update occurs.
前記資源制御部の前記制御情報は、
前記共有資源の更新前に更新される開始変数と、
前記共有資源の更新後に更新される終了変数と
を含む請求項1に記載の情報処理装置。
The control information of the resource control unit is:
A start variable that is updated before updating the shared resource;
The information processing apparatus according to claim 1, further comprising: an end variable that is updated after the shared resource is updated.
前記資源制御部の前記制御情報は、
前記共有資源の更新前及び更新後に更新される制御変数を
含む請求項1に記載の情報処理装置。
The control information of the resource control unit is:
The information processing apparatus according to claim 1, further comprising: a control variable that is updated before and after updating the shared resource.
前記第2の処理部は、
前記共有資源の参照前に前記資源制御部から取り出した前記制御情報を第1の変数として前記第1の判定を行い、
前記共有資源の参照後に前記資源制御部から取り出した前記制御情報を第2の変数として前記第1の変数及び前記第2の変数を基に前記第2の判定を行う
請求項1乃至請求項3のいずれか1項に記載の情報処理装置。
The second processing unit includes:
Performing the first determination using the control information extracted from the resource control unit before referring to the shared resource as a first variable;
The second determination is performed based on the first variable and the second variable by using the control information extracted from the resource control unit after referring to the shared resource as a second variable. The information processing apparatus according to any one of the above.
共有資源の更新状態を示す制御情報を保持し、
前記共有資源を更新する場合、前記共有資源を更新する前に前記制御情報を更新し、前記共有資源を更新後に前記制御情報をさらに更新し、
前記共有資源を参照する場合、前記制御情報を基に前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する
情報処理方法。
Holds control information indicating the update status of shared resources,
When updating the shared resource, update the control information before updating the shared resource, further update the control information after updating the shared resource,
When referring to the shared resource, a first determination is made as to whether or not the shared resource is being updated based on the control information. When the shared resource is not being updated, the shared resource is referred to and being updated. Refers to the shared resource after the update is completed, and after the reference to the shared resource, performs a second determination, which is a determination as to whether or not the update of the shared resource has occurred during the reference based on the control information, An information processing method that refers to the shared resource again when an error occurs.
共有資源の更新状態を示す制御情報を保持する処理と、
前記共有資源を更新する場合、前記共有資源の更新の前に前記制御情報を更新し、前記共有資源の更新後に前記制御情報をさらに更新する処理と、
前記共有資源を参照する場合、前記制御情報を基に前記共有資源を更新中か否かの判定である第1の判定を行い、更新中でない場合は前記共有資源を参照し、更新中の場合は更新終了後に前記共有資源を参照し、前記共有資源の参照後、前記制御情報を基に参照中に前記共有資源の更新が発生したか否かを判定である第2の判定を行い、更新が発生した場合、前記共有資源を再度参照する処理と
をコンピュータに実行させるプログラム。
A process for holding control information indicating the update state of the shared resource;
When updating the shared resource, updating the control information before updating the shared resource, and further updating the control information after updating the shared resource;
When referring to the shared resource, a first determination is made as to whether or not the shared resource is being updated based on the control information. When the shared resource is not being updated, the shared resource is referred to and being updated. Refers to the shared resource after the update is completed, and after the reference to the shared resource, performs a second determination, which is a determination as to whether or not the update of the shared resource has occurred during the reference based on the control information, A program that causes a computer to execute a process of re-referencing the shared resource when a problem occurs.
JP2012032474A 2012-02-17 2012-02-17 Information processing apparatus and information processing method Active JP5890194B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012032474A JP5890194B2 (en) 2012-02-17 2012-02-17 Information processing apparatus and information processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012032474A JP5890194B2 (en) 2012-02-17 2012-02-17 Information processing apparatus and information processing method

Publications (2)

Publication Number Publication Date
JP2013168103A true JP2013168103A (en) 2013-08-29
JP5890194B2 JP5890194B2 (en) 2016-03-22

Family

ID=49178436

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012032474A Active JP5890194B2 (en) 2012-02-17 2012-02-17 Information processing apparatus and information processing method

Country Status (1)

Country Link
JP (1) JP5890194B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021060707A (en) * 2019-10-04 2021-04-15 イーソル株式会社 Synchronization control system and synchronization control method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09305478A (en) * 1996-05-16 1997-11-28 Toshiba Corp Information exchange system between information processors
JP2006285341A (en) * 2005-03-31 2006-10-19 Fujitsu Ltd Data input and output program, device and method
JP2011128975A (en) * 2009-12-18 2011-06-30 Internatl Business Mach Corp <Ibm> System, method, program, and code generation unit

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09305478A (en) * 1996-05-16 1997-11-28 Toshiba Corp Information exchange system between information processors
JP2006285341A (en) * 2005-03-31 2006-10-19 Fujitsu Ltd Data input and output program, device and method
JP2011128975A (en) * 2009-12-18 2011-06-30 Internatl Business Mach Corp <Ibm> System, method, program, and code generation unit

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021060707A (en) * 2019-10-04 2021-04-15 イーソル株式会社 Synchronization control system and synchronization control method
JP7054688B2 (en) 2019-10-04 2022-04-14 イーソル株式会社 Synchronous control system and synchronous control method
JP2022079764A (en) * 2019-10-04 2022-05-26 イーソル株式会社 Synchronous control system and synchronous control method
JP7346649B2 (en) 2019-10-04 2023-09-19 イーソル株式会社 Synchronous control system and method

Also Published As

Publication number Publication date
JP5890194B2 (en) 2016-03-22

Similar Documents

Publication Publication Date Title
EP3701377B1 (en) Method and apparatus for updating shared data in a multi-core processor environment
EP2972885B1 (en) Memory object reference count management with improved scalability
EP2936311B1 (en) System and method for implementing scalable contention-adaptive statistics counters
US10579413B2 (en) Efficient task scheduling using a locking mechanism
WO2015148608A1 (en) Enabling maximum concurrency in a hybrid transactional memory system
US11594252B2 (en) Reader bias based locking technique enabling high read concurrency for read-mostly workloads
US9747210B2 (en) Managing a lock to a resource shared among a plurality of processors
CN106537329B (en) Data processing apparatus and method for performing lock protection processing operations for multiple threads
US20180165134A1 (en) Method and system for locking storage area in storage system
US10108456B2 (en) Accelerated atomic resource allocation on a multiprocessor platform
JP6205168B2 (en) System and method for parallel model checking utilizing parallel structured duplicate detection
US8850129B2 (en) Memory ordered store system in a multiprocessor computer system
CN106068497B (en) Transactional memory support
US11500693B2 (en) Distributed system for distributed lock management and method for operating the same
US20150081986A1 (en) Modifying non-transactional resources using a transactional memory system
US20160098361A1 (en) Optimization of Data Locks for Improved Write Lock Performance and CPU Cache usage in Mulit Core Architectures
JP5890194B2 (en) Information processing apparatus and information processing method
US20160349995A1 (en) Synchronizing per-cpu data access using per socket rw-spinlocks
JP5163128B2 (en) Procedure calling method, procedure calling program, recording medium, and multiprocessor in shared memory multiprocessor
JP6201478B2 (en) Processing order control device, processing order control method, and processing order control program
CN112306698A (en) Critical region execution method and device in NUMA system

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20140819

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141117

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150513

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150519

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150701

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: 20160126

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160218

R150 Certificate of patent or registration of utility model

Ref document number: 5890194

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150