JPH0330027A - Exclusive control system - Google Patents

Exclusive control system

Info

Publication number
JPH0330027A
JPH0330027A JP16571589A JP16571589A JPH0330027A JP H0330027 A JPH0330027 A JP H0330027A JP 16571589 A JP16571589 A JP 16571589A JP 16571589 A JP16571589 A JP 16571589A JP H0330027 A JPH0330027 A JP H0330027A
Authority
JP
Japan
Prior art keywords
lock
information
exclusive control
time
acquired
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
JP16571589A
Other languages
Japanese (ja)
Inventor
Tsuneko Hagiwara
つね子 萩原
Koshio Ono
越夫 小野
Miyuki Ono
美由紀 小野
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP16571589A priority Critical patent/JPH0330027A/en
Publication of JPH0330027A publication Critical patent/JPH0330027A/en
Pending legal-status Critical Current

Links

Landscapes

  • Multi Processors (AREA)

Abstract

PURPOSE:To execute the exclusive control by the occupied time of information and to smoothly execute the processing by providing an occupied time designating means of information at the time of obtaining a lock, and a means for waiting if the occupancy is ended in a short time, and deciding the lock to be unsuccessful if the occupancy extends over many hours. CONSTITUTION:A process 10 requests to obtain a lock against shared informa tion 12 to an exclusive control system 14. The exclusive control system 14 decides whether it is successful to obtain the lock or not from exclusive manage ment information 18 on a main storage 16, and repeats success/failure. At the time of requesting to obtain the lock, one of four kinds of locks of classifications of a share lock which does not permit updating from other proc ess and an EXC lock which does not permit reference and updating of informa tion from other process, and whether the occupied time for obtaining to the lock is long or short is designated. At the time of requesting to obtain the lock, when the designated time of the process which is being obtained is short, waiting is executed, and when said time is long, it is decided to be unsuccessful to obtain the lock, and the process processing jam caused by waiting for a lock release for many hours can be prevented.

Description

【発明の詳細な説明】 [概要] 複数のプロセスにより共用される情報をアクセスする際
にロックを獲得して他のプロセスからのアクセスを禁止
する排他制御方式に関し、既に獲得しているロックによ
る情報の占有時間に応じたロックの獲得及びロック獲得
状態での複数のロック種別の保持を目的とし、 ロック獲得要求時に情報占有時間を指定し、現在ロック
獲得らに成功しているプロセスの指定占有時間が短い時
は待ち状態となり、長い時はロック獲得を不成功として
待たない。またロック獲得の要求時に現在ロック獲得に
成功しているプロセス名をチェックし、要求プロセス名
と同じ時にはロック獲得を成功させ、同一プロセスによ
る連続的なロック獲得による複数のロック種別を保持可
能に構成する。
[Detailed Description of the Invention] [Summary] Regarding an exclusive control method that acquires a lock when accessing information shared by multiple processes and prohibits access from other processes, information based on already acquired locks is provided. For the purpose of acquiring locks according to the occupation time of the process and maintaining multiple lock types in the lock acquisition state, the information occupation time is specified when requesting lock acquisition, and the specified occupation time of the process that has currently succeeded in acquiring the lock is specified. When is short, it enters a waiting state, and when it is long, the lock acquisition is considered unsuccessful and does not wait. Also, when requesting a lock, the name of the process that has currently successfully acquired the lock is checked, and if it is the same as the requesting process name, the lock is successfully acquired, making it possible to hold multiple lock types through continuous lock acquisition by the same process. do.

[産業上の利用分野] 本発明は、複数のプロセスにより共用される情報をアク
セスする際にロックを獲得して他のプロセスからのアク
セスを禁止する排他制御方式に関する。
[Field of Industrial Application] The present invention relates to an exclusive control method that acquires a lock when accessing information shared by a plurality of processes and prohibits access from other processes.

計算機上で実行される複数のプロセスによって共用され
る情報の排他制御にあっては、情報の占有時間に合わせ
たロックの獲得と複数のロック種別を保持し、ロックの
解除時にロックの種別の変更前の状態にもどす手段が望
まれる。
For exclusive control of information shared by multiple processes running on a computer, locks are acquired according to the information's occupancy time, multiple lock types are held, and the lock type is changed when the lock is released. A means to return to the previous state is desired.

[従来の技術] マルチプロセスを実現している計算機上では、共有情報
の利用についてプロセス間の情報の共有/排他という問
題が発生する。そのために、情報を他プロセスからアク
セスすることを禁止した状態にする「ロックの獲得」と
、アクセスを許可した状態にする「ロックの解除」とい
う2つの排他制御の操作が必要になる。
[Prior Art] On a computer that implements multiple processes, the problem of sharing/excluding information between processes occurs regarding the use of shared information. For this purpose, two exclusive control operations are required: ``acquiring a lock'' to prohibit access to information from other processes, and ``releasing a lock'' to allow access.

従来、ロックの獲得では、第21図に示す他プロセスか
らの情報の更新を許さないシェアロック(shsxre
 lock)と、第22図に示す他のプロセスからの情
報の参照と更新のどちらも許さないエクスクルーシイブ
ロック(exclusive lock,以下rEXC
ロック」という)の2つのロックの種別により、排他制
御を行なっている。
Conventionally, when acquiring a lock, a shared lock (shsxre) that does not allow information to be updated from other processes is used, as shown in Figure 21.
lock) and an exclusive block (rEXC, hereinafter referred to as rEXC) that does not allow either reference or update of information from other processes, as shown in Figure 22.
Exclusive control is performed using two types of locks (referred to as "locks").

[発明が解決しようとする課題] しかし、従来の排他制御方式にあっては、複数のプロセ
スからのロックの獲得が衝突した場合、後から来たロッ
クの獲得要求には、その前、すなわち現在獲得されてい
るロックによる情報の占有時間にかかわらず、そのロッ
クが獲得できるまで待つか、または、諦めてしまうかを
決定しなければならない。
[Problems to be Solved by the Invention] However, in the conventional exclusive control method, when lock acquisition from multiple processes collides, a later lock acquisition request is Regardless of how long the information is occupied by the acquired lock, a decision must be made whether to wait until the lock is acquired or to give up.

また、ロックの獲得中に情報の内容によってロックの種
別を変更したいことがある。従来の技術ではロックの種
別の変更は実現されているが、複数のロックの種別を持
ち、ロックの解除時にロックの獲得の状態にもどす手段
が実現されていない。
Additionally, while acquiring a lock, you may want to change the type of lock depending on the content of the information. In the conventional technology, it is possible to change the lock type, but there is no means for having multiple lock types and returning the lock to the acquired state when the lock is released.

まず、獲得されているロックによる情報の占有時間がわ
からないことから起こる問題について、2つ例をあげて
説明する。
First, we will explain the problem caused by not knowing how long information is occupied by an acquired lock, using two examples.

■つめの例は、第23図のような場合である。(2) An example of this is the case shown in FIG. 23.

第23図では、プロセスAが情報Pを参照しようとして
シェアロックの獲得を要求し、プロセスBは情報Pを更
新しようとして、EXCロックの獲得を要求している。
In FIG. 23, process A attempts to reference information P and requests acquisition of a share lock, and process B attempts to update information P and requests acquisition of an EXC lock.

この場合、プロセスAもプロセスBもロックの獲得がで
きなかったら、ロックの獲得ができるようになるまで待
つこととする。
In this case, if neither process A nor process B is able to acquire a lock, they will wait until they are able to acquire a lock.

今、ロックの獲得要求がプロセスA,プロセスBの順に
行なわれたとする。プロセスAによって、情報Pは、情
報Pを更新しようとする他プロセスからのアクセスを禁
止した状態になる。この状態でプロセスBが情報Pを更
新しようとしてEXCロックの獲得を要求しても、プロ
セスAが既にシェアロックを獲得しているので、プロセ
スBはEXCロックの獲得ができない。従って、プロセ
スBは、プロセスAがロックの解除を行なうのを待つ。
Assume that lock acquisition requests are made by process A and process B in this order. Process A puts information P in a state where access from other processes attempting to update information P is prohibited. In this state, even if process B requests acquisition of the EXC lock in order to update information P, process B cannot acquire the EXC lock because process A has already acquired the share lock. Therefore, process B waits for process A to release the lock.

プロセスAがシェアロックを長い時間獲得したままでい
ると、プロセスBはその間処理が進行せず、無駄に遅延
してしまう。
If process A continues to acquire the share lock for a long time, process B will not be able to proceed with its processing during that time, resulting in unnecessary delays.

もう1つの例は、第24図のような場合である。Another example is the case shown in FIG.

第24図では、プロセスCが情報Qを更新しようとして
、EXCロックの獲得を要求し、プロセスDは情報Qを
参照しようとしてシェアロックの獲得を要求している。
In FIG. 24, process C attempts to update information Q and requests acquisition of an EXC lock, and process D attempts to reference information Q and requests acquisition of a share lock.

この時、プロセスCもプロセスDも、ロックは獲得でき
なかったらば、ロックの獲得ができるようになるのを待
たずに、すぐに復帰するものとする。
At this time, if neither process C nor process D is able to acquire the lock, it is assumed that they return immediately without waiting for the lock to be acquired.

今、ロックの獲得がプロセスC,プロセスDの順に行な
われたとする。プロセスCのEXCロック獲得によって
、情報Qは、情報Qを操作しようとする他の全てのプロ
セスからのアクセスが禁止された状態になる。この状態
で、プロセスDが情報Qを参照しようとして、シェアロ
ックの獲得を要求しても、プロセスDはシエアロ.ツク
が獲得できす、すぐに復帰してしまう。この場合、プロ
セスDは情報Qの操作を中止1−でしまう。しかし、第
24図のプロセスCのようにEXCロックの獲得が短い
間だった場合、プロセスDはその間待ち状態になってい
れば、処理を継続できたはずである。
Now, assume that process C and process D acquire locks in this order. When process C acquires the EXC lock, information Q becomes in a state where access from all other processes attempting to manipulate information Q is prohibited. In this state, even if process D tries to refer to information Q and requests to acquire a share lock, process D will not be able to access information Q. I can get Tsuku, and I'll be back soon. In this case, the process D stops operating the information Q and returns 1-. However, if the EXC lock was acquired for a short period of time as in process C in FIG. 24, process D could have continued processing if it had been in the waiting state during that time.

次に、複数のロックの種別を保持し、そのロックを解除
する時に、一部だけのロックの解除ができないことから
起こる問題点について例をあげて説明する。
Next, an example will be given of a problem that occurs when a plurality of lock types are held and when the locks are released, it is not possible to release only some of the locks.

始めに、情報を参照するためにシェアロックを獲得する
。情報の内容からロックの種別をシェアロックからEX
Cロックに変更する。従来の技術では、この変更ではロ
ックの種別をシェアロックからEXCロックにすり替え
られてしまう。つまり、EXCロックのみが存在する状
態になってしまう。このような状態の時にロックの解除
をしてしまうと、情報Rに対するロックの獲得がすべて
解除されてしまう。しかし、ロックの解除後続けて、他
プログラムからの情報の変更のみを禁止するシェアロッ
クを獲得している状態にして、情報を操作したい場合が
ある。
First, acquire a share lock to view information. Change the lock type from shared lock to EX based on the information content
Change to C lock. In the conventional technology, this change would result in changing the lock type from a shared lock to an EXC lock. In other words, only the EXC lock exists. If the lock is released in such a state, all locks on the information R will be released. However, after the lock is released, there are cases where it is desired to manipulate information while acquiring a share lock that only prohibits changes to the information from other programs.

従来の技術の場合、■第25図のプロセスXX1のよう
に、ロックの解除を遅らせる。■第26図のプロセスX
X2のように、一端ロックを解除してシェアロックを獲
得する。しかし■の場合、情報YY1を参照しようとす
るプロセスZZ1を遅延させる。■の場合、プロセスX
X2がロックを解除してから新たにロックを獲得する間
に、プロセスYY2のように情報ZZ2を操作してしま
う可能性があり、情報ZZ2の一貫性が保証されなくな
ってしまう。
In the case of the conventional technology, (1) the release of the lock is delayed, as in process XX1 in FIG. ■Process X in Figure 26
Like X2, the lock is first released and a shared lock is acquired. However, in the case of ■, the process ZZ1 that attempts to refer to the information YY1 is delayed. ■In the case of process
After X2 releases the lock and acquires a new lock, there is a possibility that the information ZZ2 is manipulated like the process YY2, and the consistency of the information ZZ2 is no longer guaranteed.

以上から明らかなように、複数プロセスから共有される
情報に対する排他制御は、情報の占有時間にあわせたロ
ックの獲得と複数のロックの種別を保持し、ロックの解
除時にロックの種別の一部を前の状態にもどす方式と一
度に解除する方式が必要となる。
As is clear from the above, exclusive control over information shared by multiple processes involves acquiring locks according to the information's occupancy time, maintaining multiple lock types, and releasing some of the lock types when the lock is released. A method for returning to the previous state and a method for canceling it all at once are required.

本発明は、このような従来の問題点に鑑みてなされたも
ので、既に獲得しているロックによる情報の占有時間に
合わせたロックの獲得とロックの種別の変更を可能にす
る排他制御方式を実現する。
The present invention has been made in view of these conventional problems, and provides an exclusive control method that makes it possible to acquire a lock and change the type of lock in accordance with the time that information is occupied by the already acquired lock. Realize.

[課題を解決するための手段] 第1図は本発明の原理説明図である。[Means to solve the problem] FIG. 1 is a diagram explaining the principle of the present invention.

まず本発明は、計算機上で実行される複数のプロセスに
よって共有される共有情報を有し、この共有情報をアク
セス(参照又は更新)する際に他のにプロセスからのア
クセスを禁止するためにロックを獲得する排他制御方式
を対象とする。
First, the present invention has shared information that is shared by multiple processes executed on a computer, and when this shared information is accessed (referenced or updated), it is locked to prevent other processes from accessing it. The target is an exclusive control method that obtains

このような排他制御方式につき本発明にあっては、ロッ
ク獲得成功時の情報の占有時間が長い占有時間か短い占
有時間かを指定する占有時間指定手段と;ロック獲得を
要求した際に現在ロック獲得に成功しているプロセスの
指定占有時間をチェックし、指定占有時間が短い時には
待ち状態となり、指定占有時間我長い時にはロック獲得
を不成功とする手段と;を設け、情報の占有時間に応じ
た排他制御を行なう。
Regarding such an exclusive control method, the present invention includes an occupancy time specifying means for specifying whether the occupancy time of information upon successful lock acquisition is a long occupancy time or a short occupancy time; Check the specified occupation time of a process that has successfully acquired the lock, and if the specified occupation time is short, it will go into a waiting state, and if the specified occupation time is too long, the lock acquisition will be unsuccessful; Performs exclusive control.

またロック獲得を要求した際に、現在ロック獲得に威功
しているプロセス名を判別するチェック手段と;該チェ
ック手段による判別プロセス名がロック獲得要求を行な
ったプロセス名と同一であった場合には新たなロック獲
得を成功させる手段と;を設け、同一プロセスにおいて
連続的にロック獲得を成功させて複数のロックの種別を
保持し、ロックの解除時にロックを一度に解除する方法
と一部づつ解除する方法が同時に実現される。
Also, when a lock acquisition request is made, there is a check means for determining the name of the process currently successful in acquiring the lock; if the process name determined by the check means is the same as the process name that made the lock acquisition request; provides a method for successfully acquiring a new lock; a method for successively acquiring locks in the same process, holding multiple lock types, and releasing the locks at once when the lock is released; A method for canceling is realized at the same time.

ここで、共有情報のアクセス時に獲得するロックの種別
としては、他のプロセスからの情報の更新を許さずに参
照のみを許す情報の参照時に獲得する第1のロック(シ
ェアロック)と、他のプロセスからの情報の参照及び更
新のどちらも許さない情報の更新時に獲得する第2のロ
ック( EXCロック)との2つがある。
Here, the types of locks acquired when accessing shared information include the first lock (shared lock) acquired when accessing information that only allows access without allowing other processes to update the information, and There are two types of locks: a second lock (EXC lock) acquired when updating information that does not permit either reference or update of information from a process.

[作用コ このような構成を備えた本発明の排他制御方式によれば
、 ロック獲得を要求した際に現在ロック獲得の成功により
情報を占有しているプロセスの占有時間が輪かり、占有
時間が短かければロック解除を待ってロック獲得に成功
し、一方、占有時間が長ければロック獲得を不成功に終
らせ、長い時間にわたりロック解除を待つことによるプ
ロセスの処理の停滞を防止できる。
[Operations] According to the exclusive control method of the present invention having such a configuration, when a lock acquisition is requested, the occupation time of the process that currently occupies the information due to the successful lock acquisition is extended, and the occupancy time is reduced. If the occupied time is short, the lock can be successfully acquired after waiting for the lock to be released. On the other hand, if the occupied time is long, the lock can be unsuccessfully acquired, thereby preventing processing stagnation caused by waiting for the lock to be released for a long time.

更に、ロック獲得を要求したプロセス名と現在ロック獲
得に成功しているプロセス名が同じ時にはロック獲得を
成功させ複数のロックの種別を保持することからロック
の種別が変更可能であり、ロックの解除の時に一度に複
数のロックを解除したり、一部のロックだけを解除した
りすることができる。
Furthermore, if the process name that requested the lock acquisition is the same as the name of the process that has currently successfully acquired the lock, the lock acquisition is successful and multiple lock types are held, so the lock type can be changed and the lock can be released. You can unlock multiple locks at once or only some of them.

[実施例] 第1図において、10はプロセスであり、このプロセス
10に加えた他の複数のプロセスが存在する。12はプ
ロセス10を含む複数のプロセスで共用する情報、14
は本発明の排他制御を実行する排他制御システム、16
は主記憶、18は主記憶16上に形成された排他制御管
理情報である。
[Example] In FIG. 1, 10 is a process, and in addition to this process 10, there are a plurality of other processes. 12 is information shared by multiple processes including process 10; 14
is an exclusive control system that executes exclusive control of the present invention, 16
is the main memory, and 18 is exclusive control management information formed on the main memory 16.

この第2図の実施例においてプロセス10のロックの過
獲得要求に対する処理は次の通りでせある。
In the embodiment of FIG. 2, the process 10 handles an excessive lock acquisition request as follows.

■プロセス10は共用情報12に対するロックの獲得を
排他制御システム14に要求する。
(2) The process 10 requests the exclusive control system 14 to acquire a lock on the shared information 12.

■排他制御システム14は主記憶16上の排他制御管理
情報18からロック獲得の成功または失敗を判断する。
(2) The exclusive control system 14 determines the success or failure of lock acquisition from the exclusive control management information 18 on the main memory 16.

■排他制御システム14はプロセス10にロックの獲得
の成功/失敗を返す。
(2) The exclusive control system 14 returns success/failure of lock acquisition to the process 10.

ここで、プロセス10がロックの獲得を要求する際には
、シェアロックとEXCロックの各々につき第3図に示
すロックの種別と、第4図に示す占有時間の種別を指定
する。
Here, when the process 10 requests acquisition of a lock, it specifies the lock type shown in FIG. 3 and the occupation time type shown in FIG. 4 for each of the shared lock and EXC lock.

その結果、本発明にのロック種別は、 (A)  EXCoング(exclusite &lo
ng)(B)  EXCシa 一ト(exclusiv
e & short )(C)シェアロング(sbxr
e & lonK(D)シェアショート(share 
short)の4種類となり、プロセス10は4つの中
のいずれか一つをロック指定する。
As a result, the lock types according to the present invention are: (A) EXCong (exclusive &lo
ng) (B) EXC sheet (exclusive)
e & short) (C) share long (sbxr
e & lonK (D) share short (share
There are four types of locks (short), and the process 10 specifies one of the four locks.

第5図は第2図に示したは排他制御管理情報18の形式
の一例を示した説明図である。
FIG. 5 is an explanatory diagram showing an example of the format of the exclusive control management information 18 shown in FIG.

第5図において、排他制御管理情報は、排他制御対象の
情報を示す情報名20、この情報のロック指定状況22
,24.26.28、プロセス管理リスト34へのポイ
ンタ30、待ち状態プロセス管理リスト40へのポイン
タ32、プロセス管理リスト34から構威される。
In FIG. 5, the exclusive control management information includes an information name 20 indicating information on the object of exclusive control, and a lock specification status 22 of this information.
, 24.26.28, a pointer 30 to the process management list 34, a pointer 32 to the waiting state process management list 40, and a pointer 32 to the process management list 34.

ロック指定状況22〜28とは、EXCロング、EXC
ショート、シェアロング、シェアショートによるロック
獲得を要求し、ロック獲得に成功したプロセス又は待ち
状態になっているプロセスの数A,  B,  C, 
Dを示す。このプロセス数A−Dはロックの解除が要求
された時、1減らされる。あるロック指定のプロセス数
が0の場合、その指定でロックの獲得を要求しているプ
ロセスがないことを表し、プロセスの数が0でない場合
はその指定でロックの獲得を要求しているプロセスが幾
つあるかを表す。
Lock specification status 22 to 28 are EXC long, EXC
Number of processes that requested lock acquisition by short, shared long, and shared short and succeeded in acquiring the lock, or processes that are in a waiting state A, B, C,
Indicates D. This number of processes A-D is reduced by 1 when a lock release is requested. If the number of processes for a lock specification is 0, it means that there are no processes requesting to acquire the lock with that specification, and if the number of processes is not 0, it means that there are no processes requesting to acquire the lock with that specification. Indicates how many there are.

第6図のの情報名aの排他制御管理情報中のロック指定
状況は、EXCロング、EXCショート、シェアロング
、シェアショートを指定したプロセス数(A, B, 
C, D)が(0.  1, 0. 0)となっている
ので、B=1によりEXCショートを指定してロックの
獲得を要求したプロセスが一つあることを表し、それ以
外の指定をしてロックを獲得しているプロセスがないこ
とを表している。
The lock specification status in the exclusive control management information with information name a in Figure 6 is the number of processes (A, B,
Since C, D) are (0. 1, 0. 0), B = 1 indicates that there is one process that specified EXC short and requested to acquire the lock, and other specifications are This indicates that no process has acquired the lock.

再び第5図を参照するに、プロセス管理リスト34には
、ロックを獲得しているプロセスを示すプロセス名36
がリスト形式で保持されている。
Referring again to FIG. 5, the process management list 34 includes a process name 36 indicating the process that has acquired the lock.
are kept in list format.

またプロセス管理リスト34の前の部分ロック獲得プロ
セス管理リスト38であり、既にロックの獲得が成功し
ているプロセス名36が並んでおり、その後に、待ち状
態になっているプロセス名36を並べた待ち状態プロセ
ス管理リス40を設けている。この点を第6図について
見ると、排他制御管理情報のプロセス管理リスト34は
、プロセスp1がロックの獲得が成功しており、待ち状
態なっているプロセスがないことを表している。
In addition, there is a partial lock acquisition process management list 38 before the process management list 34, in which process names 36 that have already successfully acquired locks are listed, followed by process names 36 that are in a waiting state. A waiting state process management list 40 is provided. Looking at this point with respect to FIG. 6, the process management list 34 of the exclusive control management information indicates that the process p1 has successfully acquired the lock and that there is no process in the waiting state.

第7図は第2図の実施例において、ある情報に対してロ
ックを獲得しようとした時、その情報の排他制御管理情
報のロック指定状況とこの獲得要求のロック指定の2つ
から、排他制御システムの判断、つまり、ロックの獲得
を成功させるか、失敗させるか、または、プロセスを待
ち状態にするかの排他制御システム14による判断処理
を表にまとめている。
FIG. 7 shows that in the embodiment shown in FIG. 2, when an attempt is made to acquire a lock for certain information, exclusive control is determined based on the lock specification status of the exclusive control management information of the information and the lock specification of this acquisition request. The system judgment, that is, the judgment processing by the exclusive control system 14 as to whether lock acquisition should be successful or unsuccessful, or whether the process should be placed in a waiting state, is summarized in a table.

これ第7図の表に従って、ある情報に対してロックを獲
得しようとした時、その情報の排他制御管理情報18か
ら排他制御システム14がどのような処理を行なうかを
、例をあげて説明する。
Using an example, we will explain what kind of processing the exclusive control system 14 performs based on the exclusive control management information 18 of that information when attempting to acquire a lock on certain information according to the table in FIG. .

[処理1] 最初どのプロセスからもロックの獲得がされていない時
の情報bの排他制御管理情報18は第8図のようになっ
ている。この状態の時に、情報bに対してEXCショー
トを指定したロックの獲得要求があった場合、第7図の
■に基づきロックの獲得が成功し、プロセス管理リスト
34にプロセス名piが登録される。
[Processing 1] At first, when no process has acquired a lock, the exclusive control management information 18 of information b is as shown in FIG. In this state, if there is a lock acquisition request specifying EXC short for information b, the lock acquisition is successful based on ■ in FIG. 7, and the process name pi is registered in the process management list 34. .

[処理2] 情報Cの排他制御管理情報18が第10図の時、即ち、
プロセスp2の情報Cに対するシェアロング指定のロッ
クの獲得が成功している時、プロセスp3がロック指定
をEXCショートとしてロックの獲得を要求した場合、
第7図の■に基づき、排他制御システムはロックの獲得
を失敗させる。
[Processing 2] When the exclusive control management information 18 of information C is as shown in FIG. 10, that is,
When process p2 has successfully acquired a lock with a shared long specification for information C, if process p3 requests a lock acquisition with the lock specification set to EXC short,
Based on ■ in FIG. 7, the exclusive control system fails to acquire the lock.

[処理3] 情報dの排他制御管理情報18が第1■図の時、即ち、
プロセスp4の情報dに対するEXCショート指定のロ
ックの獲得が成功している時、プロセスp5がロック指
定をシェアショートとしてロックの獲得を要求した場合
、対7図の■に基づき排他制御システムはプロセスp5
を待ち状態にする。
[Process 3] When the exclusive control management information 18 of information d is as shown in Fig. 1, that is,
When process p4 has successfully acquired a lock with the EXC short designation on information d, and process p5 requests a lock acquisition with the lock designation as share short, based on ■ in Figure 7, the exclusive control system
to wait state.

この待ち状態から目覚め、プロセスp5がロックの獲得
ができるようになるのは、プロセスp4がロックの解除
を行なった時である。プロセスp5が待ち状態から目覚
め、ロックの獲得が成功した時の排他制御管理情報l8
は第12図のようになる。
The process p5 wakes up from this waiting state and becomes able to acquire the lock when the process p4 releases the lock. Exclusive control management information l8 when process p5 wakes up from a wait state and successfully acquires a lock
is as shown in Figure 12.

[処理4] 情報eの排他制御管理情報18が第13図の時、即ちプ
ロセスp6の情報eに対するシェアロング指定のロック
の獲得とシェアショート指定のロックの獲得が成功して
いる時、プロセスp7がロック指定をEXCショートと
してロックの獲得を要求した場合は、排他制御システム
14は第7図の■からロックの獲得を失敗させるか、第
7図の■からプロセスp7を待ち状態にするかのいずれ
かにする。
[Process 4] When the exclusive control management information 18 of information e is as shown in FIG. 13, that is, when process p6 successfully acquires a lock with share long designation and a lock with share short designation for information e, process p7 If a request is made to acquire a lock by setting the lock specification to EXC short, the exclusive control system 14 either causes the lock acquisition to fail from ■ in FIG. 7, or places process p7 in a waiting state from ■ in FIG. 7. Make it one way or the other.

このとき排他制御システム14は (失敗)=(待ち状態)→(成功) の順に判断し、プロセスp7のロックの獲得は失敗する
At this time, the exclusive control system 14 makes a determination in the following order: (failure) = (waiting state) -> (success), and the process p7 fails to acquire the lock.

[処理5コ 第14図は、情報fに対してどのプロセスからもロック
の獲得の要求が行なわれていない状態の時に、プロセス
p8が情報fに対してシェアロングを指定したロックの
獲得を要求し、その要求が成功した時の排他制御管理情
報18を表している。
[Processing 5] Figure 14 shows that when no process has made a request to acquire a lock for information f, process p8 requests acquisition of a lock with share long specified for information f. , and represents the exclusive control management information 18 when the request is successful.

更に、プロセスp8がEXCショートを指定して同じ情
報fにロックの獲得を要求した場合、現状では第7図の
■からロツクの獲得が失敗する。しかし、第l4図の排
他制御管理情報18の中のプロセス管理リスト34を見
ると、以前にロックの獲得が威功しているプロセスは自
プロセスp8だけである。
Furthermore, if the process p8 specifies EXC short and requests acquisition of a lock for the same information f, the acquisition of the lock will fail at point 2 in FIG. 7 under current circumstances. However, looking at the process management list 34 in the exclusive control management information 18 in FIG. 14, the only process that has successfully acquired a lock in the past is its own process p8.

このような場合に本発明の排他制御システム14はプロ
セス管理リスト34の中を検索して、既にロックの獲得
が成功しているプロセスが自プロセスだけだった場合、
後からのロックの獲得を成功させる。これによって、ロ
ックの種別変更が可能となる。第14図の処理では、プ
ロセス名p8が更にプロセス管理リスト34に加えられ
、プロセスp8のEXCショートのロックの獲得要求は
成功する。即ち、同じプロセスp8のロック種別をシェ
アショートからECXショートに変更する。このECX
ショート指定による新たなロックの獲得後の排他制御管
理情報18の状態は第15図のようになる。
In such a case, the exclusive control system 14 of the present invention searches the process management list 34, and if the self-process is the only process that has already successfully acquired a lock,
Successfully acquire a lock later. This allows the type of lock to be changed. In the process shown in FIG. 14, the process name p8 is further added to the process management list 34, and the EXC short lock acquisition request of the process p8 is successful. That is, the lock type of the same process p8 is changed from share short to ECX short. This ECX
The state of the exclusive control management information 18 after acquiring a new lock due to the short designation is as shown in FIG.

この第15図に示した同一プロセスで連続してロック獲
得を行なうことによりロック種別を変更するための処理
を更に詳細に説明する。
The process shown in FIG. 15 for changing the lock type by successively acquiring locks by the same process will be described in more detail.

まず同一プロセスでの連続ロック獲得のため、第16図
に示すように排他管理情報18のプロセス管理リスト3
4は、プロセス名36に加えてID部42が設けられて
おり、IDID部42にはロック獲得の順番を示す識別
子を任意に設定することができる。
First, in order to acquire consecutive locks in the same process, the process management list 3 of the exclusive management information 18 is shown in FIG.
4 is provided with an ID field 42 in addition to the process name 36, and an identifier indicating the order of lock acquisition can be arbitrarily set in the ID field 42.

従って、第14.15図に示した情報fに対し同じプロ
セスp8が2回ロック獲得を行なった時のプロセス管理
リスト34は第17図の(a)(b)のようにID部に
ロック獲得順を示すNo.1,No.2が設定されてい
る。即ち、ロック獲得毎に新たなプロセス管理リストが
重複して作られる。
Therefore, when the same process p8 acquires a lock twice for the information f shown in FIG. 14.15, the process management list 34 acquires a lock in the ID section as shown in FIGS. 17(a) and (b). No. indicating the order. 1, No. 2 is set. That is, a new process management list is created redundantly every time a lock is acquired.

第17図(c)(d)はロック解除を示している。即ち
、第17図(b)のロック獲得状態について第2回目の
ロック獲得で得られたプロセス管理リストを使用してア
ンロックを行なうと、同図(c)の状態となり、この状
態で更に第1回目のロック獲得で得られたプロセス管理
リストを使用してアンロックを行なうとロック解除に至
る。
FIGS. 17(c) and 17(d) show unlocking. That is, if the lock acquisition state shown in FIG. 17(b) is unlocked using the process management list obtained in the second lock acquisition, the state shown in FIG. When unlocking is performed using the process management list obtained in the first lock acquisition, the lock is released.

このような第17図に示した本発明のロック獲得毎に重
複してプロセス管理リストを作成して制御する方式の利
点は、例えば第18図(a)に示すように、1回目と2
回目のロック獲得時に同じID部の値No.1を使用し
たとすると、第1回目のロック獲得で得られたプロセス
管理リストを使用してアンロックを1回行なうだけで、
2回に亘り重複設定されたロック獲得を1回で解除でき
、ロック解除が迅速にできる点にある。
The advantage of the method of creating and controlling a process management list redundantly each time a lock is acquired according to the present invention, as shown in FIG. 17, is that, as shown in FIG.
When the lock is acquired for the second time, the same ID part value No. If you use 1, you only need to unlock once using the process management list obtained from the first lock acquisition.
The key point is that lock acquisition that has been set twice can be canceled in one go, and the lock can be released quickly.

即ち、第16図に示したプロセス管理リスト34のID
部42の値はロック獲得の順番を表わす識別子であるが
、識別子の値はロック獲得の順番とは無関係に自由に設
定できることから、2回の連続したロック獲得を2回の
アンロックで解除するか、1回のアンロックで解除する
かID部の決め方で選択することができる。
That is, the ID of the process management list 34 shown in FIG.
The value in section 42 is an identifier that indicates the order of lock acquisition, but since the value of the identifier can be freely set regardless of the order of lock acquisition, two consecutive lock acquisitions are released by two unlocks. You can choose whether to unlock it once, or to unlock it once, depending on how the ID section is determined.

第20図に第2図の実施例による排他制御の処理フロー
を示す。
FIG. 20 shows a processing flow of exclusive control according to the embodiment of FIG. 2.

第20図ノステップ85,86.87及びs8において
、排他制御システム14が排他制御管理情報18中のロ
ック指定状況からロックの獲得の成功/失敗または待ち
状態にさせることの判断を第7図のリストに示したよう
に行なっている。同じくステップS9において、排他制
御管理情報18中のプロセス管理リスト34を検索し、
自プロセスか否かによってロックの変更を行なうかどう
かを判断している。
In steps 85, 86, 87 and s8 of FIG. 20, the exclusive control system 14 determines whether the lock acquisition is successful/failure or whether to place the lock in a waiting state based on the lock specification status in the exclusive control management information 18 as shown in FIG. It is done as shown in the list. Similarly, in step S9, search the process management list 34 in the exclusive control management information 18,
Whether or not to change the lock is determined depending on whether the process is an own process or not.

[発明の効果] 以上説明したきたように本発明によれば、マルチプロセ
スを実現している計算機上で、情報の占有時間にあわせ
たロックの獲得とロックの種別の変更が可能な排他制御
システムが実現され、プロセスは共有情報の排他状況に
あわせた処理をスムーズに行なうことができる。
[Effects of the Invention] As explained above, according to the present invention, an exclusive control system is provided that is capable of acquiring locks and changing lock types in accordance with the information occupancy time on a computer that implements multiple processes. is realized, and the process can smoothly perform processing according to the exclusive status of shared information.

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

第1図は本発明の原理説明図; 第2図は本発明の実施例構成図; 第3図は本発明のロック種別説明図; 第4図は本発明の占有時間の種別説明図;第5図は本発
明の排他制御管理情報の説明図;第6図は情報aの排他
制御管理情報説明図;第7図は本発明のロック獲得の成
功、失敗、待ち状態の判断テーブル説明図; 第8. 9, 1.0, 11. 12. 13. 1
4. 15図は情報b−fの排他管理情報説明図;第1
6図は連続ロック獲得のためのプロセス管理リスト説明
図; 第17図は2回ロック獲得及びアンロツク時のリスト説
明図; 第{8図はアンロツク時のリスト説明図;第l9図は本
発明の処理フロー図; 第20図は従来のshaIe lock獲得状態説明図
;第21図は従来のexclucive lock獲得
状態説明図; 第22図は後からロック獲得要求を行なったプロセスの
遅延状態図; 第23図は後からロック獲得要求を行なったプロセスが
獲得を失敗して処理を中止した状態図;第24図はロッ
クの解除を遅らせる従来方式の説明図; 第25図はロックを一端解除する従来方式の説明図であ
る。 14:排他制御システム 16:主記憶 18:排他制御管理情報 20:情報名 22, 24, 26. , 28 :ロツク獲得及び
待ちプロセス数30.32:ポインタ 34:プロセス管理リスト 36:プロセス名 38:ロック獲得見みプロセス管理リスト40:待ち状
態プロセス管理リスト 42:ID部
Fig. 1 is an explanatory diagram of the principle of the present invention; Fig. 2 is an exemplary configuration diagram of the present invention; Fig. 3 is an explanatory diagram of the lock types of the present invention; Fig. 4 is an explanatory diagram of the types of occupied time of the present invention; FIG. 5 is an explanatory diagram of exclusive control management information of the present invention; FIG. 6 is an explanatory diagram of exclusive control management information of information a; FIG. 7 is an explanatory diagram of a judgment table for lock acquisition success, failure, and waiting state of the present invention; 8th. 9, 1.0, 11. 12. 13. 1
4. Figure 15 is an explanatory diagram of exclusive management information of information b-f; 1st
Figure 6 is an explanatory diagram of the process management list for continuous lock acquisition; Figure 17 is an explanatory diagram of the list when locking is acquired twice and unlocked; {Figure 8 is an explanatory diagram of the list when unlocking; Processing flow diagram; Fig. 20 is an explanatory diagram of the conventional shaIe lock acquisition state; Fig. 21 is an explanatory diagram of the conventional exclusive lock acquisition state; Fig. 22 is a delay state diagram of a process that subsequently requests lock acquisition; The figure shows a state in which a process that later requests to acquire a lock fails to acquire the lock and aborts the process; Figure 24 is an explanatory diagram of the conventional method that delays releasing the lock; Figure 25 shows the conventional method that releases the lock once. FIG. 14: Exclusive control system 16: Main memory 18: Exclusive control management information 20: Information name 22, 24, 26. , 28: Number of lock acquisition and waiting processes 30. 32: Pointer 34: Process management list 36: Process name 38: Lock acquisition waiting process management list 40: Waiting state process management list 42: ID section

Claims (3)

【特許請求の範囲】[Claims] (1)計算機上で実行される複数のプロセスによって共
有される情報を有し、該情報をアクセスする際に他のプ
ロセスからのアクセスを禁止するためにロックを獲得す
る排他制御方式に於いて、ロック獲得の要求時にロック
獲得に成功した際の情報の占有時間が長い占有時間か短
い占有時間かを指定する占有時間指定手段と; ロック獲得を要求した際に現在ロック獲得に成功してい
るプロセスの指定占有時間が短い時には待ち状態となり
、指定占有時間が長い時には待ち状態とならずロック獲
得を不成功とする手段と;を設け、情報の占有時間に応
じて排他制御することを特徴する排他制御方式。
(1) In an exclusive control method that has information shared by multiple processes executed on a computer and acquires a lock to prohibit access from other processes when accessing the information, an occupation time specifying means for specifying whether the information is occupied for a long time or a short time when the lock is successfully acquired when the lock is requested; a process that is currently successfully acquiring the lock when the lock is requested; An exclusive method is characterized in that exclusive control is performed according to the information occupancy time by providing a means for making lock acquisition unsuccessful when the specified occupancy time is short, and not entering the wait state when the specified occupancy time is long; control method.
(2)計算機上で実行される複数のプロセスによって共
有される情報を有し、該情報をアクセスする際には他の
プロセスからのアクセスを禁止するためにロックを獲得
する排他制御方式に於いて、ロック獲得を要求した際に
現在ロック獲得に成功しているプロセス名を判別するチ
ェック手段と;該チェック手段による判別プロセス名が
ロック獲得を要求したプロセス名と同一であった場合に
は、新たなロック獲得を成功させる手段と;を備え、同
一プロセスにおいて連続的にロック獲得を成功させて、
同時に複数のロック種別を保持可能とすることを特徴と
する排他制御方式。
(2) In an exclusive control method in which information is shared by multiple processes running on a computer, and when accessing the information, a lock is acquired to prohibit access from other processes. , a check means for determining the name of the process that has currently succeeded in acquiring the lock when a lock acquisition is requested; if the process name determined by the check means is the same as the process name that requested the lock acquisition, a new process name is determined; means for successfully acquiring locks in the same process;
An exclusive control method that is characterized by being able to hold multiple lock types at the same time.
(3)前記情報のアクセス時に獲得するロックの種別と
して、他のプロセスからの情報の更新を許さずに参照の
みを許す情報の参照時に獲得する第1のロックと、他の
プロセスからの情報の参照及び更新のどちらも許さない
情報の更新時に獲得する第2のロックとを備えたことを
特徴とする請求項1又は2記載の排他制御方式。
(3) The types of locks acquired when accessing the information are the first lock, which is acquired when referencing information that only allows access to the information without allowing updates from other processes, and the first lock acquired when accessing information from other processes. 3. The exclusive control method according to claim 1, further comprising a second lock acquired when updating information that does not permit either reference or update.
JP16571589A 1989-06-28 1989-06-28 Exclusive control system Pending JPH0330027A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16571589A JPH0330027A (en) 1989-06-28 1989-06-28 Exclusive control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16571589A JPH0330027A (en) 1989-06-28 1989-06-28 Exclusive control system

Publications (1)

Publication Number Publication Date
JPH0330027A true JPH0330027A (en) 1991-02-08

Family

ID=15817688

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16571589A Pending JPH0330027A (en) 1989-06-28 1989-06-28 Exclusive control system

Country Status (1)

Country Link
JP (1) JPH0330027A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010257027A (en) * 2009-04-22 2010-11-11 Nec Corp Information processing apparatus, information updating method, program, and information processing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010257027A (en) * 2009-04-22 2010-11-11 Nec Corp Information processing apparatus, information updating method, program, and information processing system

Similar Documents

Publication Publication Date Title
JP2705717B2 (en) Locking device and method, device and method for determining granularity of lock request
KR100877319B1 (en) Lock and Transaction Management Method and System
US5459862A (en) Network concurrency control for autonomous databases featuring independent lock release and lock ownership transfer
US4791554A (en) Method and apparatus for preventing deadlock in a data base management system
US5537645A (en) File lock management in a distributed data processing system
EP0972240B1 (en) An agent-implemented locking mechanism
US5987550A (en) Lock mechanism for shared resources in a data processing system
EP0917051B1 (en) State-based object transition control and attribute-based locking
US20030126187A1 (en) Apparatus and method for synchronization in a multi-thread system of JAVA virtual machine
EP0398495B1 (en) File lock management in a distributed data processing system
US6430638B1 (en) Thread synchronization via selective object locking
EP0917050B1 (en) State-based object transition control and nested locking
JPS6320634A (en) Exclusive control system for computer resource
JP2898012B2 (en) Exclusive control method for computer resources
JPH0383142A (en) Shared resource exclusive control system
JPH05120040A (en) Computer system
JPH09269912A (en) Information processing method and device
JPS592159A (en) Data controlling system
JPH0478932A (en) Shared resource exclusion control system
JPH08202567A (en) Inter-system lock processing method
JPH03116260A (en) Spin lock system for multiprocessor system
JPH0520269A (en) Exclusive control method
JPH09305471A (en) File simultaneous access control system
JPH02170259A (en) Control system for shared resources of multiprocessor system
JPS63124139A (en) Exclusive control system for shared resources