JP3603671B2 - Data sharing management device and data sharing management method - Google Patents

Data sharing management device and data sharing management method Download PDF

Info

Publication number
JP3603671B2
JP3603671B2 JP16559099A JP16559099A JP3603671B2 JP 3603671 B2 JP3603671 B2 JP 3603671B2 JP 16559099 A JP16559099 A JP 16559099A JP 16559099 A JP16559099 A JP 16559099A JP 3603671 B2 JP3603671 B2 JP 3603671B2
Authority
JP
Japan
Prior art keywords
lock
shared resource
data sharing
sharing management
shared
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP16559099A
Other languages
Japanese (ja)
Other versions
JP2000353101A (en
Inventor
武 桃井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP16559099A priority Critical patent/JP3603671B2/en
Publication of JP2000353101A publication Critical patent/JP2000353101A/en
Application granted granted Critical
Publication of JP3603671B2 publication Critical patent/JP3603671B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、データ共有管理装置およびデータ共有管理方法に関し、特に、単独のプロセスのみが共有資源を利用可能な排他ロック動作と、複数のプロセスが同時に共有資源を利用可能な共有ロック動作とを共有資源のデッドロックを検出しつつ実行するデータ共有管理装置およびデータ共有管理方法に関する。
【0002】
【従来の技術】
従来のデータ共有管理装置においては、データ共有管理装置を備えるプロセスが共有資源に対してアクセスを行なう場合、共有ロックあるいは排他ロックを掛けるに際し、ロックの失敗時に既に共有資源を共有ロックあるいは排他ロックしているプロセスの獲得している共有資源と、自プロセスが使用を待機している共有資源からデッドロックを検出していた。一方、他の従来のデータ共有管理装置は、事前に利用する共有資源のすべてに対して予約ロックをかけていた。
また、同様なデータ共有管理装置として、特開平1−120636号公報に開示されているものが知られている。
【0003】
【発明が解決しようとする課題】
上述した従来のデータ共有管理装置においては、次のような課題があった。
前者の方式における問題点は、ロックした共有資源の突き合わせを評価する場合に、共有しあうプロセスの数の増加に伴い処理時間が増加するという課題があった。後者のデータ共有管理装置は、利用者が事前に利用する共有資源のすべてに対して予約する必要があり処理構成を煩雑にしてしまうという課題があった。
【0004】
また、特開平1−120636号公報に開示されているものについては、デッドロックの検出,デッドロック事前検出およびデッドロック解除制御にプロセスグループ管理およびプロセス待ち管理を行なわないため、プロセスの待機処理を実施することができなかった。
【0005】
本発明は、上記課題にかんがみてなされたもので、排他ロックあるいは共有ロックの動作に失敗した場合であっても、ロックしている共有資源を走査することなくデッドロックの発生を検出することが可能なデータ共有管理装置およびデータ共有管理方法の提供を目的とする。
【0006】
【課題を解決するための手段】
上記目的を達成するため、請求項1にかかる発明は、複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスするデータ共有管理装置であって、各プロセスは、アクセスした共有資源に対する任意のプロセスによるロックを検知するロック検知手段と、同一共有資源をロックする各プロセスをプロセスグループとして管理するとともに、共有資源がロックされ、ロックしているプロセスが自己の所属するプロセスグループの場合、デッドロックを検出する共有資源状態検出手段とを具備する構成としてある。
【0007】
上記のように構成した請求項1にかかる発明において、データ共有管理装置は複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスするものであって、アクセスするにあたり、共有資源に対してロックをする。このように複数のプロセスが同時に動作する環境で、共有資源を利用する場合、デッドロックが発生することがある。
【0008】
そこで、各プロセスは、ロック検知手段でアクセスした共有資源に対する任意のプロセスによるロックを検知する。
ここで、共有資源がロックされ、ロックしているプロセスが自己の所属するプロセスグループの場合、共有資源状態検出手段ではデッドロックを検出する。
【0009】
すなわち、共有資源状態検出手段でプロセスグループを管理し、共有資源をロックしているプロセスがプロセスグループに所属するか否かによりデッドロックを検出する。
【0010】
デッドロックの状態ではない場合で、他のプロセスにて共有資源に対してロックが掛けられているときの好適な処理手法として、請求項2にかかる発明は、請求項1に記載のデータ共有管理装置において、上記共有資源状態検出手段は、共有資源をロックしているプロセスが自己の所属するプロセスグループでない場合、自プロセスを、共有資源をロックしているプロセスが所属するプロセスグループに追加する構成としてある。
さらに、請求項3にかかる発明は、請求項1または請求項2に記載のデータ共有管理装置において、上記ロックが、排他ロック又は共有ロックであり、上記データ共有管理装置が、検知されたロックの種類が排他ロックか共有ロックかを識別するロック種別識別手段を有する構成としてある。
排他ロックとは共有資源にデータを書き込む場合などであって、各プロセス間にてデータの整合性をとる必要がある場合に利用される。例えば、各プロセスが共有資源に対してデータを書き込む場合、まず、共有資源に排他ロックを掛けて、他のプロセスからの共有資源に対するアクセスを禁止し、データを書き込むと排他ロックを解除し、他のプロセスが共有資源にアクセス可能にする。
一方、共有ロックとは、各プロセスから同時に共有資源に対してアクセス可能な状態を示し、特にデータの整合性に問題の生じない読み出し処理において使用される。
【0011】
デッドロックの状態ではない場合で、他のプロセスにて共有資源に対して排他ロックが掛けられているときの好適な処理手法として、請求項にかかる発明は、請求項に記載のデータ共有管理装置において、上記共有資源状態検出手段は、共有資源を排他ロックしているプロセスが自己の所属するプロセスグループのプロセスでない場合、プロセスの共有資源に対するアクセスを待機状態にする構成としてある。
【0012】
上記のように構成した請求項にかかる発明において、共有資源状態検出手段は、共有資源を排他ロックしているプロセスが自己の所属するプロセスグループのプロセスでない場合、自プロセスの当該共有資源に対するアクセスを待機状態にする。待機状態にすることにより、排他ロック中のプロセスによって排他ロックが解除されると、すぐに自プロセスにより共有資源を排他ロックすることが可能になる。
【0013】
さらに、請求項にかかる発明は、請求項または請求項のいずれかに記載のデータ共有管理装置において、上記ロック種別識別手段は、検知されたロックが自プロセス以外の共有資源に対する共有ロックであると識別すると、上記共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスとして自プロセス以外のプロセスが指定されている場合、デッドロックを検出する構成としてある。
【0014】
上記のように構成した請求項にかかる発明においては、ロック検知手段が共有資源に対するロックを検知した場合であって、ロック種別識別手段が検知されたロックが自プロセス以外の共有資源に対する共有ロックであると識別すると、共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスとして自プロセス以外のプロセスが指定されている場合、デッドロックを検出する。
【0015】
さらに、請求項にかかる発明は、請求項に記載のデータ共有管理装置において、上記共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスに指定がない場合、自プロセスをモード変更許可プロセスに設定し待機状態にする構成としてある。
【0016】
上記のように構成した請求項にかかる発明において、共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスに指定がない場合、自プロセスをモード変更許可プロセスに設定する。これにより、自プロセスは共有資源に対して待機状態になる。
【0017】
さらに、請求項にかかる発明は、請求項〜請求項のいずれかに記載のデータ共有管理装置において、上記共有資源状態検出手段は、自プロセスがロックしている共有資源を取得し、全ての共有資源に対して共有ロック中であるとともに、自プロセスのみによる共有ロックであると検出した場合、排他ロックのプロセスの待機状態を解除する構成としてある。
【0018】
上記のように構成した請求項にかかる発明において、共有資源状態検出手段は、自プロセスのロックしている共有資源を取得し、全ての共有資源に対して、共有ロック中である場合であって、自プロセスのみによるロックであると検出すると、排他ロックのプロセスの待機状態を解除する。
【0019】
このように、複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスする手法は必ずしも実体のある装置に限られる必要はなく、その方法としても機能することは容易に理解できる。このため、請求項にかかる発明は、複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスするデータ共有管理方法であって、各プロセスは、アクセスした共有資源に対する任意のプロセスによるロックを検知するロック検知工程と、同一共有資源をロックする各プロセスをプロセスグループとして管理するとともに、共有資源がロックされ、ロックしているプロセスが自己の所属するプロセスグループの場合、デッドロックを検出する共有資源状態検出工程とを具備する構成としてある。
すなわち、必ずしも実体のある装置に限らず、その方法としても有効であることに相違はない。
【0020】
【発明の実施の形態】
以下、図面にもとづいて本発明の実施形態を説明する。
図1は、本発明の一実施形態にかかるデータ共有管理プログラムの構成をブロック図により示している。
同図において、データ共有管理プログラムAは、コンピュータ上で動作する各プロセスがそれぞれ有するものであり、ページ状態管理モジュール100と、ロックプロセス管理モジュール110と、プロセスグループ管理モジュール120と、プロセス間状態管理モジュール130とから構成されている。
【0021】
そして、各プロセスは、コンピュータにて動作する基本プログラム上にて動作するものであり、コンピュータ上の共有資源である、メモリ上に展開された所定の分割領域である共有メモリや、ハードディスクに格納されるファイル等の共有資源に対して、相互にアクセス可能になっている。
【0022】
本実施形態においては、上述した共有メモリ,ファイル等の共有資源として「ページ」という概念を使用し、各プロセスPが「ページ」に対して排他ロックや共有ロックを掛けて、所定のデータ処理を実行する場合について観念する。
【0023】
ここで、排他ロックは「ページ」にデータを書き込む場合などであって、各プロセス間にてデータの整合性をとる必要がある場合に利用される。例えば、各プロセスはページPに対して「A」というデータを書き込む場合、まず、ページPに排他ロックを掛けて、他のプロセスからのページPに対するアクセスを禁止し、データ「A」を書き込み、書き込みが完了すると、排他ロックを解除し、他のプロセスがページPにアクセス可能にする。
一方、共有ロックとは、各プロセスから同時にページPに対してアクセス可能な状態を示し、特に、データの整合性に問題の生じない読み出し処理において使用される。
【0024】
ここで、図2に示すようにページ状態管理モジュール100は、ロック判定モジュール101と、ロック種別判定モジュール102とを有する。ロック判定モジュール101は、アクセスの対象となる共有資源のページがロックされていないか検出する。そして、ロック種別判定モジュール102は、ロック判定モジュールがページに対するロックを検出すると、このロックの種類を識別する。すなわち、ロックが排他ロックであるか共有ロックであるかを識別する。
【0025】
ロックプロセス管理モジュール110は図3に示すように、ロックプロセス判定モジュール111と、待機プロセス判定モジュール112とを備える。
ロックプロセス判定モジュール111は、ページをロックしているプロセスおよびその数を記憶する処理を実行する。また、待機プロセス判定モジュール112は、ページに対するロックに失敗して待機状態にあるプロセスを記憶する処理を実行する。
【0026】
プロセスグループ管理モジュール120は、共有資源のページをロックしているプロセスグループに所属するプロセスを記憶する処理を実行する。そして、プロセス間待機管理モジュール130は、待機プロセスリストを参照し、共有資源の使用を待機させているプロセスを記憶する処理を実行する。
【0027】
次に、図4、図5、図6および図7のフローチャートを参照して各モジュール100〜130の動作について詳細に説明する。
まず、図4を参照して本実施例の第一の動作である共有ロック実行時の動作について説明する。
同図において、プロセスのページ状態管理モジュール100は、ロック判定モジュール101によりアクセス対象となる共有資源のページPに対する排他ロックあるいは共有ロックのいずれかのロックを検出すると、ロック種別判定モジュール102により、このページPに対するロックが排他ロックであるか共有ロックであるかを識別する。ここで、ページPに対して排他ロックが掛けられていると識別した場合(ステップA1)、プロセスのロックプロセス管理モジュール110は、ロックプロセス判定モジュール111により、この排他ロックを掛けているプロセスグループを取得する。
【0028】
ロックプロセス管理モジュール110は、取得したプロセスグループと、自プロセスのプロセス番号とが同一であるかを判定する。そして、同一である場合であって(ステップA2)、ページPを排他ロックしているプロセスグループが自己の待機プロセスリストに入っている場合(ステップA3)には、デッドロックと判定する(ステップA4)。
【0029】
一方、自己の待機プロセスリストに入っていない場合には、自プロセスをページPを排他ロックしている自己の待機プロセスリストに加える(ステップA7)。また、プロセスグループとプロセス番号が異なる場合には、自プロセスをプロセスのプロセスグループに加えるとともに(ステップA6)、更に、自プロセスをページPを排他ロックしているプロセスの待機プロセスリストに加える。
【0030】
ページPに対して、既に、共有ロックが掛けられている場合(ステップA8)、待機プロセス判定モジュール112により、ページPを待機しているプロセスを取得する。ここで、待機しているプロセスのプロセスグループと、自プロセスのプロセス番号が同じ場合であって(ステップA9)、ページPを待機しているプロセスの待機プロセスリストに自プロセス番号が入っている場合(ステップA10)には、デッドロックと判定する(ステップA11)。
【0031】
一方、ページPを待機しているプロセスの待機プロセスリストに自プロセス番号が入っていない場合には、ページPを待機しているプロセスを自プロセスの待機プロセスリストに加える(ステップA12)。
また、待機しているプロセスのプロセスグループと、自プロセスのプロセス番号と異なる場合には、自プロセスをプロセスのプロセスグループに加え(ステップA13)、更に、ページPを待機しているプロセスを自プロセスの待機プロセスリストに加える(ステップA12)。
【0032】
次に、図5を参照して本実施例の第二の動作である排他ロック実行時の動作について説明する。
同図において、ロック判定モジュール101によりページPのロックを検出すると、(ステップA1)、ロックプロセス判定モジュール111により、既にページPに対してロックを掛けているプロセスを取得する。そして、取得したプロセスのプロセスグループと、自プロセスのプロセス番号とを比較し、同じである場合であって(ステップA2)、ページPをロックしているプロセスが自プロセスの待機プロセスリストに入っている場合(ステップA3)には、デッドロックと判定する(ステップA4)。
【0033】
待機プロセスリストに入っていない場合には、自プロセスをページPをロックしているプロセスの待機プロセスリストに加える(ステップA5)。
さらに、プロセスグループと、プロセス番号が異なる場合には、自プロセスを該当プロセスのプロセスグループに加えるとともに(ステップA6)、更に、自プロセスをページPをロックしているプロセスの待機プロセスリストに加える。
【0034】
次に、図6を参照して本実施例の第三の動作である共有ロックから排他ロックへのロック状態切り替え実行時の動作について説明する。
同図において、ロックプロセス判定モジュール111により自プロセス以外による共有ロックを検出すると(ステップA1)、自プロセスの属するプロセスグループにモード変更許可プロセスとして自プロセス以外のプロセスが指定されている場合(ステップA2)、デッドロックと判定する(ステップA3)。
一方、何も指定されていなければ、自プロセスをモード変更許可プロセスに設定して待機状態にする(ステップA4)。また、他にロックしているプロセスが存在しなければ排他ロックとロック状態を切り替える(ステップA5)。
【0035】
図7を参照して本実施例の第四の動作であるロック解除実行時の動作について説明する。
同図において、ロックプロセス判定モジュール111により自プロセスがロックしているページPを取得する(ステップA1)。ここで、全てのページPにおいて共有ロック中である場合(ステップA2)、ロックプロセス判定モジュール111は、ページPに対するロックが自プロセスのみによるロックであると検出すると(ステップA3)、ページPに対して排他ロックを待機しているプロセスの待機を解除する(ステップA4)。
【0036】
他にロックしているプロセスが一つであるとともに、そのプロセスがモード変更許可プロセスである場合(ステップA5)、そのプロセスを排他ロックに切り替える(ステップA6)。一方、ページPが排他ロック中である場合、ロック待機状態にあるプロセスの待機状態を解除する(ステップA7)。ここで、解除したプロセスが共有ロックでの待機状態であるならば(ステップA8)、他のプロセスであって、共有ロックの待機状態であるプロセス全ての待機状態を解除する(ステップA9)。その後、自プロセスの待機プロセスリストをクリアしてプロセスグループを採番し直す(ステップA10)。
【0037】
このように、プロセス管理モジュール120においてアクセス対象の共有資源であるページPをロックする各プロセスをプロセスグループとして管理するとともに、各プロセスの共有資源における待機状態を管理することにより、アクセスする事前にデッドロックを検出するための情報を収集することができるとともに、排他ロックあるいは共有ロックに失敗したときに排他ロックしているページを走査することなくデッドロックの発生を検出することが可能になる。
【0038】
【発明の効果】
以上説明したように本発明は、プロセス管理装置において共有資源をロックする各プロセスをプロセスグループとして管理するとともに、各プロセスの共有資源における待機状態を管理することにより、アクセスする事前にデッドロックを検出するための情報を収集する。そして、排他ロックあるいは共有ロックに失敗したときに排他ロックされている共有資源を走査することなくデッドロックの発生を検出することが可能なデータ共有管理装置を提供することができる。
また、請求項2にかかる発明によれば、アクセスした共有資源がデッドロックではない場合、待機状態にすることにより、他のプロセスによる排他ロックが解除されると、すぐに排他ロックを掛けることが可能になる。
さらに、請求項3にかかる発明によれば、モード変更許可プロセスの指定の態様によりデッドロックを検出することが可能になる。
【0039】
さらに、請求項4にかかる発明によれば、モード変更許可プロセスの指定の態様により待機状態にすることが可能になる。
さらに、請求項5にかかる発明によれば、排他ロックを待機しているプロセスの待機状態を解除することが可能になる。
さらに、請求項6にかかる発明によれば、プロセス管理装置において共有資源をロックする各プロセスをプロセスグループとして管理するとともに、各プロセスの共有資源における待機状態を管理することにより、アクセスする事前にデッドロックを検出するための情報を収集する。そして、排他ロックあるいは共有ロックに失敗したときに排他ロックされている共有資源を走査することなくデッドロックの発生を検出することが可能なデータ共有管理方法を提供することができる。
【図面の簡単な説明】
【図1】本発明の一実施形態にかかる各プロセスが備えるデータ共有管理モジュールのブロック図である。
【図2】ページ状態管理モジュールの構成を示したブロック図である。
【図3】ロックプロセス管理モジュールの構成を示したブロック図である。
【図4】本実施例の第一の動作である共有ロック実行時の動作を示したフローチャートである。
【図5】本実施例の第二の動作である排他ロック実行時の動作を示したフローチャートである。
【図6】本実施例の第三の動作である共有ロックから排他ロックへのロック状態切り替え実行時の動作を示したフローチャートである。
【図7】本実施例の第四の動作であるロック解除実行時の動作を示したフローチャートである。
【符号の説明】
100 ロック状態管理モジュール
110 ロックプロセス管理モジュール
120 プロセスグループ管理モジュール
130 プロセス間管理モジュール
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a data sharing management device and a data sharing management method, in particular, an exclusive lock operation in which only a single process can use a shared resource, and a shared lock operation in which a plurality of processes can simultaneously use a shared resource. The present invention relates to a data sharing management device and a data sharing management method that execute while detecting a resource deadlock.
[0002]
[Prior art]
In a conventional data sharing management device, when a process having a data sharing management device accesses a shared resource, when a shared lock or an exclusive lock is applied, the shared resource or the exclusive lock is already locked when the lock fails. A deadlock was detected from the shared resources acquired by the process and the shared resources that the process is waiting to use. On the other hand, other conventional data sharing management devices lock reservations in advance on all shared resources to be used.
As a similar data sharing management device, there is known a device disclosed in Japanese Patent Application Laid-Open No. 1-120636.
[0003]
[Problems to be solved by the invention]
The conventional data sharing management device described above has the following problems.
The problem with the former method is that when evaluating the matching of locked shared resources, there is a problem that the processing time increases as the number of shared processes increases. The latter data sharing management device has a problem in that it is necessary to reserve all of the shared resources used by the user in advance, which complicates the processing configuration.
[0004]
Further, in the system disclosed in Japanese Patent Application Laid-Open No. 1-120636, process wait management is not performed because process group management and process wait management are not performed for deadlock detection, deadlock advance detection, and deadlock release control. Could not be implemented.
[0005]
The present invention has been made in view of the above problems, and can detect the occurrence of a deadlock without scanning a locked shared resource even when the operation of an exclusive lock or a shared lock fails. It is an object of the present invention to provide a possible data sharing management device and a data sharing management method.
[0006]
[Means for Solving the Problems]
In order to achieve the above object, an invention according to claim 1 is a data sharing management device that accesses a shared resource when a plurality of processes operate and each process uses a page of the shared resource. process, a lock detecting means for detecting a lock by any process for the shared resources accessed manages the respective process of locking the same shared resource as a process group, locked shared resources, lock and process self In the case of a process group to which the group belongs, a shared resource state detecting means for detecting a deadlock is provided.
[0007]
In the invention according to claim 1 configured as described above, the data sharing management device accesses a shared resource when a plurality of processes operate and each process uses a page of the shared resource. When accessing, lock on shared resources. As described above, when using a shared resource in an environment where a plurality of processes operate at the same time, a deadlock may occur.
[0008]
Therefore, each process detects a lock by an arbitrary process on the shared resource accessed by the lock detection unit.
Here, if the shared resource is locked and the locked process is the process group to which it belongs, the shared resource state detecting means detects deadlock.
[0009]
That is, the process group is managed by the shared resource state detecting means, and a deadlock is detected based on whether or not the process which has locked the shared resource belongs to the process group.
[0010]
As a preferred processing method when a shared resource is locked by another process in a state of no deadlock, the invention according to claim 2 is the data sharing management according to claim 1. In the apparatus, the shared resource status detecting means may add the own process to a process group to which the process locking the shared resource belongs, if the process locking the shared resource is not the process group to which the process belongs. There is.
Further, according to a third aspect of the present invention, in the data sharing management device according to the first or second aspect, the lock is an exclusive lock or a shared lock, and the data sharing management device The configuration includes a lock type identification unit that identifies whether the type is an exclusive lock or a shared lock.
An exclusive lock is used when data is to be written to a shared resource and when it is necessary to ensure data consistency between processes. For example, when each process writes data to a shared resource, an exclusive lock is first placed on the shared resource, access to the shared resource from other processes is prohibited, and when the data is written, the exclusive lock is released. Make the shared resources accessible.
On the other hand, the shared lock indicates a state in which each process can simultaneously access a shared resource, and is used particularly in a read process in which there is no problem in data consistency.
[0011]
According to a fourth aspect of the present invention, as a preferred processing method when an exclusive lock is held on a shared resource by another process in a state where the state is not a deadlock state, the data sharing according to the third aspect is described. in the management apparatus, the shared resource state detecting means, if the process that is exclusive lock the shared resource is not a process of the process group of its own belongs, is configured so as to access to shared resources of its own process in a standby state.
[0012]
In the invention according to Claim 4 as constructed above, the shared resource state detection means, if the process that is exclusive lock the shared resource is not a process of the process group of its own belonging, access to the shared resources of its own process To the standby state. By setting the standby state, when the exclusive lock is released by the process that is in the exclusive lock state, the shared resource can be exclusively locked by the own process immediately.
[0013]
According to a fifth aspect of the present invention, in the data sharing management device according to any one of the third and fourth aspects, the lock type identification unit determines that the detected lock is a shared lock for a shared resource other than the own process. When the shared resource status detection means identifies that a process other than the own process is designated as the mode change permitted process of the process group to which the own process belongs, the shared resource state detecting means is configured to detect a deadlock.
[0014]
In the invention according to claim 5 , the lock detecting means detects a lock on the shared resource, and the lock type identifying means detects the lock on the shared resource other than the own process. If the process other than the own process is designated as the mode change permission process of the process group to which the own process belongs, the shared resource state detecting means detects the deadlock.
[0015]
Further, according to a sixth aspect of the present invention, in the data sharing management device according to the fifth aspect , the shared resource state detecting means determines whether the mode change permission process of the process group to which the own process belongs is not specified. Is set as a mode change permission process, and a standby state is set.
[0016]
In the invention according to claim 6 configured as described above, the shared resource status detecting means sets the own process as the mode change permission process when the process change permission process of the process group to which the own process belongs is not specified. As a result, the own process enters a standby state for the shared resource.
[0017]
Further, according to a seventh aspect of the present invention, in the data sharing management device according to any one of the third to sixth aspects, the shared resource state detecting means acquires a shared resource locked by the own process, When the shared lock is being applied to all the shared resources and the shared lock is detected by only the own process, the exclusive lock process is released from the standby state.
[0018]
In the invention according to claim 7 configured as described above, the shared resource state detecting means acquires the locked shared resource of the own process, and performs the shared lock on all the shared resources. When the lock is detected by the own process only, the waiting state of the exclusive lock process is released.
[0019]
As described above, when a plurality of processes operate and each process uses the page of the shared resource, the method of accessing the shared resource does not necessarily need to be limited to a substantial device, and also functions as the method. That is easy to understand. For this reason, the invention according to claim 8 is a data sharing management method for accessing a shared resource when a plurality of processes operate and each process uses a page of the shared resource. A lock detection step for detecting the lock of an arbitrary shared resource by a given process, and managing each process that locks the same shared resource as a process group, while the shared resource is locked and the process to which the locking process belongs belongs. In the case of a group, a shared resource state detecting step of detecting a deadlock is provided.
In other words, there is no difference that the present invention is not necessarily limited to a substantial device and is effective as a method.
[0020]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing a configuration of a data sharing management program according to an embodiment of the present invention.
In the figure, a data sharing management program A is included in each process operating on a computer, and includes a page state management module 100, a lock process management module 110, a process group management module 120, an inter-process state management And a module 130.
[0021]
Each process runs on a basic program that runs on a computer, and is stored on a hard disk or a shared memory that is a predetermined divided area developed on a memory, which is a shared resource on the computer. Files and other shared resources are mutually accessible.
[0022]
In the present embodiment, the concept of “page” is used as a shared resource such as the above-described shared memory and file, and each process P applies an exclusive lock or a shared lock to the “page” to perform predetermined data processing. Think about when to do it.
[0023]
Here, the exclusive lock is used when writing data to a “page” or the like and when it is necessary to ensure data consistency between processes. For example, when each process writes data “A” to page P, first, it locks page P exclusively, prohibits other processes from accessing page P, and writes data “A”. When the writing is completed, the exclusive lock is released, and another process can access the page P.
On the other hand, the shared lock indicates a state in which each process can simultaneously access the page P, and is used particularly in a read process in which there is no problem in data consistency.
[0024]
Here, as shown in FIG. 2, the page state management module 100 includes a lock determination module 101 and a lock type determination module 102. The lock determination module 101 detects whether a page of a shared resource to be accessed is locked. When the lock determination module 102 detects a lock on the page, the lock type determination module 102 identifies the type of the lock. That is, it is determined whether the lock is an exclusive lock or a shared lock.
[0025]
As shown in FIG. 3, the lock process management module 110 includes a lock process determination module 111 and a standby process determination module 112.
The lock process determination module 111 executes a process of storing a process that has locked a page and the number thereof. Further, the standby process determination module 112 executes a process of storing a process that has failed in locking a page and is in a standby state.
[0026]
The process group management module 120 executes a process of storing the processes belonging to the process group that locks the page of the shared resource. Then, the inter-process standby management module 130 executes a process of referring to the standby process list and storing the process that is waiting to use the shared resource.
[0027]
Next, the operation of each of the modules 100 to 130 will be described in detail with reference to the flowcharts of FIGS. 4, 5, 6, and 7.
First, the operation at the time of executing the shared lock, which is the first operation of the present embodiment, will be described with reference to FIG.
In the figure, when the page state management module 100 of the process detects either an exclusive lock or a shared lock on the page P of the shared resource to be accessed by the lock determination module 101, the lock type determination module 102 It identifies whether the lock on page P is an exclusive lock or a shared lock. Here, when it is identified that the page P is exclusively locked (step A1), the lock process management module 110 of the process uses the lock process determination module 111 to identify the process group that holds the exclusive lock. get.
[0028]
The lock process management module 110 determines whether the acquired process group is the same as the process number of its own process. If they are the same (step A2) and the process group that has exclusively locked page P is in its own standby process list (step A3), it is determined to be deadlocked (step A4). ).
[0029]
On the other hand, if it is not in its own standby process list, its own process is added to its own standby process list that exclusively locks page P (step A7). If the process group is different from the process number, the own process is added to the process group of the process (step A6), and further, the own process is added to the waiting process list of the process that exclusively locks the page P.
[0030]
If the page P is already locked (step A8), the standby process determination module 112 acquires a process waiting for the page P. Here, when the process group of the waiting process is the same as the process number of the own process (step A9), and the own process number is included in the waiting process list of the process waiting for page P. In (Step A10), a deadlock is determined (Step A11).
[0031]
On the other hand, if the own process number is not included in the waiting process list of the process waiting for page P, the process waiting for page P is added to the waiting process list of the own process (step A12).
If the process group of the waiting process is different from the process number of the own process, the own process is added to the process group of the process (step A13). (Step A12 ).
[0032]
Next, the operation at the time of executing the exclusive lock, which is the second operation of the present embodiment, will be described with reference to FIG.
In the figure, when the lock of the page P is detected by the lock determination module 101 (step A1), a process that has already locked the page P is acquired by the lock process determination module 111. The process group of the acquired process is compared with the process number of the own process. If the process numbers are the same (step A2), the process locking the page P enters the standby process list of the own process. If there is (Step A3), a deadlock is determined (Step A4).
[0033]
If the process is not included in the standby process list, the own process is added to the standby process list of the process locking the page P (step A5).
Further, when the process number is different from the process number, the own process is added to the process group of the corresponding process (step A6), and further, the own process is added to the standby process list of the process that locks the page P.
[0034]
Next, with reference to FIG. 6, a description will be given of an operation at the time of executing the lock state switching from the shared lock to the exclusive lock, which is the third operation of the present embodiment.
In the figure, when the lock process determination module 111 detects a shared lock by a process other than the subject process (step A1), a process other than the subject process is designated as the mode change permission process in the process group to which the subject process belongs (step A2). ), A deadlock is determined (step A3).
On the other hand, if nothing is specified, the process is set to the mode change permission process and put into a standby state (step A4). If there is no other locked process, the process switches between the exclusive lock and the locked state (step A5).
[0035]
The operation at the time of executing the lock release, which is the fourth operation of the present embodiment, will be described with reference to FIG.
In the figure, the page P locked by the own process is acquired by the lock process determination module 111 (step A1). Here, if the shared lock is being performed on all the pages P (step A2), the lock process determination module 111 detects that the lock on the page P is a lock by only the own process (step A3), and To release the wait of the process waiting for the exclusive lock (step A4).
[0036]
If there is another locked process and the process is a mode change permission process (step A5), the process is switched to an exclusive lock (step A6). On the other hand, when the page P is exclusively locked, the standby state of the process in the lock standby state is released (step A7). Here, if the released process is in the standby state with the shared lock (step A8), the standby state of all other processes that are in the standby state with the shared lock is released (step A9). After that, the process list of the own process is cleared and the process group is renumbered (step A10).
[0037]
In this way, the process management module 120 manages each process that locks the page P, which is the shared resource to be accessed, as a process group, and manages the standby state of each process in the shared resource, so that the deadline before access is obtained. In addition to collecting information for detecting a lock, it is possible to detect the occurrence of a deadlock without scanning a page that is exclusively locked when an exclusive lock or a shared lock fails.
[0038]
【The invention's effect】
As described above, the present invention manages each process that locks a shared resource in a process management device as a process group, and manages the standby state of each process in a shared resource to detect a deadlock before accessing. Gather information to do. Further, it is possible to provide a data sharing management device capable of detecting occurrence of a deadlock without scanning a shared resource locked exclusively when an exclusive lock or a shared lock fails.
According to the second aspect of the present invention, when the accessed shared resource is not a deadlock, by setting the standby state, the exclusive lock can be immediately acquired when the exclusive lock by another process is released. Will be possible.
Further, according to the third aspect of the present invention, it is possible to detect a deadlock by specifying a mode change permission process.
[0039]
Furthermore, according to the invention of claim 4, it is possible to set the mode change permission process in the standby state according to the specified mode.
Further, according to the invention according to claim 5, it is possible to release the waiting state of the process waiting for the exclusive lock.
Further, according to the invention of claim 6, each process that locks the shared resource in the process management device is managed as a process group, and the standby state of each process in the shared resource is managed, so that the deadline before access is obtained. Gather information to detect locks. Further, it is possible to provide a data sharing management method capable of detecting occurrence of a deadlock without scanning a shared resource locked exclusively when an exclusive lock or a shared lock fails.
[Brief description of the drawings]
FIG. 1 is a block diagram of a data sharing management module included in each process according to an embodiment of the present invention.
FIG. 2 is a block diagram illustrating a configuration of a page state management module.
FIG. 3 is a block diagram showing a configuration of a lock process management module.
FIG. 4 is a flowchart showing an operation at the time of executing a shared lock, which is a first operation of the embodiment.
FIG. 5 is a flowchart showing an operation at the time of executing an exclusive lock, which is a second operation of the embodiment.
FIG. 6 is a flowchart illustrating an operation at the time of executing a lock state switch from a shared lock to an exclusive lock, which is a third operation according to the embodiment.
FIG. 7 is a flowchart showing an operation at the time of executing lock release, which is a fourth operation of the embodiment.
[Explanation of symbols]
100 lock state management module 110 lock process management module 120 process group management module 130 inter-process management module

Claims (8)

複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスするデータ共有管理装置であって、
各プロセスは、アクセスした共有資源に対する任意のプロセスによるロックを検知するロック検知手段と、
同一共有資源をロックする各プロセスをプロセスグループとして管理するとともに、共有資源がロックされ、ロックしているプロセスが自己の所属するプロセスグループの場合、デッドロックを検出する共有資源状態検出手段とを具備することを特徴とするデータ共有管理装置。
A data sharing management device that accesses a shared resource when a plurality of processes operate and each process uses a page of the shared resource,
Each process includes: a lock detecting unit that detects a lock on an accessed shared resource by an arbitrary process;
A process for managing each process that locks the same shared resource as a process group, and a shared resource state detecting means for detecting a deadlock when the shared resource is locked and the locking process is a process group to which the process belongs. A data sharing management device.
上記請求項1に記載のデータ共有管理装置において、The data sharing management device according to claim 1,
上記共有資源状態検出手段は、共有資源をロックしているプロセスが自己の所属するプロセスグループでない場合、自プロセスを、共有資源をロックしているプロセスが所属するプロセスグループに追加することを特徴とするデータ共有管理装置。The shared resource state detecting means adds the own process to the process group to which the process locking the shared resource belongs, when the process locking the shared resource is not the process group to which the process belongs. Data sharing management device.
上記請求項1または請求項2に記載のデータ共有管理装置において、In the data sharing management device according to claim 1 or 2,
上記ロックが、排他ロック又は共有ロックであり、The lock is an exclusive lock or a shared lock,
上記データ共有管理装置が、検知されたロックの種類が排他ロックか共有ロックかを識別するロック種別識別手段を有することを特徴とするデータ共有管理装置。The data sharing management device, wherein the data sharing management device includes a lock type identification unit that identifies whether the detected lock type is an exclusive lock or a shared lock.
上記請求項に記載のデータ共有管理装置において、
上記共有資源状態検出手段は、共有資源を排他ロックしているプロセスが自己の所属するプロセスグループでない場合、プロセスの共有資源に対するアクセスを待機状態にすることを特徴とするデータ共有管理装置。
The data sharing management device according to claim 3 ,
The shared resource state detecting means, if the process that is exclusive lock the shared resource is not a process group of its own belonging, data sharing management apparatus characterized by access to shared resources of its own process in a standby state.
上記請求項または請求項に記載のデータ共有管理装置において、
上記ロック種別識別手段は、検知されたロックが自プロセス以外の共有資源に対する共有ロックであると識別すると、上記共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスとして自プロセス以外のプロセスが指定されている場合、デッドロックを検出することを特徴とするデータ共有管理装置。
In the data sharing management device according to claim 3 or 4 ,
When the lock type identifying means identifies that the detected lock is a shared lock for a shared resource other than the own process, the shared resource state detecting means sets the own process as a mode change permission process of the process group to which the own process belongs. A data sharing management device, wherein a deadlock is detected when a process other than is specified.
上記請求項に記載のデータ共有管理装置において、
上記共有資源状態検出手段は、自プロセスの所属するプロセスグループのモード変更許可プロセスに指定がない場合、自プロセスをモード変更許可プロセスに設定し待機状態にすることを特徴とするデータ共有管理装置。
The data sharing management device according to claim 5 ,
The data sharing management device, wherein the shared resource state detection means sets the own process as a mode change permission process and sets a standby state when there is no designation as a mode change permission process of a process group to which the own process belongs.
上記請求項〜請求項のいずれかに記載のデータ共有管理装置において、
上記共有資源状態検出手段は、自プロセスがロックしている共有資源を取得し、全ての共有資源に対して共有ロック中であるとともに、自プロセスのみによる共有ロックであると検出した場合、排他ロックのプロセスの待機状態を解除することを特徴とするデータ共有管理装置。
In the data sharing management device according to any one of claims 3 to 6 ,
The shared resource state detecting means acquires a shared resource locked by the own process, and detects that the shared lock is being applied to all the shared resources and that the shared lock is exclusively performed by the own process. A data sharing management device, which releases the standby state of the process.
複数のプロセスが動作するとともに、各プロセスが共有資源のページを利用するに際して、この共有資源にアクセスするデータ共有管理方法であって、
各プロセスは、アクセスした共有資源に対する任意のプロセスによるロックを検知するロック検知工程と、
同一共有資源をロックする各プロセスをプロセスグループとして管理するとともに、共有資源がロックされ、ロックしているプロセスが自己の所属するプロセスグループの場合、デッドロックを検出する共有資源状態検出工程とを具備することを特徴とするデータ共有管理方法。
A data sharing management method for accessing a shared resource when a plurality of processes operate and each process uses a page of the shared resource,
Each process includes a lock detection step of detecting a lock on the accessed shared resource by an arbitrary process;
A process for managing each process that locks the same shared resource as a process group, and a shared resource state detecting step for detecting a deadlock when the shared resource is locked and the locked process is a process group to which the process belongs. A data sharing management method.
JP16559099A 1999-06-11 1999-06-11 Data sharing management device and data sharing management method Expired - Fee Related JP3603671B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16559099A JP3603671B2 (en) 1999-06-11 1999-06-11 Data sharing management device and data sharing management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16559099A JP3603671B2 (en) 1999-06-11 1999-06-11 Data sharing management device and data sharing management method

Publications (2)

Publication Number Publication Date
JP2000353101A JP2000353101A (en) 2000-12-19
JP3603671B2 true JP3603671B2 (en) 2004-12-22

Family

ID=15815255

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16559099A Expired - Fee Related JP3603671B2 (en) 1999-06-11 1999-06-11 Data sharing management device and data sharing management method

Country Status (1)

Country Link
JP (1) JP3603671B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5055059B2 (en) * 2007-08-03 2012-10-24 株式会社日立製作所 Database processing method, implementation system and program
CN110442467B (en) * 2019-06-20 2023-02-03 Oppo广东移动通信有限公司 Data sharing method, terminal and computer readable storage medium

Also Published As

Publication number Publication date
JP2000353101A (en) 2000-12-19

Similar Documents

Publication Publication Date Title
US8209692B2 (en) Deallocation of computer data in a multithreaded computer
US6463532B1 (en) System and method for effectuating distributed consensus among members of a processor set in a multiprocessor computing system through the use of shared storage resources
US5579505A (en) Memory access system and method for granting or preventing atomic or nonatomic memory access requests to shared memory regions
PL183365B1 (en) Computer system for archiving open files
US20090254724A1 (en) Method and system to manage memory accesses from multithread programs on multiprocessor systems
EP1936498A1 (en) A method and system to manage memory accesses from multithread programs on multiprocessor systems
KR20070049155A (en) Apparatus, system, and method for file system serialization reinitialization
JP3611295B2 (en) Computer system, memory management method, and storage medium
JP5131563B2 (en) Computer, operation rule application method, operating system
JPH03212755A (en) Inter-processor interrupt system
US6721775B1 (en) Resource contention analysis employing time-ordered entries in a blocking queue and waiting queue
JPH0383154A (en) Multiple processing computer system and method
US10372682B2 (en) Maintaining data integrity
JP5392263B2 (en) Information processing apparatus and memory protection method thereof
JP3603671B2 (en) Data sharing management device and data sharing management method
US9418175B2 (en) Enumeration of a concurrent data structure
Preslan et al. Device locks: mutual exclusion for storage area networks
EP1569121B1 (en) Method and system for detecting potential deadlocks in computer programs
JP2007249634A (en) Lock management method and lock management system
JP2856761B2 (en) Resource lock management device
JP2001256065A (en) Exclusive control method and computer system
JPS6191729A (en) Selection system of exclusive error information destination
CN114020491A (en) Parallel task data exchange method and device, electronic equipment and storage medium
CN118174980A (en) Message processing method and device, electronic equipment, storage medium and vehicle
JP2933011B2 (en) Exclusive file control system

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040217

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040419

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040907

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040920

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20071008

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20081008

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees