JPH0383142A - Shared resource exclusive control system - Google Patents

Shared resource exclusive control system

Info

Publication number
JPH0383142A
JPH0383142A JP1221016A JP22101689A JPH0383142A JP H0383142 A JPH0383142 A JP H0383142A JP 1221016 A JP1221016 A JP 1221016A JP 22101689 A JP22101689 A JP 22101689A JP H0383142 A JPH0383142 A JP H0383142A
Authority
JP
Japan
Prior art keywords
lock
shared
mode
task
tasks
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
JP1221016A
Other languages
Japanese (ja)
Inventor
Yoshihisa Suzuki
鈴木 善尚
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 JP1221016A priority Critical patent/JPH0383142A/en
Publication of JPH0383142A publication Critical patent/JPH0383142A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To avoid a problem of permanent blocking and to improve the use efficiency of shared resources by providing a share request processing means and a share wait lock means and allowing a shared mode lock request to have priority over an exclusive mode lock request. CONSTITUTION:When a resource is not locked for the lock request in the share mode or a share request processing means 1 is locked in the share mode and the number of tasks to which the lock right is given after locking in the share mode is smaller than a maximum number of sharing tasks, the processing means 1 gives the lock right to the task which issues the lock request; but otherwise, this task is caused to wait for lock. When the task waiting for lock to which the lock right should be next given for an unlock request requests lock in the share mode, a share wait lock means 4 gives the lock right to tasks waiting for lock in the share mode whose number is smaller than the maximum sharing tasks. Thus, a problem of permanent blocking is avoided to improve the use efficiency of shared resources of shared resource using tasks T1 to Tn.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は共有資源排他側9n方式に関し、特に計算機シ
ステムの共有資源の排他制御方式に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a 9n system on the exclusive side of shared resources, and particularly to an exclusive control system for shared resources in a computer system.

〔従来の技術〕[Conventional technology]

計算機システムにおいて複数のタスクから使用される資
源については、それへのアクセスを逐次化するために排
他制御が必要である。このような排他制御のために、計
算機システムには、ロック/アンロック(あるいはEN
Q/DEQ)と呼ばれる基本機能が備えられており、ロ
ック要求には通常排他モードと共有モードとの2fim
がある。
Exclusive control is required for resources used by multiple tasks in a computer system in order to serialize access to them. For such exclusive control, computer systems have lock/unlock (or EN
It is equipped with a basic function called Q/DEQ), and lock requests are usually handled in two modes: exclusive mode and shared mode.
There is.

排他制御の基本的動作は次のようなものである。The basic operation of exclusive control is as follows.

あるタスクがロック要求を出した場合、ロック要求対象
資源が他のタスクによりロックされていないならば、す
ぐにロック権が与えられる。しかし、他のタスクにより
すでにロックされている場合、その資源のロックモード
、または該タスクのロック要求のモードが排他モードの
ときはロック待ちとなる。その*aのロックモードと該
タスクの口7り要求のモードとがともに共有モードのと
きは、(1)  ロック待ちしているタスクがない場合
は該タスクにロック権を与え、ロック待ちタスクがある
場合は該タスクをロック待ちとする、(2)該タスクに
ロック権を与える、 のいずれかの方法がとられる。
When a task issues a lock request, the lock right is immediately granted if the resource to which the lock is requested is not locked by another task. However, if the resource is already locked by another task, and the lock mode of the resource or the lock request mode of the task is exclusive mode, the task waits for the lock. If the *a lock mode and the task's request mode are both shared mode, (1) If there is no task waiting for the lock, give the lock right to the task; If so, one of the following methods is taken: (2) making the task wait for a lock; or (2) giving the task lock rights.

また、資源をロックしていたタスクがアンロック要求を
出した場合は、該アンロック要求タスクのロック樽の行
使が終了する。他にロックしているタスクがなく、かつ
リック待ちタスクがある場合には、それらのうちの最も
早くロック要求したタスクの要求モードが排他モードな
らばこのタスクのみにロック権を与え、共有モードなら
ば前記(1)および(2)に対応して、 (1)  現在排他モードでロック待ちしているどのタ
スクよりも早く共有モードでロック待ちしているタスク
のすべてにロック権を与える、(2)現在共有モードで
ロック待ちしているタスクのすべてにロック潅を写える
、 のいづ゛れかの方法がとられる。
Furthermore, when a task that has locked a resource issues an unlock request, the unlock request task's use of the lock barrel ends. If there is no other task holding the lock and there is a task waiting for a lick, if the request mode of the task that requested the lock earliest among them is exclusive mode, only this task is given the locking right, and if it is shared mode, the locking right is granted only to this task. For example, in response to (1) and (2) above, (1) Give lock rights to all tasks currently waiting for a lock in shared mode before any tasks currently waiting for a lock in exclusive mode; (2) ) One of the following methods can be used to copy the lock to all tasks currently waiting for the lock in shared mode.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

−L述した(1)の方法を採用した従来の共有資源排他
制御方式では、いかなる場合も共有モードのロック要求
を出したタスクが排他モードのロック要求を出したタス
クを追い越してロックできないので、現在のロックが解
け、次のロック待ちタスクにロック権を与える際に該タ
スクのロックモードが共有モードであっても、排他モー
ドのロック待ちタスクがあると、それ以後に共有モード
でロック待ちになったタスクにはロック権が与えられず
、資源を効率よく使用できないという欠点がある。
-L In the conventional shared resource exclusive control method that adopts method (1) described above, the task that issued the shared mode lock request cannot overtake and lock the task that issued the exclusive mode lock request in any case. Even if the lock mode of the task is shared mode when the current lock is released and the lock right is given to the next task waiting for the lock, if there is a task waiting for the lock in exclusive mode, the task will be waiting for the lock in shared mode after that. The disadvantage is that tasks that have become disabled are not given lock rights, and resources cannot be used efficiently.

また、上述した(2)の方法を採用した従来の共有資源
排他制御方式では、共有モードのロック要求に対して排
他モードのロック要求に比べて有利にロック権が与えら
れることになるので、共有モードのロック要求が排他モ
ードのロック要求よりも頻繁に行われると、いつまでも
排他モードでロック要求したタスクにロック潅が与えら
れない状況(永久封鎖)が発生するという欠点がある。
In addition, in the conventional shared resource exclusive control method that adopts method (2) above, locking rights are granted more favorably to lock requests in shared mode than to lock requests in exclusive mode. If mode lock requests are made more frequently than exclusive mode lock requests, there is a drawback that a situation (permanent blockade) may occur in which a task that has requested a lock in exclusive mode is forever denied a lock.

本発明の目的は、上述の点に鑑み、最大共有タスク数を
新たに導入し、資源が共有モードでロックされていると
きにこの共有モードロック中にロック権を与えたタスク
数が最大共有タスク数未満の間は共イfモードロック要
求が排他モードロック要求を追い越すのを許すようにし
て、永久封鎖の問題を避けながら共有資源の使用効率の
向上を図るようにした共有資源排他制御方式を提供する
ことにある。
In view of the above points, an object of the present invention is to newly introduce a maximum number of shared tasks, so that when a resource is locked in shared mode, the number of tasks granted lock rights during this shared mode lock is the maximum number of shared tasks. We have developed a shared resource exclusive control method that allows shared f mode lock requests to overtake exclusive mode lock requests while the number of shared resources is less than 1, thereby improving the efficiency of shared resource use while avoiding the problem of permanent blockage. It is about providing.

(課題2−・解決するための手段) 本二発明の共有資源排他制御方式は、計算機シスツムの
共有資源排他制御方式において、共有モードのロック要
求に対して資源がロックされていない場合および共有モ
ードでロックされかつ共有モードロックになってかへロ
ック権を与えたタスクの数が最大共有タスク数より少な
い場合に該ロック要求を出したタスクにロック権を与え
その他の場合にはロック待ちとする共有要求処理手段と
、アンロック要求に対して次にロック権を与えるべきロ
、ツク待ちタスクが共有モードでロック要求している場
合に最大共有タスク数以内の共有モート′のロック待ち
タスクにロック権を与える共有待ちロック手段とを有す
る。
(Problem 2--Means for Solving) The shared resource exclusive control method of the second invention is a shared resource exclusive control method for a computer system, when a resource is not locked in response to a shared mode lock request, and when the resource is not locked in the shared mode. If the number of tasks that have been locked in a shared mode lock and have been given lock rights is less than the maximum number of shared tasks, the task that issued the lock request is given lock rights, and in other cases it is placed in a lock wait state. The sharing request processing means and the next locking right to be granted in response to the unlock request are locked to the lock waiting task of the shared mote within the maximum number of shared tasks when the locking task is requesting a lock in shared mode. and a shared wait lock means for granting the right.

〔作用〕[Effect]

本発明の共有’RB排他制御方式では、共有要求処理手
段が共有モードのロック要求に対してIQがロックされ
ていない場合および共有モードでロックされかつ共有モ
ードロックになってからロック権を与えたタスクの数が
最大共有タスク数より少ない場合に該ロック要求を出し
たタスクにロック権を与えその他の場合にはロック待ち
とし、共有待ちロック手段がアンロック要求に対し2て
次にロック権を与えるべきロック待ちタスクが共有モー
ドでロック要求している場合に最大共有タスク数以内の
共有モードのロック待ちタスク口、・り権を与える。
In the shared 'RB exclusive control method of the present invention, the share request processing means grants the lock right to a lock request in the shared mode when the IQ is not locked or after the IQ is locked in the shared mode and becomes a shared mode lock. If the number of tasks is less than the maximum number of shared tasks, the task that issued the lock request is given the lock right, and in other cases, the task is placed in a lock wait state, and the shared wait lock means responds to the unlock request by granting the lock right next. If the task waiting for the lock to be granted is requesting a lock in the shared mode, grant rights to the tasks waiting for the lock in the shared mode within the maximum number of shared tasks.

〔実施例〕〔Example〕

次に、本発明について図面を参照して詳細に説明する。 Next, the present invention will be explained in detail with reference to the drawings.

第1図は、本発明の一実施例の共有資源排他制御方式の
構成を示すプロ/り図である。本実施例の共有資源排他
制御方式を実現する共有資源排他制御機能9は、ロック
要求処理部6と、アンロック要求処理部7と、排他制御
テーブル8とから、その主要部が構成されている。
FIG. 1 is a schematic diagram showing the configuration of a shared resource exclusive control system according to an embodiment of the present invention. The main parts of the shared resource exclusive control function 9 that implements the shared resource exclusive control method of this embodiment include a lock request processing section 6, an unlock request processing section 7, and an exclusive control table 8. .

ロック要求処理部6は、共有モードのロック要求を処理
する共有要求処理手段1と、排他モードのロック要求を
処理する排他要求処理手段2とから構成されている。
The lock request processing section 6 includes a shared request processing means 1 that processes lock requests in shared mode, and an exclusive request processing means 2 that processes lock requests in exclusive mode.

アンロック要求処理部7は、アンロック要求したタスク
のロック解除を行うロック解除手段3と、次のロック待
ちタスクの要求モードが共有モードの場合のロック処理
を行う共有待ちロック手段4と、次のロック待ちタスク
の要求モードが排他モードの場合のロック処理を行う排
他待ちロック手段5とから構成されている。
The unlock request processing unit 7 includes an unlocking means 3 that unlocks a task that has requested an unlock, a shared waiting locking means 4 that performs a locking process when the request mode of the next lock waiting task is shared mode, and Exclusive wait lock means 5 performs lock processing when the request mode of the lock wait task is exclusive mode.

なお、第1図中、符号T1〜Tn、(nは正整数)は、
共有資源使用タスク(以下、単にタスクという)をそれ
ぞれ示す。
In addition, in FIG. 1, the symbols T1 to Tn (n is a positive integer) are as follows.
Each of the shared resource usage tasks (hereinafter simply referred to as tasks) is shown.

第2図を参照すると、排他制御テーブル8は、計xiシ
ステム内の排他制御対i資源(図示せず)を−意に識別
するための名前である資源名をキーとするテーブルであ
る。各資源に対するエントリは、資源名部と、共有タス
ク数と、ロックモード部と、ロック中タスクリストと、
ロック待ちタスクキューとからなる。共有タスク数は、
現在、資源が共有モードでロックされている場合、この
共有モードロック中にロック権を与えたタスクの数を記
録する。ロックモード部は、資源がロックされていると
きのロックモードを記録する。ロック中タスクリストは
、その資源をロックしているタスクのタスク識別子を記
録する。ロック待ちタスクキューは、待ち状態にあるロ
ック要求の待ち行列であり、これらのロック要求を出し
ているタスクのタスク識別子とロックモードとの組を要
求順に記録する。
Referring to FIG. 2, the exclusive control table 8 is a table whose key is a resource name, which is a name for arbitrarily identifying an exclusive control pair i resource (not shown) in the total xi system. The entry for each resource includes a resource name section, the number of shared tasks, a lock mode section, a locked task list,
It consists of a lock waiting task queue. The number of shared tasks is
If the resource is currently locked in shared mode, record the number of tasks that have been granted lock rights during this shared mode lock. The lock mode section records the lock mode when the resource is locked. The locked task list records the task identifier of the task that has locked the resource. The lock waiting task queue is a queue of lock requests in a waiting state, and records pairs of task identifiers and lock modes of tasks issuing these lock requests in the order of requests.

なお、第2図および第3図(a)〜(e)中、T1〜T
7はタスク識別子(タスクと同じ符号を使用する。以下
同様)を、Rは資源名を、SおよびEは共有モードおよ
び排他モードをそれぞれ示す。
In addition, in FIG. 2 and FIG. 3 (a) to (e), T1 to T
7 indicates a task identifier (the same code as the task is used; the same applies hereinafter), R indicates a resource name, and S and E indicate a shared mode and an exclusive mode, respectively.

共有要求処理手段1は、共有モードのロック要求の処理
を行う、詳しくは、 〈1)  排他制御テーブル8のロック中タスクリスト
が空の場合か、共有タスク数が最大共有タスク数N(正
整数)未満の場合、該ロック要求のロックモード(共有
モード)をロックモード部に記録し、該ロック要求を出
したタスクのタスク識別子をロック中タスクリストに追
加し、共有タスク数に1を加える。
The share request processing means 1 processes lock requests in the share mode. ), the lock mode (shared mode) of the lock request is recorded in the lock mode section, the task identifier of the task that issued the lock request is added to the locked task list, and 1 is added to the number of shared tasks.

12)排他制御テーブル8のロックモード部に排他モー
ドが記録されている場合か、共有タスク数が最大共有タ
スク数Nに達している場合、該ロック要求を出したタス
クのタスク識別子と該ロック要求のロックモード(共有
モード)との姐をロック待ちタスクキューの最後に追加
し、該ロック要求を出したタスクの処理を中断させる。
12) If the exclusive mode is recorded in the lock mode section of the exclusive control table 8, or if the number of shared tasks has reached the maximum number of shared tasks N, the task identifier of the task that issued the lock request and the lock request. The second lock mode (shared mode) is added to the end of the lock waiting task queue, and the processing of the task that issued the lock request is interrupted.

共有待ちロック手段4は、アンロック要求処理において
、次のロック待ちタスクの要求モードが共有モードの場
合のロック処理を行う、詳しくは、tl)  排他制御
テーブル8のロックモード部に共有モードを記録し、ロ
ック待ちタスクキューの先頭から最大共有タスク数Nま
での共有モードのロック要求のタスク識別子をロック中
タスクリストに記録する0次に、この記録が行われたロ
ック要求を排他制御テーブル8のロック待ちタスクキュ
ーから削陳し、これらのタスクの処理を再開させる。さ
らに、ロック中タスクリストに記録されたタスク数を共
有タスク数に記録する。
In the unlock request process, the shared waiting lock means 4 performs lock processing when the request mode of the next lock waiting task is shared mode. Then, the task identifiers of shared mode lock requests from the head of the lock waiting task queue to the maximum number of shared tasks N are recorded in the locked task list.Next, the lock requests for which this recording was made are stored in the exclusive control table 8 Removes them from the lock-waiting task queue and resumes processing of these tasks. Furthermore, the number of tasks recorded in the locked task list is recorded in the number of shared tasks.

排他要求処理手段2は、排他モードのロック要求の処理
を行う、詳しくは、 (1)排他制御テーブル8のロック中タスクリストが空
の場合、咳ロック要求のロックモード(排他モード)を
ロックモード部に記録し、該ロック要求を出したタスク
のタスク識別子をロック中タスクリストに記録する。
The exclusive request processing means 2 processes lock requests in exclusive mode. Specifically, (1) If the locked task list of the exclusive control table 8 is empty, the lock mode (exclusive mode) of the lock request is changed to lock mode. The task identifier of the task that issued the lock request is recorded in the locked task list.

(2)排他制御テーブル8のロック中タスクリストが空
でない場合、該ロック要求を出したタスクのタスク識別
子と該ロック要求のロックモード(排他モード)との組
をロック待ちタスクキューの最後に追加し、咳ロック要
求を出したタスクの処理を中断させる。
(2) If the locking task list in the exclusive control table 8 is not empty, the pair of the task identifier of the task that issued the lock request and the lock mode (exclusive mode) of the lock request is added to the end of the lock waiting task queue. and interrupts the processing of the task that issued the cough lock request.

ロック解除手段3は、アンロック要求された場合のロッ
ク解除処理を行い、ロック待ちタスクがある場合には、
次のロック待ちタスクのロック処理を行うために、共有
待ちロック手段4または排他待ちロック手段5を呼び出
す、詳しくは、Tll  35タスクのタスク識別子を
ロック中タスクリストから削除し、ロック中タスクリス
トが空になったならば、ロックモード部の内容を消去し
、共有タスク数に0を記録する。
The lock release means 3 performs lock release processing when an unlock request is made, and if there is a task waiting for lock,
In order to perform lock processing for the next lock waiting task, the shared waiting locking means 4 or the exclusive waiting locking means 5 is called. When it becomes empty, the contents of the lock mode section are erased and 0 is recorded in the number of shared tasks.

、  t2+  11Aいて、ロック中タスクリストが
空の場合、ロック待ちタスクキューの先頭のロック要求
が共有モードならば共有待ちロック手段4を、排他モー
ドならば排他待ちロック手段5を呼び出す。
, t2+ 11A, and if the locking task list is empty, if the lock request at the head of the lock waiting task queue is in the shared mode, the shared waiting locking means 4 is called, and if it is in the exclusive mode, the exclusive waiting locking means 5 is called.

上記(1)において、共有タスク数を共有モードロック
のアンロック要求のたびに1つ減じて、現在共有モード
ロックしているタスクの数を表すようにすると、排他モ
ードのロック待ちがあるときに、共有モードのアンロッ
ク要求と共有モードのロック要求とが交互に行われた場
合、排他モードのロック待ちタスクは永久封鎖されてし
まうが、本実施例の共有資源排他制御方式のように、共
有モードロックのアンロック要求に対して共有タスク数
を1つ減しることなく、ロック中タスクリストが空にな
った時点で初めて共有タスク数を0にすることにより、
共有タスク数は、現在の共有モードロック状態が始まっ
てからロック権を与えたタスクの累積数を表し、共有モ
ードのアンロック要求と共有モードのロック要求とが交
互に行われた場合でも、いずれ共有タスク数が最大共有
タスク数に達して、それ以後に共有モードでロック要求
したタスクはロック待ちとなり、排他モードのロック待
ちタスクの永久封鎖は発生しない。
In (1) above, if the number of shared tasks is decremented by one each time a shared mode lock unlock request is made to represent the number of tasks currently holding a shared mode lock, when there is an exclusive mode lock waiting, , if a shared mode unlock request and a shared mode lock request are made alternately, a task waiting for a lock in exclusive mode will be permanently blocked. By not reducing the number of shared tasks by 1 in response to a mode lock unlock request, but by reducing the number of shared tasks to 0 only when the locked task list becomes empty.
The number of shared tasks represents the cumulative number of tasks that have been granted lock rights since the start of the current shared mode lock state, and even if shared mode unlock requests and shared mode lock requests are made alternately. When the number of shared tasks reaches the maximum number of shared tasks, any task that requests a lock after that in shared mode will be placed in a lock wait state, and tasks waiting for a lock in exclusive mode will not be permanently blocked.

排他待ちロック手段5は、ロック解除手段3から呼び出
され、排他モードのロック待ちタスクのロック処理を行
う。詳しくは、 (1)  ロック待ちタスクキューの先頭にあるロック
要求のロックモードをロックモード部に、タスク識別子
をロック中タスクリストにそれぞれ記録し、ロック待ち
タスクキューから該ロック要求を削除する。さらに、該
ロック要求を出したタスクの処理を再開させる。
The exclusive wait locking means 5 is called by the lock release means 3 and performs lock processing for lock waiting tasks in exclusive mode. Specifically, (1) Record the lock mode of the lock request at the head of the lock waiting task queue in the lock mode field and the task identifier in the locked task list, and delete the lock request from the lock waiting task queue. Furthermore, the processing of the task that issued the lock request is restarted.

次に、このように構成された本実施例の共有資源排他制
御方式の動作について、第3図(a)〜(e)を参照し
ながら具体的に説明する。なお、ここでは、最大共有タ
スク数Nは、固定値2であると仮定する。
Next, the operation of the shared resource exclusive control system of this embodiment configured as described above will be specifically explained with reference to FIGS. 3(a) to 3(e). Note that here, it is assumed that the maximum number of shared tasks N is a fixed value of two.

第3図(a)〜(e)は、いずれもある時点での排他制
御テーブル8の状態を示している。第3図(a)では資
BRをタスクTlが共有モードでロックし、タスクT2
が排他モードでロック待ちしている。このとき、新たな
タスクT3およびT4がこの順序で共有モードのロック
要求をすると、共有要求処理手段1によりタスクT3に
対してはこの時点での共有タスク数が最大共有タスク数
2よりも小さいのでロック権が与えられるが、次のタス
クT4が要求した時点では共有タスク数がすでに最大共
有タスク数2に等しくなっているため、ロック待ちとな
る。この結果、排他制御テーブル8は第3図(b)の状
態となる。
3(a) to 3(e) each show the state of the exclusive control table 8 at a certain point in time. In FIG. 3(a), task Tl locks the resource BR in shared mode, and task T2
is waiting for a lock in exclusive mode. At this time, when the new tasks T3 and T4 make a shared mode lock request in this order, the sharing request processing means 1 informs the task T3 that the number of shared tasks at this point is smaller than the maximum number of shared tasks 2. Although the lock right is granted, by the time the next task T4 makes a request, the number of shared tasks is already equal to the maximum number of shared tasks 2, so the task is placed in a lock wait state. As a result, the exclusive control table 8 is in the state shown in FIG. 3(b).

次に、タスクTIおよびT3がアンロック要求すると、
ロック解除手段3によりこれらタスクTlおよびT3の
ロックが解除され、ロック中タスクリストが空になるの
で、共有タスク数に0が記録される。続いて、次のロッ
ク待ちタスクT2のロック要求が排他モードなので排他
待ちロック手段5が呼び出され、ロックモード部に排他
モードが、ロック中タスクリストにタスク識別子T2が
それぞれ記録される0次に、ロック待ちタスクキュー中
のタスクT2のロック要求が削除され、タスクT2の処
理が再開される。この結果、排他制御テーブル8は第3
図(C)の状態となる。
Next, when tasks TI and T3 request unlocking,
The unlocking means 3 unlocks these tasks Tl and T3, and the locked task list becomes empty, so 0 is recorded in the number of shared tasks. Subsequently, since the lock request of the next lock waiting task T2 is in the exclusive mode, the exclusive waiting lock means 5 is called, and in the 0th order, the exclusive mode is recorded in the lock mode section and the task identifier T2 is recorded in the currently locked task list. The lock request of task T2 in the lock waiting task queue is deleted, and the processing of task T2 is restarted. As a result, the exclusive control table 8 is
The state shown in Figure (C) is reached.

次に、新たなタスクT5が排他モードで、タスクT6お
よびT7が共有モードでロック要求すると、タスクT5
に対しては排他要求処理手段2が、タスクT6およびT
7に対しては共有要求処理手段1が呼び出され、すでに
資源Rが排他モードでタスクT2によりロックされてい
るので、これらタスクT5.T6およびT7はロック待
ちとなり、これらタスクT5.T6およびT7のタスク
識別子と要求モード(排他モード、共有モードおよび共
有モード)との紐がロック待ちタスクキューに記録され
る。この結果、排他制御テーブル8は第3図(d)の状
態となる。
Next, when a new task T5 requests a lock in exclusive mode and tasks T6 and T7 request a lock in shared mode, task T5
, the exclusive request processing means 2 executes tasks T6 and T
Share request processing means 1 is called for tasks T5.7 and resource R is already locked by task T2 in exclusive mode. T6 and T7 are waiting for a lock, and these tasks T5. The links between the task identifiers of T6 and T7 and the request modes (exclusive mode, shared mode, and shared mode) are recorded in the lock-waiting task queue. As a result, the exclusive control table 8 is in the state shown in FIG. 3(d).

次に、タスクT2がアンロック要求すると、ロック解除
手段3が呼び出され、ロック中タスクリストからタスク
識別子T2が削除される。続いて、ロック中タスクリス
トが空、かつ次のロック待ちタスクT4の要求モードが
共有モードなので、共有待ちロック手段4が呼び出され
、ロック待ちタスクキューの先頭から最大共有タスク数
2までの共有モードロック要求のタスク識別子T4およ
びT6をロック中タスクリストに記録し、共有タスク数
に2を記録する0次に、タスクT4およびT6のロック
要求をロック待ちタスクキューから削除し、タスクT4
およびT6の処理を再開させる。
Next, when the task T2 makes an unlock request, the lock release means 3 is called and the task identifier T2 is deleted from the locked task list. Subsequently, since the locking task list is empty and the request mode of the next lock-waiting task T4 is the shared mode, the shared-waiting lock means 4 is called, and the shared mode is set from the head of the lock-waiting task queue to the maximum number of shared tasks 2. Record the task identifiers T4 and T6 of the lock requests in the locking task list, and record 2 in the number of shared tasks. Next, delete the lock requests of tasks T4 and T6 from the lock waiting task queue, and
and restarts the process at T6.

この結果、排他制御テーブル8は第3図(6)の状態と
なる。
As a result, the exclusive control table 8 is in the state shown in FIG. 3 (6).

なお、本実施例では、最大共有タスク数Nを資源の種類
にかかわらずに固定値としたが、排他制御テーブル8内
に各資源に対する最大共有タスク数の欄を設けることに
より、資源ごとに異なる最大共有タスク数を使用するこ
とも可能である。
In this embodiment, the maximum number of shared tasks N is set to a fixed value regardless of the type of resource, but by providing a column for the maximum number of shared tasks for each resource in the exclusive control table 8, it can be set to a different value for each resource. It is also possible to use a maximum number of shared tasks.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、共有モードのロック要求
に対して共有モードでロックされかつ共有モードロック
になってからロック権を与えたタスクの数が最大共有タ
スク数より少ない場合に該ロック要求を出したタスクに
ロック権を与える共有要求処理手段と、アンロック要求
に対して次にロック権を与えるべきロック待ちタスクが
共有モードでロック要求している場合に最大共有タスク
数以内の共有モードのロック待ちタスクにロック権を与
える共有待ちロック手段とを設けることにより、資源が
共有モードでロックされているときにこの共有モードロ
7り中にロック権を与えたタスク数が最大共有タスク数
未満の間は共有モードロック要求が排他モードロック要
求を追い越すのを許すようにして、永久封鎖の問題を避
けながら共有資源の使用効率を向上させることができる
という効果がある。
As explained above, in response to a shared mode lock request, when the number of tasks that have been locked in shared mode and have been given lock rights after becoming a shared mode lock is less than the maximum number of shared tasks, the lock request is made. A shared request processing means that grants lock rights to the task that issued the lock request, and a shared mode within the maximum number of shared tasks when the lock waiting task to which the next lock right is to be granted in response to an unlock request is requesting a lock in shared mode. When a resource is locked in shared mode, the number of tasks to which locking rights are granted during this shared mode lock is less than the maximum number of shared tasks. By allowing shared mode lock requests to overtake exclusive mode lock requests during this time, the effect is that the efficiency of use of shared resources can be improved while avoiding the problem of permanent blockage.

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

第1図は本発明の一実施例の共有資源排他制御方式のf
Jll戒を示すブロック図、 第2図は第1図中の排他制御テーブルのI#I威を示す
図、 第3図(a)〜(e)は本実施例の共有資源排他制御方
式の具体的な動作例を説明するための図である。 図において、 l・・・共有要求処理手段、 2・・・排他要求処理手段、 3・・・ロック解除手段、 4・・・共有待ちロック手段、 5・・・排他待ちロック手段、 6・・・ロック要求処理部、 7・・・アンロック要求処理部、 8・・・排他制御テーブル、 9・・・共有資源排他制御機能、 TI−Tn・・・タスクである。 第 図 第2図 E・・臂他モ ド
FIG. 1 shows f of a shared resource exclusive control system according to an embodiment of the present invention.
Figure 2 is a diagram showing the I#I power of the exclusive control table in Figure 1. Figures 3 (a) to (e) are specific examples of the shared resource exclusive control method of this embodiment. FIG. 3 is a diagram for explaining a typical operation example. In the figure, l...share request processing means, 2...exclusion request processing means, 3...lock release means, 4...share wait lock means, 5...exclusion wait lock means, 6... - Lock request processing unit; 7... Unlock request processing unit; 8... Exclusive control table; 9... Shared resource exclusive control function; TI-Tn... Task. Figure 2 Figure E...Arm and other mods

Claims (1)

【特許請求の範囲】 計算機システムの共有資源排他制御方式において、 共有モードのロック要求に対して資源がロックされてい
ない場合および共有モードでロックされかつ共有モード
ロックになってからロック権を与えたタスクの数が最大
共有タスク数より少ない場合に該ロック要求を出したタ
スクにロック権を与えその他の場合にはロック待ちとす
る共有要求処理手段と、 アンロック要求に対して次にロック権を与えるべきロッ
ク待ちタスクが共有モードでロック要求している場合に
最大共有タスク数以内の共有モードのロック待ちタスク
にロック権を与える共有待ちロック手段と を有することを特徴とする共有資源排他制御方式。
[Claims] In a shared resource exclusive control method for a computer system, when a resource is not locked in response to a lock request in a shared mode, or when a resource is locked in a shared mode and becomes a shared mode lock, a lock right is granted. A sharing request processing means that grants a lock right to a task that issues a lock request when the number of tasks is less than the maximum number of shared tasks, and waits for a lock in other cases; A shared resource exclusive control method characterized by having a shared resource lock means for granting a lock right to lock-waiting tasks in a shared mode within the maximum number of shared tasks when a task waiting for a lock to be granted is requesting a lock in a shared mode. .
JP1221016A 1989-08-28 1989-08-28 Shared resource exclusive control system Pending JPH0383142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1221016A JPH0383142A (en) 1989-08-28 1989-08-28 Shared resource exclusive control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1221016A JPH0383142A (en) 1989-08-28 1989-08-28 Shared resource exclusive control system

Publications (1)

Publication Number Publication Date
JPH0383142A true JPH0383142A (en) 1991-04-09

Family

ID=16760162

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1221016A Pending JPH0383142A (en) 1989-08-28 1989-08-28 Shared resource exclusive control system

Country Status (1)

Country Link
JP (1) JPH0383142A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08272667A (en) * 1995-03-31 1996-10-18 Nec Corp File access control system
US9411660B2 (en) 2011-02-25 2016-08-09 Fujitsu Limited Lock control apparatus and lock control method
JP2018506085A (en) * 2015-12-14 2018-03-01 華為技術有限公司Huawei Technologies Co.,Ltd. Lock management method, lock server and client in cluster
CN112965829A (en) * 2021-02-22 2021-06-15 电子科技大学 Method for using lock protocol under parallel task grouping scheduling

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08272667A (en) * 1995-03-31 1996-10-18 Nec Corp File access control system
US9411660B2 (en) 2011-02-25 2016-08-09 Fujitsu Limited Lock control apparatus and lock control method
JP2018506085A (en) * 2015-12-14 2018-03-01 華為技術有限公司Huawei Technologies Co.,Ltd. Lock management method, lock server and client in cluster
US10257282B2 (en) 2015-12-14 2019-04-09 Huawei Technologies Co., Ltd. Lock management method in cluster, lock server, and client
US10609150B2 (en) 2015-12-14 2020-03-31 Huawei Technologies Co., Ltd. Lock management method in cluster, lock server, and client
CN112965829A (en) * 2021-02-22 2021-06-15 电子科技大学 Method for using lock protocol under parallel task grouping scheduling
CN112965829B (en) * 2021-02-22 2023-08-11 电子科技大学 Method for using lock protocol under parallel task grouping scheduling

Similar Documents

Publication Publication Date Title
US5454108A (en) Distributed lock manager using a passive, state-full control-server
US8082379B2 (en) Systems and methods for managing semantic locks
JPH01298440A (en) Exclusion control system
KR20010005570A (en) An agent-implemented locking mechanism
JPH02195453A (en) File access control system
US8566298B1 (en) Method and apparatus for sharing resource locks amongst applications
JP2002157554A (en) System for managing access of smart card, sharing method and storage medium
Stone Database applications of the fetch-and-add instruction
JPH0383142A (en) Shared resource exclusive control system
JP2518134B2 (en) Shared resource exclusive control method
JPH0478932A (en) Shared resource exclusion control system
JPH02118843A (en) Shared resources exclusion control system
JPH03141458A (en) Exclusive control system for shared resource
JP2898012B2 (en) Exclusive control method for computer resources
JPH04116731A (en) Exclusive control for shared resources
JPH03257568A (en) Exclusive control system for shared resources
JPH0423047A (en) Exclusive control system for shared resources
JPH02194442A (en) Shared resource controller
JPH05120040A (en) Computer system
JPS5827255A (en) Controlling system of file used for plural electronic computers in common
JP3068556B2 (en) Shared resource exclusion control method and its program recording medium
JP3036468B2 (en) Exclusive control processing device, exclusive control processing method, and storage medium storing exclusive control processing program
JPS6320634A (en) Exclusive control system for computer resource
JPH0981438A (en) Automatic exclusive control system in client server system
JPH04223533A (en) Common resource exclusive control system