JP3746826B2 - Resource lock control mechanism - Google Patents

Resource lock control mechanism Download PDF

Info

Publication number
JP3746826B2
JP3746826B2 JP03037896A JP3037896A JP3746826B2 JP 3746826 B2 JP3746826 B2 JP 3746826B2 JP 03037896 A JP03037896 A JP 03037896A JP 3037896 A JP3037896 A JP 3037896A JP 3746826 B2 JP3746826 B2 JP 3746826B2
Authority
JP
Japan
Prior art keywords
resource
token
execution body
lock
acquisition request
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
JP03037896A
Other languages
Japanese (ja)
Other versions
JPH09223032A (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.)
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 JP03037896A priority Critical patent/JP3746826B2/en
Publication of JPH09223032A publication Critical patent/JPH09223032A/en
Application granted granted Critical
Publication of JP3746826B2 publication Critical patent/JP3746826B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、実行体による資源の排他獲得を制御する資源ロック制御機構に関し、特に、長期間型ロックと短期間型ロックの双方に適するとともに、スピンロック方式の持つプロセスディスパッチフォルトやMPフォルトの問題点を解消できるようにする資源ロック制御機構に関する。
【0002】
【従来の技術】
並列計算機では、並列動作を行うプロセス(実行体)が資源を逐次的にアクセスするために、資源を排他的に使用可能にする資源ロック制御機構を備えている。
【0003】
この資源ロック制御機構には、スタックロック方式とスピンロック方式という2つの方式がある。
スタックロック方式では、資源ロック制御機構は、図10に示すように、プロセスから資源アクセス権の獲得要求が発行されると、その要求を資源毎に用意されるスタックにキューイングしていくとともに、先頭にキューイングされる要求の発行元プロセスに対して資源へのアクセス権を与え、そして、資源へのアクセス処理を終了したプロセスから資源開放要求が発行されると、キューイングされているそのプロセスの要求をスタックから取り外していくことで、資源への逐次アクセスを実現している。ここで、図中の「○」は、資源へのアクセスの待ち状態にあるプロセスの要求を示しており、「●」は、資源にアクセスしているプロセスの要求を示している。
【0004】
一方、スピンロック方式では、図11に示すように、資源へアクセスする必要のあるプロセスは、資源ロック制御機構に対して、資源アクセス権を獲得できるまで獲得要求を繰り返し発行する構成を採って、資源ロック制御機構は、その要求を受け取るときに、その要求の指す資源にアクセスしているプロセスが存在しない場合には、その要求元のプロセスにアクセス権を与えていくことで、資源への逐次的アクセスを実現している。
【0005】
従来技術では、資源に合わせて、このスタックロック方式かスピンロック方式のいずれかの方式を採用して、資源ロック制御を実行するという構成を採っている。
【0006】
【発明が解決しようとする課題】
スタックロック方式は、スタックに要求をキューイングしたり、スタックから要求を取り外す処理を実行することから、排他時間の短い資源排他制御に使用する場合には、処理負荷が重いという欠点がある。これから、例えば、ファイルアクセスのような資源へのアクセスが比較的長い時間となる処理に適用されている。
【0007】
一方、スピンロック方式は、資源アクセス権を獲得したプロセスが長い時間それを保持したまま処理を続行すると、別のプロセスが資源アクセス権の獲得要求を長い時間繰り返し発行していくループ(スピン)に陥るという欠点がある。これから、例えば、メモリアクセスのような排他時間が極端に短い処理に適用されている。
【0008】
更に、このスピンロック方式には、プロセスディスパッチフォルトとMPフォルトという2つのフォルト現象がある。次に、この2つのフォルト現象について説明する。
【0009】
同時に複数のプロセスが動作することを基本とする現在の計算機アーキテクチャでは、プロセスへのCPU資源の割り当てを時分割に行うというタイムシェアリングアーキテクチャを採用している。
【0010】
すなわち、各プロセスへのCPU走行権の割り当ては時分割的であり、オペレーティングシステムにより、例えば、数msec〜数十msecを単位(タイムスライス時間)として、複数のプロセスに対して逐次的/時分割的にCPU走行権が割り当てられていく。そして、CPU走行権の付与されたプロセスは、所定の走行時間を消費すると、CPU走行権を奪い取られて休眠状態に入り、別の休眠状態にあるプロセスにCPU走行権が付与されていく。このようにして、オペレーティングシステムは、タイムスライス時間を単位として、複数のプロセスが均等にCPU資源を使えるように制御する構成を採っているのである。
【0011】
このタイムシェアリングシステム下では、スピンロック方式は、プロセスディスパッチによるロックフォルト(プロセスディスパッチフォルト)を発生してしまう。
【0012】
すなわち、資源アクセス権を保持するプロセスが、資源アクセス権を保持した状態でタイムシェアリングルールに従ってCPU走行権を奪われると、図12に示すように、その資源に対して資源のアクセス権の獲得を要求する他のプロセスは、最低でも1タイムスライス時間はスピンを繰り返し(プロセス数が多くなると長くなる)、無駄な時間を費やしてしまうというプロセスディスパッチフォルトが発生するのである。
【0013】
このプロセスディスパッチフォルトは、資源へのアクセス処理の時間が長くなる程高い確率で起こることから、資源排他/占有時間の長くなる場合には、スピンロック方式の利用には注意が必要となる。なお、タイムシェアリングルールにより各プロセスに順序よくCPU走行権が与えられることから、このプロセスディスパッチフォルトは、アクセス権を保持したまま休眠したプロセスが再びCPU走行権を得て、それにより処理を終了してアクセス権を開放していく時点で解消されることになる。
【0014】
一方、近年の計算機システムでは、1つのオペレーティングシステム下で、複数のCPUを装備するようになってきた。このようなマルチプロセッサシステム(MP)では、同時にCPU台数分の複数のプロセスがCPU走行権を得て並列的に動作することから、MPフォルトを発生してしまう。
【0015】
すなわち、CPUが2台の場合で説明するならば、プロセス1とプロセス2とに同時にCPU走行権が与えられることになるが、この場合、プロセス1とプロセス2とが同時に資源に対するアクセス権を要求することが起こると、図13に示すように、一方がアクセス権を開放するまでの間、他方がスピンロックによるループに陥るというMPフォルトが発生するのである。このように、資源に対するアクセス権を保持するプロセスがアクティブであるのにも関わらず、すなわちプロセスディスパッチによるフォルトでないにも関わらず、マルチプロセッサシステムの構成により他のプロセスが待たされてしまうことになる。
【0016】
このMPフォルトは、CPU台数が多くなる程高い確率で起こることから、CPU台数が多い場合には、スピンロック方式の利用には注意が必要となる。
このように、スタックロック方式は長期間型ロックに向く資源ロック制御方式であり、スピンロック方式は短期間型ロックに向く資源ロック制御方式であることから、従来技術では、資源へのアクセスが長い時間となる場合には、スタックロック方式を用い、資源へのアクセスが短い時間となる場合には、スピンロック方式を用いる構成を採っているが、この方法に従っていると、用途に応じてこの2つを切り分けて使用しなければならないという問題点があった。
【0017】
更に、スピンロック方式には、プロセスディスパッチフォルトとMPフォルトという2つのフォルト現象があり、従来技術のように、スピンロック方式を固定的に用いる方法を採っていると、プロセスディスパッチフォルトやMPフォルトにより、本来の短期間型ロックの特性を著しく損なうという問題点があった。
【0018】
本発明はかかる事情に鑑みてなされたものであって、長期間型ロックと短期間型ロックの双方に適するとともに、スピンロック方式の持つプロセスディスパッチフォルトやMPフォルトの問題点を解消できるようにする新たな資源ロック制御機構の提供を目的する。
【0019】
【課題を解決するための手段】
図1に本発明の原理構成を図示する。
図中、1は計算機システムであって、1つ又は複数の資源2と、資源2を使用する複数の実行体3と、実行体3による資源2の排他獲得を制御する本発明の資源ロック制御機構4とを備えるものである。
【0020】
本発明の資源ロック制御機構4は、トークン管理手段10と、放棄手段11と、判断手段12と、スタック型事象待ち手段13と、第1の制御手段14と、第2の制御手段15と、第3の制御手段16とを備える。
【0021】
このトークン管理手段10は、実行体3からのトークン獲得要求に応答して、その実行体3の要求する資源2が使用されているのか否かの判断を行うことなく、1つの実行体3のみにトークンを与える。
放棄手段11は、実行体3の発行するトークン獲得要求を監視して、そのトークン獲得要求が指定の回数を超えるときに、その実行体3の走行権を一時的に放棄させる。
この処理を行うにあたって、放棄手段11は、この指定回数として、他に資源2を要求する実行体3が存在せず、かつ、既に資源2を使用している実行体3が存在していない状態で、実行体3が資源2を獲得してトークンを返却するまでの最短の処理時間に相当する回数を用いて、この処理を行う。
【0022】
判断手段12は、実行体3にトークンが与えられるときに、その実行体3の要求する資源2が使用されているのか否かを判断する。スタック型事象待ち手段13は、実行体3の資源獲得要求をキューイングする。
【0023】
第1の制御手段14は、実行体3の資源獲得要求をスタック型事象待ち手段13に登録する。第2の制御手段15は、実行体3に資源アクセス権を与える。第3の制御手段16は、スタック型事象待ち手段13に資源開放を通知することで実行体3に資源アクセス権を与える。
【0024】
このように構成される本発明の資源ロック制御機構4では、トークン管理手段10は、実行体3からのトークン獲得要求に応答して1つの実行体3のみにトークンを与えていく処理を実行する。このとき、放棄手段11は、実行体3の発行するトークン獲得要求を監視して、そのトークン獲得要求が指定の回数を超えるときに、その実行体3の走行権を一時的に放棄させることで長期間のスピンに陥ることを防止する。
【0025】
そして、判断手段12は、実行体3にトークンが与えられると、その実行体3の要求する資源2が使用されているのか否かを判断する。
この判断手段12の判断処理を受けて、第1の制御手段14は、判断手段12が資源2の使用状態を判断すると、実行体3の持つトークンを返却するとともに、その実行体3の資源獲得要求をスタック型事象待ち手段13に登録し、第2の制御手段15は、判断手段12が資源2の非使用状態を判断すると、その実行体3に資源アクセス権を与えてから、その実行体3の持つトークンを返却する。
【0026】
一方、第3の制御手段16は、トークン管理手段10により資源2の使用の終えた実行体3に対してトークンが与えられると、スタック型事象待ち手段13に資源獲得要求が登録されているときには、スタック型事象待ち手段13に資源開放を通知(これにより、スタック型事象待ち手段13の先頭に登録されている実行体3に資源アクセス権が与えられる)してからトークンを返却するとともに、登録されていないときには、直ちにトークンを返却する。
【0027】
このように、本発明の資源ロック制御機構4では、トークンを獲得した実行体3に対して資源2の獲得権を与える構成を採って、その資源2が他の実行体3により排他獲得されていない場合には、その資源2へのアクセス権を与えていくとともに、排他獲得されている場合には、スタック型事象待ち手段13に資源獲得要求をキューイングするというスピンロック方式とスタックロック方式のハイブリッド構成を採ることで、長期間型ロックと短期間型ロックの双方に適する資源ロック制御方式を実現できる。
【0028】
そして、その構成を採るときに、規定のスピン回数でトークンを獲得できない場合には、資源獲得要求を発行する実行体3の走行権を一時的に奪っていくことで、長期間のスピンに陥らないようにするとともに、MPフォルトに起因するロック競合を解消し、更に、実行体3に資源アクセス権を与えていく場合にも、資源獲得要求をスタック型事象待ち手段13にキューイングしていく場合にも、トークンを直ちに返却させて実行体3がトークンを保持したまま休眠状態に入らないようにすることで、プロセスディスパッチフォルトに起因するロック競合を解消していく構成を採ることから、スピンロック方式の持つプロセスディスパッチフォルトやMPフォルトの発生も防止できる。
【0029】
【発明の実施の形態】
以下、実施の形態に従って本発明を詳細に説明する。
図1で説明したように、本発明では、スタックロック方式とスピンロック方式の両方の機能を兼ね備えたハイブリッドロック機構とも呼ぶべき資源ロック制御機構を用意して、これに従って資源ロック制御を実行する構成を採るものである。
【0030】
図2に示すように、各プロセスは、資源を要求するときには、この本発明のハイブリッドロック機構20のロック獲得制御機構200を呼び出し、資源に対するアクセス権を獲得してから、その資源に対する処理を行わなくてはならない。そして、資源に対する処理を終了したときには、この本発明のハイブリッドロック機構20のロック開放制御機構300を呼び出し、資源に対するアクセス権を開放していかなくてはならない。
【0031】
図3に、本発明のハイブリッドロック機構20の装置構成を図示する。
この図に示すように、本発明のハイブリッドロック機構20は、トークン管理機構21と、スピンロック機構22と、プロセス走行権一時放棄機構23と、スタック型事象待ち機構24と、ロック保持者登録管理機構25という5つの機構を持っている。
【0032】
次に、これらの各機構について説明する。
本発明のハイブリッドロック機構20の備えるトークン管理機構21は、図4に示すように、資源獲得や資源開放を要求するプロセスに対しての関所としての役割を持っている。すなわち、トークン管理機構21は、通行手形に相当するトークンを1個のみ発行する構成を採っており、各プロセスは、資源獲得(ロック獲得)や資源開放(ロック開放)の処理に入るときには、このトークンを獲得しなければならず、また、処理を終了したときには、このトークンを返却しなければならない構成を採っている。
【0033】
トークン管理機構21は、様々な方法により実現可能であるが、例えば、通常の計算機に一般的に備わっている排他処理命令/チェック処理命令を使って実現することができる。
【0034】
この排他処理命令は、図5に示すように、第1オペランドの内容を第2オペランドの示すメモリ番地へ移す処理を実行するものであり、実行前後の値が等しいときには、ステータスレジスタに「等しい」旨の状態情報が設定されることになる。この命令を実行しているプロセッサがある場合、他のプロセッサは、その間、この命令を行うことはなく、これから、この命令を実行した後に、チェック処理命令に従ってステータスレジスタの状態を調べることにより、この命令が排他的に完了したのか否かを知ることができる。なお、この排他処理命令は、第1オペランドと第2オペランドの意味が逆になる等、計算機により若干の違いはあるが本質的な意味はみな同じである。
【0035】
この排他処理命令の性質を使うと、図6に示すように、初期値としてOff値の設定されるフラグ域(トークンが返却されるときに設定される)に、排他処理命令によりOn値を書き込む構成を採ることで、1個のプロセスにのみトークンを発行するトークン管理機構21を実現できることになる。なお、On値/Off値は逆であってもよく、フラグ域の代わりに、長いデータ長のメモリ域を使ってもよいことは言うまでもない。
【0036】
本発明のハイブリッドロック機構20の備えるスピンロック機構22は、プロセスの発行するトークン管理機構21に対するトークン獲得要求を規定の回数まで許可する処理を行う。
【0037】
本発明のハイブリッドロック機構20の備えるプロセス走行権一時放棄機構23は、スピンロック機構22によりプロセスの発行するトークン獲得要求が規定回数に到達することが判断されると、そのプロセスに割り当てられた走行時間が消費される前に、オペレーティングシステムに対して、そのプロセスに対する走行権利の放棄を指示する処理を行う。オペレーティングシステムは、この指示を受け取ると、そのプロセスをプロセスディスパッチ待ちキューの所定の位置に設定することで、そのプロセスの走行権を放棄させるとともに、次のプロセスディスパッチに備えさせる。
【0038】
このプロセス走行権一時放棄機構23は、タイマー機構を使って実現することも可能である。すなわち、タイマー機構では、図7に示すように、プロセスがタイマー値(相対値のこともあるし、絶対値のこともある)を設定すると、そのプロセスはCPU資源を使用しない状態に入って、その設定したタイマー時間後に、CPUにタイマー割り込みというハードウェア割り込みが通知され、これにより、そのプロセスは走行を再開する。これから、このタイマー機構を使うことで、プロセスの走行権を一時的に放棄させるプロセス走行権一時放棄機構23を実現できるのである。なお、タイマー値としては、タイムシェアリングシステムの1タイムスライス時間より若干大きい値で、2タイムスライス時間よりは小さい値を設定することが好ましい。
【0039】
本発明のハイブリッドロック機構20の備えるスタック型事象待ち機構24は、複数のプロセスからの資源獲得要求を要求順にスタックし逐次的に資源獲得要求を処理していくために用意されるものであり、サービスの待ち合わせを実現する。このスタック型事象待ち機構24は、Wait/Post関数や、MsgSEND/MsgRCV関数や、SetLOCK関数といった通常の計算機で一般的に装備されている機構で実現できる。
【0040】
本発明のハイブリッドロック機構20の備えるロック保持者登録管理機構25は、資源へのアクセス権を獲得したプロセス(ロック保持者となる)の識別子を管理する。資源へのアクセス権を獲得したプロセスは1つであることから、ロック保持者登録管理機構25に管理されるプロセス識別子は1つのみである。
【0041】
図8に、本発明のハイブリッドロック機構20のロック獲得制御機構200がプロセスより資源獲得要求を受け取るときに実行する処理フローの一実施例、図9に、本発明のハイブリッドロック機構20のロック開放制御機構300がプロセスより資源開放要求を受け取るときに実行する処理フローの一実施例を図示する。
【0042】
次に、この処理フローに従って、本発明のハイブリッドロック機構20により実行される資源ロック制御について詳細に説明する。
本発明のハイブリッドロック機構20のロック獲得制御機構200は、プロセスより資源獲得要求を受け取ると、図8の処理フローに示すように、先ず最初に、ステップ1で、トークン管理機構21を使って、排他処理命令によるトークン獲得処理を実行する。このトークンは、上述したように、1つのプロセスのみが獲得できることになる。
【0043】
続いて、ステップ2で、資源獲得要求を発行してきたプロセスがトークンを獲得できたのか否かをチェックして、トークンを獲得できないことを判断するときには、ステップ3に進んで、そのプロセスによるトークン獲得の試みの回数が所定のスピン回数を超えたのか否を判断して、超えていないことを判断するときには、ステップ1に戻っていく。このスピン処理がスピンロック機構22の処理に該当する。
【0044】
一方、ステップ3で所定のスピン回数を超えたことを判断するときには、ステップ4に進んで、プロセス走行権一時放棄機構23を起動して、そのプロセスの持つ走行権を一時的に放棄させる。この走行権の放棄処理により、無駄なスピンの実行が防止され、走行権を他のプロセスに分け与えていくことで、ロック競合事象を速やかに解消していくことを積極的に進め、システム全体としての処理能力の向上を実現する。
【0045】
ステップ2でトークンの獲得を判断すると、ステップ5に進んで、ロック保持者登録管理機構25にロック保持者が登録されているのか否かを問い合わせ、続くステップ6で、ロック保持者が登録されているのか否かを判断する。この判断処理によりロック保持者が登録されていないことを判断するとき、すなわち、アクセス要求のある資源を排他獲得しているプロセスが存在しないことを判断するときには、ステップ7に進んで、ロック保持者登録管理機構25に対して、トークンを獲得したプロセスの識別子を登録してから、ステップ8に進んで、トークン管理機構21を使って、排他処理命令によるトークン返却処理を実行する。
【0046】
この後、トークンを返却したプロセスは、ロック保持者登録管理機構25にプロセス識別子が登録されることで資源を排他獲得できたことから、資源をアクセスすることで所定のデータ処理を実行することになる。従って、この処理ルートを辿る場合には、プロセスは、スピンロックだけで資源アクセス権が得られるので、極めて高速に資源アクセス権を得られることになる。
【0047】
一方、ステップ6でロック保持者が登録されていることを判断するとき、すなわち、アクセス要求のある資源を排他獲得しているプロセスが存在していることとを判断するときには、ステップ9に進んで、トークン管理機構21を使って、排他処理命令によるトークン返却処理を実行してから、続くステップ10で、トークンを返却したプロセスの発行した資源獲得要求をスタック型事象待ち機構24に登録する。
【0048】
このようにして資源排他獲得制御を実行するのであるが、この構成を採るときにあって、ステップ3で設定されるスピン回数としては、他に資源を要求するプロセスが存在せず、かつ、既に資源を使用しているプロセスが存在していない状態で、プロセスが資源を獲得してトークンを返却するまでの最短の処理時間よりも若干長い時間に相当する回数を用いることが好ましい。このように設定すると、無駄なスピンに陥らずに、しかも、トークンを獲得したプロセスがトークンを返却するまでの間は、トークンの獲得を要求するプロセスはスピンを実行することになって、大部分のMPフォルトから逃れられることになる。
【0049】
この処理にあって、ステップ5ないしステップ10の処理は、従来のスタックロック方式そのものであるが、本発明のスタックロック方式は、スピン回数を限定して実行するスピンロック機構22により実現されるロック競合の低下と、プロセス走行権一時放棄機構23により実現されるロック競合の低下では解消しきれないロック競合に対処するために設けられている。
【0050】
そして、本発明のスタックロック方式は、スピンロック機構22から直接発生するスピンロックと、プロセス走行権一時放棄機構23から発生するスピンロックの欠点である長期間スピンの可能性を排除すべく設けられている。逆を言うと、本発明では、スタックロック方式を用意することで、スピンロック方式を途中で打ち切ることを可能にしているのである。
【0051】
一方、本発明のハイブリッドロック機構20のロック開放制御機構300は、プロセスより資源開放要求を受け取ると、図9の処理フローに示すように、先ず最初に、ステップ1で、トークン管理機構21を使って、排他処理命令によるトークン獲得処理を実行する。
【0052】
続いて、ステップ2で、資源開放要求を発行してきたプロセスがトークンを獲得できたのか否かをチェックして、トークンを獲得できないことを判断するときには、ステップ3に進んで、そのプロセスによるトークン獲得の試みの回数が所定のスピン回数を超えたのか否を判断して、超えていないことを判断するときには、ステップ1に戻っていく。
【0053】
一方、ステップ3で所定のスピン回数を超えたことを判断するときには、ステップ4に進んで、プロセス走行権一時放棄機構23を起動して、そのプロセスの持つ走行権を一時的に放棄させる。この走行権の放棄処理により、無駄なスピンの実行が防止され、走行権を他のプロセスに分け与えていくことで、ロック競合事象を速やかに解消していくことを積極的に進め、システム全体としての処理能力の向上を実現する。
【0054】
ステップ2でトークンの獲得を判断すると、ステップ5に進んで、ロック保持者登録管理機構25に登録されている開放発行元のプロセス識別子を削除し、続くステップ6で、スタック型事象待ち機構24に資源獲得要求がキューイングされているのか否かを判断する。この判断処理によりスタック型事象待ち機構24に資源獲得要求がキューイングされていないことを判断するときには、ステップ7に進んで、トークン管理機構21を使って、排他処理命令によるトークン返却処理を実行する。
【0055】
一方、ステップ6でスタック型事象待ち機構24に資源獲得要求がキューイングされていることを判断するときには、ステップ8に進んで、スタック型事象待ち機構24に対してロック開放を通知し、続くステップ9で、ロック保持者登録管理機構25に対して、スタック型事象待ち機構24の先頭にキューイングされている資源獲得要求の発行元プロセスの識別子(このプロセスに資源アクセス権が与えられることになる)を登録してから、ステップ7に進んで、トークン管理機構21を使って、排他処理命令によるトークン返却処理を実行する。
【0056】
このようにして資源開放制御を実行するのであるが、この構成を採るときにあって、ステップ3で設定されるスピン回数としては、他に資源を要求するプロセスが存在せず、かつ、既に資源を使用しているプロセスが存在していない状態で、プロセスが資源を獲得してトークンを返却するまでの最短の処理時間よりも若干長い時間に相当する回数を用いることが好ましい。このように設定すると、無駄なスピンに陥らずに、しかも、トークンを獲得したプロセスがトークンを返却するまでの間は、トークンの獲得を要求するプロセスはスピンを実行することになって、大部分のMPフォルトから逃れられることになる。
【0057】
【発明の効果】
以上説明したように、本発明では、トークンを獲得したプロセスに対して資源の獲得権を与える構成を採って、その資源が他のプロセスにより排他獲得されていない場合には、その資源のアクセス権を与えていくとともに、排他獲得されている場合には、資源獲得要求をスタックにキューイングするというスピンロック方式とスタックロック方式のハイブリッド構成を採ることで、長期間型ロックと短期間型ロックの双方に適する資源ロック制御方式を実現できるようになる。
【0058】
そして、その構成を採るときに、規定のスピン回数でトークンを獲得できない場合には、資源獲得要求を発行するプロセスの走行権を一時的に奪っていくことで、長期間のスピンに陥らないようにするとともに、MPフォルトに起因するロック競合を解消し、更に、プロセスに資源アクセス権を与えていく場合にも、資源獲得要求をスタックにキューイングしていく場合にも、トークンを直ちに返却させてプロセスがトークンを保持したまま休眠状態に入らないようにすることで、プロセスディスパッチフォルトに起因するロック競合を解消していく構成を採ることから、スピンロック方式の持つプロセスディスパッチフォルトやMPフォルトの発生も防止できるようになる。
【図面の簡単な説明】
【図1】本発明の原理構成図である。
【図2】本発明の利用説明図である。
【図3】ハイブリッドロック機構の装置構成図である。
【図4】トークン管理機構の説明図である。
【図5】排他処理命令の説明図である。
【図6】排他処理命令を使用したトークン管理機構の説明図である。
【図7】タイマー機構を使用したプロセス走行権一時放棄機構の説明図である。
【図8】ハイブリッドロック機構の実行する処理フローである。
【図9】ハイブリッドロック機構の実行する処理フローである。
【図10】スタックロック方式の説明図である。
【図11】スピンロック方式の説明図である。
【図12】プロセスディスパッチフォルトの説明図である。
【図13】MPフォルトの説明図である。
【符号の説明】
1 計算機システム
2 資源
3 実行体
4 資源ロック制御機構
10 トークン管理手段
11 放棄手段
12 判断手段
13 スタック型事象待ち手段
14 第1の制御手段
15 第2の制御手段
16 第3の制御手段
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a resource lock control mechanism for controlling exclusive acquisition of resources by an executioner, and particularly suitable for both long-term locks and short-term locks, and the problem of process dispatch faults and MP faults possessed by a spin lock method. The present invention relates to a resource lock control mechanism that can eliminate the point.
[0002]
[Prior art]
The parallel computer includes a resource lock control mechanism that enables exclusive use of resources so that processes (executors) that perform parallel operations sequentially access the resources.
[0003]
This resource lock control mechanism has two methods, a stack lock method and a spin lock method.
In the stack lock method, as shown in FIG. 10, when a resource access right acquisition request is issued from a process, the resource lock control mechanism queues the request to a stack prepared for each resource. When a resource release request is issued from a process that has given access to a resource to the process that issued the request that is queued at the top and that has finished accessing the resource, the process that is queued By removing these requests from the stack, sequential access to resources is realized. Here, “◯” in the figure indicates a request for a process waiting for access to a resource, and “●” indicates a request for a process accessing a resource.
[0004]
On the other hand, in the spin lock method, as shown in FIG. 11, a process that needs to access a resource adopts a configuration that repeatedly issues an acquisition request to the resource lock control mechanism until a resource access right can be acquired. When the resource lock control mechanism receives the request and there is no process accessing the resource pointed to by the request, the resource lock control mechanism assigns the access right to the requesting process so that the resource is sequentially accessed. Real access.
[0005]
The prior art employs a configuration in which resource lock control is executed by adopting either the stack lock method or the spin lock method according to the resource.
[0006]
[Problems to be solved by the invention]
The stack lock method has a drawback in that the processing load is heavy when used for resource exclusion control with a short exclusion time because a request is queued to the stack or a process of removing a request from the stack is executed. From now on, for example, it is applied to processing such as file access in which access to resources takes a relatively long time.
[0007]
On the other hand, the spin lock method is a loop (spin) in which a process that has acquired a resource access right continues processing while holding it for a long time, and another process repeatedly issues a resource access right acquisition request for a long time. There is a drawback of falling. Thus, for example, the present invention is applied to a process such as memory access where the exclusion time is extremely short.
[0008]
Furthermore, this spin lock method has two fault phenomena, a process dispatch fault and an MP fault. Next, these two fault phenomena will be described.
[0009]
The current computer architecture based on the simultaneous operation of a plurality of processes employs a time sharing architecture in which CPU resources are allocated to processes in a time-sharing manner.
[0010]
In other words, the CPU run right is assigned to each process in a time-sharing manner, and is sequentially / time-sharing for a plurality of processes, for example, in units of several msec to several tens of msec (time slice time). CPU running rights are assigned to each other. Then, when the process granted the CPU running right consumes a predetermined running time, the CPU running right is taken and enters a sleep state, and the CPU running right is given to a process in another sleep state. In this way, the operating system adopts a configuration in which control is performed so that a plurality of processes can use the CPU resources equally in units of time slice time.
[0011]
Under this time sharing system, the spin lock method generates a lock fault (process dispatch fault) due to process dispatch.
[0012]
That is, when the process that holds the resource access right is deprived of the CPU running right according to the time sharing rule while holding the resource access right, the resource access right is acquired for the resource as shown in FIG. The process dispatch fault occurs in that another process that requests the process repeats the spinning for at least one time slice time (which becomes longer as the number of processes increases), and wastes time.
[0013]
This process dispatch fault occurs with a higher probability as the processing time for accessing the resource becomes longer. Therefore, when the resource exclusion / occupation time becomes longer, care must be taken in using the spin lock method. In addition, since the CPU run right is given to each process in order according to the time sharing rule, this process dispatch fault causes the process that has been sleeping while retaining the access right to obtain the CPU run right again, thereby terminating the process. It will be canceled when the access right is released.
[0014]
On the other hand, recent computer systems have been equipped with a plurality of CPUs under one operating system. In such a multiprocessor system (MP), since a plurality of processes for the number of CPUs simultaneously obtain the CPU running right and operate in parallel, an MP fault occurs.
[0015]
In other words, in the case where there are two CPUs, the CPU running right is given to the process 1 and the process 2 at the same time. In this case, the process 1 and the process 2 simultaneously request the access right to the resource. When this happens, as shown in FIG. 13, an MP fault occurs in which one side falls into a loop due to a spin lock until one side releases the access right. In this way, even if the process that holds the access right to the resource is active, that is, it is not a fault due to process dispatch, other processes are kept waiting due to the configuration of the multiprocessor system. .
[0016]
Since this MP fault occurs with a higher probability as the number of CPUs increases, attention must be paid to the use of the spin lock method when the number of CPUs is large.
As described above, the stack lock method is a resource lock control method suitable for a long-term type lock, and the spin lock method is a resource lock control method suitable for a short-term type lock. Therefore, in the prior art, access to resources is long. When the time is reached, the stack lock method is used. When the access to the resource is short, the spin lock method is used. There was a problem that it was necessary to separate and use one.
[0017]
Furthermore, the spin lock method has two fault phenomena, a process dispatch fault and an MP fault. If the method using the spin lock method is fixed as in the prior art, the process dispatch fault and the MP fault There is a problem that the characteristics of the original short-term lock are remarkably impaired.
[0018]
The present invention has been made in view of such circumstances, and is suitable for both long-term locks and short-term locks, and can solve the problems of process dispatch faults and MP faults of the spin lock method. The purpose is to provide a new resource lock control mechanism.
[0019]
[Means for Solving the Problems]
FIG. 1 illustrates the principle configuration of the present invention.
In the figure, reference numeral 1 denotes a computer system, which includes one or a plurality of resources 2, a plurality of execution bodies 3 that use the resources 2, and a resource lock control according to the present invention that controls exclusive acquisition of the resources 2 by the execution bodies 3. The mechanism 4 is provided.
[0020]
The resource lock control mechanism 4 of the present invention includes a token management means 10, a waiver means 11, a judgment means 12, a stack type event waiting means 13, a first control means 14, a second control means 15, Third control means 16.
[0021]
  This token management means 10 responds to the token acquisition request from the execution body 3.Without determining whether or not the resource 2 requested by the execution body 3 is used.Only one execution body 3 is given a token.
  The abandoning means 11 monitors the token acquisition request issued by the execution body 3, and temporarily abandons the running right of the execution body 3 when the token acquisition request exceeds a specified number of times.
  In performing this processing, the abandoning means 11 is in a state in which there is no other execution body 3 that requests the resource 2 and there is no execution body 3 that already uses the resource 2 as the specified number of times. Thus, this processing is performed using the number of times corresponding to the shortest processing time from when the execution body 3 acquires the resource 2 and returns the token.
[0022]
When the token is given to the execution body 3, the determination means 12 determines whether or not the resource 2 requested by the execution body 3 is being used. The stack type event waiting unit 13 queues the resource acquisition request of the execution body 3.
[0023]
The first control unit 14 registers the resource acquisition request of the execution body 3 in the stack type event waiting unit 13. The second control means 15 gives a resource access right to the execution body 3. The third control means 16 gives the resource access right to the execution body 3 by notifying the stack type event waiting means 13 of the resource release.
[0024]
In the resource lock control mechanism 4 of the present invention configured as described above, the token management means 10 executes a process of giving a token only to one execution body 3 in response to a token acquisition request from the execution body 3. . At this time, the abandonment means 11 monitors the token acquisition request issued by the execution body 3, and when the token acquisition request exceeds the specified number of times, the execution body 3 temporarily abandons the running right of the execution body 3. Prevent falling into a long-term spin.
[0025]
  Then, when the token is given to the execution body 3, the determination means 12 determines whether or not the resource 2 requested by the execution body 3 is used.
  In response to the determination process of the determination unit 12, when the determination unit 12 determines the usage state of the resource 2, the first control unit 14 returns the token of the execution body 3 and acquires the resource of the execution body 3. The request is registered in the stack type event waiting unit 13, and the second control unit 15 determines that the determination unit 12 is not using the resource 2.And grant the resource access right to the executor 3,Returns the token of the executable 3 ofReject.
[0026]
On the other hand, when the token is given to the execution body 3 that has finished using the resource 2 by the token management means 10, the third control means 16 receives a resource acquisition request registered in the stack type event waiting means 13. , Notifies the stack type event waiting unit 13 of the release of the resource (which gives the resource access right to the execution body 3 registered at the top of the stack type event waiting unit 13), returns the token, and registers If not, return the token immediately.
[0027]
As described above, the resource lock control mechanism 4 of the present invention adopts a configuration in which the execution right 3 that has acquired the token is given the right to acquire the resource 2, and the resource 2 is exclusively acquired by the other execution body 3. If not, the access right to the resource 2 is given, and if the exclusive acquisition is made, the resource acquisition request is queued to the stack type event waiting means 13 and the spin lock method and the stack lock method are used. By adopting a hybrid configuration, it is possible to realize a resource lock control system suitable for both long-term locks and short-term locks.
[0028]
If the token cannot be acquired with the specified number of spins when adopting the configuration, the runner 3 that issues the resource acquisition request is temporarily deprived of the running right, thereby falling into a long-term spin. In addition, the lock contention caused by the MP fault is resolved, and the resource acquisition request is queued to the stack type event waiting unit 13 when the resource access right is given to the execution body 3. Even in this case, since the token is immediately returned so that the execution body 3 does not enter the sleep state while holding the token, the lock contention caused by the process dispatch fault is eliminated. Occurrence of process dispatch faults and MP faults in the lock method can also be prevented.
[0029]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, the present invention will be described in detail according to embodiments.
As described with reference to FIG. 1, in the present invention, a resource lock control mechanism that should be called a hybrid lock mechanism that has both functions of a stack lock method and a spin lock method is prepared, and resource lock control is executed according to the prepared resource lock control mechanism. Is taken.
[0030]
As shown in FIG. 2, when a process requests a resource, each process calls the lock acquisition control mechanism 200 of the hybrid lock mechanism 20 of the present invention, acquires an access right to the resource, and then performs processing for the resource. Must-have. When the processing for the resource is finished, the lock release control mechanism 300 of the hybrid lock mechanism 20 of the present invention must be called to release the access right to the resource.
[0031]
FIG. 3 illustrates a device configuration of the hybrid lock mechanism 20 of the present invention.
As shown in this figure, the hybrid lock mechanism 20 of the present invention includes a token management mechanism 21, a spin lock mechanism 22, a process running right temporary abandonment mechanism 23, a stack type event waiting mechanism 24, and a lock holder registration management. The mechanism 25 has five mechanisms.
[0032]
Next, each of these mechanisms will be described.
As shown in FIG. 4, the token management mechanism 21 included in the hybrid lock mechanism 20 of the present invention has a role as a gateway for a process requesting resource acquisition or resource release. That is, the token management mechanism 21 has a configuration in which only one token corresponding to a bill of passage is issued. When each process enters processing for resource acquisition (lock acquisition) or resource release (lock release), The token has to be acquired, and when the processing is completed, the token must be returned.
[0033]
The token management mechanism 21 can be realized by various methods. For example, the token management mechanism 21 can be realized by using an exclusive processing instruction / check processing instruction generally provided in a normal computer.
[0034]
As shown in FIG. 5, this exclusive processing instruction executes a process of moving the contents of the first operand to the memory address indicated by the second operand. When the values before and after execution are equal, the status register is “equal”. The status information to that effect is set. If there is a processor executing this instruction, the other processor does not execute this instruction during that time, and after executing this instruction, this processor is checked by checking the status register status according to the check processing instruction. It is possible to know whether the instruction is completed exclusively. This exclusive processing instruction has the same essential meaning although there are some differences depending on the computer, such as the meanings of the first operand and the second operand are reversed.
[0035]
Using this property of the exclusive processing instruction, as shown in FIG. 6, the On value is written by the exclusive processing instruction in the flag area (set when the token is returned) in which the Off value is set as the initial value. By adopting the configuration, the token management mechanism 21 that issues a token to only one process can be realized. Needless to say, the On value / Off value may be reversed, and a memory area having a long data length may be used instead of the flag area.
[0036]
The spin lock mechanism 22 included in the hybrid lock mechanism 20 of the present invention performs processing for permitting a token acquisition request to the token management mechanism 21 issued by the process up to a specified number of times.
[0037]
When the spin lock mechanism 22 determines that the token acquisition request issued by the process has reached a specified number of times, the process run right temporary abandonment mechanism 23 included in the hybrid lock mechanism 20 of the present invention is assigned to the process run. Before the time is consumed, the operating system is instructed to give up the right to travel for the process. Upon receiving this instruction, the operating system sets the process to a predetermined position in the process dispatch queue, thereby giving up the right to travel of the process and preparing for the next process dispatch.
[0038]
This process running right temporary abandonment mechanism 23 can also be realized using a timer mechanism. In other words, in the timer mechanism, as shown in FIG. 7, when a process sets a timer value (which may be a relative value or an absolute value), the process enters a state in which CPU resources are not used, After the set timer time, the CPU is notified of a hardware interrupt called a timer interrupt, whereby the process resumes running. From now on, by using this timer mechanism, it is possible to realize the process running right temporary abandoning mechanism 23 for temporarily giving up the running right of the process. The timer value is preferably set to a value slightly larger than one time slice time of the time sharing system and smaller than two time slice times.
[0039]
The stack type event waiting mechanism 24 included in the hybrid lock mechanism 20 of the present invention is prepared for stacking resource acquisition requests from a plurality of processes in order of request and sequentially processing the resource acquisition requests. Realize service waiting. The stack type event waiting mechanism 24 can be realized by a mechanism generally equipped in a normal computer such as a Wait / Post function, an MsgSEND / MsgRCV function, or a SetLOCK function.
[0040]
The lock holder registration management mechanism 25 included in the hybrid lock mechanism 20 of the present invention manages the identifier of the process (being a lock holder) that has acquired the access right to the resource. Since there is one process that has acquired the right to access the resource, only one process identifier is managed by the lock holder registration management mechanism 25.
[0041]
FIG. 8 shows an example of a processing flow executed when the lock acquisition control mechanism 200 of the hybrid lock mechanism 20 of the present invention receives a resource acquisition request from a process. FIG. 9 shows the unlocking of the hybrid lock mechanism 20 of the present invention. An example of a processing flow executed when the control mechanism 300 receives a resource release request from a process is illustrated.
[0042]
Next, resource lock control executed by the hybrid lock mechanism 20 of the present invention will be described in detail according to this processing flow.
When the lock acquisition control mechanism 200 of the hybrid lock mechanism 20 of the present invention receives a resource acquisition request from the process, first, as shown in the processing flow of FIG. 8, using the token management mechanism 21 in step 1, Execute token acquisition processing by exclusive processing instruction. This token can be acquired by only one process as described above.
[0043]
Subsequently, in Step 2, when it is determined whether or not the process that issued the resource acquisition request has acquired a token and it is determined that the token cannot be acquired, the process proceeds to Step 3 to acquire the token by the process. It is determined whether or not the number of attempts has exceeded a predetermined number of spins, and when it is determined that the number has not exceeded, the process returns to step 1. This spin process corresponds to the process of the spin lock mechanism 22.
[0044]
On the other hand, when it is determined in step 3 that the predetermined number of spins has been exceeded, the process proceeds to step 4 where the process running right temporary abandonment mechanism 23 is activated and the running right of the process is temporarily abandoned. This run-right abandonment process prevents unnecessary spins from being executed, and by proactively promoting the elimination of lock contention events by assigning run rights to other processes. Improve the processing capacity of
[0045]
If it is determined in step 2 that the token is acquired, the process proceeds to step 5 to inquire whether or not the lock holder is registered in the lock holder registration management mechanism 25, and in step 6 the lock holder is registered. Judge whether or not. When it is determined by this determination processing that the lock holder is not registered, that is, when it is determined that there is no process that has exclusively acquired the resource having the access request, the process proceeds to step 7 to move to the lock holder. After registering the identifier of the process that acquired the token in the registration management mechanism 25, the process proceeds to step 8, and the token management mechanism 21 is used to execute the token return process by the exclusive processing instruction.
[0046]
After that, the process that has returned the token can acquire the resource exclusively by registering the process identifier in the lock holder registration management mechanism 25, and therefore executes predetermined data processing by accessing the resource. Become. Therefore, when following this processing route, the process can obtain the resource access right only by the spin lock, so that the resource access right can be obtained at a very high speed.
[0047]
On the other hand, when it is determined in step 6 that the lock holder is registered, that is, when it is determined that there is a process that exclusively acquires the resource having the access request, the process proceeds to step 9. Then, the token management mechanism 21 is used to execute the token return processing by the exclusive processing instruction, and then in step 10, the resource acquisition request issued by the process that returned the token is registered in the stack type event waiting mechanism 24.
[0048]
In this way, the resource exclusive acquisition control is executed. When this configuration is adopted, the number of spins set in step 3 is not any other process requesting resources, and has already been performed. It is preferable to use a number corresponding to a time slightly longer than the shortest processing time from when a process acquires a resource and returns a token when there is no process using the resource. With this setting, the process requesting acquisition of the token will execute the spin until the process that acquired the token returns the token without falling into a useless spin, You will be escaped from the MP fault.
[0049]
In this processing, the processing from step 5 to step 10 is the conventional stack lock method itself, but the stack lock method of the present invention is a lock realized by the spin lock mechanism 22 that executes with a limited number of spins. It is provided to cope with a lock contention that cannot be solved by a decrease in contention and a decrease in lock contention realized by the process running right temporary abandonment mechanism 23.
[0050]
The stack lock system of the present invention is provided to eliminate the possibility of long-term spin, which is a drawback of the spin lock generated directly from the spin lock mechanism 22 and the spin lock generated from the process running right temporary abandonment mechanism 23. ing. In other words, in the present invention, the stack lock method is prepared, so that the spin lock method can be interrupted halfway.
[0051]
On the other hand, when receiving the resource release request from the process, the lock release control mechanism 300 of the hybrid lock mechanism 20 of the present invention first uses the token management mechanism 21 in step 1 as shown in the processing flow of FIG. Then, the token acquisition process by the exclusive process instruction is executed.
[0052]
Subsequently, in step 2, when it is determined whether or not the process that issued the resource release request has acquired a token and it is determined that the token cannot be acquired, the process proceeds to step 3 and the token is acquired by the process. It is determined whether or not the number of attempts has exceeded a predetermined number of spins, and when it is determined that the number has not exceeded, the process returns to step 1.
[0053]
On the other hand, when it is determined in step 3 that the predetermined number of spins has been exceeded, the process proceeds to step 4 where the process running right temporary abandonment mechanism 23 is activated and the running right of the process is temporarily abandoned. This run-right abandonment process prevents unnecessary spins from being executed, and by proactively promoting the elimination of lock contention events by assigning run rights to other processes. Improve the processing capacity of
[0054]
If it is determined in step 2 that the token has been acquired, the process proceeds to step 5 where the process identifier of the release issuer registered in the lock holder registration management mechanism 25 is deleted. Determine whether a resource acquisition request is queued. When it is determined that the resource acquisition request is not queued in the stack type event waiting mechanism 24 by this determination processing, the process proceeds to Step 7 and the token management mechanism 21 is used to execute the token return processing by the exclusive processing instruction. .
[0055]
On the other hand, when it is determined in step 6 that a resource acquisition request is queued in the stack type event wait mechanism 24, the process proceeds to step 8 to notify the stack type event wait mechanism 24 of the unlocking, and the following steps 9, the identifier of the process that issued the resource acquisition request queued at the head of the stack type event waiting mechanism 24 is given to the lock holder registration management mechanism 25 (the resource access right is given to this process). ) Is registered, the process proceeds to step 7, and the token management mechanism 21 is used to execute the token return process by the exclusive process instruction.
[0056]
In this way, the resource release control is executed. However, when this configuration is adopted, the number of spins set in step 3 does not include any other process that requests the resource, and has already been a resource. It is preferable to use a number corresponding to a time slightly longer than the shortest processing time from when a process acquires a resource and returns a token in a state where there is no process using. With this setting, the process requesting acquisition of the token will execute the spin until the process that acquired the token returns the token without falling into a useless spin, You will be escaped from the MP fault.
[0057]
【The invention's effect】
As described above, the present invention adopts a configuration in which a resource acquisition right is given to a process that has acquired a token, and when the resource is not acquired exclusively by another process, the access right to the resource is acquired. In the case of exclusive acquisition, a hybrid configuration of a spin lock method and a stack lock method in which a resource acquisition request is queued on the stack is adopted. A resource lock control method suitable for both can be realized.
[0058]
And when adopting that configuration, if a token cannot be acquired with the specified number of spins, by temporarily taking away the running right of the process issuing the resource acquisition request, it will not fall into a long-term spin In addition, the lock contention caused by the MP fault is resolved, and the token is immediately returned both when the resource access right is given to the process and when the resource acquisition request is queued on the stack. In this way, the lock contention caused by the process dispatch fault is eliminated by preventing the process from entering the sleep state while holding the token. Therefore, the process dispatch fault and MP fault of the spin lock method are adopted. Occurrence can be prevented.
[Brief description of the drawings]
FIG. 1 is a principle configuration diagram of the present invention.
FIG. 2 is a diagram for explaining the use of the present invention.
FIG. 3 is a device configuration diagram of a hybrid lock mechanism.
FIG. 4 is an explanatory diagram of a token management mechanism.
FIG. 5 is an explanatory diagram of an exclusive processing instruction.
FIG. 6 is an explanatory diagram of a token management mechanism using an exclusive processing instruction.
FIG. 7 is an explanatory diagram of a process running right temporary abandonment mechanism using a timer mechanism.
FIG. 8 is a processing flow executed by the hybrid lock mechanism.
FIG. 9 is a processing flow executed by the hybrid lock mechanism.
FIG. 10 is an explanatory diagram of a stack lock method.
FIG. 11 is an explanatory diagram of a spin lock method.
FIG. 12 is an explanatory diagram of a process dispatch fault.
FIG. 13 is an explanatory diagram of an MP fault.
[Explanation of symbols]
1 Computer system
2 resources
3 Executable
4 Resource lock control mechanism
10 Token management means
11 Abandonment means
12 Judgment means
13 Stack type event waiting means
14 First control means
15 Second control means
16 Third control means

Claims (3)

実行体による資源の排他獲得を制御する資源ロック制御機構において、
実行体からのトークン獲得要求に応答して、該実行体の要求する資源が使用されているのか否かの判断を行うことなく、1つの実行体のみにトークンを与えるトークン管理手段と、
実行体の発行するトークン獲得要求を監視して、そのトークン獲得要求が指定の回数を超えるときに、該実行体の走行権を一時的に放棄させる処理を行い、かつ、この指定回数として、他に資源を要求する実行体が存在せず、かつ、既に資源を使用している実行体が存在していない状態で、実行体が資源を獲得してトークンを返却するまでの最短の処理時間に相当する回数を用いて、この処理を行う放棄手段と、
実行体にトークンが与えられるときに、該実行体の要求する資源が使用されているのか否かを判断する判断手段と、
上記判断手段が資源の使用状態を判断するときに、実行体の持つトークンを返却するとともに、該実行体の資源獲得要求をスタック型事象待ち手段に登録する第1の制御手段と、
上記判断手段が資源の非使用状態を判断するときに、トークンの与えられた実行体に資源アクセス権を与えてから、該実行体の持つトークンを返却する第2の制御手段とを備えることを、
特徴とする資源ロック制御機構。
In the resource lock control mechanism that controls exclusive acquisition of resources by the execution body,
In response to a token acquisition request from an execution body, token management means for giving a token to only one execution body without determining whether or not the resource requested by the execution body is used ;
Watching the issue token acquisition request to the execution body, when the token acquisition request exceeds a specified number of, performs processing Ru temporarily abandon the travel rights of the executable units, and, as the specified number of times, The shortest processing time required for an executor to acquire a resource and return a token when there is no other executor that requests the resource and there is no executor that already uses the resource using the number of times corresponding to a disposal means release to do this,
A determination means for determining whether or not a resource requested by the execution body is used when a token is given to the execution body;
A first control means for returning a token possessed by the execution body and registering the resource acquisition request of the execution body in the stack type event waiting means when the determination means determines the resource usage state;
Provided when said determination means determines the non-use state of the resource, the execution body given token from giving resource access, and a second control means for retirement return the token with the said actual line body That
Feature resource lock control mechanism.
請求項1記載の資源ロック制御機構において、
上記トークン管理手段が資源の使用の終えた実行体に対してトークンを与えるときに、スタック型事象待ち手段に資源獲得要求が登録されているときには、該スタック型事象待ち手段に資源開放を通知してからトークンを返却するとともに、登録されていないときには、直ちにトークンを返却する第3の制御手段を備えることを、
特徴とする資源ロック制御機構。
The resource lock control mechanism according to claim 1, wherein
When the token management means gives a token to the execution body that has finished using the resource, if a resource acquisition request is registered in the stack type event waiting means, the stack type event waiting means is notified of the resource release. And a third control means for immediately returning the token when the token is not registered.
Feature resource lock control mechanism.
請求項1又は2記載の資源ロック制御機構において、
上記トークン管理手段は、実行体からトークン獲得要求があるときに、規定のメモリ域に規定のデータ値を書き込む排他処理命令と、該メモリ域のデータ値が該排他処理命令の実行前後で異なるものとなるのか否かをチェックするチェック処理命令とを使ってトークンの排他付与を実行することを、
特徴とする資源ロック制御機構。
In the resource lock control mechanism according to claim 1 or 2,
The token management means includes an exclusive processing instruction that writes a specified data value in a specified memory area when a token acquisition request is issued from the execution body, and a data value in the memory area that differs before and after the execution of the exclusive processing instruction. To execute the exclusive grant of the token using the check processing instruction to check whether or not
Feature resource lock control mechanism.
JP03037896A 1996-02-19 1996-02-19 Resource lock control mechanism Expired - Fee Related JP3746826B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP03037896A JP3746826B2 (en) 1996-02-19 1996-02-19 Resource lock control mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP03037896A JP3746826B2 (en) 1996-02-19 1996-02-19 Resource lock control mechanism

Publications (2)

Publication Number Publication Date
JPH09223032A JPH09223032A (en) 1997-08-26
JP3746826B2 true JP3746826B2 (en) 2006-02-15

Family

ID=12302228

Family Applications (1)

Application Number Title Priority Date Filing Date
JP03037896A Expired - Fee Related JP3746826B2 (en) 1996-02-19 1996-02-19 Resource lock control mechanism

Country Status (1)

Country Link
JP (1) JP3746826B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6349322B1 (en) * 1998-05-06 2002-02-19 Sun Microsystems, Inc. Fast synchronization for programs written in the JAVA programming language
US20030204549A1 (en) * 1998-10-22 2003-10-30 Wolfgang Eibach Operating system for handling dynamic and static tasks
US6691304B1 (en) * 1999-02-25 2004-02-10 Sun Microsystems, Inc. Monitor conversion in a multi-threaded computer system
US8990954B2 (en) 2007-06-20 2015-03-24 International Business Machines Corporation Distributed lock manager for file system objects in a shared file system
US8127063B2 (en) * 2009-01-20 2012-02-28 Fisher-Rosemount Systems, Inc. Distributed equipment arbitration in a process control system
JP5625379B2 (en) * 2010-02-16 2014-11-19 日本電気株式会社 Lock contention management device, lock contention management method, and program

Also Published As

Publication number Publication date
JPH09223032A (en) 1997-08-26

Similar Documents

Publication Publication Date Title
JP2514299B2 (en) Serialization method of interrupt handling for process level programming
US6792497B1 (en) System and method for hardware assisted spinlock
CA2165493A1 (en) Method and apparatus for crash safe enforcement of mutually exclusive access to shared resources in a multitasking computer system
JP2015530679A (en) Method and apparatus using high efficiency atomic operations
JP3746826B2 (en) Resource lock control mechanism
EP1693743A2 (en) System, method and medium for using and/or providing operating system information to acquire a hybrid user/operating system lock
JPH0877025A (en) Method and device for controlling priority of task
Lehey Improving the FreeBSD SMP Implementation.
JP3862293B2 (en) Information processing method and apparatus
JP2804478B2 (en) Task control system and online transaction system
JPH1049388A (en) Input and output controller
JPS6321941B2 (en)
US20040243751A1 (en) Method for resource access co-ordination in a data processing system, data processing system and computer program
JPH03116261A (en) Multiprocessor control system
JPH0115899B2 (en)
JPH02171952A (en) Dispatching system for multiprocessor
JPH06161872A (en) Inter-task exclusive control method
JP2023091314A (en) Semiconductor device, control method of semiconductor device, and program
JPH04223533A (en) Common resource exclusive control system
JPH09330241A (en) Exclusive deadlock prevention control system
JPS6265157A (en) Exclusive control system for roughly coupled multi-processor system
JPS6125249A (en) Exclusive control system
JPH08190531A (en) Management system for memory buffer
JP2856761B2 (en) Resource lock management device
JP2001256065A (en) Exclusive control method and computer system

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041129

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050412

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050609

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: 20051122

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20051125

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: 20091202

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091202

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20101202

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20111202

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111202

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20121202

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees