JPH06332789A - Parallel processor and locking method for shared data - Google Patents

Parallel processor and locking method for shared data

Info

Publication number
JPH06332789A
JPH06332789A JP12590493A JP12590493A JPH06332789A JP H06332789 A JPH06332789 A JP H06332789A JP 12590493 A JP12590493 A JP 12590493A JP 12590493 A JP12590493 A JP 12590493A JP H06332789 A JPH06332789 A JP H06332789A
Authority
JP
Japan
Prior art keywords
lock
processor
address information
address
data
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.)
Pending
Application number
JP12590493A
Other languages
Japanese (ja)
Inventor
Toshiaki Takewaki
敏晃 武脇
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.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP12590493A priority Critical patent/JPH06332789A/en
Publication of JPH06332789A publication Critical patent/JPH06332789A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To make it possible to improve whole performance by averaging lock standby time by assigning he authority of a lock in order of large number of times of trial of the lock and preventing the authority of the lock from centralizing in a specified processor. CONSTITUTION:This device is the one accessing to the data of a shared memory from plural processors provided with lock instructions and unlock instructions. A shared memory is provided with an access holding part 20b holding the pair of an address information storage part 20b-1 for storing address information showing the address of data, an access counter 20b-2 for counting the number of time of trial of the lock for the data shown by address information corresponding to address information every processor and a lock flag part 20b-3 storing lock flags showing whether the data corresponding to address information is locked or not. By using these, the authority of the lock is assigned in order of large number of times of trial of the lock.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、複数のプロセッサによ
り共有される共有メモリに対する共有データのロック方
式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a shared data locking system for a shared memory shared by a plurality of processors.

【0002】[0002]

【従来の技術】近年では、より処理能力の高いコンピュ
ータを実現するために、複数のプロセッサによって並列
に処理を行なう並列処理装置の開発が行なわれている。
このような並列処理装置では、プロセッサ間でデータの
やりとりをする必要があり、それを実現する一つの方法
として共有メモリがある。
2. Description of the Related Art In recent years, in order to realize a computer having a higher processing capacity, a parallel processing apparatus for processing in parallel by a plurality of processors has been developed.
In such a parallel processing device, it is necessary to exchange data between processors, and there is a shared memory as one method for realizing this.

【0003】共有メモリは、通常のメモリと同じように
プロセッサからアドレスを指定してデータの読み書きが
出来るものであるが、複数のプロセッサによってデータ
が更新される場合に、整合性を保つために、同時に更新
操作が行なわれないようにロックをかける必要が出てく
る。
The shared memory is capable of reading and writing data by designating an address from a processor like a normal memory, but in order to maintain consistency when data is updated by a plurality of processors, At the same time, it becomes necessary to lock the update operation.

【0004】ロックの方法として従来から行なわれてい
るものの1つに、プロセッサが共有メモリのあるアドレ
スを読み書きする操作を、他のプロセッサからの干渉を
受けることなく実現できるようにする特殊な命令をプロ
セッサで用意しておく方法がある。
One of the conventional locking methods is a special instruction that enables a processor to read or write an address in a shared memory without interference from other processors. There is a method to prepare in the processor.

【0005】この特殊な命令による方法は、先にアクセ
スしたプロセッサにロックの権限を与えるものである。
従って、頻繁に更新が行なわれる場合には、タイミング
が悪いと、特定のプロセッサにロックをする権限が与え
られなくなってしまう場合がある。以下、図4を用いて
具体例について説明する。
This special instruction method gives the lock right to the processor that has accessed first.
Therefore, when updating is frequently performed, if the timing is wrong, the right to lock a specific processor may not be granted. Hereinafter, a specific example will be described with reference to FIG.

【0006】図4(a)は、図4(b)に示すプログラ
ムの処理の流れを示すフローチャートである。図4
(b)に示すプログラムの各命令(命令I1〜I8)
は、それぞれ1サイクルで処理できるものとする。
FIG. 4 (a) is a flow chart showing the flow of processing of the program shown in FIG. 4 (b). Figure 4
Each instruction (instructions I1 to I8) of the program shown in (b)
Can be processed in one cycle each.

【0007】この場合、図4に示すように、命令I1に
おいてロックに成功しても、また失敗しても、ラベルL
OOPに戻るまでに5サイクル必要となる。このような
状況で、プロセッサQがプロセッサPより1サイクル遅
くこのプログラムを実行したものとする。この時の各プ
ロセッサ(P,Q)の実行命令のタイミングを図5に示
している。
In this case, as shown in FIG. 4, whether the lock succeeds or fails in the instruction I1, the label L
It takes 5 cycles to return to OOP. In such a situation, it is assumed that the processor Q executes this program one cycle later than the processor P. The timing of the execution instruction of each processor (P, Q) at this time is shown in FIG.

【0008】この例では、プロセッサPは、命令I1〜
I5を繰り返すことになり、T1からT4の間、アドレ
スMをロックすることになる。従って、プロセッサQが
ロックを試行(命令I1)する時には、プロセッサPが
常にロックをかけていることになり、プロセッサQはロ
ックをかけることができなくなってしまう。
In this example, processor P has instructions I1 ...
I5 will be repeated, and the address M will be locked between T1 and T4. Therefore, when the processor Q tries to lock (instruction I1), the processor P always locks, and the processor Q cannot lock.

【0009】[0009]

【発明が解決しようとする課題】このように従来の方法
では、最悪の場合には、特定のプロセッサがロックをか
けることができなくなる状況が生じてしまうという問題
があった。本発明は前記のような事情を考慮してなされ
たもので、ロックの試行回数の多いものから順に割り当
て、特定のプロセッサにロックの権限が集中しないよう
にすることでロック待ちの時間を平均化し、全体性能を
高めることが可能な並列処理装置及び共有データのロッ
ク方法を提供することを目的とする。
As described above, the conventional method has a problem that, in the worst case, a particular processor cannot lock. The present invention has been made in consideration of the above-mentioned circumstances. The lock waiting time is averaged by allocating the locks in descending order of the number of trials so that lock authority is not concentrated on a specific processor. An object of the present invention is to provide a parallel processing device and a shared data locking method capable of improving the overall performance.

【0010】[0010]

【課題を解決するための手段】本発明は、データに対す
るロック命令とアンロック命令を備えた複数のプロセッ
サから、共有メモリのデータにアクセスするもので、前
記共有メモリは、格納されたデータのアドレスを示すア
ドレス情報を格納するためのアドレス情報格納手段、前
記アドレス情報格納手段に格納されたアドレス情報に対
応して前記アドレス情報が示すデータに対するロックの
試行回数を各プロセッサ毎にカウントするためのカウン
タ、及び前記アドレス情報格納手段に格納されたアドレ
ス情報に対応するデータがロックされているか否かを示
すロックフラグを格納するロックフラグ手段の組を保持
するアクセス保持手段を具備し、ロック命令に対して、
前記共有メモリ内の指定されたアドレスが前記アクセス
保持手段に保持されていない場合、同アドレスを前記ア
ドレス情報格納手段に保持し、前記カウンタの各プロセ
ッサのカウント値を初期化し、前記ロックフラグ手段に
ロックフラグを立てると共に、当該プロセッサにロック
が成功したことを通知し、ロック命令に対して、前記共
有メモリ内の指定されたアドレスが前記アクセス保持手
段に保持されている場合、前記ロックフラグ手段にロッ
クフラグが立っておらず、かつ前記カウンタの当該プロ
セッサに対応するカウント値が最大であれば、前記ロッ
クフラグ手段にロックフラグを立てると共に、当該プロ
セッサにロックが成功したことを通知し、それ以外の場
合は、当該プロセッサのカウント値を増加させることと
もに当該プロセッサにロックが失敗したことを通知し、
アンロック命令に対して、指定されたアドレスに対応す
る前記カウンタの当該プロセッサのカウント値を初期化
することを特徴とする。
According to the present invention, data in a shared memory is accessed from a plurality of processors having a lock instruction and an unlock instruction for data, and the shared memory is an address of stored data. Address information storage means for storing the address information indicating the address, and a counter for counting the number of lock attempts for the data indicated by the address information corresponding to the address information stored in the address information storage means for each processor. , And access holding means for holding a set of lock flag means for storing a lock flag indicating whether or not the data corresponding to the address information stored in the address information storage means is locked. hand,
When the specified address in the shared memory is not held in the access holding means, the same address is held in the address information storage means, the count value of each processor of the counter is initialized, and the lock flag means is held. When the lock flag is set, the processor is notified that the lock is successful, and when the specified address in the shared memory is held in the access holding means, the lock flag means is notified to the lock instruction. If the lock flag is not set and the count value corresponding to the processor of the counter is the maximum, the lock flag is set to the lock flag means and the processor is notified that the lock is successful. In the case of, the count value of the processor is increased and Reports that the lock has failed to,
In response to the unlock instruction, the count value of the processor of the counter corresponding to the designated address is initialized.

【0011】[0011]

【作用】このような構成によれば、プロセッサがロック
命令を実行することによって、更新すべきデータのロッ
クを試行し、この時、他のプロセッサによってそのアド
レスがロックされておらず、ロックを試行したプロセッ
サの試行回数が最大であれば、ロックに成功する。ま
た、ロックに失敗したのであれば、試行を繰り返すので
そのプロセッサの試行回数は増加していく。これによ
り、早くにロックを試行したものは優先的にロックを行
うことができるようになる。一方、一度ロックに成功す
ると、試行回数を初期化するので、次のロック要求では
優先度が低いロック要求となる。これによって、ロック
要求の頻繁なものから順に割り当てる事になる。
According to this structure, the processor executes the lock instruction to try to lock the data to be updated. At this time, the address is not locked by another processor, and the lock is tried. The lock succeeds if the number of attempts made by the processor is maximum. If the lock is unsuccessful, the trial is repeated and the number of trials of the processor increases. As a result, those who try to lock earlier can preferentially lock. On the other hand, once the lock is successful, the number of trials is initialized, so that the next lock request has a low priority. As a result, the lock requests are frequently allocated in order.

【0012】[0012]

【実施例】以下、図面を参照して本発明の一実施例を説
明する。図1は本発明の一実施例に係わるコンピュータ
の主要な構成を示すブロック図である。図1に示すよう
に、本実施例におけるコンピュータは、複数のプロセッ
サ10−1,10−2,…,10−N、及び共有メモリ
20が、バス30を介して接続されて構成されている。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the main configuration of a computer according to an embodiment of the present invention. As shown in FIG. 1, the computer in this embodiment is configured by connecting a plurality of processors 10-1, 10-2, ..., 10-N and a shared memory 20 via a bus 30.

【0013】プロセッサ10−1,10−2,…,10
−Nからのロック命令やアンロック命令は、バス30を
経由して共有メモリ20に送られる。共有メモリ20に
は、図2に示すように、データを格納するためのデータ
部20a、及びアクセス保持部20bが設けられてい
る。
Processors 10-1, 10-2, ..., 10
The lock command and unlock command from -N are sent to the shared memory 20 via the bus 30. As shown in FIG. 2, the shared memory 20 is provided with a data section 20a for storing data and an access holding section 20b.

【0014】さらに、アクセス保持部20bには、アド
レス情報格納部20b−1、アクセスカウンタ20b−
2、ロックフラグ部20b−3が設けられている。アド
レス情報格納部20b−1は、データ部20aに格納さ
れたデータのアドレスを示すアドレス情報を格納するた
めのものである。アクセスカウンタ20b−2は、アド
レス情報格納部20b−1に格納されたアドレス情報に
対応して、アドレス情報が示すデータに対するロックの
試行回数を、各プロセッサ毎にカウントするためのもの
である。ロックフラグ部20b−3は、アドレス情報格
納部20b−1に格納されたアドレス情報に対応するデ
ータがロックされているか否かを示すものである。な
お、アドレス情報、カウンタ値、ロックフラグの組をエ
ントリと呼ぶ。
Further, the access holding unit 20b includes an address information storage unit 20b-1 and an access counter 20b-.
2, a lock flag portion 20b-3 is provided. The address information storage unit 20b-1 is for storing address information indicating the address of the data stored in the data unit 20a. The access counter 20b-2 is for counting the number of lock attempts for the data indicated by the address information for each processor, corresponding to the address information stored in the address information storage unit 20b-1. The lock flag portion 20b-3 indicates whether or not the data corresponding to the address information stored in the address information storage portion 20b-1 is locked. A set of address information, counter value, and lock flag is called an entry.

【0015】次に、本実施例の動作について説明する。
ここでは、プロセッサ10−1,10−2,…,10−
N中の任意のプロセッサPとプロセッサQが、同じアド
レスM1のデータを操作する処理を例にして説明する。
説明を簡単にするため、従来技術の説明で用いた図4に
示すプログラムを用い、図4に明示されたプログラム以
外ではアドレスM1に対する操作が行なわれないものと
する。
Next, the operation of this embodiment will be described.
Here, the processors 10-1, 10-2, ..., 10-
A description will be given by taking as an example a process in which an arbitrary processor P and a processor Q in N operate data at the same address M1.
For simplification of explanation, it is assumed that the program shown in FIG. 4 used in the description of the conventional technique is used, and the operation on the address M1 is not performed by a program other than the program explicitly shown in FIG.

【0016】図4に示すプログラムは、従来技術の説明
で用いたプログラムであり、ロックに成功した場合も、
また失敗した場合も、共に5サイクル必要な処理であ
る。これを、プロセッサPがプロセッサQより1サイク
ル早く実行する状況について、図3に示すタイミングチ
ャートを参照しながら、各クロック(T1〜T10)毎
に説明する。
The program shown in FIG. 4 is the program used in the description of the prior art. Even when the lock is successful,
Also, in the case of failure, the processing requires 5 cycles each. A situation in which the processor P executes one cycle earlier than the processor Q will be described for each clock (T1 to T10) with reference to the timing chart shown in FIG.

【0017】(T1)プロセッサPは、 read with loc
k 命令(ロック命令I1)によって、共有メモリ20上
のアドレスM1のデータに対して読み込みロックをかけ
ようとする。ここで、アクセス保持部20bにはアドレ
スM1に対するエントリがないので、新しいエントリを
確保し、そのアドレス情報M1をアドレス情報格納部2
0b−1に格納する。さらに、アドレスM1のエントリ
に、各プロセッサ用のアクセスカウンタ20b−2を初
期化し、ロックフラグ部20b−3にロックフラグを立
てる(“1”)。共有メモリ20は、アドレスM1の値
とロックが成功したことを通知する。
(T1) Processor P is read with loc
The k instruction (lock instruction I1) tries to apply a read lock to the data at the address M1 on the shared memory 20. Here, since there is no entry for the address M1 in the access holding unit 20b, a new entry is secured and the address information M1 is stored in the address information storage unit 2.
Store in 0b-1. Further, the access counter 20b-2 for each processor is initialized in the entry of the address M1, and a lock flag is set in the lock flag unit 20b-3 (“1”). The shared memory 20 notifies the value of the address M1 and the success of the lock.

【0018】(T2)プロセッサPは、ロックが失敗し
たかを調べ(命令I2)、この結果、成功したのでジャ
ンプしない。一方、プロセッサQは、 read with lock
命令(ロック命令I1)によって、共有メモリ20上の
アドレスM1のデータに対して読み込みロックをかけよ
うとする。ここでは、アドレスM1のエントリのロック
フラグが既に立っているので、共有メモリ20は、アク
セスカウンタ20b−2のプロセッサQに対するカウン
タ値を増加させ、プロセッサQにロックが失敗したこと
を通知する。
(T2) The processor P checks whether the lock has failed (instruction I2), and as a result of this, it does not jump because it succeeds. On the other hand, the processor Q uses read with lock
The instruction (lock instruction I1) attempts to lock the read of the data at the address M1 on the shared memory 20. Here, since the lock flag of the entry of the address M1 has already been set, the shared memory 20 increases the counter value of the access counter 20b-2 for the processor Q, and notifies the processor Q that the lock has failed.

【0019】(T3)プロセッサPは、読み込んだ値に
対して1を加える処理を実行する(命令I3)。一方、
プロセッサQは、ロックが失敗したかを調べる(命令I
2)。この結果、ロックに失敗していることが判別され
るのでラベルFAILへジャンプする。
(T3) The processor P executes a process of adding 1 to the read value (instruction I3). on the other hand,
Processor Q checks if the lock failed (instruction I
2). As a result, it is determined that the lock has failed, and the process jumps to the label FAIL.

【0020】(T4)プロセッサPは、計算結果を wri
te with unlock命令(アンロック命令I4)によって書
き込みロックを解除しようとする。共有メモリ20は、
アドレスM1に対応するエントリのアクセスカウンタ2
0b−2のプロセッサPに関するカウンタ値を初期化
し、ロックフラグを下ろす(“0”)。一方、プロセッ
サQは、inst1命令(命令I6)を実行する。
(T4) The processor P calculates the calculation result by wri.
Attempt to release the write lock by the te with unlock instruction (unlock instruction I4). The shared memory 20 is
Access counter 2 of entry corresponding to address M1
The counter value for the processor P of 0b-2 is initialized, and the lock flag is cleared (“0”). On the other hand, the processor Q executes the inst1 instruction (instruction I6).

【0021】(T5)プロセッサPは、無条件にラベル
LOOPへ飛ぶ(命令I5)。一方、プロセッサQは、
inst2命令(命令I7)を実行する。 (T6)プロセッサPは、 read with lock 命令(ロッ
ク命令I1)によって、共有メモリ20上のアドレスM
1のデータを読み込みロックをかけようとする。共有メ
モリ20は、アドレスM1のエントリにロックフラグは
立っていないが、アクセスカウンタ20b−2の各プロ
セッサに対応するエントリのカウント値を比較し、プロ
セッサPのエントリのカウンタ値が最大ではないので、
プロセッサPのカウンタ値を増加させると共に、プロセ
ッサPにロックが失敗したことを通知する。一方、プロ
セッサQは、無条件にラベルLOOPへ飛ぶ(命令I
8)。
(T5) The processor P unconditionally jumps to the label LOOP (instruction I5). On the other hand, the processor Q
The inst2 instruction (instruction I7) is executed. (T6) The processor P uses the read with lock instruction (lock instruction I1) to address M on the shared memory 20.
Attempts to lock the data of No. 1 by reading it. In the shared memory 20, the lock flag is not set for the entry of the address M1, but the count value of the entry corresponding to each processor of the access counter 20b-2 is compared, and the counter value of the entry of the processor P is not the maximum.
The counter value of the processor P is incremented, and the processor P is notified of the lock failure. On the other hand, the processor Q unconditionally jumps to the label LOOP (command I
8).

【0022】(T7)プロセッサPは、ロックが失敗し
たかを調べた結果、失敗したことが判別されるのでラベ
ルFAILへ飛ぶ(命令I2)。一方、プロセッサQ
は、read with lock命令(ロック命令I1)によって共
有メモリ20上のアドレスM1のデータを読み込みロッ
クをかけようとする。アドレスM1のエントリにはロッ
クフラグは立っておらず、プロセッサQのカウンタは最
大であるので、共有メモリ20はロックフラグを立て、
アドレスM1の値とロックが成功したことをプロセッサ
Qに通知する。
(T7) The processor P determines whether the lock has failed as a result of checking whether the lock has failed, and therefore jumps to the label FAIL (instruction I2). On the other hand, processor Q
Attempts to lock the data at the address M1 on the shared memory 20 by the read with lock instruction (lock instruction I1). Since the lock flag is not set in the entry of the address M1 and the counter of the processor Q is maximum, the shared memory 20 sets the lock flag,
Notify the value of the address M1 and the success of the lock to the processor Q.

【0023】(T8)プロセッサPは、inst1命令(命
令I6)を実行する。プロセッサQは、ロックが失敗し
たかを調べ、成功したのでジャンプしない(命令I
2)。 (T9)プロセッサPは、inst2命令(命令I8)を実
行する。プロセッサQは、読み込んだ値に対して1を加
える処理を施す(命令I3)。
(T8) The processor P executes the inst1 instruction (instruction I6). Processor Q checks if the lock failed and does not jump because it succeeded (instruction I
2). (T9) The processor P executes the inst2 instruction (instruction I8). The processor Q performs a process of adding 1 to the read value (instruction I3).

【0024】(T10)プロセッサPは、無条件にラベ
ルLOOPへ飛ぶ(命令I8)。プロセッサQは、計算
結果を write with unlock命令(アンロック命令I4)
によって書き込みロックを解除しようとする。共有メモ
リ20は、アドレスM1のエントリのプロセッサQのカ
ウンタ値を初期化し、ロックフラグを下ろす。
(T10) The processor P unconditionally jumps to the label LOOP (instruction I8). The processor Q writes the calculation result in a write with unlock instruction (unlock instruction I4)
Try to release the write lock by. The shared memory 20 initializes the counter value of the processor Q of the entry of the address M1 and lowers the lock flag.

【0025】このようにして、プロセッサがロック命令
を実行することによって、更新すべきデータのロックを
試行すると、他のプロセッサによってそのアドレスがロ
ックされておらず、かつロックを試行したプロセッサの
試行回数が最大であればロックに成功する。また、ロッ
クに失敗したのであれば、試行を繰り返すのでそのプロ
セッサの試行回数は増加していく。これにより、先にロ
ックを試行したものが優先的にロックを行うことができ
るようになる。
In this way, when the processor executes the lock instruction to attempt to lock the data to be updated, the address is not locked by another processor, and the number of trials of the processor that has tried to lock the data. If is maximum, the lock succeeds. If the lock is unsuccessful, the trial is repeated and the number of trials of the processor increases. As a result, the person who tried the lock first can preferentially perform the lock.

【0026】その一方、一度ロックに成功すると、試行
回数を初期化するので、次のロック要求では優先度が低
いロック要求となる。これによって、ロック要求の頻繁
なものから順に割り当てることになる。
On the other hand, once the lock is successful, the number of trials is initialized, so that the next lock request has a low priority. As a result, the lock requests are allocated in order from the most frequent one.

【0027】従って、特定のプロセッサにロックの権限
が集中することがなく、他のプロセッサがロックをかけ
ることができなくなる状況が生じることがない。なお、
アクセス保持部20bの各プロセッサのカウンタを増加
させる操作は、ロック試行回数をそのまま保持しても良
く、また優先度処理を施した値を保持しても良い。それ
に応じて、各プロセッサのカウンタ値の最大の判定は、
ロックの試行回数に基づいていれば良い。
Therefore, the lock authority is not concentrated on a specific processor, and there is no possibility that another processor cannot lock. In addition,
For the operation of increasing the counter of each processor of the access holding unit 20b, the number of lock attempts may be held as it is, or a value subjected to priority processing may be held. Accordingly, the maximum judgment of the counter value of each processor is
It should be based on the number of lock attempts.

【0028】また、エントリの解放は、ロックフラグが
立っていなければ、いつ行なっても良い。さらに、ロッ
クが失敗したことを通知する方法としては、コンデショ
ンコードに反映させることによって通知しても良く、ま
た、割り込みによって通知しても良い。
The entry may be released at any time unless the lock flag is set. Further, as a method of notifying that the lock has failed, the lock code may be reflected in the condition code or may be notified by an interrupt.

【0029】[0029]

【発明の効果】以上のように本発明によれば、ロックの
試行回数の多いものから順にロックの権限を割り当てる
ことより、特定のプロセッサにロックの権限が集中しな
いようにするので、ロック待ちの時間を平均化し、共有
メモリに対するアクセス競合を緩和することができ、全
体性能を高めることが可能となるものである。
As described above, according to the present invention, the lock authority is assigned in order from the one having the largest number of lock attempts, so that the lock authority is not concentrated on a specific processor. The time can be averaged, access competition for the shared memory can be relaxed, and the overall performance can be improved.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の一実施例に係わるコンピュータの主要
な構成を示すブロック図。
FIG. 1 is a block diagram showing the main configuration of a computer according to an embodiment of the present invention.

【図2】本実施例における共有メモリ20の構成を示す
ブロック図。
FIG. 2 is a block diagram showing the configuration of a shared memory 20 in this embodiment.

【図3】本実施例の動作を説明するための2つのプロセ
ッサP,Qの実行命令のタイミングを示す図。
FIG. 3 is a diagram showing the timing of execution instructions of two processors P and Q for explaining the operation of this embodiment.

【図4】動作を説明するためのロックプログラムの一例
を示す図。
FIG. 4 is a diagram showing an example of a lock program for explaining the operation.

【図5】従来技術を説明するための2つのプロセッサ
P,Qの実行命令のタイミングを示す図。
FIG. 5 is a diagram showing timings of execution instructions of two processors P and Q for explaining a conventional technique.

【符号の説明】[Explanation of symbols]

10−1,10−2,…,10−N…プロセッサ、20
…共有メモリ、20a…データ部、20b…アクセス保
持部、20b−1…アドレス情報格納部、20b−2…
アクセスカウンタ、20b−3…ロックフラグ部、30
…バス。
10-1, 10-2, ..., 10-N ... Processor, 20
... shared memory, 20a ... data section, 20b ... access holding section, 20b-1 ... address information storage section, 20b-2 ...
Access counter, 20b-3 ... Lock flag part, 30
…bus.

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 データに対するロック命令とアンロック
命令を備えた複数のプロセッサから、共有メモリのデー
タにアクセスする並列処理装置において、 前記共有メモリは、 格納されたデータのアドレスを示すアドレス情報を格納
するためのアドレス情報格納手段、前記アドレス情報格
納手段に格納されたアドレス情報に対応して前記アドレ
ス情報が示すデータに対するロックの試行回数を各プロ
セッサ毎にカウントするためのカウンタ、及び前記アド
レス情報格納手段に格納されたアドレス情報に対応する
データがロックされているか否かを示すロックフラグを
格納するロックフラグ手段の組を保持するアクセス保持
手段を具備し、 ロック命令に対して、前記共有メモリ内の指定されたア
ドレスが前記アクセス保持手段に保持されていない場
合、同アドレスを前記アドレス情報格納手段に保持し、
前記カウンタの各プロセッサのカウント値を初期化し、
前記ロックフラグ手段にロックフラグを立てると共に、
当該プロセッサにロックが成功したことを通知し、 ロック命令に対して、前記共有メモリ内の指定されたア
ドレスが前記アクセス保持手段に保持されている場合、
前記ロックフラグ手段にロックフラグが立っておらず、
かつ前記カウンタの当該プロセッサに対応するカウント
値が最大であれば、前記ロックフラグ手段にロックフラ
グを立てると共に、当該プロセッサにロックが成功した
ことを通知し、それ以外の場合は、当該プロセッサのカ
ウント値を増加させることともに当該プロセッサにロッ
クが失敗したことを通知し、 アンロック命令に対して、指定されたアドレスに対応す
る前記カウンタの当該プロセッサのカウント値を初期化
することを特徴とする並列処理装置。
1. A parallel processing apparatus for accessing data in a shared memory from a plurality of processors having a lock instruction and an unlock instruction for data, wherein the shared memory stores address information indicating an address of the stored data. Address information storing means, a counter for counting the number of lock attempts for the data indicated by the address information corresponding to the address information stored in the address information storing means for each processor, and the address information storage Access holding means for holding a set of lock flag means for storing a lock flag indicating whether or not the data corresponding to the address information stored in the means is locked; Specified address is not held in the access holding means In the case, holding the same address in the address information storage means,
Initialize the count value of each processor of the counter,
While setting a lock flag in the lock flag means,
Notifying the processor that the lock is successful, and when the specified address in the shared memory is held in the access holding means in response to the lock instruction,
The lock flag is not set in the lock flag means,
If the count value of the counter corresponding to the processor is maximum, the lock flag means is set to the lock flag and the processor is notified that the lock is successful. Otherwise, the count of the processor is counted. In parallel with increasing the value, notifying the processor that locking has failed, and initializing the count value of the processor of the counter corresponding to the specified address to the unlock instruction. Processing equipment.
【請求項2】 データに対するロック命令とアンロック
命令を備えた複数のプロセッサからアクセスされる共有
メモリにおける共有データのロック方法であって、 前記共有メモリは、 格納されたデータのアドレスを示すアドレス情報を格納
するためのアドレス情報格納手段、前記アドレス情報格
納手段に格納されたアドレス情報に対応して前記アドレ
ス情報が示すデータに対するロックの試行回数を各プロ
セッサ毎にカウントするためのカウンタ、及び前記アド
レス情報格納手段に格納されたアドレス情報に対応する
データがロックされているか否かを示すロックフラグを
格納するロックフラグ手段の組を保持するアクセス保持
手段を具備し、 ロック命令に対して、前記共有メモリ内の指定されたア
ドレスが前記アクセス保持手段に保持されていない場
合、同アドレスを前記アドレス情報格納手段に保持し、
前記カウンタの各プロセッサのカウント値を初期化し、
前記ロックフラグ手段にロックフラグを立てると共に、
当該プロセッサにロックが成功したことを通知し、 ロック命令に対して、前記共有メモリ内の指定されたア
ドレスが前記アクセス保持手段に保持されている場合、
前記ロックフラグ手段にロックフラグが立っておらず、
かつ前記カウンタの当該プロセッサに対応するカウント
値が最大であれば、前記ロックフラグ手段にロックフラ
グを立てると共に、当該プロセッサにロックが成功した
ことを通知し、それ以外の場合は、当該プロセッサのカ
ウント値を増加させることともに当該プロセッサにロッ
クが失敗したことを通知し、 アンロック命令に対して、指定されたアドレスに対応す
る前記カウンタの当該プロセッサのカウント値を初期化
することを特徴とする共有データのロック方法。
2. A method of locking shared data in a shared memory, which is accessed by a plurality of processors having a lock instruction and an unlock instruction for data, wherein the shared memory is address information indicating an address of the stored data. Address information storing means for storing the address, a counter for counting, for each processor, the number of lock attempts for the data indicated by the address information corresponding to the address information stored in the address information storing means, and the address An access holding means for holding a set of lock flag means for storing a lock flag indicating whether or not the data corresponding to the address information stored in the information storage means is locked is provided, and the sharing is performed in response to the lock instruction. The specified address in the memory is held in the access holding means. If not, hold the same address in the address information storage means,
Initialize the count value of each processor of the counter,
While setting a lock flag in the lock flag means,
Notifying the processor that the lock is successful, and when the specified address in the shared memory is held in the access holding means in response to the lock instruction,
The lock flag is not set in the lock flag means,
If the count value of the counter corresponding to the processor is maximum, the lock flag means is set to the lock flag and the processor is notified that the lock is successful. Otherwise, the count of the processor is counted. Shared by not only increasing the value but also notifying the processor that locking has failed, and initializing the count value of the processor of the counter corresponding to the specified address for the unlock instruction. How to lock data.
JP12590493A 1993-05-27 1993-05-27 Parallel processor and locking method for shared data Pending JPH06332789A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP12590493A JPH06332789A (en) 1993-05-27 1993-05-27 Parallel processor and locking method for shared data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP12590493A JPH06332789A (en) 1993-05-27 1993-05-27 Parallel processor and locking method for shared data

Publications (1)

Publication Number Publication Date
JPH06332789A true JPH06332789A (en) 1994-12-02

Family

ID=14921792

Family Applications (1)

Application Number Title Priority Date Filing Date
JP12590493A Pending JPH06332789A (en) 1993-05-27 1993-05-27 Parallel processor and locking method for shared data

Country Status (1)

Country Link
JP (1) JPH06332789A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102012221037A1 (en) 2011-12-02 2013-06-06 International Business Machines Corporation Unit and method for realizing a resource lock

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102012221037A1 (en) 2011-12-02 2013-06-06 International Business Machines Corporation Unit and method for realizing a resource lock
US8898127B2 (en) 2011-12-02 2014-11-25 International Business Machines Corporation Device and method for acquiring resource lock
US9189512B2 (en) 2011-12-02 2015-11-17 International Business Machines Corporation Device and method for acquiring resource lock

Similar Documents

Publication Publication Date Title
US7536582B1 (en) Fault-tolerant match-and-set locking mechanism for multiprocessor systems
US5274809A (en) Task execution control method for a multiprocessor system with enhanced post/wait procedure
US6681226B2 (en) Selective pessimistic locking for a concurrently updateable database
US8234646B2 (en) Fault tolerant mutual exclusion locks for shared memory systems
EP0145889B1 (en) Non-spinning task locking using compare and swap
Michael et al. Nonblocking algorithms and preemption-safe locking on multiprogrammed shared memory multiprocessors
US6889269B2 (en) Non-blocking concurrent queues with direct node access by threads
US5742785A (en) Posting multiple reservations with a conditional store atomic operations in a multiprocessing environment
US4949251A (en) Exactly-once semantics in a TP queuing system
US5050072A (en) Semaphore memory to reduce common bus contention to global memory with localized semaphores in a multiprocessor system
US5579505A (en) Memory access system and method for granting or preventing atomic or nonatomic memory access requests to shared memory regions
US4584644A (en) Method of controlling use of resources in a data processing system by at least two processes
US20020029239A1 (en) Method and system for enhanced concurrency in a computing environment
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
US5138713A (en) Multiprocessing computer system with exit logic and method for maintaining resource integrity
US20060161919A1 (en) Implementation of load linked and store conditional operations
US6976260B1 (en) Method and apparatus for serializing a message queue in a multiprocessing environment
EP0343646B1 (en) Task execution control method for a multiprocessor system with enhanced post/wait procedure
Michael et al. Relative performance of preemption-safe locking and non-blocking synchronization on multiprogrammed shared memory multiprocessors
JPH06332789A (en) Parallel processor and locking method for shared data
JP2804478B2 (en) Task control system and online transaction system
US7539678B2 (en) Systems and methods for controlling access to an object
KR20000070374A (en) Locking of computer resources
US7047245B2 (en) Processing system
JPH05134930A (en) Memory protecting device