JP2834036B2 - Lock controller - Google Patents

Lock controller

Info

Publication number
JP2834036B2
JP2834036B2 JP7177248A JP17724895A JP2834036B2 JP 2834036 B2 JP2834036 B2 JP 2834036B2 JP 7177248 A JP7177248 A JP 7177248A JP 17724895 A JP17724895 A JP 17724895A JP 2834036 B2 JP2834036 B2 JP 2834036B2
Authority
JP
Japan
Prior art keywords
lock
transaction
mode
request
deadlock
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.)
Expired - Fee Related
Application number
JP7177248A
Other languages
Japanese (ja)
Other versions
JPH0926907A (en
Inventor
祥浦 武田
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.)
NIPPON DENKI SOFUTOEA KK
Original Assignee
NIPPON DENKI SOFUTOEA KK
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 NIPPON DENKI SOFUTOEA KK filed Critical NIPPON DENKI SOFUTOEA KK
Priority to JP7177248A priority Critical patent/JP2834036B2/en
Publication of JPH0926907A publication Critical patent/JPH0926907A/en
Application granted granted Critical
Publication of JP2834036B2 publication Critical patent/JP2834036B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明はトランザクション処
理における共有資源のロック制御器に関し、特に共有資
源ロックのにより発生するデッドロックの解除をトラン
ザクションの再実行により行うロック制御器に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a lock controller for a shared resource in transaction processing, and more particularly to a lock controller for releasing a deadlock caused by locking of a shared resource by re-executing a transaction.

【0002】[0002]

【従来の技術】従来のロック制御器では、共有資源の共
有を許す共有モードと共有資源の排他的使用を許す排他
モードの2つのモードで共有資源のロックを行ってお
り、2つのロックモードによる排他制御は図2に示す排
他制御規定に従って行われる(従来のロック制御器につ
いては、例えば、前川 守「ソフトウェア実行/開発環
境」4.7節“共有リソースへの拡張”を参照された
い)。
2. Description of the Related Art In a conventional lock controller, a shared resource is locked in two modes, a shared mode in which the shared resource is shared and an exclusive mode in which the shared resource is exclusively used. The exclusive control is performed according to the exclusive control rule shown in FIG. 2 (for the conventional lock controller, see, for example, Mamoru Maekawa “Software execution / development environment”, Section 4.7 “Extension to shared resources”).

【0003】従来のロック制御器を使用した典型的なト
ランザクション処理プログラムは、ファイルから1レコ
ードを読み込み、レコード内の一部のフィールドを更新
してレコードを書き込むレコードの更新処理を行う。
A typical transaction processing program using a conventional lock controller reads one record from a file, updates a part of the fields in the record, and writes the record to update the record.

【0004】この状況では、読み込むレコードに対して
共有モードでロックを行い、レコードを書き込む時点で
同一レコードに対して排他モードでロックが行われる。
この様な同一のトランザクション内で共有モードでロッ
クを行った資源に対して再度排他モードでロックを行う
操作のことをロックのアップグレードという。
In this situation, a record to be read is locked in the shared mode, and the same record is locked in the exclusive mode when the record is written.
Such an operation of re-locking the resource locked in the shared mode in the exclusive mode in the same transaction in the same transaction is called lock upgrade.

【0005】例えば、ファイルの読み込み処理において
は読み込む時点では後で更新されるどうかは不明である
ので読み込み時点では共有モードでロックを行い、書き
込み時点で排他モードでロックを行うことが一般的であ
りロックのアップグレードが発生する。また、制御表や
資源のロックにおいて、トランザクション処理プログラ
ムが複数のサブルーチンに分割されて作成されるような
場合には呼び出しもとのルーチンが共用モードでロック
した資源を呼び出し先のルーチンで排他モードでロック
する場合もロックのアップグレードが発生する。
For example, in a file reading process, it is unclear whether the file will be updated later at the time of reading. Therefore, it is common to lock in the shared mode at the time of reading and lock in the exclusive mode at the time of writing. Lock upgrade occurs. If the transaction processing program is divided into a plurality of subroutines for control table and resource locking, the calling routine locks the resource locked in shared mode in exclusive mode in the called routine. Locking also requires a lock upgrade.

【0006】頻繁に更新されないレコードに対して、ロ
ックのアップグレードを行うことは問題ないが、頻繁に
更新されるレコード(この様なレコードはホットスポッ
トと呼ばれる)に対するロックのアップグレードはデッ
ドロックを発生させる。図3に示すように近接した時間
で3つのトランザクション41、42およびトランザク
ション43がホットスポット44を読み込み共有モード
でロックを行い、レコードを書き込むために排他モード
でロック要求を行う場合には、図2の他トランザクショ
ンが共有モードでロックした資源に対する排他モードの
ロック要求の場合となるため、3つのトランザクション
がお互いに待ちになりデッドロックが発生する。
Upgrading locks on records that are not updated frequently is not a problem, but upgrading locks on records that are updated frequently (such records are called hot spots) causes deadlock. . As shown in FIG. 3, when three transactions 41, 42 and 43 read the hot spot 44 and lock it in the shared mode at close time, and issue a lock request in the exclusive mode to write the record, as shown in FIG. Since this is a lock request in the exclusive mode for the resource locked by the other transaction in the shared mode, the three transactions wait for each other and a deadlock occurs.

【0007】リレーショナルデータベースに関するデッ
ドロック原因のほとんどがこのホットスポットに対する
ロックのアップグレードにあるといわれている(例え
ば、Jim Gray、Andreas Reuter
「TRANSACTION PROCESSING」
Section 7.8.2“Update Mode
Locks”)。
[0007] It is said that most deadlock causes for relational databases are due to lock upgrades to this hot spot (eg, Jim Gray, Andreas Reuter).
"TRANSACTION PROCESSING"
Section 7.8.2 "Update Mode"
Locks ").

【0008】トランザクション処理においてはロック制
御器においてデッドロックが発生した場合は、トランザ
クションモニタにデッドロックが通知され、トランザク
ションモニタはデッドロックに含まれる1つ以上のトラ
ンザクションを中断することによりデッドロックを解除
する方式が一般的である。
In the transaction processing, when a deadlock occurs in the lock controller, the deadlock is notified to the transaction monitor, and the transaction monitor releases the deadlock by suspending one or more transactions included in the deadlock. Is generally used.

【0009】中断されたトランザクションは、トランザ
クションモニタにより、トランザクションがアクセスし
たデータベース等の資源をロールバックした後に再実行
される。
The suspended transaction is re-executed by the transaction monitor after rolling back resources such as a database accessed by the transaction.

【0010】[0010]

【発明が解決しようとする課題】上述した従来のロック
制御器では、このデッドロック解除の効率性が悪いとい
う欠点があった。
The conventional lock controller described above has a disadvantage that the deadlock is not efficiently released.

【0011】即ち、近接した時間にN個のトランザクシ
ョンがホットスポットを読み込み共有モードでロックを
行い、レコードを書き込むために排他モードでロック要
求を行う場合にトランザクションが中断されて再実行さ
れる回数を見積もると次の通りである。
That is, when N transactions read a hot spot and lock it in a shared mode in a close time and make a lock request in an exclusive mode to write a record, the number of times the transaction is interrupted and re-executed is determined. The estimate is as follows.

【0012】排他モードのロックが成功するためには排
他モードのロックを行う1つのトランザクション以外の
トランザクションがロックを行っていないことが条件で
あるので、ホットスポットに共有モードでロックを行っ
ているN−1個のトランザクションを中断しなければな
らない。中断されたN−1個のトランザクションは再実
行され、中断前と同様に共有モードでロックを行いホッ
トスポットを読み込みレコードを書き込むために排他モ
ードでロック要求を行う。デッドロックの解除のため再
びN−2個のトランザクションを中断しなければならな
い。従って、N個のトランザクションがホットスポット
に対するロックのアップグレードでデッドロックを発生
させた場合のトランザクションの中断回数は、 1+2+ ・・・・・ + (N−2) + (N−
1) = N(N−1)/2回 となる。
In order for the lock in the exclusive mode to succeed, the transaction must be locked by a transaction other than one transaction that locks in the exclusive mode. -One transaction must be interrupted. The interrupted N-1 transactions are re-executed, locked in the shared mode as before the interruption, and issued a lock request in the exclusive mode to read the hot spot and write the record. In order to release the deadlock, N-2 transactions must be suspended again. Therefore, when N transactions cause a deadlock due to a lock upgrade for a hot spot, the number of transaction interruptions is 1 + 2 +... + (N−2) + (N−
1) = N (N-1) / 2 times.

【0013】トランザクションの中断処理はトランザク
ションが中断の直前までアクセスした資源に対するロー
ルバックが必要であるので多くのオーバーヘッドとな
る。特にN個のトランザクションがホットスポットに対
するロックのアップグレードでデッドロックを発生させ
た場合にはN(N−1)/2回のトランザクションの中
断処理が必要であり、従来のロック制御器ではロックの
アップグレードにより発生するデッドロックの解除の効
率性に問題があった。
The process of suspending a transaction involves a lot of overhead because it is necessary to roll back resources accessed until immediately before the transaction was suspended. In particular, when N transactions cause a deadlock due to a lock upgrade for a hot spot, N (N-1) / 2 transaction suspension processes are required, and a lock upgrade is performed with a conventional lock controller. There is a problem in the efficiency of releasing the deadlock caused by the above.

【0014】[0014]

【課題を解決するための手段】本発明のロック制御器
は、同一のトランザクション内で共有モードでロックを
行った資源に対して再度排他モードでロックを行う場合
のロック制御を行うロック制御器において、前記トラン
ザクションプログラムからのロック要求をキューイング
するロック待ちキューと、前記ロック待ちキューから該
ロック要求を取り出し該ロック要求が実行可能な場合は
ロックを実行し、資源に対してデッドロック状態の前記
ロック要求はそのロック要求が前記排他モードで行われ
ておりかつ前記資源に対して既に前記共有モードでロッ
クが行われている場合は前記ロック待ちキューより削除
するとともにデッドロック通知を出力するロック処理器
と、前記デッドロック通知を受けたトランザクションモ
ニタの制御により再実行を指示された前記トランザクシ
ョン処理プログラムからの前記共有モードのロック要求
を前記排他モードのロック要求に変換して前記ロック待
ちキューに登録するモード変換器とを備え、デッドロッ
クが発生したトランザクションの再実行による前記共有
モードのロック要求に対して前記排他モードでロックを
行うようにしたことにより再実行後のロック要求を成功
させデッドロックの解除の効率性を向上させたことを特
徴とする。
SUMMARY OF THE INVENTION A lock controller according to the present invention is a lock controller for performing a lock control when a resource locked in a shared mode in the same transaction is locked in an exclusive mode again. A lock wait queue for queuing a lock request from the transaction program, and taking out the lock request from the lock wait queue, executing the lock if the lock request is executable, and executing the lock in a deadlock state with respect to a resource. If the lock request is made in the exclusive mode and the resource is already locked in the shared mode, the lock request is deleted from the lock waiting queue and a deadlock notification is output. And the transaction monitor receiving the deadlock notification. A mode converter that converts the lock request in the shared mode from the transaction processing program instructed to the row into the lock request in the exclusive mode and registers the lock request in the lock wait queue. A lock request in the exclusive mode is performed in response to a lock request in the shared mode due to execution, so that a lock request after re-execution is successful and deadlock release efficiency is improved.

【0015】[0015]

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

【0016】図1は本発明の一実施例のロック制御器の
ブロック図であり、トランザクション処理への適用例で
ある。ロック制御器1はロック要求元トランザクション
をトランザクション識別子により識別し、ロックする資
源を資源識別子により識別し、ロックのモードとして共
有モードと排他モードを持つ。
FIG. 1 is a block diagram of a lock controller according to an embodiment of the present invention, which is an example of application to transaction processing. The lock controller 1 identifies a lock request source transaction by a transaction identifier, identifies a resource to be locked by a resource identifier, and has a lock mode of a shared mode and an exclusive mode.

【0017】トランザクションモニタ10はトランザク
ション処理要求を受け付けた時点で、新しいトランザク
ション識別子を割り当ててトランザクション処理プログ
ラム2を起動14する。また、トランザクション処理プ
ログラム2が終了16した時点で資源のコミット処理を
行い、ロック制御器1に対してロック解除要求11とリ
セット要求12を行った後にトランザクション処理を終
了させる。
When the transaction monitor 10 receives the transaction processing request, it allocates a new transaction identifier and activates the transaction processing program 2 14. Further, when the transaction processing program 2 ends 16, the resource commit processing is performed, and after issuing the lock release request 11 and the reset request 12 to the lock controller 1, the transaction processing is ended.

【0018】起動されたトランザクション処理プログラ
ム2はアクセスする資源の処理に応じてトランザクショ
ンモニタ10により与えられたトランザクション識別子
とロックする資源に対応する資源識別子を指定して排他
モードのロック要求8や共有モードのロック要求9をロ
ック制御器1に対して行う。
The started transaction processing program 2 designates the transaction identifier given by the transaction monitor 10 and the resource identifier corresponding to the resource to be locked according to the processing of the resource to be accessed, and the lock request 8 in the exclusive mode and the shared mode. Is issued to the lock controller 1.

【0019】共有モードロック要求9はモード変換器3
に送られ、モード変換器3によりデッドロック記憶器4
にデッドロックの発生が登録されいるかが検査される。
登録されている場合はロックのモードが排他モードに変
更されてロック要求はロック待ちキュー5に登録され、
登録されていない場合は共有モードのロック要求として
ロック待ちキュー5に登録される。一方、排他モードロ
ック要求8は直接ロック待ちキュー5に排他モードのロ
ック要求として登録される。
The shared mode lock request 9 is transmitted to the mode converter 3
To the deadlock memory 4 by the mode converter 3.
A check is made to see if a deadlock has been registered.
If registered, the lock mode is changed to the exclusive mode, and the lock request is registered in the lock waiting queue 5,
If not registered, it is registered in the lock waiting queue 5 as a lock request in the shared mode. On the other hand, the exclusive mode lock request 8 is registered in the direct lock waiting queue 5 as an exclusive mode lock request.

【0020】デッドロック記憶器4は、トランザクショ
ン識別子と資源識別子の組を1エントリとするデータベ
ースであり、モード変換器3によりロック要求のパラメ
ータとして指定されたトランザクション識別子と資源識
別子の組が登録されているかが検査される。デッドロッ
ク記憶器4の各エントリはトランザクション識別子で識
別されるトランザクションが資源識別子で識別される資
源に対してロックのアップグレードを行うための排他モ
ードのロック要求8でデッドロックが発生したことを示
している。
The deadlock storage 4 is a database in which a set of a transaction identifier and a resource identifier is set as one entry, and a set of a transaction identifier and a resource identifier specified as a parameter of a lock request by the mode converter 3 is registered. Is inspected. Each entry of the deadlock storage 4 indicates that a deadlock has occurred in the exclusive mode lock request 8 for the transaction identified by the transaction identifier to upgrade the lock on the resource identified by the resource identifier. I have.

【0021】ロック待ちキュー5に登録されたロック要
求は、ロック待ちキュー5にロック要求が登録された時
点とロック解除要求11が要求された時点で起動される
ロック処理器7によりロック可能な時点で取り出さてロ
ック処理が行われる。
The lock request registered in the lock wait queue 5 is determined when the lock request is registered in the lock wait queue 5 and when the lock processor 7 is activated when the lock release request 11 is requested. And the lock process is performed.

【0022】ロック処理器7は、資源識別子とトランザ
クション識別子とロックモードの組を1エントリとする
データベースにより資源識別子に対応する資源のロック
状態を管理し、図2に従ってロック処理を行う。
The lock processor 7 manages the lock state of the resource corresponding to the resource identifier by using a database having a set of the resource identifier, the transaction identifier, and the lock mode as one entry, and performs a lock process according to FIG.

【0023】すなわち、排他モードロックはロックする
資源識別子を持つエントリをサーチして他トランザクシ
ョンによるロックが行われていない場合にロック可能で
あるのでロック処理を行い、共有モードロックはロック
する資源識別子を持つエントリをサーチして他トランザ
クションによる排他モードによるロックが行われていな
い場合にロック可能であるのでロック処理を行う。
In other words, the exclusive mode lock searches for an entry having the resource identifier to be locked and can be locked when the lock is not performed by another transaction, so that lock processing is performed, and the shared mode lock specifies the resource identifier to be locked. The search is performed for the entry having the lock, and when the lock in the exclusive mode by another transaction is not performed, the lock is possible, so that the lock processing is performed.

【0024】ロック処理では資源識別子とトランザクシ
ョン識別子とロックモードの組をロック処理器内のバッ
ファ(図示せず)に登録して、更に共有モードのロック
の場合には共有トランザクション記憶器6にトランザク
ション識別子と資源識別子を登録する。ロック処理の終
了後にロックの完了をトランザクション処理プログラム
2に通知する。
In the lock processing, a set of a resource identifier, a transaction identifier, and a lock mode is registered in a buffer (not shown) in the lock processor, and in the case of lock in the shared mode, the transaction identifier is stored in the shared transaction storage 6. And a resource identifier. After completion of the lock processing, the completion of the lock is notified to the transaction processing program 2.

【0025】トランザクション記憶器6はトランザクシ
ョン処理プログラム2が資源識別子に対応する資源に対
して共有モードのロックを行っていることを登録するデ
ータベースであり、デッドロック検出時にロックのアッ
プグレードを行おうとしていたかどうかを判別するため
にロック処理器7から参照される。
The transaction storage 6 is a database for registering that the transaction processing program 2 has locked the resource corresponding to the resource identifier in the shared mode, and intends to upgrade the lock when a deadlock is detected. It is referred to from the lock processor 7 in order to determine whether or not it has occurred.

【0026】また、ロック処理器7は定期的にロック待
ちキュー5を検査して一定時間以上待ちとなっているロ
ック要求が有れば、ロック要求が待ちとなっている資源
でデッドロックが発生していると判断し、一定時間以上
待ちとなっているロック要求を1つづつロック待ちキュ
ー5より取り出して、最後のロック要求を除いてロック
要求を取消し、ロック要求元のトランザクション識別子
をパラメータとしてデッドロック通知13をトランザク
ションモニタに通知する。尚、最後のロック要求はロッ
ク可能なので、ロックを実行する。再度、ロック待ちキ
ュー5を検査して一定時間以上待ちとなっているロック
要求が有ればロック可能かどうかを判別する。ロック不
能な場合には前述のデッドロックによるロック要求の取
消しを繰り返す。
The lock processor 7 periodically checks the lock waiting queue 5 and, if there is a lock request that has been waiting for a predetermined time or more, a deadlock occurs in the resource for which the lock request is waiting. The lock requests that have been waiting for a certain period of time or more are taken out one by one from the lock wait queue 5, and the lock requests are canceled except for the last lock request, and the transaction identifier of the lock request source is used as a parameter. A deadlock notification 13 is sent to the transaction monitor. Since the last lock request can be locked, the lock is executed. The lock waiting queue 5 is inspected again, and if there is a lock request that has been waiting for a predetermined time or more, it is determined whether or not lock is possible. If the lock is not possible, cancellation of the lock request due to the deadlock described above is repeated.

【0027】例えば、図3の場合、トランザクション4
1の排他モードロック要求を取消し、次にトランザクシ
ョン42の排他モードロック要求を取消す。この時点
で、トランザクション43の排他モードロック要求は処
理可能となりデッドロックは解除される。
For example, in the case of FIG.
One exclusive mode lock request is canceled, and then the exclusive mode lock request of transaction 42 is canceled. At this point, the exclusive mode lock request of the transaction 43 can be processed, and the deadlock is released.

【0028】デッドロックにより取り消したロック要求
が排他モードで共有トランザクション記憶器6にトラン
ザクション識別子と資源識別詞が登録されている場合
(同一の資源に対して既に共有モードでロックを行って
いる場合)はデッドロック記憶器4にトランザクション
識別子と資源識別子を登録する。
When the lock request canceled by the deadlock is in exclusive mode and the transaction identifier and the resource identifier are registered in the shared transaction storage 6 (when the same resource is already locked in shared mode) Registers the transaction identifier and the resource identifier in the deadlock storage 4.

【0029】トランザクションモニタ10はデッドロッ
ク通知13を受信すると、資源のロールバックを行った
後にロック解除要求11を行いロック要求を削除した後
に、トランザクション処理プログラム2を再実行する。
When the transaction monitor 10 receives the deadlock notification 13, after performing the rollback of the resource, it issues the lock release request 11, deletes the lock request, and executes the transaction processing program 2 again.

【0030】ロック解除要求11はトランザクション識
別子をキーにトランザクションから要求されたロック要
求をロック待ちキュー5とロック処理器7のデータベー
スより削除する。
The lock release request 11 deletes the lock request requested by the transaction from the lock waiting queue 5 and the database of the lock processor 7 using the transaction identifier as a key.

【0031】一方、トランザクション処理プログラム2
が終了16した時点で、トランザクションモニタ10に
よって行なわれるコミット処理後に出力されるリセット
要求12は、トランザクション識別子をキーにトランザ
クションから要求されたロック要求に対応するデータベ
ースのエントリをデッドロック記憶器4と共有トランザ
クション記憶器6から削除する。
On the other hand, the transaction processing program 2
Is completed 16 after the commit processing performed by the transaction monitor 10, the reset request 12 shares the database entry corresponding to the lock request requested by the transaction with the deadlock storage 4 using the transaction identifier as a key. Delete from transaction storage 6.

【0032】トランザクションモニタ10にデッドロッ
クの通知13が行われた後の再起動15に基くトランザ
クション処理プログラム2における、前回デッドロック
を起こした資源に対する共有モードのロック要求9は、
デッドロック記憶器4を参照するモード変換器3により
排他モード要求に変更されてロック待ちキュー5にキュ
ーイングされる。
In the transaction processing program 2 based on the restart 15 after the notification 13 of the deadlock is made to the transaction monitor 10, the lock request 9 in the shared mode for the resource that caused the deadlock last time is as follows:
The request is changed to the exclusive mode request by the mode converter 3 referring to the deadlock storage 4 and is queued in the lock waiting queue 5.

【0033】排他モード要求が成功した場合、他トラン
ザクション処理プログラムからの共有ロック要求は待ち
となるのでるので後続の排他モードのロック要求8も成
功し、デッドロックの事象は解除される。
When the exclusive mode request is successful, the shared lock request from the other transaction processing program waits, so that the subsequent exclusive mode lock request 8 also succeeds and the deadlock event is released.

【0034】デッドロック記憶器4にデッドロックが登
録されていない通常のロックにおいては、共有モードの
ロックは共有モードでロック処理を行うので通常のロッ
ク処理器と同様の動作となる。
In a normal lock in which a deadlock is not registered in the deadlock storage 4, the lock in the shared mode performs the lock processing in the shared mode, so that the operation is the same as that of the normal lock processor.

【0035】本発明のロック制御器を適用したトランザ
クション処理において、近接した時間にN個のトランザ
クションがホットスポットを読み込み共有モードでロッ
クを行い、レコードを書き込むために排他モードでロッ
ク要求を行う場合にトランザクションが中断されて再実
行される回数を見積もると次の通りである。
In transaction processing to which the lock controller of the present invention is applied, when N transactions read a hot spot and lock in a shared mode at close time, and issue a lock request in an exclusive mode to write a record. The number of times the transaction is suspended and re-executed is estimated as follows.

【0036】排他モードのロックが成功するためには排
他モードのロックを行う1つのトランザクション以外の
トランザクションがロックを行っていないことが条件で
あるので、ホットスポットに共有モードでロックを行っ
ているN−1個のトランザクションを中断しなければな
らない。
In order for the lock in the exclusive mode to succeed, the transaction must be locked by a transaction other than one transaction that locks in the exclusive mode. -One transaction must be interrupted.

【0037】中断されたN−1個のトランザクションは
再実行され中断前と同様にホットスポットを読み込み共
有モードでロックを行うが本ロック処理器の内部では排
他モードでロック要求を処理するため、後続の更新モー
ドでのロック要求ではデッドロックは発生しない。
The interrupted N-1 transactions are re-executed and the hot spot is read and locked in the shared mode in the same manner as before the interruption, but the lock processor processes the lock request in the exclusive mode in the same manner as before the interruption. Deadlock does not occur for lock requests in update mode.

【0038】従って、N個のトランザクションがホット
スポットに対するロックのアップグレードでデッドロッ
クを発生させた場合のトランザクションの中断回数は、
(N−1)回 となる。
Therefore, when N transactions cause a deadlock due to a lock upgrade to a hot spot, the number of transaction interruptions is:
(N-1) times.

【0039】[0039]

【発明の効果】以上説明したように本発明は、ロックの
アップグレードを行っている資源のロックおいてデッド
ロックが発生した場合に、トランザクションを中断して
共有モードにも拘わらず排他モードに変更してロックを
行うので、他トランザクションからの共有モードのロッ
クや排他モードのロックはロック待ちキューにより待た
されるため再実行後のロックは成功しデッドロックの解
除の効率が良い(再実行回数がN(N−1)/2回から
N−1回に減少する)という効果を有する。
As described above, according to the present invention, when a deadlock occurs in a lock of a resource whose lock is being upgraded, the transaction is interrupted and the exclusive mode is changed in spite of the shared mode. Therefore, the lock in the shared mode or the lock in the exclusive mode from another transaction is waited in the lock waiting queue, so that the lock after re-execution is successful and the deadlock is released efficiently (the number of re-executions is N ( N-1) / 2 times to N-1 times).

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

【図1】本発明のロック制御器の一実施例を示すブロッ
ク図である。
FIG. 1 is a block diagram showing an embodiment of a lock controller according to the present invention.

【図2】本発明における排他制御規程を示す図である。FIG. 2 is a diagram showing an exclusive control rule according to the present invention.

【図3】デッドロック発生の説明図である。FIG. 3 is an explanatory diagram of occurrence of deadlock.

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

1 ロック制御器 2 トランザクション処理プログラム 3 モード変換器 4 デッドロック記憶器 5 ロック待ちキュー 6 共有トランザクション記憶器 7 ロック処理器 10 トランザクションモニタ DESCRIPTION OF SYMBOLS 1 Lock controller 2 Transaction processing program 3 Mode converter 4 Deadlock storage 5 Lock wait queue 6 Shared transaction storage 7 Lock processor 10 Transaction monitor

フロントページの続き (56)参考文献 特開 平4−241034(JP,A) 特開 平4−369056(JP,A) 特開 平5−46415(JP,A) 特開 平5−204678(JP,A) 特開 平5−216728(JP,A) 特開 平5−334160(JP,A) 特開 平6−103142(JP,A) 特開 平6−208497(JP,A) 特開 平7−78093(JP,A) 特開 平7−84851(JP,A) (58)調査した分野(Int.Cl.6,DB名) G06F 12/00 535Continuation of the front page (56) References JP-A-4-241034 (JP, A) JP-A-4-369056 (JP, A) JP-A-5-46415 (JP, A) JP-A-5-204678 (JP) JP-A-5-216728 (JP, A) JP-A-5-334160 (JP, A) JP-A-6-103142 (JP, A) JP-A-6-208497 (JP, A) 7-78093 (JP, A) JP-A-7-84851 (JP, A) (58) Fields investigated (Int. Cl. 6 , DB name) G06F 12/00 535

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 同一のトランザクション内で共有モード
でロックを行った資源に対して再度排他モードでロック
を行う場合のロック制御を行うロック制御器において、
前記トランザクションプログラムからのロック要求をキ
ューイングするロック待ちキューと、前記ロック待ちキ
ューから該ロック要求を取り出し該ロック要求が実行可
能な場合はロックを実行し、資源に対してデッドロック
状態の前記ロック要求はそのロック要求が前記排他モー
ドで行われておりかつ前記資源に対して既に前記共有モ
ードでロックが行われている場合は前記ロック待ちキュ
ーより削除するとともにデッドロック通知を出力するロ
ック処理器と、前記デッドロック通知を受けたトランザ
クションモニタの制御により再実行を指示された前記ト
ランザクション処理プログラムからの前記共有モードの
ロック要求を前記排他モードのロック要求に変換して前
記ロック待ちキューに登録するモード変換器とを備え、
デッドロックが発生したトランザクションの再実行によ
る前記共有モードのロック要求に対して前記排他モード
でロックを行うようにしたことにより再実行後のロック
要求を成功させデッドロックの解除の効率性を向上させ
たことを特徴とするロック制御器。
1. A lock controller for performing lock control when a resource locked in a shared mode in the same transaction is locked again in an exclusive mode.
A lock wait queue for queuing a lock request from the transaction program; and taking out the lock request from the lock wait queue, executing the lock if the lock request is executable, and executing the lock in a deadlock state with respect to a resource. If the lock request has been made in the exclusive mode and the resource has already been locked in the shared mode, the request is deleted from the lock waiting queue and a deadlock notification is output. The lock request in the shared mode from the transaction processing program instructed to be re-executed by the control of the transaction monitor receiving the deadlock notification is converted into the lock request in the exclusive mode and registered in the lock waiting queue. With a mode converter,
By performing lock in the exclusive mode in response to the lock request in the shared mode due to re-execution of the transaction in which the deadlock has occurred, the lock request after the re-execution is successful, and the efficiency of deadlock release is improved. A lock controller.
JP7177248A 1995-07-13 1995-07-13 Lock controller Expired - Fee Related JP2834036B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7177248A JP2834036B2 (en) 1995-07-13 1995-07-13 Lock controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7177248A JP2834036B2 (en) 1995-07-13 1995-07-13 Lock controller

Publications (2)

Publication Number Publication Date
JPH0926907A JPH0926907A (en) 1997-01-28
JP2834036B2 true JP2834036B2 (en) 1998-12-09

Family

ID=16027754

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7177248A Expired - Fee Related JP2834036B2 (en) 1995-07-13 1995-07-13 Lock controller

Country Status (1)

Country Link
JP (1) JP2834036B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0308923D0 (en) * 2003-04-17 2003-05-28 Ibm Low-overhead storage cluster configuration locking
CN109359081B (en) 2015-12-14 2022-05-17 华为技术有限公司 Lock management method in cluster, lock server and client

Also Published As

Publication number Publication date
JPH0926907A (en) 1997-01-28

Similar Documents

Publication Publication Date Title
JP2820752B2 (en) Cache Memory Coincidence Control Method in Tightly Coupled Multiprocessor System
JP2500101B2 (en) How to update the value of a shared variable
CN1755635B (en) Hybrid hardware and software implementation of transactional memory access
US8386720B2 (en) Method for allowing exclusive access to shared data
JP2667039B2 (en) Data management system and data management method
JP3512439B2 (en) Locking method in check-in / check-out model
US20090183159A1 (en) Managing concurrent transactions using bloom filters
EP0490526A2 (en) Multi-system data sharing combination and method of operating same
US20020078307A1 (en) Memory-to-memory copy and compare/exchange instructions to support non-blocking synchronization schemes
KR19990077481A (en) Method and apparatus for performing a semaphore operation
JPH05197604A (en) Multiprocessor computer and operating method thereof
US20090292706A1 (en) Apparatus and method for data management
JPH01188965A (en) Data processing
JPH04310148A (en) High-speed accessing method for data unit
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
CN107003896B (en) Apparatus with shared transaction processing resources and data processing method
US5734896A (en) Recovery of a remotely initiated distributed prepared transaction by status report from a second database to an external coordinator
US7890707B2 (en) Efficient retry for transactional memory
JP3052908B2 (en) Transaction program parallel execution method and transaction program parallel execution method
US20100174875A1 (en) System and Method for Transactional Locking Using Reader-Lists
US20030208489A1 (en) Method for ordering parallel operations in a resource manager
JP2834036B2 (en) Lock controller
JP2821345B2 (en) Asynchronous I / O control method
JPH04155465A (en) Method for using file in common
US8219762B1 (en) Computer system and method for leasing memory location to allow predictable access to memory location

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19980825

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081002

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees