JPH09223030A - Exclusive control method and equipment therefor - Google Patents

Exclusive control method and equipment therefor

Info

Publication number
JPH09223030A
JPH09223030A JP8050899A JP5089996A JPH09223030A JP H09223030 A JPH09223030 A JP H09223030A JP 8050899 A JP8050899 A JP 8050899A JP 5089996 A JP5089996 A JP 5089996A JP H09223030 A JPH09223030 A JP H09223030A
Authority
JP
Japan
Prior art keywords
task
lock
deadlock
monitoring
time
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
JP8050899A
Other languages
Japanese (ja)
Inventor
Katsumi Kobayashi
勝美 小林
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 Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP8050899A priority Critical patent/JPH09223030A/en
Publication of JPH09223030A publication Critical patent/JPH09223030A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To reduce the overhead loaded on a lock operation. SOLUTION: When requesting the lock of resources, a task issues a lock possession request containing the designation of monitor time. When the permission of lock can not be immediately given to this lock possession request, task information concerning that task is added to a waiting list by a task information register means 210. A wait time monitor means 220 monitors the lapse of time after the task is turned into lock waiting and when that time becomes a monitor time designated by the task, a deadlock check means 230 is called. When this task is set in a lock waiting state, concerning this task, the deadlock check means 230 checks whether deadlock has been generated or not. When the deadlock has been generated, this task is excluded out of the lock waiting list and it is reported to the task of the request source. When this report is received, the task cancels already possessed lock through a task information deleting means 240.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、情報処理システム
に於いて資源の排他制御を行う技術に関し、特に、デッ
ドロックチェックに係るオーバヘッドを低減させること
ができる排他制御方法及びその装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a technology for performing exclusive control of resources in an information processing system, and more particularly to an exclusive control method and apparatus capable of reducing the overhead related to deadlock check.

【0002】[0002]

【従来の技術】複数のタスクにより資源が共有される場
合、その資源を使用するためにはその資源をロックする
ことが必要になる。一般に、書き込みのためのロックが
取得されていると、他のタスクは同一資源に関するロッ
クを取得することができない。
2. Description of the Related Art When a resource is shared by a plurality of tasks, it is necessary to lock the resource in order to use it. In general, when the lock for writing is acquired, other tasks cannot acquire the lock for the same resource.

【0003】一方、複数のタスクで共有される資源に対
してロックを取得しようとした場合、他のタスクが取得
しているロックを互いに待ってしまい、処理が進まなく
なってしまうことがある。このような状態をデッドロッ
クという。デッドロックが発生すると、処理が進まなく
なるため、何らかの処置をとることが必要になる。
On the other hand, when trying to acquire a lock for a resource shared by a plurality of tasks, the locks acquired by other tasks may wait for each other and the processing may not proceed. Such a state is called deadlock. When a deadlock occurs, the process does not proceed, and it is necessary to take some action.

【0004】従来は、ロック取得要求を発行したタスク
がロックに失敗してロック待ちとなるような場合、必ず
デッドロック発生の有無をチェックし、デッドロックが
発生するようなロック取得要求は拒否するようにしてい
た。この従来の技術によれば、デッドロックの発生を防
ぐことはできるが、デッドロックの発生頻度は一般的に
は少ないため、ロック待ち合わせが発生する毎にデッド
ロックチェックを行うのではオーバヘッドが大きくなる
という問題がある。
Conventionally, when a task that issues a lock acquisition request fails to lock and waits for a lock, it is always checked whether a deadlock has occurred, and a lock acquisition request that causes a deadlock is rejected. Was doing. According to this conventional technique, it is possible to prevent the occurrence of deadlock, but since the frequency of deadlock is generally low, performing a deadlock check every time lock waiting occurs increases overhead. There is a problem.

【0005】そこで、上記した問題点を解決するため、
ロック待ち合わせが発生した時にはデッドロックチェッ
クを行わずに、或る一定時間間隔でロック待ち状態にあ
る全てのタスクに対してデッドロックチェックを行うよ
うにした技術が提案されている(特開昭62−1776
31号公報)。この技術によれば、ロック待ちが発生し
てからデッドロックチェックタイミングとなるまでの間
にロック待ちが解消したタスクについてはデッドロック
チェックを行うことが不要になるので、デッドロックチ
ェックを行うタスク数を少なくし、オーバヘッドを少な
くすることができる。
Therefore, in order to solve the above problems,
A technique has been proposed in which, when a lock wait occurs, a deadlock check is not performed, but a deadlock check is performed for all tasks that are in a lock wait state at a certain fixed time interval (Japanese Patent Laid-Open No. 62-62160). -1776
31 publication). According to this technology, it is not necessary to perform a deadlock check for the tasks for which the lock wait has been resolved between the occurrence of the lock wait and the deadlock check timing, so the number of tasks that perform the deadlock check And the overhead can be reduced.

【0006】[0006]

【発明が解決しようとする課題】上述した従来の技術
は、一定時間間隔でデッドロックチェックを行っている
が、ロック待ちが発生するタイミングはデッドロックチ
ェックタイミングとは無関係のものである。従って、デ
ッドロックチェックタイミングの直前に於いて、ロック
待ちが発生する場合もあり、このような場合、上記ロッ
ク待ちに関係するタスクがデッドロックチェックタイミ
ングに於いてロック待ちが解消されている確率は低い。
つまり、上記したようなタスクについてはデッドロック
チェックを省くことができない確率が高くなる。このた
め、上述した従来の技術では、デッドロックチェックタ
イミングの直前に於いて、集中的にロック待ちが発生し
たような場合には、デッドロックチェックを省くことが
できるタスク数が少なくなり、オーバヘッドを余り低減
させることができないという問題がある。
In the above-mentioned conventional technique, the deadlock check is performed at fixed time intervals, but the timing at which the lock wait occurs is independent of the deadlock check timing. Therefore, a lock wait may occur immediately before the deadlock check timing. In such a case, the probability that the task related to the lock wait has been released from the lock wait at the deadlock check timing is as follows. Low.
In other words, there is a high probability that the deadlock check cannot be omitted for the above tasks. Therefore, in the above-described conventional technique, when the lock wait occurs intensively immediately before the deadlock check timing, the number of tasks that can omit the deadlock check becomes small, and the overhead is reduced. There is a problem that it cannot be reduced so much.

【0007】そこで、本発明の目的は、ロック待ちの発
生タイミングにかかわらず、オーバヘッドを少なくする
ことができる排他制御方法及びその装置を提供すること
にある。
Therefore, an object of the present invention is to provide an exclusive control method and an apparatus thereof which can reduce the overhead regardless of the timing of occurrence of the lock wait.

【0008】[0008]

【課題を解決するための手段】本発明の排他制御方法
は、上記目的を達成するため、タスクが発行するロック
取得要求に監視時間の指定を含ませ、監視時間の指定を
含むロック取得要求を発行したタスクがロックに失敗し
てロック待ちになった場合、前記ロック取得要求で指定
されている監視時間が経過するのを待ち合わせ、前記監
視時間が経過した時に前記タスクのロック待ちが解除さ
れていない場合に限って前記タスクに関連するデッドロ
ック発生の有無を調べ、デッドロックが発生している場
合、前記タスクがロックしている資源を解放する。
In order to achieve the above-mentioned object, the exclusive control method of the present invention includes a lock acquisition request issued by a task including a specification of a monitoring time, and a lock acquisition request including a specification of the monitoring time. If the issued task fails to lock and waits for a lock, the task waits until the monitoring time specified in the lock acquisition request elapses, and when the monitoring time elapses, the task lock wait is released. Only when there is no deadlock, whether or not a deadlock related to the task has occurred is checked, and when the deadlock has occurred, the resource locked by the task is released.

【0009】また、本発明の排他制御方法は、優先度が
異なるタスク間で競合が発生した場合、優先度の高いタ
スクが優先的に資源をロックできるようにするため、優
先度の高いタスク程、ロック取得要求に於いて指定する
監視時間を長くする。
Further, in the exclusive control method of the present invention, when a conflict occurs between tasks having different priorities, a task having a higher priority can preferentially lock the resource. , Increase the monitoring time specified in the lock acquisition request.

【0010】また、本発明の排他制御装置は、上記目的
を達成するため、監視時間の指定を含むロック取得要求
を発行したタスクがロックに失敗してロック待ちになっ
た場合、前記ロック取得要求で指定されている監視時間
の経過を監視する待ち時間監視手段と、該待ち時間監視
手段によって監視時間の経過が検出されたタスクのロッ
ク待ちが解除されていない場合に限って前記タスクに関
連するデッドロック発生の有無を調べ、デッドロックが
発生している場合、前記タスクがロックしている資源を
解放するデッドロックチェック手段とを備えている。
Further, in order to achieve the above object, the exclusive control device of the present invention provides the lock acquisition request when the task that has issued the lock acquisition request including the designation of the monitoring time fails to lock and waits for the lock. Waiting time monitoring means for monitoring the elapse of the monitoring time specified by the above, and is related to the task only if the lock wait of the task whose monitoring time has been detected by the waiting time monitoring means is not released. A deadlock check means for checking whether or not a deadlock has occurred and for releasing the resource locked by the task when the deadlock has occurred.

【0011】上記した構成に於いては、タスクがロック
に失敗してロック待ちになった場合、待ち時間監視手段
が、上記タスクによって指定された監視時間の経過を監
視する。デッドロックチェック手段は、待ち時間監視手
段によって監視時間の経過が検出されたタスクのロック
待ちが解除されていない場合に限ってそのタスクに関連
するデッドロック発生の有無を調べる。
In the above-mentioned configuration, when the task fails to lock and waits for lock, the waiting time monitoring means monitors the elapse of the monitoring time designated by the task. The deadlock check means checks whether or not a deadlock related to the task has occurred only when the lock wait of the task whose elapsed monitoring time has been detected by the wait time monitoring means is not released.

【0012】[0012]

【発明の実施の形態】次に本発明の実施の形態について
図面を参照して詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0013】図1を参照すると、本発明にかかる排他制
御装置200は、例えば、複数のプロセッサ100と、
これらプロセッサ100に共有される共有資源300と
を含む疎結合システム等の情報処理システムに適用され
る。ここで、共有資源300とされるのは、例えば、メ
モリの一部の領域やファイル等である。尚、以下の説明
に於いては、ロック制御の対象となる最小単位をブロッ
クと呼ぶ。
Referring to FIG. 1, an exclusive control device 200 according to the present invention includes, for example, a plurality of processors 100,
It is applied to an information processing system such as a loosely coupled system including the shared resource 300 shared by these processors 100. Here, the shared resource 300 is, for example, a partial area or file of the memory. In the following description, the minimum unit subject to lock control is called a block.

【0014】図2は排他制御装置200の構成例を示し
たブロック図である。同図を参照すると、排他制御装置
200は、各プロセッサ100とコマンドをやりとりす
るコマンドインタフェース250と、ロックまたはロッ
ク待ちしているタスクに関する情報(以下、タスク情
報)が登録されるロック管理テーブル260と、ロック
またはロック待ちしているタスクのタスク情報をロック
管理テーブル260に登録するタスク情報登録手段21
0と、タスクが発行したロック取得要求によって指定さ
れている監視時間の経過を監視する待ち時間監視手段2
20と、タスク間のデッドロックの有無を調べるデッド
ロックチェック手段230と、ロック管理テーブル26
0に登録されているタスク情報を削除するタスク情報削
除手段240とを備えている。
FIG. 2 is a block diagram showing a configuration example of the exclusive control device 200. Referring to FIG. 1, the exclusive control device 200 includes a command interface 250 for exchanging commands with each processor 100, and a lock management table 260 in which information about a lock or a task waiting for a lock (hereinafter, task information) is registered. , Task information registration means 21 for registering the task information of the lock or the task waiting for the lock in the lock management table 260.
0 and the waiting time monitoring means 2 for monitoring the elapse of the monitoring time designated by the lock acquisition request issued by the task 2
20, a deadlock check means 230 for checking whether there is a deadlock between tasks, and a lock management table 26.
Task information deleting means 240 for deleting the task information registered in 0.

【0015】図3はロック管理テーブル260の内容例
を示した図である。同図を参照すると、ロック管理テー
ブル260には、ブロック毎のブロック情報261と、
そのブロックをロックまたはロック待ちしているタスク
のタスク情報262とが登録される。
FIG. 3 is a diagram showing an example of the contents of the lock management table 260. Referring to the figure, the lock management table 260 includes block information 261 for each block,
The task information 262 of the task that locks or waits for the block is registered.

【0016】ブロック情報261は、そのブロックを識
別するためのブロック識別子と、ロックリストの先頭に
対するポインタであるロックリストポインタと、待ちリ
ストの先頭に対するポインタである待ちリストポインタ
とを有する。ここで、ロックリストとは、そのブロック
をロックしているタスクのタスク情報を連結リストによ
り接続したものである。また、待ちリストとは、そのブ
ロックをロック待ちしているタスクのタスク情報を連結
リストにより接続したものである。また、各タスク情報
262は、タスクを識別するためのタスク識別子と、読
み出しか書き込みか等のロック種別を表すロック種別
と、連結リストを形成する次のタスク情報をポイントす
る次タスク情報ポインタとを有している。尚、本実施例
では、ロック管理テーブル260には、ブロック毎のブ
ロック情報を予め登録するようにしているが、そのブロ
ックをロックするタスクが発生した時に、そのブロック
のブロック情報を生成し、また、そのブロックをロック
またはロック待ちしているタスクがなくなった場合、そ
のブロックのブロック情報を削除するようにしても良
い。このようにすることにより、ロック管理テーブル2
60の容量を少ないものにすることができる。
The block information 261 has a block identifier for identifying the block, a lock list pointer which is a pointer to the head of the lock list, and a wait list pointer which is a pointer to the head of the wait list. Here, the lock list is a list in which task information of tasks that lock the block is connected by a linked list. Further, the waiting list is a list in which the task information of the tasks waiting for the lock of the block is connected by the linked list. Further, each task information 262 includes a task identifier for identifying a task, a lock type indicating a lock type such as read or write, and a next task information pointer that points to the next task information forming a linked list. Have In the present embodiment, the block information for each block is registered in advance in the lock management table 260. However, when a task to lock the block occurs, the block information of the block is generated, and When there is no task that locks or waits for the block, the block information of the block may be deleted. By doing so, the lock management table 2
The capacity of 60 can be reduced.

【0017】図4は待ち時間監視手段220が使用する
監視エントリの内容例を示した図である。同図を参照す
ると、監視エントリは、ロック管理テーブル260中の
タスク情報へのポインタである対象エントリポインタ
と、ロック管理テーブル260に登録された時刻を示す
登録時刻と、タスクからのロック取得要求によって指定
された監視時間とを含む。
FIG. 4 is a diagram showing an example of the contents of the monitoring entries used by the waiting time monitoring means 220. Referring to the figure, the monitoring entry is a target entry pointer that is a pointer to the task information in the lock management table 260, a registration time indicating the time registered in the lock management table 260, and a lock acquisition request from the task. Including the specified monitoring time.

【0018】図5は各プロセッサ100上のタスクが発
行するコマンドの形式の一例を示す図である。同図を参
照すると、プロセッサ100が発行するコマンドは、要
求の種類を表すコマンドコードと、要求元タスクを表す
タスク識別子と、要求対象のブロックを表すブロック識
別子と、ロックの種別を表すロック種別と、ロック待ち
が生じた場合の監視時間とを含んでいる。
FIG. 5 is a diagram showing an example of the format of a command issued by a task on each processor 100. Referring to the figure, the command issued by the processor 100 includes a command code indicating a request type, a task identifier indicating a request source task, a block identifier indicating a request target block, and a lock type indicating a lock type. , And the monitoring time when a lock wait occurs.

【0019】図6はタスク情報登録手段210の処理例
を示す流れ図、図7は待ち時間監視手段220の処理例
を示す流れ図、図8はデッドロックチェック手段230
の処理例を示す流れ図、図9はタスク情報削除手段24
0の処理例を示す流れ図であり、以下各図を参照して本
実施例の動作を説明する。
FIG. 6 is a flow chart showing a processing example of the task information registration means 210, FIG. 7 is a flow chart showing a processing example of the waiting time monitoring means 220, and FIG. 8 is a deadlock check means 230.
9 is a flowchart showing an example of the processing of FIG.
10 is a flowchart showing a processing example of 0, and the operation of the present embodiment will be described below with reference to each drawing.

【0020】排他制御装置200内のコマンドインタフ
ェース250は、プロセッサ100上のタスクから図5
に示す形式のコマンドを受け取ると、コマンド中のコマ
ンドコードを解析する。そして、コマンドコードがロッ
ク取得要求を示していれば、タスク情報登録手段210
を呼び出してコマンドを渡し、アンロック要求を示して
いれば、タスク情報削除手段240を呼び出してコマン
ドを渡す。
The command interface 250 in the exclusive control device 200 is shown in FIG.
When the command of the format shown in is received, the command code in the command is analyzed. If the command code indicates a lock acquisition request, the task information registration means 210
Is called to pass the command, and if the unlock request is indicated, the task information deleting means 240 is called to pass the command.

【0021】図6を参照すると、タスク情報登録手段2
10は、コマンドインタフェース250からコマンドが
渡されると、先ずロック管理テーブルを検索して(S2
11)、上記コマンドに含まれている「ブロック識別
子」が示すブロックに対するロック可否を判定する(S
212)。
Referring to FIG. 6, task information registration means 2
When the command is passed from the command interface 250, the device 10 first searches the lock management table (S2
11), it is determined whether the block indicated by the “block identifier” included in the command can be locked (S).
212).

【0022】このS212の処理例を詳細に説明する
と、先ず、ロック管理テーブル260の中から、コマン
ドに含まれている「ブロック識別子」と同じ「ブロック
識別子」を有するブロック情報261を検索して、この
ブロック情報261の「ロックリストポインタ」が空ポ
インタであるか否かを調べる。そして、空きポインタで
ある場合は、ロック可と判定する。
Explaining the processing example of S212 in detail, first, the block information 261 having the same “block identifier” as the “block identifier” included in the command is searched from the lock management table 260, It is checked whether or not the "lock list pointer" of this block information 261 is an empty pointer. If it is a free pointer, it is determined that the lock is possible.

【0023】また、空きポインタでない場合は、既に他
のタスクによってロックされているため、ロックリスト
に接続されている各タスク情報の「ロック種別」を参照
して同時にロックすることが可能か否かを判定する。即
ち、対象となるブロックが既に読み出しのためにロック
されていても、コマンドの「ロック種別」が「読み出
し」であれば、これもロックできるものと判定する。読
み出し同士であれば矛盾が生じないからである。一方、
対象となるブロックが既に書き込みのためにロックされ
ていれば、コマンドの「ロック種別」にかかわらず、ロ
ックできないものと判定する。以上がS212の詳細な
処理例である。
If the pointer is not a free pointer, it has already been locked by another task. Therefore, it is possible to lock at the same time by referring to the "lock type" of each task information connected to the lock list. To judge. That is, even if the target block is already locked for reading, if the “lock type” of the command is “read”, it is also determined that this can be locked. This is because no contradiction occurs if they are read from each other. on the other hand,
If the target block is already locked for writing, it is determined that the block cannot be locked regardless of the "lock type" of the command. The above is a detailed processing example of S212.

【0024】S212でロック可と判定された場合は、
コマンドに含まれている「タスク識別子」及び「ロック
種別」に基づいてタスク情報を生成して、ロックリスト
の最後尾に接続し(S213)、その後、コマンドイン
タフェース250を介してコマンドの「タスク識別子」
が示すタスクに対してロック許可の旨を通知する(S2
16)。
If it is determined in S212 that the lock is possible,
The task information is generated based on the “task identifier” and the “lock type” included in the command, and the task information is connected to the end of the lock list (S213), and then the “task identifier” of the command is sent via the command interface 250. "
Is notified to the task indicated by (S2).
16).

【0025】一方、S212でロックできないと判定さ
れた場合は、コマンドに含まれている「タスク識別子」
及び「ロック種別」に基づいてタスク情報を生成して、
待ちリストの最後尾に接続し(S214)、更に、待ち
時間監視手段220を呼び出してコマンドを渡し(21
5)、その後、コマンドの「タスク識別子」が示すタス
クに対してロック待ちの旨を通知する(S216)。
On the other hand, if it is determined in S212 that the lock cannot be made, the "task identifier" included in the command
And generate task information based on "Lock type",
Connect to the end of the waiting list (S214), and further call the waiting time monitoring means 220 to pass the command (21
5) After that, the fact that the task indicated by the "task identifier" of the command is waiting for lock is notified (S216).

【0026】図7を参照すると、待ち時間監視手段22
0は、タスク情報登録手段210から呼び出されてコマ
ンドが渡されると、先ず、図4に示す形式の監視エント
リを生成し、ロック管理テーブル260に登録する(S
221)。そして、監視エントリ中の登録時刻からの経
過時間が監視エントリの「監視時間」と一致するまで監
視処理を行う(S222,S223)。
Referring to FIG. 7, the waiting time monitoring means 22
When 0 is called from the task information registration means 210 and a command is passed, first, a monitoring entry of the format shown in FIG. 4 is generated and registered in the lock management table 260 (S
221). Then, the monitoring process is performed until the elapsed time from the registration time in the monitoring entry matches the “monitoring time” of the monitoring entry (S222, S223).

【0027】そして、経過時間が監視エントリ中の「監
視時間」と一致すると、ロック管理テーブル260を検
索して、監視エントリの「対象エントリポインタ」が指
し示すタスク情報が既に削除済みか否かを調べる(S2
24,S225)。その結果、ロック管理テーブル26
0に「対象エントリポインタ」によって指し示されるタ
スク情報がまだ残っている場合には、デッドロックチェ
ックを行うために、デッドロックチェック手段230を
呼び出して上記タスク情報を指し示す「対象エントリポ
インタ」を渡す(S226)。尚、ロック管理テーブル
260に「対象エントリポインタ」によって指し示され
るタスク情報が残っていない場合には、デッドロックチ
ェックを行う必要がないので、デッドロックチェック手
段230の呼び出しは行わない。
When the elapsed time matches the "monitoring time" in the monitoring entry, the lock management table 260 is searched to see if the task information pointed to by the "target entry pointer" of the monitoring entry has already been deleted. (S2
24, S225). As a result, the lock management table 26
If the task information pointed to by the "target entry pointer" still exists in 0, the deadlock check means 230 is called to pass the "target entry pointer" pointing to the task information in order to perform the deadlock check. (S226). If there is no task information pointed to by the “target entry pointer” in the lock management table 260, it is not necessary to perform the deadlock check, so the deadlock check means 230 is not called.

【0028】図8を参照すると、デッドロックチェック
手段230は、待ち時間監視手段220から呼び出され
て「対象エントリポインタ」が渡されると、先ず、「対
象エントリポインタ」によって指し示されるタスク情報
を起点にしてタスク間のデッドロック発生の有無を調べ
る(S231,S232)。その結果、デッドロックが
発生していた場合には、起点となったタスク情報中の
「タスク識別子」が指し示すタスクをデッドロック発生
の原因タスクと決定すると共に、タスク情報削除手段2
40を呼び出して上記「対象エントリポインタ」を渡し
(S233)、その後、コマンドインタフェース250
を介して原因タスクに対してデッドロックによるタスク
情報削除が発生した旨を通知する(S234)。この通
知を受けた原因タスクは、自身がロックしている全ての
ブロックを解放してデッドロックを解消するために、
「コマンドコード」にアンロックを要求するコードを、
「タスク識別子」に自身のタスク識別子を、「ブロック
識別子」にアンロックするブロックのブロック識別子を
設定した図5に示す形式のコマンドを、ロックしている
ブロックそれぞれについて発行する。このコマンドは、
コマンドインタフェース250によって解析され、タス
ク情報削除手段240に渡される。
Referring to FIG. 8, when the deadlock checking means 230 is called from the waiting time monitoring means 220 and the "target entry pointer" is passed, the deadlock check means 230 first starts the task information pointed to by the "target entry pointer". Then, the presence or absence of deadlock between tasks is checked (S231, S232). As a result, when a deadlock has occurred, the task indicated by the “task identifier” in the task information that is the starting point is determined as the task causing the deadlock, and the task information deleting means 2
40, and the above “target entry pointer” is passed (S233), and then the command interface 250
The fact that task information deletion due to deadlock has occurred is notified to the cause task via (S234). The task that received this notification releases all the blocks that it has locked to eliminate the deadlock.
The code that requests unlocking to the "command code",
A command of the format shown in FIG. 5 in which the task identifier of the block is set to the task identifier of itself and the block identifier of the block to be unlocked is issued to each of the locked blocks. This command
It is analyzed by the command interface 250 and passed to the task information deleting means 240.

【0029】図9を参照すると、タスク情報削除手段2
40は、デッドロックチェック手段230から呼び出さ
れた場合、及びコマンドインタフェース250を介して
アンロックを要求するコマンドが渡された場合、先ず、
ロック管理テーブル260から削除対象のタスク情報を
検索する(S241)。具体的には、アンロックを要求
するコマンドが渡された場合には、コマンドに含まれる
「ブロック識別子」を有するブロック情報を検索し、検
索されたブロック情報につながれているタスク情報の中
からコマンドに含まれる「タスク識別子」を有するタス
ク情報を検索する。また、デッドロックチェック手段2
30から呼び出され、「対象エントリポインタ」が渡さ
れた場合は、それが指し示すタスク情報を検索する。そ
して、この検索されたタスク情報を削除する(S24
2)。
Referring to FIG. 9, task information deleting means 2
40 is first called when the deadlock check means 230 is called and when a command requesting unlock is passed through the command interface 250.
The task information to be deleted is retrieved from the lock management table 260 (S241). Specifically, when a command requesting unlocking is passed, the block information having the “block identifier” included in the command is searched, and the command is searched from the task information linked to the searched block information. The task information having the "task identifier" included in is retrieved. Also, the deadlock check means 2
When called from 30, and the "target entry pointer" is passed, the task information pointed to by it is searched. Then, the retrieved task information is deleted (S24).
2).

【0030】その後、タスク情報を削除したブロック情
報の待ちリストに他のタスク情報が存在するか否かを調
べる(S243)。もし、待ちリストにタスク情報が存
在すれば、そのタスク情報が前述したタスク情報の削除
によってロック可能となったか否かを判断する(S24
4)。そして、ロック可能であると判断した場合には、
そのタスク情報を待ちリストから外してロックリストに
接続し、そのタスク情報に含まれる「タスク識別子」が
示すタスクに対して、ロックが許可された旨を通知する
(S245)。次に、アンロックを要求するコマンドが
コマンドインタフェース250から渡された場合であっ
た時は、コマンドに含まれる「タスク識別子」の指すタ
スクに対して、アンロックが完了した旨を通知する(S
246)。一方、待ちタスク情報が存在しないか、或い
はロック可能になっていなければ(S243,S24
4)、ロックが許可された旨は通知しない。尚、待ちリ
ストに複数のタスク情報が存在する場合には、全てのタ
スク情報に対して同様の処理を行う。
After that, it is checked whether or not other task information exists in the waiting list of the block information from which the task information has been deleted (S243). If there is task information in the waiting list, it is determined whether the task information can be locked by deleting the task information described above (S24).
4). When it is determined that the lock is possible,
The task information is removed from the waiting list and connected to the lock list, and the task indicated by the "task identifier" included in the task information is notified that the lock is permitted (S245). Next, when the command requesting the unlock is passed from the command interface 250, the task indicated by the “task identifier” included in the command is notified that the unlock is completed (S
246). On the other hand, if the waiting task information does not exist or it is not lockable (S243, S24
4) It does not notify that the lock is permitted. If there is a plurality of task information in the waiting list, the same process is performed for all the task information.

【0031】次に2つのタスク間でデッドロックが発生
した場合の動作を図10を参照して詳細に説明する。こ
こで、タスクT1は、ブロックA,Bをその順番でロッ
クした後、更新処理を行うものであり、タスクT2はブ
ロックB,Aをその順番でロックした後、更新処理を行
うものとする。また、両タスクT1,T2とも、ブロッ
クA,Bの両方をロックした上でなければ、更新処理を
行えないものとする。
Next, the operation when a deadlock occurs between two tasks will be described in detail with reference to FIG. Here, it is assumed that the task T1 locks the blocks A and B in that order and then performs the update processing, and the task T2 locks the blocks B and A in that order and then performs the update processing. Further, both tasks T1 and T2 cannot be updated unless both blocks A and B are locked.

【0032】図10を参照すると、タスクT1がコマン
ドを発行して、ブロックAに対するロック取得を要求す
ると、排他制御装置200は、ブロックAのロックリス
トにタスクT1のタスク情報を登録し、その後、タスク
T1に対してロック許可通知を行う(S901)。次
に、タスクT2がコマンドを発行して、ブロックBに対
するロック取得を要求すると、排他制御装置200は、
ブロックBのロックリストにタスクT2のタスク情報を
登録し、その後、タスクT2に対してロック許可通知を
行う(S902)。
Referring to FIG. 10, when the task T1 issues a command and requests the lock acquisition for the block A, the exclusive control device 200 registers the task information of the task T1 in the lock list of the block A, and thereafter, A lock permission notification is issued to the task T1 (S901). Next, when the task T2 issues a command to request the lock acquisition for the block B, the exclusive control device 200
The task information of the task T2 is registered in the lock list of the block B, and then the lock permission notification is given to the task T2 (S902).

【0033】その後、タスクT1が、コマンドを発行し
て、ブロックBに対するロック取得を要求する。しか
し、この時点に於いては、ブロックBは既にタスクT2
によってロックされているため、排他制御装置200
は、タスクT2に対してロック待ち通知を行うと共に、
ブロックBの待ちリストにタスクT1のタスク情報を登
録する(S903)。また、排他制御装置200は、上
記コマンドによって指定された「監視時間」の監視を開
始する(S904)。
Then, the task T1 issues a command to request the lock acquisition for the block B. However, at this point, block B is already in task T2.
Exclusive control device 200 because it is locked by
Sends a lock wait notification to task T2,
The task information of task T1 is registered in the waiting list of block B (S903). Further, the exclusive control device 200 starts monitoring the "monitoring time" designated by the above command (S904).

【0034】次に、タスクT2がコマンドを発行してブ
ロックAに対するロック取得を要求する。しかし、この
時点に於いては、ブロックAは既にタスクT1によって
ロックされているため、排他制御装置200は、タスク
T2に対してロック待ち通知を行うと共に、ブロックA
の待ちリストにタスクT2のタスク情報を登録する(S
905)。また、排他制御装置200は、上記コマンド
によって指定された「監視時間」の監視を開始する(S
906)。
Next, task T2 issues a command to request the lock acquisition for block A. However, at this point, since the block A has already been locked by the task T1, the exclusive control device 200 sends a lock wait notification to the task T2 and the block A
The task information of task T2 is registered in the waiting list of (S
905). Further, the exclusive control device 200 starts monitoring the “monitoring time” designated by the above command (S
906).

【0035】ここまでの処理により、タスクT1,T2
間でデッドロックが生じる。即ち、タスクT1,T2が
それぞれブロックA,Bをロックする一方、タスクT
1,T2がそれぞれブロックB,Aのロックを待ってお
り、互いに相手のロックしているブロックのロックを待
って硬直状態になっている。この場合、何れかがロック
してブロックを強制的にアンロックしない限り、この状
態が永久に続いてしまう。そこで、本発明では、監視エ
ントリの「監視時間」が経過すると、デッドロック発生
の有無を調べ、もしデッドロックが発生していれば、そ
のロック待ち状態を解除して、その旨をタスクに通知す
ることにより、このデッドロックを解消するようにして
いる。
By the processing up to this point, tasks T1 and T2
Deadlock occurs between. That is, while the tasks T1 and T2 lock the blocks A and B, respectively, the task T
1 and T2 are waiting for the locks of the blocks B and A, respectively, and are in a rigid state after waiting for the lock of the blocks locked by each other. In this case, this state will continue forever unless either one locks and the block is forcibly unlocked. Therefore, in the present invention, when the "monitoring time" of the monitoring entry has passed, it is checked whether or not a deadlock has occurred, and if a deadlock has occurred, the lock waiting state is released and the task is notified to that effect. By doing so, the deadlock is eliminated.

【0036】今、例えば、タスクT1,タスクT2が同
じ値の「監視時間」を指定していたとすると、先に待ち
登録されたタスクT1の待ちが早くタイムアウトとな
る。このタイムアウトが検出されると(S907)、タ
スクT1のブロックBに対するロック待ちを表すタスク
情報を起点にデッドロック発生の有無が調べられ、タス
クT1が原因でデッドロックが発生していることが検出
される。そして、タスクT1のブロックBに対するロッ
ク待ちを表すタスク情報が待ちリストから削除され、タ
スクT1にはこの削除に関する通知がなされる(S90
8)。
Now, for example, if the task T1 and the task T2 specify the same "monitoring time", the waiting of the task T1 previously registered for waiting will time out quickly. When this timeout is detected (S907), whether or not a deadlock has occurred is checked starting from the task information indicating the lock wait for the block B of the task T1, and it is detected that the deadlock has occurred due to the task T1. To be done. Then, the task information indicating the lock wait for the block B of the task T1 is deleted from the wait list, and the task T1 is notified of this deletion (S90).
8).

【0037】この通知を受けて、タスクT1はデッドロ
ックが発生したことを認識し、自身がロックしているブ
ロックAのアンロックを要求する命令をコマンドする。
このコマンドに応答して、タスクT1のブロックAに対
するロック取得を表すタスク情報は、ロックリストから
削除され、タスクT1にはこの削除に関する通知がなさ
れる(S909)。また、ブロックAのロックを待って
いたタスクT2には、ロック許可の通知がなされる(S
909)。これにより、タスクT2は、ブロックA及び
ブロックBのロックが許可されて、更新処理が可能とな
る。
In response to this notification, the task T1 recognizes that a deadlock has occurred, and issues a command to request unlocking of the block A locked by itself.
In response to this command, the task information indicating the lock acquisition of the block A by the task T1 is deleted from the lock list, and the task T1 is notified of this deletion (S909). Further, the task T2 waiting for the lock of the block A is notified of the lock permission (S
909). As a result, the task T2 is permitted to lock the block A and the block B, and the update process becomes possible.

【0038】上述した例では、タスクT1,T2が同じ
値の「監視時間」を指定するようにしたが、タスクT1
が指定する「監視時間」をタスクT2が指定する「監視
時間」よりも大きな値とすることにより、タスクT2の
待ちを早くタイムアウトするようにすることもできる。
また、各タスクが指定する「監視時間」を、優先度の高
いタスク程長く指定するというように、タスクの優先度
に応じて調整しておけば、優先度が異なるタスク間でデ
ッドロックが発生した場合、優先度の低いタスクを最初
にタイムアウトさせることができ、優先度の高いタスク
に優先的に資源をロックさせることが可能になる。
In the above example, the tasks T1 and T2 are designed to specify the same "monitoring time", but the task T1
By setting the "monitoring time" specified by the task monitoring time to a value larger than the "monitoring time" specified by the task T2, the waiting of the task T2 can be timed out earlier.
Also, by adjusting the "monitoring time" specified by each task according to the priority of the task such that the higher the priority of the task, the deadlock occurs between the tasks with different priorities. In this case, a task with a low priority can be timed out first, and a task with a high priority can be locked with priority.

【0039】[0039]

【発明の効果】以上説明したように、本発明の排他制御
方法は、監視時間の指定を含むロック取得要求を発行し
たタスクがロックに失敗してロック待ちになった場合、
ロック取得要求によって指定された監視時間の経過を待
ち合わせ、監視時間が経過した時に上記タスクのロック
待ちが解除されていない場合に限ってデッドロックチェ
ックを行うようにしたものであるので、ロック待ちが発
生してからデッドロックチェックタイミングとなるまで
の時間間隔は常にタスクによって指定された監視時間と
なる。従って、ロック待ちの発生タイミングによって
は、ロック待ちが発生してからデッドロックチェックタ
イミングとなるまでの時間間隔が非常に短くなる場合が
ある従来の技術に比較して、ロック待ちとなってからデ
ッドロックタイミングとなるまでの間にロック待ちが解
除される確率が高くなる。ロック待ちが解除されたタス
クに関しては、デッドロックチェックを行う必要がなく
なるので、本発明の排他制御方法によれば、従来の技術
に比較してデッドロックチェックを行うタスク数を少な
くし、オーバヘッドを少なくすることができる。
As described above, according to the exclusive control method of the present invention, when the task that issues the lock acquisition request including the designation of the monitoring time fails in the lock and waits for the lock,
The deadlock check is performed only when the monitoring time specified by the lock acquisition request is waited for and the task lock wait is not released when the monitoring time elapses. The time interval from the occurrence to the deadlock check timing is always the monitoring time specified by the task. Therefore, depending on the timing of occurrence of lock wait, the time interval from the occurrence of lock wait to the deadlock check timing may become very short, compared to the conventional technique, in which the dead time is reached after lock wait. There is a high probability that the lock wait is released before the lock timing is reached. Since it is not necessary to perform the deadlock check for the task whose lock wait is released, the exclusive control method of the present invention reduces the number of tasks that perform the deadlock check as compared with the conventional technique and reduces the overhead. Can be reduced.

【0040】また、本発明の排他制御方法は、優先度の
高いタスク程、指定する監視時間を長くするようにした
ので、優先度の異なるタスク間でデッドロックが発生し
た場合、優先度の高いタスクに優先的に資源をロックさ
せることができる。
Further, in the exclusive control method of the present invention, the higher the priority task is, the longer the designated monitoring time is set. Therefore, when a deadlock occurs between tasks having different priorities, the priority is high. Tasks can be made to lock resources preferentially.

【0041】また、本発明の排他制御装置は、監視時間
の指定を含むロック取得要求を発行したタスクがロック
に失敗してロック待ちになった場合、ロック取得要求で
指定されている監視時間の経過を監視する待ち時間監視
手段と、待ち時間監視手段によって監視時間の経過が検
出されたタスクのロック待ちが解除されていない場合に
限ってそのタスクに関連するデッドロック発生の有無を
調べ、デッドロックが発生している場合、上記タスクが
ロックしている資源を解放するデッドロックチェック手
段とを備えているので、簡単な構成で、且つ少ないオー
バヘッドでデッドロックを解除することができる。
Further, the exclusive control device of the present invention, when the task that issues the lock acquisition request including the specification of the monitoring time fails in the lock and waits for the lock, the exclusive time of the monitoring time specified by the lock acquisition request is set. Only when the waiting time monitoring means for monitoring the progress and the waiting time for the task whose monitoring time has been detected by the waiting time monitoring means are not released, the deadlock related to the task is checked to see if there is a deadlock. When a lock is generated, the task is provided with deadlock check means for releasing the locked resource, so that the deadlock can be released with a simple configuration and with a small overhead.

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

【図1】本発明の排他制御装置が使用される情報処理シ
ステムの一例を示すブロック図である。
FIG. 1 is a block diagram showing an example of an information processing system in which an exclusive control device of the present invention is used.

【図2】排他制御装置の構成例を示すブロック図であ
る。
FIG. 2 is a block diagram showing a configuration example of an exclusive control device.

【図3】ロック管理テーブル260の内容例を示す図で
ある。
FIG. 3 is a diagram showing an example of contents of a lock management table 260.

【図4】監視エントリの内容例を示す図である。FIG. 4 is a diagram showing an example of contents of a monitoring entry.

【図5】コマンド形式を示す図である。FIG. 5 is a diagram showing a command format.

【図6】タスク情報登録手段210の処理例を示す流れ
図である。
6 is a flowchart showing a processing example of task information registration means 210. FIG.

【図7】待ち時間監視手段220の処理例を示す流れ図
である。
7 is a flowchart showing a processing example of the waiting time monitoring means 220. FIG.

【図8】デッドロックチェック手段230の処理例を示
す流れ図である。
FIG. 8 is a flowchart showing a processing example of the deadlock check means 230.

【図9】タスク情報削除手段240の処理例を示す流れ
図である。
FIG. 9 is a flowchart showing a processing example of task information deleting means 240.

【図10】デッドロックが発生した場合の排他制御装置
200の動作の一例を示す図である。
FIG. 10 is a diagram showing an example of an operation of the exclusive control device 200 when a deadlock occurs.

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

100…プロセッサ 200…排他制御装置 210…タスク情報登録手段 220…待ち時間監視手段 230…デッドロックチェック手段 240…タスク情報削除手段 250…コマンドインタフェース 260…ロック管理テーブル 261…ブロック情報 262…タスク情報 300…共有資源 100 ... Processor 200 ... Exclusive control device 210 ... Task information registration means 220 ... Wait time monitoring means 230 ... Deadlock check means 240 ... Task information deleting means 250 ... Command interface 260 ... Lock management table 261 ... Block information 262 ... Task information 300 … Shared resources

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 タスクが発行するロック取得要求に監視
時間の指定を含ませ、 監視時間の指定を含むロック取得要求を発行したタスク
がロックに失敗してロック待ちになった場合、前記ロッ
ク取得要求で指定されている監視時間が経過するのを待
ち合わせ、前記監視時間が経過した時に前記タスクのロ
ック待ちが解除されていない場合に限って前記タスクに
関連するデッドロック発生の有無を調べ、デッドロック
が発生している場合、前記タスクがロックしている資源
を解放することを特徴とする排他制御方法。
1. A lock acquisition request issued by a task includes a specification of a monitoring time, and when the task that issued the lock acquisition request including the specification of the monitoring time fails to lock and waits for a lock, the lock acquisition is performed. Wait until the monitoring time specified in the request elapses, and only if the task's lock wait is not released when the monitoring time elapses, check whether there is a deadlock related to the task, and An exclusive control method characterized in that when a lock is generated, the resource locked by the task is released.
【請求項2】 優先度の高いタスク程、ロック取得要求
に於いて指定する監視時間を長くすることを特徴とする
請求項1記載の排他制御方法。
2. The exclusive control method according to claim 1, wherein the higher the priority of the task, the longer the monitoring time specified in the lock acquisition request.
【請求項3】 監視時間の指定を含むロック取得要求を
発行したタスクがロックに失敗してロック待ちになった
場合、前記ロック取得要求で指定されている監視時間の
経過を監視する待ち時間監視手段と、 該待ち時間監視手段によって監視時間の経過が検出され
たタスクのロック待ちが解除されていない場合に限って
前記タスクに関連するデッドロック発生の有無を調べ、
デッドロックが発生している場合、前記タスクがロック
している資源を解放するデッドロックチェック手段とを
備えたことを特徴とする排他制御装置。
3. A waiting time monitor for monitoring the elapse of the monitoring time specified by the lock acquisition request when the task that issued the lock acquisition request including the specification of the monitoring time fails to lock and waits for the lock. And means for checking whether or not a deadlock related to the task has occurred only when the lock wait of the task whose elapsed monitoring time has been detected by the wait time monitoring means is not released,
An exclusive control device comprising: deadlock check means for releasing the resource locked by the task when a deadlock occurs.
【請求項4】 優先度の高いタスク程、ロック取得要求
に於いて指定する監視時間が長いことを特徴とする請求
項3記載の排他制御装置。
4. The exclusive control device according to claim 3, wherein a task having a higher priority has a longer monitoring time specified in the lock acquisition request.
JP8050899A 1996-02-14 1996-02-14 Exclusive control method and equipment therefor Pending JPH09223030A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8050899A JPH09223030A (en) 1996-02-14 1996-02-14 Exclusive control method and equipment therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8050899A JPH09223030A (en) 1996-02-14 1996-02-14 Exclusive control method and equipment therefor

Publications (1)

Publication Number Publication Date
JPH09223030A true JPH09223030A (en) 1997-08-26

Family

ID=12871601

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8050899A Pending JPH09223030A (en) 1996-02-14 1996-02-14 Exclusive control method and equipment therefor

Country Status (1)

Country Link
JP (1) JPH09223030A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015075871A (en) * 2013-10-08 2015-04-20 株式会社リコー Exclusive control program, information processing apparatus, and exclusive control method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015075871A (en) * 2013-10-08 2015-04-20 株式会社リコー Exclusive control program, information processing apparatus, and exclusive control method

Similar Documents

Publication Publication Date Title
US5537645A (en) File lock management in a distributed data processing system
US5659682A (en) Scheme to determine completion of directory operations for server recovery
EP0563624B1 (en) Method and apparatus for performing conditional operations on externally shared data
US6965893B1 (en) Techniques for granting shared locks more efficiently
US5761659A (en) Method, product, and structure for flexible range locking of read and write requests using shared and exclusive locks, flags, sub-locks, and counters
US4965719A (en) Method for lock management, page coherency, and asynchronous writing of changed pages to shared external store in a distributed computing system
US6681226B2 (en) Selective pessimistic locking for a concurrently updateable database
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
JPH0465414B2 (en)
JPH03161859A (en) Request control method and access control system
JPH04308961A (en) Means and apparatus for notifying state of synchronous locking of occupied process
JPH06103132A (en) Method of parallel control
JPH01298440A (en) Exclusion control system
JP3611295B2 (en) Computer system, memory management method, and storage medium
US6185650B1 (en) High performance locking facility
US20020042850A1 (en) System and method for deadlock management in database systems with demultiplexed connections
JP2685530B2 (en) How to manage shared data
JPH036751A (en) File-locking method and device
JPH09223030A (en) Exclusive control method and equipment therefor
JPH09106357A (en) Exclusive controller and method therefor
JPH09330240A (en) Exclusive resource control system
JPS62140159A (en) Lock system
JPS63307538A (en) Control system for simultaneous access of files
CN114817287A (en) Electric power data access conflict processing method and device and computer equipment
JPH09305471A (en) File simultaneous access control system

Legal Events

Date Code Title Description
A621 Written request for application examination

Effective date: 20041221

Free format text: JAPANESE INTERMEDIATE CODE: A621

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20050119

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070227

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070306

A521 Written amendment

Effective date: 20070427

Free format text: JAPANESE INTERMEDIATE CODE: A523

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070807