JP2804478B2 - Task control system and online transaction system - Google Patents

Task control system and online transaction system

Info

Publication number
JP2804478B2
JP2804478B2 JP63127150A JP12715088A JP2804478B2 JP 2804478 B2 JP2804478 B2 JP 2804478B2 JP 63127150 A JP63127150 A JP 63127150A JP 12715088 A JP12715088 A JP 12715088A JP 2804478 B2 JP2804478 B2 JP 2804478B2
Authority
JP
Japan
Prior art keywords
task
lock
shared resource
post
control method
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
JP63127150A
Other languages
Japanese (ja)
Other versions
JPH01297760A (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.)
Hitachi Ltd
Hitachi Solutions Technology Ltd
Original Assignee
Hitachi Ltd
Hitachi ULSI Systems Co 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 Hitachi Ltd, Hitachi ULSI Systems Co Ltd filed Critical Hitachi Ltd
Priority to JP63127150A priority Critical patent/JP2804478B2/en
Priority to DE1989625064 priority patent/DE68925064T2/en
Priority to EP19890109410 priority patent/EP0343646B1/en
Publication of JPH01297760A publication Critical patent/JPH01297760A/en
Priority to US07/940,347 priority patent/US5274809A/en
Application granted granted Critical
Publication of JP2804478B2 publication Critical patent/JP2804478B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は複数のプロセツサがメモリを共有した密結合
マルチ・プロセツサ(Tightly Coupled Multi Processo
r、以下TCMPと記す)に係わり、特に共有リソースの排
他アクセス制御に好適なロツク制御のためのタスク制御
方式に関する。
DETAILED DESCRIPTION OF THE INVENTION [Industrial Application Field] The present invention relates to a tightly coupled multi processor in which a plurality of processors share a memory.
r, hereinafter referred to as TCMP), and particularly to a task control method for lock control suitable for exclusive access control of shared resources.

〔従来の技術〕[Conventional technology]

計算機システム内で実行される処理単位(タスク)
は、各種の共有リソースを使用する。TCMPのように複数
のタスクが同時に動作するシステムでは、これらのタス
ク間で共有リソースの占有使用権に関する競合が発生す
るので、このための排他制御が必要となる。例えば、オ
ンライン・システムで複数のタスクがそれぞれ別々の
『売上げ処理』を行つている場合、共通の記憶域上にあ
る『売上げ現在高』を、別々のタスクが参照・更新す
る。この様な状況では、あるタスクがこの『売上げ現在
高』を参照し、更新している間、別のタスクがこのデー
タにアクセスすることを禁止する必要がある。
Processing unit (task) executed in the computer system
Uses various shared resources. In a system in which a plurality of tasks operate at the same time, such as TCMP, a conflict regarding the exclusive use right of the shared resource occurs between these tasks, and thus exclusive control is required for this. For example, when a plurality of tasks perform different “sales processing” in the online system, different tasks refer to and update “current sales” in a common storage area. In such a situation, it is necessary to prohibit another task from accessing this data while one task refers to this “sales current” and updates it.

現在実用化されている計算機システムの多くは、排他
制御のための基本機能として、メモリ(主メモリ)上の
1ワードの参照と更新を不可分の操作として実行する命
令をハードウエア・レベルでサポートしている(例え
ば、TEST AND SET命令(TS命令)あるいはCOMPARE AND
SWAP命令(CS命令)等。K.Hwang,F.A.Briggs共著“Comp
uter Architecture and Parallel Processing",McGraw
Hill出版、pp.559〜560参照)。しかし、排他制御の対
象となる共有リソースは、主メモリ上の1ワードとは限
らず、デイスク装置上のデータベースの場合もある。一
般に、この種の共有リソースに対する排他制御は、次の
ようにして行なわれる。即ち、主メモリ上に共有リソー
スのデータ(それぞれ数KBにも及ぶ多数のデータA,B,C,
……等からなる)の格納領域のほかに、これらのデータ
を参照するための参照テーブルを設け、このテーブルに
前記共有のデータA,B,C,……にそれぞれ対応して1ワー
ドの参照情報(ロツクワード)を割り当て記述してお
く。そして、各データA,B,C,……に対するアクセスは、
このロツクワードを通じて行なう。このロツクワードに
上記の命令を用いて占有使用中(ロツク中)のフラグを
書き込むことにより共有リソースの各データに対する排
他制御を実現することができる。但し、この方式では共
有リソースの占有使用権が得られなかつた場合の処理が
必要となる。この点を考慮した排他制御方式のひとつと
してWAIT・POST方式(Suspend・Resume方式、Block・Ac
tivate方式、Sleep・Wakeup方式等とも呼ばれる。上記
文献参照)が知られている。
Many of the computer systems that are currently in practical use support, at the hardware level, instructions for executing one-word referencing and updating in memory (main memory) as inseparable operations as a basic function for exclusive control. (For example, TEST AND SET instruction (TS instruction) or COMPARE AND
SWAP instruction (CS instruction) etc. K. Hwang and FABriggs, “Comp
uter Architecture and Parallel Processing ", McGraw
Hill Publishing, pp. 559-560). However, the shared resource subject to exclusive control is not limited to one word in the main memory, and may be a database on a disk device. Generally, exclusive control of this type of shared resource is performed as follows. That is, the data of the shared resources (a large number of data A, B, C,
.., Etc.), and a reference table for referencing these data is provided. In this table, one-word reference corresponding to the shared data A, B, C,. Information (lock word) is assigned and described. And access to each data A, B, C, ...
This is done through the lock word. The exclusive control for each data of the shared resource can be realized by writing the occupied in use (locked) flag in the lock word using the above-mentioned instruction. However, this method requires processing when the exclusive use right of the shared resource cannot be obtained. WAIT / POST (Suspend / Resume, Block / Ac
It is also called the tivate method, Sleep / Wakeup method, etc. The above document is known).

WAIT・POST方式は、共有リソースがタスク1により占
有中であつた場合に、この共有リソースの占有に失敗し
たタスク2を「待ち状態」にするWAIT処理と、タスク1
が共有リソースを解放する時に、タスク2の「待ち状
態」を解除するPOST処理(通知処理)によつて、共有リ
ソースを占有使用権のタスク間排他制御を行なう(以
下、本明細書中で共有リソースの占有使用権を得る事を
ロツクを取る、ロツク権を確保する等表現する。又、ロ
ツクを取ろうとして、他のタスクが占有使用中であつた
為にロツクが取れなかつた事を、ロツク失敗、ロツク確
保失敗等と表現する)。
In the WAIT / POST method, when the shared resource is being occupied by the task 1, the WAIT process that sets the task 2 that has failed to occupy the shared resource to a “waiting state”;
When the shared resource is released, the exclusive control of the exclusive use right of the shared resource is performed between the tasks by the POST process (notification process) for releasing the “waiting state” of the task 2 (hereinafter, the shared resource is shared in the present specification). To obtain the exclusive use right of the resource, take the lock, secure the lock right, etc. Also, express that the lock could not be taken because another task was in the exclusive use while trying to take the lock. Lock failure, failure to secure lock, etc.).

以下の説明で、「実行状態」とは、あるタスクがCPU
の使用権を得て実際に動作している状態をいい、「実行
可能状態」とは、CPUが塞がつているため実行できない
が、CPUが空きさえすればいつでも実行できうタスク状
態をいい、一方、「待ち状態」とは、共有リソースが空
いていないため、CPUが空いても実行できないタスク状
態をいう。また、共有リソースの使用権は、「占有使用
権」、「占有権」、又は「ロツク権」のように表現す
る。CPUの使用については単に「使用権」のように表現
する。
In the following description, "execution state" means that a task
Refers to the state in which it is actually operating with the right to use it, and the `` executable state '' refers to the task state that cannot be executed because the CPU is blocked, but can be executed at any time as long as the CPU is available, On the other hand, the “waiting state” refers to a task state that cannot be executed even if the CPU is vacant because the shared resource is not vacant. The right to use a shared resource is expressed as “exclusive use right”, “exclusive right”, or “lock right”. The use of the CPU is simply expressed as "right to use".

各タスクはロツク失敗するとWAIT処理ルーチンへ制御
を渡す。WAIT処理ルーチンはロツク失敗したタスクを
「待ち状態」にし、デイスパツチヤを呼び出す。デイス
パツチヤは、「待ち状態」となつたタスクを実行してい
たCPUに「実行可能状態」の別タスク(第3,第4,……の
タスク)を割り当てる。「実行可能状態」のタスクに
は、タスク毎にあらかじめ設定した実行優先順位に従
い、デイスパツチヤがCPUを割り当てる。また一方、各
タスク(今まで実行していたタスク)は共有リソース解
放(アンロツク)直前に「待ち状態」のタスク(WAITタ
スク)の有無を調べ、WAITタスクがあればPOST処理ルー
チンへ制御を渡す。POST処理ルーチンはWAITタスクを
「実行可能状態」に戻す。「実行可能状態」に戻つたタ
スクは、後にデイスパツヤによつてCPUを割り当てら
れ、共有リソース占有使用権を得て処理を再開する。
Each task transfers control to the WAIT processing routine when the lock fails. The WAIT processing routine puts the task whose lock failed into a "waiting state" and calls the dispatcher. The dispatcher assigns another task (third, fourth,...) In the “executable state” to the CPU executing the task in the “waiting state”. A dispatcher allocates a CPU to a task in the “executable state” according to an execution priority set in advance for each task. On the other hand, each task (the task that has been executed so far) checks whether there is a "waiting" task (WAIT task) immediately before releasing (unlocking) the shared resource, and if there is a WAIT task, passes control to the POST processing routine. . The POST processing routine returns the WAIT task to the “executable state”. The task that has returned to the “executable state” is assigned a CPU by the dispatcher later, and obtains the right to occupy shared resources, and resumes processing.

この様にWAIT・POST方式では、WAIT処理でロツク失敗
したタスクを「待ち状態」にし、POST処理でこのタスク
を「実行可能状態」に戻すことで排他制御を実現する。
以下、POST処理を起動するタスク(通常はそれまで実行
状態にあつたタスク)をPOST発行タスク、POST処理によ
り「待ち状態」を解除されるWAITタスクをPOST受理タス
クと呼ぶ(POST発行タスク、POST受理タスク、WAITタス
ク等は各タスクの固有名称ではない。各タスクがPOST発
行タスクになる場合もあれば、POST受理タスクになる場
合もある)。現在実用化されている多くの汎用計算機シ
ステムのスーパーバイザには、上記のPOST処理ルーチ
ン、WAIT処理ルーチンが組み込まれている。
As described above, in the WAIT / POST method, exclusive control is realized by setting a task whose lock failed in WAIT processing to a “waiting state” and returning the task to an “executable state” in the POST processing.
Hereinafter, the task that starts the POST process (the task that has been in the running state until now) is called the POST issue task, and the WAIT task that is released from the “waiting state” by the POST process is called the POST accept task (the POST issue task, POST (Receiving tasks, WAIT tasks, etc. are not unique names of each task. Each task may be a POST issuing task or a POST receiving task.) The above-described POST processing routine and WAIT processing routine are incorporated in supervisors of many general-purpose computer systems that are currently in practical use.

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

ところで、このWAIT・POST方式には以下の様な問題点
がある。
By the way, the WAIT / POST method has the following problems.

この問題を第10図により説明する。第10図は、従来方
式におけるロツク競合発生時のタスクの動作例を示すタ
イミング図であつて、時間軸は上から下に向かう方向で
ある。第10図は、3台のCPU1,2,3により、複数のタスク
1,2,3,4,5,……が実行される状況を示している。左下り
のハツチ部はタスク1、右下りのハツチ部はタスク2、
白枠部分は第3のタスク(タスク3〜5)、粗い梨地状
部分はいずれのタスクにも属さないスーパバイザ(タス
ク相互の橋渡しを行なう)部、細かい梨地状部分は、共
有リソースに対するロツク権(占有使用権)を示す。LO
CKはロツク処理、POSTはポスト処理、FALLはそこでのタ
スクによるロツク失敗、DISPはその下に示すタスクに対
するデイスパツチヤの処理を示す。
This problem will be described with reference to FIG. FIG. 10 is a timing chart showing an operation example of a task when a lock conflict occurs in the conventional method, and the time axis is a direction from top to bottom. Fig. 10 shows multiple tasks performed by three CPUs 1, 2, and 3.
1, 2, 3, 4, 5,... Are shown. The hatch that descends to the left is task 1, the hatch that descends to the right is task 2,
The white frame portion is the third task (tasks 3 to 5), the coarse satin portion is a supervisor (to bridge tasks) that does not belong to any task, and the fine satin portion is the locking right ( Exclusive use right). LO
CK indicates lock processing, POST indicates post processing, FALL indicates lock failure due to the task at that point, and DISP indicates dispatch processing for the task below.

最初に、タスク1はCPU1上でロツク権を得(時刻
t1)、次にタスク2はロツク失敗し(時刻t2)待ち状態
に入る。タスク1は、これをみて、共有リソースの使用
が終ると、ロツク権を手放しタスク2にPOST処理を発行
する(時刻t3)、これにより、タスク2は一応共有リソ
ースに対するロツク権(占有権)を獲得したことになる
が、その時CPUが空いていなため(CPUの使用権を有しな
いため)直ちに実行状態にはならない(実行可能状
態)。一方、実行可能状態の複数のタスクに優先順位が
あるため、CPUが空いたときデイスパツチされるタスク
は、必ずしも、今通知を受けたタスク2になる訳ではな
く、例えば、CPU2が空いたとき、優先順位の高いタスク
4が先にデイスパツチされ(時刻t5〜t6)実行される
(t6〜t7)ことがある。その場合は、タスク4が先に実
行されその処理が終つた後に、タスク2がデイスパツチ
され実行されることになる(時刻t7〜t8〜t9)。タスク
1によるタスク2に対するPOST処理からタスク2による
実行状態に移るまでの間に(時刻t3〜t8)、タスク3の
如き他のCPU上の別のタスクがロツク要求を発行しても
(時刻t4)、この間共有リソースはいずれのタスクも使
つていないのにあたかもロツクがかかつた状態になつて
いるためロツク失敗となる。
First, task 1 obtains the lock right on CPU1 (time
t 1 ), then task 2 fails to lock (time t 2 ) and enters a wait state. Upon seeing this, when the use of the shared resource ends, the task 1 releases the lock right and issues a POST process to the task 2 (time t 3 ), whereby the task 2 temporarily locks the shared resource (exclusive right). However, since the CPU is not available at that time (because it does not have the right to use the CPU), it does not immediately enter the execution state (executable state). On the other hand, since a plurality of tasks in the executable state have a priority, the task dispatched when the CPU becomes available does not necessarily become the task 2 that has just been notified. For example, when the CPU 2 becomes available, higher priority task 4 may be dispatching previously (time t 5 ~t 6) is performed (t 6 ~t 7). If so, task 4 after the process is executed first was Tsuitsu, so that the task 2 is being dispatching executed (time t 7 ~t 8 ~t 9). During the POST process by the task 1 to the task 2 to move to the execution state by task 2 (time t 3 ~t 8), even if another task on such tasks 3 other CPU issues a lock request ( At time t 4 ), the lock fails during this time because the lock is in a locked state even though the shared resource is not using any task.

また、タスク2にとつて、時刻t3でPOSTを受理して
も、他にタスク4のような高実行優先順位のタスクがあ
ると、このタスク4の処理が実行され終るまで、タスク
2はCPU使用権が得られないことになる。
Further, connexion and the task 2, even when receiving the POST at time t 3, the other has a high execution priority tasks, such as task 4, until the end processing of the task 4 is executed, the task 2 You will not be able to get CPU usage rights.

以上を要約すると、従来技術は次の課題1及び2の問
題点がある。
To summarize the above, the prior art has the following problems 1 and 2.

(課題1)POST発行タスク(この場合タスク1)がPOST
受理タスク(この場合タスク2)に対しPOST処理を開始
した後、POST受理タスクがデイスパツチヤによりCPUを
割り当てられて実行状態に移るまでの間、POST受理タス
ク以外のタスク(第3者のタスク3)が共有リソースを
使用できないため、全処理ステツプに対するロツク占有
ステツプの比率(ロツク占有率)が高くなり、システム
の性能が低下する。特にマルチ・プロセツサ・システム
では、POST発行タスクがPOST処理を開始した後、POST受
理タクスがデイスパツチヤによりCPUを割り当てられて
実行状態に移るまでの間、他プロセツサ上で実行中のタ
スクがロツク要求を発行するため、ロツク失敗率(ロツ
ク確保を試みて失敗する確率)が高くなり、POST処理・
WAIT処理のオーバーヘツドが増加する。
(Issue 1) POST issuance task (task 1 in this case) is POST
After starting the POST process for the accepting task (task 2 in this case), until the POST accepting task is assigned a CPU by the dispatcher and shifts to the execution state, a task other than the POST accepting task (task 3 of the third party). ) Cannot use the shared resource, the ratio of the lock occupation step to all the processing steps (lock occupancy) increases, and the performance of the system decreases. In particular, in a multi-processor system, after a POST issuing task starts POST processing, a task running on another processor will receive a lock request until the POST reception task is assigned to the CPU by the dispatcher and enters the execution state. The lock failure rate (probability of trying to secure the lock and fail) increases, and POST processing
WAIT processing overhead increases.

(課題2)POST受理タスクが待ち状態を解除されて実行
可能状態となつた時、POST受理タスク以外の高実行優先
順位タスクが先にデイスパツチされるために、POST受理
タスクが即座にCPU使用権を得られない場合がある(以
下、このように、共有リソースのロツク占有権は得られ
ても、CPUの使用権を得られない場合を「ロツク占有タ
スクの沈み込み」と呼ぶ)。ロツク占有タスクが沈み込
んだ状態で、他のタスクがロツク要求を発行すると必ず
ロツク失敗してしまい、POST処理・WAIT処理のオーバー
ヘツドが増加する。
(Issue 2) When the POST accepting task is released from the waiting state and becomes executable, the high-priority tasks other than the POST accepting task are dispatched first. There is a case where the lock occupation right of the shared resource is obtained but the right to use the CPU is not obtained (hereinafter, the case where the lock occupation task sinks). When the lock occupation task sinks and another task issues a lock request, the lock always fails and the overhead of the POST process and the WAIT process increases.

従つて、本発明の目的は、上記従来技術の問題点(課
題1及2)を解消し、POST受理タスクがデイスパツチヤ
によりCPUを割り当てられて実行状態に移るまでの間
に、第3者のタスクが共有リソースを使用できるように
して、ロツク失敗率を低減すると共に、ロツク占有タス
クの沈み込みを防止して更にロツク失敗をなくしたマル
チ・タスク方式のマルチ・プロセツサ・システムにおけ
るロツク制御のためのタスク制御方式を提供することに
ある。
Therefore, an object of the present invention is to solve the above-mentioned problems (problems 1 and 2) of the prior art, and to prevent the POST acceptance task from being assigned a CPU by the dispatcher and shifting to the execution state. For the purpose of lock control in a multi-task type multi-processor system in which a task can use a shared resource to reduce a lock failure rate and prevent a lock-occupied task from sinking to further eliminate a lock failure. And a task control method.

〔課題を解決するための手段〕[Means for solving the problem]

上記課題1を解決するため、本発明のタスク制御方式
は、つぎの解決手段1又は2のように構成する。
In order to solve the above problem 1, the task control method of the present invention is configured as the following means 1 or 2.

(解決手段1)POST発行タスクが該共有リソースの使用
を終了した時点で該共有リソースを解放し、他プロセツ
サ上で実行中の第3のタスクによる該共有リソースのロ
ツクを許可する手段と、しかる後、POST処理によつてPO
ST受理タスクを実行可能状態に遷移させる手段と、しか
る後、デイスパツチ処理によつてプロセツサ使用権を得
たPOST受理タスクが該共有リソースのロツク権確保をリ
トライ(再試行)する手段とを備えた構成とする。
(Solution 1) Means for releasing the shared resource when the POST issuing task finishes using the shared resource, and for permitting the third task running on another processor to lock the shared resource. After that, the PO processing
Means are provided for transitioning the ST acceptance task to the executable state, and thereafter, means for the POST acceptance task, which has obtained the processor use right by the dispatch processing, to retry (retry) securing the lock right of the shared resource. Configuration.

なお、この方式は、ロツク占有率を低く抑えることが
できるので、ロツク競合によるスループツト低下を起こ
しにくいという利点がある。しかし、POST受理タスクが
ロツクを確保する前に他のタスクにロツクを「横取り」
され、再度ロツク失敗する可能性がある。このため、同
一タスクが何回もリトライを繰返し、レスポンスがやや
低下するおそれがある。この問題は次の(解決手段2)
により解決される。
This method has an advantage in that the lock occupancy can be kept low, so that a decrease in throughput due to lock competition is unlikely to occur. However, before the POST receiving task secures the lock, it "steals" the lock to other tasks
And the lock may fail again. For this reason, the same task may repeat the retry many times, and the response may slightly decrease. The problem is as follows (Solution 2)
Is solved by

(解決手段2)POST発行タスクが該共有リソースの使用
を終了した時点で該共有リソースを解放し、他プロセツ
サ上で実行中の第3のタスクによる該共有リソースのロ
ツクを許可した後、POST処理によつてPOST受理タスクを
実行可能状態に遷移し、しかる後、デイスパツチ処理に
よつてプロセツサ使用権を得たPOST受理タスクが該共有
リソースのロツク権確保をリトライする第1のロツク制
御方式と、 POST発行タスクが該共有リソースの使用を終了した時
点で該共有リソースのロツク権をPOST受理タスクへ直接
譲渡し、POST処理によつてPOST受理タスクを実行可能状
態に遷移させた後、デイスパツチ処理によつてプロセツ
サ使用権を得たPOST受理タスクが該共有リソースのロツ
ク権を解放するまでの間、POST受理タスク以外のタスク
による該共有リソースのロツクを禁止する第2のロツク
制御方式とを含み、 前記第1のロツク制御方式と第2のロツク制御方式と
を動的に切り替える切り替え手段を設ける構成とする。
(Solution 2) When the POST issue task finishes using the shared resource, the shared resource is released, and after the third task running on another processor locks the shared resource, the POST processing is performed. A first lock control method in which the POST receiving task transits to the executable state according to the above, and then the POST receiving task that has obtained the right to use the processor by the dispatch processing retries to secure the right to lock the shared resource; and When the POST issuing task finishes using the shared resource, the lock right of the shared resource is directly transferred to the POST accepting task, and the POST accepting task is shifted to the executable state by the POST process, and then the dispatching process is performed. Therefore, until the POST receiving task that has obtained the right to use the processor releases the locking right of the shared resource, the shared resource by a task other than the POST receiving task is released. And a second lock control method for prohibiting lock, and be provided with a switching means for dynamically switching between the first lock control method and a second lock control system.

具体的には、POST受理タスクのリトライ回数を計数
し、このリトライ回数が所定の上限値未満ならば、前記
第1のロツク制御を行い、リトライ回数が所定の上限値
以上に達すると、前記第2のロツク制御を行う構成とす
る。つまり、基本的には上記解決手段1の方式を採り入
れるが、POST受理タスクが何回もロツク権要求しても獲
得できないときや、特定のリソースを用いるときには、
ロツク権をPOST受理タスクに渡す方式である。
Specifically, the number of retries of the POST acceptance task is counted, and if the number of retries is less than a predetermined upper limit, the first lock control is performed. 2 to perform the lock control. In other words, basically, the method of the above-mentioned solution 1 is adopted. However, when the POST acceptance task cannot acquire the lock right even if it requests the lock right many times, or when the specific resource is used,
In this method, the lock right is passed to the POST acceptance task.

次に、上記課題2を解決するため、本発明のタスク制
御方式は、つぎの解決手段3,4、及び5のように構成す
る。
Next, in order to solve the above problem 2, the task control method of the present invention is configured as the following solving means 3, 4, and 5.

(解決手段3)POST処理によるPOST受理タスクの待ち状
態解除後、POST発行タスクの実行を中断し、POST発行タ
スクが走行していたプロセツサをPOST受理タスクに割り
当てるように構成する。
(Solution 3) After the waiting state of the POST accepting task is released by the POST process, the execution of the POST issuing task is interrupted, and the processor on which the POST issuing task is running is assigned to the POST accepting task.

(解決手段4)WAIT処理によつてPOST受理タスクが待ち
状態に遷移する前に、POST受理タスクの実行優先順位を
高める優先順位変更を行ない、このPOST受理タスクの共
有リソース解放時に前記変更を施した実行優先順位を復
元するように構成する。
(Solution 4) Prior to the transition of the POST accepting task to the waiting state by the WAIT processing, the priority is changed to increase the execution priority of the POST accepting task, and the change is performed when the shared resources of the POST accepting task are released. It is configured to restore the execution priority that has been set.

(解決手段5)POST発行タスクがPOST処理によつてPOST
受理タスクの待ち状態を解除する前に、POST受理タスク
の実行優先順位を高める優先順位変更を行ない、このPO
ST受理タスクの共有リソース解放時に前記変更を施した
実行優先順位を復元するように構成する。
(Solution 5) The POST issuance task performs the POST by the POST processing.
Before releasing the waiting state of the receiving task, change the priority order to increase the execution priority of the POST receiving task.
When the shared resource of the ST acceptance task is released, the changed execution priority is restored.

〔作用〕[Action]

上記構成に基ずく本発明の作用を従来方式と対比して
説明する。なお、この作用については、後で〔実施例〕
のところで、第10図〜第13図によつて詳細に説明する。
The operation of the present invention based on the above configuration will be described in comparison with a conventional system. This operation will be described later (Example).
The details will be described with reference to FIGS. 10 to 13.

まず(解決手段1)の作用について説明する。従来方
式では、さきに第10図により説明したように、待ち状態
となつたタスク2が、タスク1によつてPOSTされて、CP
U2で再び実行状態となるまでの期間に、CPU3上で実行中
のタスク3がロツク失敗してしまう。これに対し、本発
明の(解決手段1)の方式では、タスク1がPOST処理開
始前に共有リソースを解放するまで、待ち状態となつた
タスク2が、タスク1によつてPOSTされて、CPU1で再び
実行状態となるまでの期間に、CPU3上で実行中のタスク
3が共有リソースをロツクできる。このためWAIT処理、
POST処理の回数を減らすことができる(詳細は第11図に
より後述する)。
First, the operation of (Solution 1) will be described. In the conventional method, as described earlier with reference to FIG. 10, the task 2 in the waiting state is POSTed by the task 1 and the
During the period until the state becomes the execution state again at U2, the task 3 being executed on the CPU 3 fails to lock. On the other hand, in the method of (Solution 1) of the present invention, the task 2 in the waiting state is POSTed by the task 1 until the task 1 releases the shared resource before the POST processing starts, and the CPU 1 Then, the task 3 running on the CPU 3 can lock the shared resource until the state becomes the execution state again. For this reason, WAIT processing,
The number of times of the POST process can be reduced (details will be described later with reference to FIG. 11).

次に(解決手段2)の作用について説明する。上述の
(解決手段1)の方式では、待ち状態となつたタスク2
が、タスク1によつてPOSTされて実行状態に戻つた後、
再びロツク失敗する可能性がある。最悪の場合、タスク
2が無限にリトライを繰り返すことになる。そこで、タ
スク2のリトライ回数を計数し、このリトライ回数が所
定の上限値を越えた場合は、POST処理開始前に共有リソ
ースを解放しないで、POSTされて実行状態に戻つたタス
ク2が確実にロツク権を得るようにロツク制御を切り替
える。
Next, the operation of (Solution 2) will be described. According to the above-mentioned (solution 1), the task 2 in the waiting state
Is returned by POST by task 1 to the execution state.
The lock may fail again. In the worst case, the task 2 repeats infinitely. Therefore, the number of retries of task 2 is counted, and if the number of retries exceeds a predetermined upper limit, the task 2 that has been POST and returned to the execution state without releasing the shared resource before the start of the POST process is surely performed. The lock control is switched to obtain the lock right.

次に(解決手段3〜5)の作用について説明する。従
来方式では、タスク1によつてPOSTされたタスク2がデ
イスパツチされるまでの期間に、CPU1上で実行中のタス
ク1やCPU2上で実行中のタスク3がロツク失敗してい
る。これに比べ、本発明の(解決手段3〜5)の方式で
は、POST処理の後、タスク2を優先的にデイスパツチし
てCPU1上で実行しているので、POST処理開始からタスク
2がデイスパツチされるまでの期間を短縮でき、他タス
クのロツク失敗を少なくできる。
Next, the operation of (Solutions 3 to 5) will be described. In the conventional system, the task 1 running on the CPU 1 and the task 3 running on the CPU 2 have failed in locking until the task 2 POSTed by the task 1 is dispatched. In contrast, in the method of (Solutions 3 to 5) of the present invention, after POST processing, task 2 is preferentially dispatched and executed on CPU 1, so task 2 is dispatched from the start of POST processing. The time required to complete the task can be reduced, and lock failures of other tasks can be reduced.

〔実施例〕 以下、本発明の一実施例を第1図から第9図を使つて
説明する。本実施例は、オンライン・データベース・シ
ステムの例である。
[Embodiment] An embodiment of the present invention will be described below with reference to FIGS. This embodiment is an example of an online database system.

本発明のロツク制御方式のためのタスク制御方式につ
いて述べる前に、本実施例の適用されるオンライン・デ
ータベース・システムの概略を説明する。なお、本発明
はオンラインシステムに限らず、マルチ・タスク方式の
マルチプロセツサ・システム全般に適用できる。第7図
は、システムの構成概略を表わす。CPU1とCPU2(101お
よび102)を共有メモリ103を介して結合する。2つのCP
Uは各々メモリ上のプログラムを動作させ、メモリ上の
データを参照して、並列に処理を行なうことができる。
各CPUは、通信制御装置104を介して、端末装置105とデ
ータの送受を行なうことができる。また、各CPUはデイ
スク制御装置106を介して、デイスク上のデータベース1
07へアクセスできる。
Before describing a task control method for the lock control method of the present invention, an outline of an online database system to which the present embodiment is applied will be described. Note that the present invention is not limited to the online system, but can be applied to general multi-processor multiprocessor systems. FIG. 7 shows a schematic configuration of the system. CPU1 and CPU2 (101 and 102) are connected via a shared memory 103. Two CP
Each U operates a program on a memory, and can execute processing in parallel with reference to data on the memory.
Each CPU can transmit and receive data to and from the terminal device 105 via the communication control device 104. In addition, each CPU communicates with the database 1 on the disk via the disk controller 106.
You can access 07.

以下本明細書では、オンライン・データベース・シス
テムでの一まとまりのデータ参照・更新処理をトランザ
クシヨンと呼ぶ。例えば、「預金の引出し要求に対し、
預金残高を確認し、預金残高から引出し額を差引き、デ
ータベース内の預金残高を更新する」といつた一連の処
理をトランザクシヨンと呼ぶ。トランザクシヨンは、端
末装置からのデータ送信を契機として開始する。
Hereinafter, in this specification, a set of data reference / update processing in an online database system is referred to as a transaction. For example, "In response to a withdrawal request,
The process of checking the deposit balance, subtracting the withdrawal amount from the deposit balance, and updating the deposit balance in the database "is called a transaction. The transaction starts when data is transmitted from the terminal device.

次にタスクの基本的な管理方法について説明する。ト
ランザクシヨンが入力されると、スーパーバイサがこの
トランザクシヨンに対応する1個以上のタスクを生成す
る。具体的には、スーパーバイザがタスクの生成時にタ
スク毎に制御情報を格納したTCB(Task Control Bloc
k)を作成し、これらのTCBをトランザクシヨンの終了時
まで第9図に示すタスクキユー140に登録して管理す
る。タスクキユーに登録中の各タスクは、「待ち状
態」、「実行可能状態」、または「実行状態」のいずれ
かの状態をとる。「待ち状態」のタスクは、待ちの原因
となつている事象を完了し、「実行可能状態」となるま
でCPUを割り付けられない。「実行可能状態」のタスク
は、システム内のいずれかのCPUが空き次第、CPUを割り
付けて「実行状態」に遷移させることが可能である。
「実行状態」のタスクとはCPU使用権を得て実行中のタ
スクである。「実行可能状態」のタスクが複数ある場合
には、タスク毎に割り当てた実行優先順位に従つて、デ
イスパツチヤがCPUを割り付ける。タスクキユー140は、
タスクキユー先頭ポインタ141、タスクキユー末尾ポイ
ンタ142、および0個以上のTCB143のチエインで構成す
る。TCBは以下のフイールドから構成する(第2図)。
Next, a basic task management method will be described. When a transaction is input, the supervisor creates one or more tasks corresponding to this transaction. Specifically, the TCB (Task Control Block) in which the supervisor stores control information for each task when the task is created
k) is created, and these TCBs are registered and managed in the task queue 140 shown in FIG. 9 until the end of the transaction. Each task registered in the task queue takes one of a “waiting state”, an “executable state”, and an “executing state”. A task in the "waiting state" completes the event causing the waiting state and cannot allocate a CPU until the task becomes "executable state". The task in the “executable state” can assign a CPU and transition to the “executable state” as soon as any CPU in the system becomes available.
A task in the “running state” is a task that is executing with the right to use the CPU. When there are a plurality of tasks in the “executable state”, the dispatcher allocates a CPU according to the execution priority assigned to each task. The task queue 140
It is composed of a task queue start pointer 141, a task queue end pointer 142, and a chain of zero or more TCBs 143. The TCB consists of the following fields (Fig. 2).

(1)タスク状態401 タスクの状態(待ち状態、実行可能状態、または実行
状態)を格納する。
(1) Task state 401 The task state (waiting state, executable state, or execution state) is stored.

(2)実行優先順位402 該タスクに割り当てた実行優先順位を格納する。(2) Execution priority 402 The execution priority assigned to the task is stored.

(3)次TCBポインタ403 TCBをチエインしてタスクキユーを構成する際、次のT
CBアドレスを格納する。タスクキユー末尾のTCBの場合
は本フイールドは0を格納する。
(3) When configuring the task queue by chaining the next TCB pointer 403 TCB,
Stores the CB address. In the case of the TCB at the end of the task queue, this field stores 0.

(4)タスク情報退避領域404 タスクの実行を中断する場合に、該タスクの再開がで
きるように、PSW(プログラム状態語)、レジスタ等の
内容を退避するために用いる。
(4) Task information save area 404 Used to save the contents of a PSW (program state word), register, and the like so that when the execution of a task is suspended, the task can be resumed.

次に本発明のロツク競合の制御方式について説明す
る。以下、本実施例のオンライン・データベース・シス
テムではロツク競合の対象となる共有リソースはひとつ
のデータベースのみと仮定する。即ち、共有リソースが
単一と仮定する。また、各トランザクシヨンによつて生
成されるタスクも単一とする。即ち、トランザクシヨン
とタスクとの間に1対1の対応が成り立つ場合を考え
る。これらの仮定によつて、本発明の方式の利点は失わ
れない。
Next, a lock contention control method according to the present invention will be described. Hereinafter, in the online database system of the present embodiment, it is assumed that the shared resource subject to lock contention is only one database. That is, it is assumed that there is a single shared resource. In addition, a single task is generated by each transaction. That is, a case is considered where a one-to-one correspondence is established between a transaction and a task. With these assumptions, the advantages of the inventive scheme are not lost.

まず、第1図を用いて本発明のロツク制御、タスク制
御方式の概略について説明する。各タスクは共有リソー
スをロツクする場合、LOCKマクロ551を発行し、ロツク
処理ルーチン500を呼び出す。必要な共有リソースが他
タスクによつて占有使用中の為に確保できない場合、ロ
ツク制御方式の切替え判定(処理502)に従い、ロツク
制御方式の切替え処理(503)を行い、POST処理開始前
に共有リソースを解放する第1のロツク制御方式か、PO
ST処理開始前に共有リソースを解放しない第2のロツク
制御方式かを選択する。次に、スーパーバイザ内のWAIT
処理ルーチン510を呼出して(504)LOCKマクロを発行し
たタスクを「待ち状態」にする(処理511)。この場
合、スーパーバイザ内のデイスパツチヤ530が他の「実
行可能状態」のタスクにCPUを割当てる(処理531,53
2)。CPUを割当てられたタスクは「実行状態」となり、
割込み等によりCPU使用権を奪われるまで処理を継続す
る。一方、「待ち状態」となつたタスクはPOST処理によ
つて「実行可能状態」に戻されるまで「待ち状態」を継
続する。
First, an outline of the lock control and task control method of the present invention will be described with reference to FIG. When each task locks a shared resource, it issues a LOCK macro 551 and calls a lock processing routine 500. If the required shared resources cannot be secured because they are being occupied by another task, the lock control method switching process (503) is performed according to the lock control method switch determination (process 502), and shared before the POST process starts. The first lock control method to release resources or PO
Selects the second lock control method that does not release shared resources before the start of ST processing. Next, WAIT in the supervisor
The processing routine 510 is called (504), and the task which has issued the LOCK macro is set to the "waiting state" (processing 511). In this case, the dayspatcher 530 in the supervisor allocates the CPU to another task in the "executable state" (processing 531 and 53).
2). The task to which the CPU is assigned is in the "running state",
Processing continues until CPU usage is deprived by an interrupt or the like. On the other hand, the task in the “waiting state” continues in the “waiting state” until the task is returned to the “executable state” by the POST process.

一方、共有リソースを占有使用していたタスクは、共
有リソースをアンロツクする場合、UNLKマクロ552を発
行し、アンロツク処理ルーチン520を呼び出す。アンロ
ツク処理ルーチンでは、待ち状態のタスクがあるかどう
か調べる(処理521)。もし、待ち状態のタスクがあれ
ば、ロツク制御方式の切替え処理(503)により、いず
れのロツク制御方式が選択されているか判定する(処理
522)。POST処理開始前に共有リソースを解放する第1
のロツク制御方式が選択されていれば、共有リソースを
解放し(処理523)、WAITタスクに共有リソース解放を
通知する為にPOST処理ルーチンを呼び出す(524)。POS
T処理開始前に共有リソースを解放しない第2のロツク
制御方式が選択されていれば、共有リソースを解放しな
いで、WAITタスクに共有リソース解放を通知する為にPO
ST処理ルーチンを呼び出す(524)。
On the other hand, when the task that has exclusively used the shared resource unlocks the shared resource, it issues the UNLK macro 552 and calls the unlock processing routine 520. In the unlock processing routine, it is checked whether or not there is a task waiting (process 521). If there is a task in a waiting state, it is determined which lock control method is selected by the lock control method switching processing (503) (processing
522). First to release shared resources before POST processing starts
If the lock control method is selected, the shared resource is released (process 523), and the POST processing routine is called to notify the shared resource release to the WAIT task (524). POS
If the second lock control method that does not release the shared resource before the start of the processing is selected, the PO is used to notify the WAIT task of the release of the shared resource without releasing the shared resource.
The ST processing routine is called (524).

POST処理ルーチン540は、POST発行タスクを「実行状
態」から「実行可能状態」に移し、POST受理タスクを
「待ち状態」から「実行可能状態」に移す(処理54
1)。ロツク制御方式の切替え処理(503)により、いず
れのロツク制御方式が選択されているか判定する(処理
542)。第1のロツク制御方式が選択されていれば、デ
イスパツチヤ530を呼び出す(処理544)。第2のロツク
制御方式が選択されていれば、POST受理タスクに優先的
にCPUを割り当てる(処理543,532)。CPU使用権を与え
られたPOST受理タスクは、共有リソースを占有して処理
を再開することができる。
The POST processing routine 540 shifts the POST issuing task from the “executing state” to the “executable state”, and shifts the POST receiving task from the “waiting state” to the “executable state” (processing 54
1). In the lock control system switching process (503), it is determined which lock control system is selected (processing
542). If the first lock control method has been selected, the dispatcher 530 is called (step 544). If the second lock control method is selected, the CPU is preferentially assigned to the POST accepting task (processing 543, 532). The POST accepting task given the right to use the CPU can occupy the shared resource and resume processing.

以上、WAITタスクがひとつの場合について説明してき
たが、一般にはWAITタスクが複数存在し得るので、WAIT
タスク用の待ち行列(WAITキユー130)を用いる。ロツ
ク失敗したタスクは、WAITマクロを発行してWAIT処理ル
ーチンをコールする前に、LRB(Lock Request Blockの
略)を作成してWAITキユーにチエインする。また、各タ
スクは共有リソースを解放する前に、WAITキユーを参照
して待ち状態のタスクがあるかどうか調べる。もし、待
ち状態のタスクがあれば、即ち、WAITキユーに1個以上
LRBがチエインしていれば、先頭の(時間的に最も古
い)LRB(第7図と第8図で最も左側のLRB132)をWAIT
キユーから取り出し、このLRBに対応するWAITタスクに
対して共有リソース解放を通知するPOSTマクロを発行す
る。
The case where there is only one WAIT task has been described above. However, in general, there may be a plurality of WAIT tasks.
A task queue (WAIT Queue 130) is used. Before issuing the WAIT macro and calling the WAIT processing routine, the task that failed the lock creates an LRB (abbreviation of Lock Request Block) and chains it to the WAIT queue. Before releasing the shared resource, each task refers to the WAIT queue to check whether there is a task waiting. If there are waiting tasks, that is, one or more tasks in the WAIT queue
If the LRB is chained, the first (oldest in time) LRB (leftmost LRB 132 in FIGS. 7 and 8) is WAIT
Take out from the queue and issue a POST macro that notifies the WAIT task corresponding to this LRB of the release of shared resources.

次に、このWAITキユー130および管理ブロツクのデー
タ構造について第3〜4図及び第7〜8図により説明す
る。WAITキユーは共有メモリ103上に設け、システム内
の各タスクからアクセス可能とする。WAITキユーは、各
共有リソース毎にひとつ設ける。本実施例では、前述の
とおり共有リソースが単一の場合を考えているので、WA
ITキユーはシステム内に唯一である。WAITキユーは、ひ
とつのWCB(WAIT Control Blockの略)131と各タスク毎
に設けた0個以上のLRB132から構成する。第3図〜第4
図にWCBとLRBの構造を示す。
Next, the data structure of the WAIT queue 130 and the management block will be described with reference to FIGS. 3 and 4 and FIGS. The WAIT queue is provided on the shared memory 103 and can be accessed from each task in the system. One WAIT queue is provided for each shared resource. In this embodiment, as described above, the case where the shared resource is single is considered.
The IT queue is the only one in the system. The WAIT queue is composed of one WCB (abbreviation of WAIT Control Block) 131 and zero or more LRBs 132 provided for each task. Figures 3-4
Figure shows the structure of WCB and LRB.

WCBには以下の情報を格納する。 The following information is stored in the WCB.

(1)WAITキユー・ロツクワード301 WCB自身の更新の排他制御に用いる。(1) WAIT queue lock word 301 Used for exclusive control of updating of the WCB itself.

当WCBが占有中はロツクキーを格納し、解放中は0を
格納する。
When this WCB is occupied, the lock key is stored, and when it is released, 0 is stored.

(2)リソース・ロツクワード302 排他制御の対象となる共有リソースの占有状態を表わ
す。共有リソースが占有中はロツクキーを格納し、解放
中は0を格納する。
(2) Resource Lockword 302 Indicates the occupation state of a shared resource subject to exclusive control. The lock key is stored when the shared resource is occupied, and 0 is stored when the shared resource is released.

(3)WAITキユー先頭ポインタ303 WAITキユー先頭のLRBのアドレスを格納する。WAITキ
ユーが空の場合は0を格納する。
(3) WAIT queue head pointer 303 Stores the address of the LRB at the head of the WAIT queue. If the WAIT queue is empty, 0 is stored.

(4)WAITキユー末尾ポインタ304 WAITキユー末尾のLRBのアドレスを格納する。WAITキ
ユーが空の場合は0を格納する。
(4) WAIT queue end pointer 304 Stores the address of the LRB at the end of the WAIT queue. If the WAIT queue is empty, 0 is stored.

(5)最大リトライ回数(MAX-RETRY-COUNT)305 WAITキユー中のLRB中のリトライ回数の最大値を示
す。
(5) Maximum number of retries (MAX-RETRY-COUNT) 305 Indicates the maximum value of the number of retries in the LRB during the WAIT queue.

(6)リトライ上限値(RETRY-LIMIT)306 ロツク失敗回数の上限値を示す正整数。(6) Retry upper limit (RETRY-LIMIT) 306 A positive integer indicating the upper limit of the number of lock failures.

(7)占有タスクTCBポインタ307 共有リソースを占有中のタスクのTCBアドレスを格納
する。共有リソースが解放中は当フイールドは意味を持
たない。
(7) Occupied task TCB pointer 307 The TCB address of the task occupying the shared resource is stored. This field has no meaning while the shared resource is released.

LRB132には以下の情報を格納する。 The following information is stored in the LRB 132.

(1)ECB(Event Control Block)311 一般にWAIT・POST方式においてPOST発行タスクとWAIT
タスクの間で、待ち事象の発生・未発生を管理する制御
情報である。POSTビツト312が0の時は事象未発生、1
の時は事象発生完了を示す。WAIT、1の時はWAIT中を示
す。本実施例では、共有リソースの解放を通知する為に
用いる。また、ECB内のPOSTコード・フイールド314を用
いてPOST発行タスクからPOST受理タスクへロツクキーを
渡す。
(1) ECB (Event Control Block) 311 In general, POST issue task and WAIT in WAIT / POST method
This is control information for managing occurrence / non-occurrence of a wait event between tasks. No event occurred when POST bit 312 is 0, 1
Indicates that the event has occurred. WAIT 1 indicates WAIT. In this embodiment, it is used to notify the release of the shared resource. The lock key is passed from the POST issuing task to the POST receiving task using the POST code field 314 in the ECB.

(2)リトライ回数(RETRY-COUNT)315 当タスクが何回ロツク失敗したかを示すカウンタであ
る。ロツクが確保できると0クリアする。
(2) Retry count (RETRY-COUNT) 315 This counter indicates how many times the task has failed. When the lock is secured, it is cleared to zero.

(3)次LRBポインタ316 LRBをチエインしてWAITキユーを構成する際、次のLRB
のアドレスを格納する。
(3) When configuring the WAIT queue by chaining the next LRB pointer 316 LRB, the next LRB pointer
Stores the address of

(4)WAITタスクTCBポインタ317 当LRBに対応するWAITタスクのTCBアドレスを格納す
る。
(4) WAIT task TCB pointer 317 Stores the TCB address of the WAIT task corresponding to this LRB.

次に共有リソースのロツク処理、及びアンロツク処理
のアルゴリズムについて説明する。尚、以下の説明では
リソース・ロツクワード302を単にロツクワードと呼
ぶ。
Next, a description will be given of an algorithm of the lock processing and the unlock processing of the shared resource. In the following description, the resource lock word 302 is simply called a lock word.

共有リソース占有時は占有しているタスクのTCBアド
レスをロツクワードに格納し、非占有時は0をロツクワ
ードに格納する。TCBは各タスクに対応して生成するの
で、タスクの識別情報IDとしてTCBアドレスを用いる。
以下、ロツクキーとして、このTCBアドレスを用いると
する。
When the shared resource is occupied, the TCB address of the occupied task is stored in the lock word, and when not occupied, 0 is stored in the lock word. Since the TCB is generated for each task, the TCB address is used as the task identification information ID.
Hereinafter, this TCB address is used as a lock key.

まず、第5図を用いてロツク処理を説明する。まず、
判定処理701によつて、他タスクからPOSTされた後、即
ち「待ち状態」の後か否かの判定を行なう。これはECB1
32内のPOSTビツト312が0か1かにより判定できる。も
し、POSTされた後ならば、レジスタ1(R1)に旧ロツク
キー、即ちECB132内のPOSTコード314をロードする(処
理702)。POSTコードにはPOST発行タスクの識別情報ID
(POST発行タスクのTCBアドレス)が格納されている。
そうでなければ、レジスタ1に0をロードする(処理70
3)。次に、レジスタ2(R2)に新ロツクキー、即ち自
タスクの識別情報ID(自タスクのTCBアドレス)をロー
ドする(処理704)。判定処理705はCS命令を用いて次の
様に行なう。
First, the lock processing will be described with reference to FIG. First,
According to the determination processing 701, it is determined whether or not a POST has been made by another task, that is, after a “waiting state”. This is ECB1
It can be determined by whether the POST bit 312 in 32 is 0 or 1. If the POST has been performed, the old lock key, that is, the POST code 314 in the ECB 132 is loaded into the register 1 (R1) (process 702). In the POST code, the identification information ID of the POST issuance task
(TCB address of the POST issuing task) is stored.
Otherwise, load 0 into register 1 (step 70
3). Next, the new lock key, that is, the identification information ID of the own task (TCB address of the own task) is loaded into the register 2 (R2) (process 704). The determination process 705 is performed as follows using the CS instruction.

CS R1,R2,LOCKWORD この命令は、レジスタ1の内容である旧ロツクキーと
ロツクワード302の値を比較し、もし等しければ、ロツ
クワードの値をレジスタ2の内容である新ロツクキーで
置換する(ロツク成功)。前記の比較の結果が等しくな
い場合は、ロツクワードの置換を行なわない(ロツク失
敗)。CS命令の機能の重要な点は、上記のロツクワード
の読み出しから、比較、更新の間、他のCPUによるロツ
クワードへのアクセスを禁止できる事である。これによ
つて、共有リソースが非占有状態の場合、あるいは、PO
ST発行タスクからPOSTコードとして渡された旧ロツクキ
ーの値がロツクワードの現在(即ちCS命令実行時)の値
に等しい場合以外は、ロツク処理を試みたタスクはロツ
ク失敗となる。
CS R1, R2, LOCKWORD This instruction compares the old lock key, which is the content of register 1, with the value of the lock word 302, and if equal, replaces the value of the lock word with the new lock key, which is the content of register 2 (lock succeeded). . If the results of the above comparisons are not equal, no lock word replacement is performed (lock failure). An important point of the function of the CS instruction is that access to the lock word by other CPUs can be prohibited during the above-described read, comparison, and update of the lock word. As a result, when the shared resource is not occupied, or when the PO
Unless the value of the old lock key passed as the POST code from the ST issuing task is equal to the current value of the lock word (that is, at the time of executing the CS instruction), the task that attempted the lock processing fails in lock.

判定処理705によつて、ロツク成功となつた場合は、
処理706でリトライ回数315を0に戻しロツク処理完了と
なる。ロツク失敗した場合、リトライ回数を1増加し
(処理707)、LRBを作成し(始めてロツク失敗したと
き)又はLRBのリトライ回数を更新し(715)、WAITキユ
ー130をロツクする(処理708)。他タスクがWAITキユー
をロツク中は、他タスクの処理が完了するまでループし
て待つ(708a)。WAITキユーがロツクできたら、リトラ
イ回数315と最大リトライ回数(WAITキユーのチエーン
中でリトライした回数が最大のもの)305を比較する
(処理709)。
If the lock is successful according to the determination process 705,
In processing 706, the number of retries 315 is returned to 0, and the lock processing is completed. If the lock fails, the number of retries is increased by one (process 707), an LRB is created (when the lock fails for the first time) or the number of retries of the LRB is updated (715), and the WAIT queue 130 is locked (process 708). While the other task is locking the WAIT queue, it loops and waits until the processing of the other task is completed (708a). If the WAIT queue is locked, the number of retries 315 and the maximum number of retries (the number of retries in the WAIT queuing chain that is the largest) 305 are compared (processing 709).

リトライ回数≧最大リトライ回数 ならば最大リトライ回数を今回のリトライ回数に更新
し(処理710)、WAITキユー先頭へ(最優先位置へ)自
タスクのLRBをチエインする(処理711)。
If the number of retries ≧ the maximum number of retries, the maximum number of retries is updated to the current number of retries (processing 710), and the LRB of the invoking task is chained to the head of the WAIT queue (to the highest priority position) (processing 711).

リトライ回数<最大リトライ回数 ならばWAITキユー末尾へ自タスクのLRBをチエインす
る(処理712)。WAITキユーの更新中(WAITキユーをチ
エーンに繋いだり、チエンからはずしたり、カウンタを
書き替える処理中)は、WAITキユーに他のプロセサから
入れないように、WAITキユー自体ロツクされているが、
LRBのWAITキユーへのチエインが完了したらWAITキユー
を解放し(713)、WAITマクロを呼び出す(処理714)。
WAITマクロを発行したタスクは「待ち状態」となり、PO
STされるまで「待ち状態」を継続する。POSTされると再
度処理701に戻り、ロツク確保を試みる。
If the number of retries <the maximum number of retries, the LRB of the invoking task is chained to the end of the WAIT queue (processing 712). While the WAIT queue is being updated (during the process of connecting the WAIT queue to the chain, removing it from the chain, and rewriting the counter), the WAIT queue itself is locked so that it cannot be entered from other processors.
When the chain of the LRB to the WAIT queue is completed, the WAIT queue is released (713), and the WAIT macro is called (process 714).
The task that issued the WAIT macro enters "Waiting state" and the PO
Continue "waiting" until ST is performed. When POST is performed, the process returns to the process 701 again to try to secure the lock.

尚、ECB311の初期化(POSTビツト312のクリア)は処
理702の直後に行なう。又、処理711および処理712で
は、WAITキユーのロツク時間短縮のため、WAITキユー先
頭ポインタ303、WAITキユー末尾ポインタ303を使用し、
WAITキユーをサーチする処理は行なわない。又、WAITキ
ユーをロツク中は割込タスクとのデツドロツク防止のた
め、割込禁止とする。
The initialization of the ECB 311 (clearing of the POST bit 312) is performed immediately after the process 702. In steps 711 and 712, the WAIT queue start pointer 303 and the WAIT queue end pointer 303 are used to reduce the lock time of the WAIT queue.
The process of searching for the WAIT queue is not performed. While the WAIT queue is locked, interrupts are prohibited to prevent deadlock with the interrupt task.

次に第6図を用いてアンロツク処理を説明する。第6
図は、第1図のアンロツク処理520の部分を詳細に示す
ものである。アンロツク処理では、まずWAITキユーをロ
ツクする(処理801)。他タスクがWAITキユーを占有中
は、ロツクできるまでループして待つ。WAITキユーがロ
ツクできたら、WAITキユーが空か否か、即ち、共有リソ
ースの解放を待つているタスクの有無をチエツクする
(処理802)。もし、WAITタスクがなければ、WAITキユ
ーおよび共有リソースを解放する(処理803〜804)。WA
ITキユー、共有リソースの解放は、ロツクワード(301
及び302)に0を書き込む事で行なう。
Next, the unlocking process will be described with reference to FIG. Sixth
The figure shows in detail the part of the unlocking process 520 of FIG. In the unlock processing, first, the WAIT queue is locked (processing 801). While another task is occupying the WAIT queue, it loops and waits until it can be locked. When the WAIT queue is locked, it is checked whether the WAIT queue is empty, that is, whether there is a task waiting for release of the shared resource (process 802). If there is no WAIT task, the WAIT queue and the shared resources are released (processes 803 to 804). WA
IT ku, release of shared resources, lock word (301
And 302) by writing 0.

WAITタスクがある場合は、まず最大リトライ回数305
とリトライ上限値(予じめ設定した値で、この値を境に
制御を切換える)306を比較する(処理805)。
If there is a WAIT task, the maximum retry count is 305 first.
Then, the retry upper limit value (the value is set in advance and the control is switched on the basis of this value) 306 is compared (process 805).

最大リトライ回数<リトライ上限値 ならば、即ち、失敗回数が上限値に達していなけれ
ば、共有リソースを解放し(処理807)、POSTコード314
に0をセツトする(処理808)。
If the maximum number of retries <the retry upper limit value, that is, if the number of failures has not reached the upper limit value, the shared resource is released (processing 807), and the POST code 314 is issued.
Is set to 0 (process 808).

最大リトライ回数≧リトライ上限値 ならば、即ち、失敗回数が上限値に達していれば、PO
STコードに現ロツクキー、即ち、現ロツク権占有タスク
(現在ロツク権を占有中のタスク)の識別情報(TCBア
ドレス307)をセツトする(処理806)。次にWAITキユー
先頭のLRB(前記最大リトライ回数を有するタスクに相
当)を取り出し(処理809)、最大リトライ回数305を更
新し(処理811または812)、WAITキユーを解放し(処理
813)、処理809にて取り出したLRBに対応するタスク
に、POSTマクロを発行し(処理814)、共有リソースの
解放を通知する。この時、処理806または処理808でセツ
トしたPOSTコードをPOST受理タスクへ渡す。このPOSTコ
ードは、処理702または703(第5図)によつてPOST受理
タスクが受け取る。この機構により、ロツク失敗回数が
上限値未満の場合は、処理807によつて解放した共有リ
ソースは、POST受理タスクとそれ以外のタスクの間で
「早い者勝ち」で争われる。しかし、ロツク失敗回数が
上限値以上になつた場合、POST発行タスクでの共有リソ
ースの解放は行なわず、POST受理タスクへ直接ロツク権
を渡す。
If the maximum number of retries ≥ upper limit of retry, that is, if the number of failures has reached the upper limit, PO
The current lock key, that is, the identification information (TCB address 307) of the current lock right occupied task (the task currently occupying the lock right) is set in the ST code (process 806). Next, the LRB at the head of the WAIT queue (corresponding to the task having the maximum number of retries) is extracted (processing 809), the maximum number of retries 305 is updated (processing 811 or 812), and the WAIT queue is released (processing).
813), issue a POST macro to the task corresponding to the LRB extracted in process 809 (process 814), and notify the release of the shared resource. At this time, the POST code set in the processing 806 or 808 is passed to the POST receiving task. This POST code is received by the POST receiving task by the processing 702 or 703 (FIG. 5). With this mechanism, if the number of lock failures is less than the upper limit, the shared resources released by the process 807 compete for "first-come, first-served" between the POST accepting task and other tasks. However, if the number of lock failures exceeds the upper limit, the lock right is passed directly to the POST accepting task without releasing the shared resources in the POST issuing task.

次に、上記実施例による作用(動作)を、第10図ない
し第13図を用いて従来方式と対比しながら説明する。こ
れらの図における左下り,右下りのハツチ、梨地状部、
文字記号の意味は、第10図について前述したところと同
じである。
Next, the operation (operation) of the above embodiment will be described with reference to FIGS. 10 to 13 in comparison with the conventional system. In these figures, the hatch, satin-shaped part,
The meanings of the character symbols are the same as those described above with reference to FIG.

まず(解決手段1)に関する実施例の作用について説
明する。第10図は、前述したように、従来方式における
ロツク競合発生時のタスクの動作例を示すタイミング図
である。第11図は(解決手段1)の方式におけるロツク
競合発生時のタスクの動作例を示すタイミング図であ
る。第11図でも、第10と同じく、CPU1で実行中のタスク
1によりロツク占有中のために、CPU2で実行中のタスク
2がロツク失敗した場合の動作例を示している。第10図
に示す従来方式では、前記のように、待ち状態となつた
タスク2が、タスク1によつてPOSTされて、CPU2で再び
実行状態となるまでの期間に、CPU3上で実行中のタスク
3がロツク失敗してしまう。これに対し、第11図に示す
(解決手段1の実施例)の方式では、タスク1がPOST処
理開始(時刻t5)前に(時刻t3)共有リソースを解放す
るので、時刻t4で待ち状態となつたタスク2が、タスク
1によつてPOSTされて、CPU1で再び実行状態となるまで
の期間(時刻t5〜t7)に、CPU3上で実行中のタスク3が
共有リソースをロツクできる(時刻t6)。このためWAIT
処理、POST処理の回数を減らすことができる。
First, the operation of the embodiment relating to (Solution 1) will be described. FIG. 10 is a timing chart showing an operation example of a task when a lock conflict occurs in the conventional method, as described above. FIG. 11 is a timing chart showing an operation example of a task when a lock conflict occurs in the method of (Solution 1). FIG. 11 also shows an operation example in the case where the lock of the task 2 being executed by the CPU 2 fails because the lock is occupied by the task 1 being executed by the CPU 1 as in the tenth embodiment. In the conventional method shown in FIG. 10, as described above, the task 2 in the waiting state is POSTed by the task 1 and is being executed on the CPU 3 until the task 2 is again executed. Task 3 fails to lock. In contrast, in the method shown in FIG. 11 (Example of solutions 1), since the task 1 POST processing start (time t 5) before (time t 3) to release the shared resources, at time t 4 During the period (time t 5 to t 7 ) until the task 2 in the waiting state is POSTed by the task 1 and becomes the execution state again in the CPU 1 (time t 5 to t 7 ), the task 3 running on the CPU 3 uses the shared resource. Can be locked (time t 6 ). For this reason WAIT
The number of processing and POST processing can be reduced.

次に(解決手段2)に関する実施例の作用について説
明する。上述の(解決手段1)の方式では、待ち状態と
なつたタスク2が、タスク1によつてPOSTされて実行状
態に戻つた後、再びロツク失敗する可能性がある。最悪
の場合、タスク2が無限にリトライを繰り返すことにな
る。そこで、タスク2のリトライ回数を計数し、このリ
トライ回数が所定の上限値を越えた場合は、POST処理開
始前に共有リソースを解放しないで、POSTされて実行状
態に戻つたタスク2が確実にロツク権を得るようにロツ
ク制御を切り替える。ロツク失敗率(ロツク確保を試み
て失敗する確率)をβ、リトライ回数の上限値をNとす
ると、N回連続してロツク失敗する確率はβとなり、
0<β<1であるからβは十分小さな値となる。即
ち、リトライ回数が上限値を越えて、POST処理開始から
タスク2が再び実行状態となるまでの期間に渡つて共有
リソースがロツクされる確率(=β)を極めて小さく
抑え、同時にタスク2のリトライ回数をN回以下に抑え
ることができる。
Next, the operation of the embodiment relating to (solution means 2) will be described. In the method of (Solution 1) described above, there is a possibility that the task 2 which has been in the waiting state is POSTed by the task 1 and returns to the execution state, and then the lock fails again. In the worst case, the task 2 repeats infinitely. Therefore, the number of retries of task 2 is counted, and if the number of retries exceeds a predetermined upper limit, the task 2 that has been POST and returned to the execution state without releasing the shared resource before the start of the POST process is surely performed. The lock control is switched to obtain the lock right. Assuming that the lock failure rate (probability of trying to secure the lock and fail) is β and the upper limit of the number of retries is N , the probability of N consecutive lock failures is βN,
Since 0 <β <1, β N is a sufficiently small value. That is, the probability that the shared resource is locked (= β N ) during the period from when the number of retries exceeds the upper limit and when the POST processing is started to when the task 2 is again in the execution state (= β N ) is extremely small. The number of retries can be suppressed to N or less.

次に(解決手段3〜5)に関する実施例の作用につい
て説明する。第12図は従来方式におけるロツク競合発生
時のタスクの動作例を示すタイミング図である。第13図
は(解決手段3〜5)の方式の実施例におけるロツク競
合発生時のタスクの動作例を示すタイミング図である。
第12図,第13図ともにCPU1で実行中のタスク1によりロ
ツク占有中のために、CPU2で実行中のタスク2がロツク
失敗した場合の動作例を示している。第12図の従来方式
では、タスク1によつてPOSTされたタスク2がデイスパ
ツクされるまでの期間に、CPU1上で実行中のタスク1や
CPU2上で実行中のタスク3がロツク失敗している。これ
に比べ、第13図の(解決手段3〜5)の方式では、CPU1
のタスク1を中断して該CPU1をタスク2に割り当てるこ
とによりPOST処理(時刻t4)の後、タスク2を優先的に
デイスパツチして(時刻t5)CPU1上で実行しているの
で、POST処理開始からタスク2がデイスパツチされるま
での期間を短縮でき、他タスクのロツク失敗を少なくで
きる。また、これに代えて、タスク2のWAIT処理(時刻
t3)でタスク2が待ち状態に遷移する前、又はタスク1
のPOST処理(時刻t4)によりタスク2の待ち状態が解除
される前に、タスク2の実行優先順位を高めることによ
つて、タスク2はCPU1又は他のCPUに優先的に割り当て
られ、同様に上記期間を短縮できる。
Next, the operation of the embodiment relating to (Solutions 3 to 5) will be described. FIG. 12 is a timing chart showing an operation example of a task when a lock conflict occurs in the conventional method. FIG. 13 is a timing chart showing an operation example of a task when a lock conflict occurs in the embodiment of the method of (solution means 3 to 5).
FIG. 12 and FIG. 13 both show an operation example in the case where the lock of task 2 being executed by CPU2 fails because the lock is occupied by task 1 being executed by CPU1. In the conventional method shown in FIG. 12, while the task 2 POSTed by the task 1 is dispatched, the task 1 running on the CPU 1 and the
Task 3 running on CPU2 has failed to lock. On the other hand, in the method of (solution means 3 to 5) in FIG.
After the POST process (time t 4 ) by interrupting task 1 of the above and allocating the CPU 1 to task 2, the task 2 is preferentially dispatched (time t 5 ) and executed on the CPU 1. The period from the start of processing to the time when task 2 is dispatched can be shortened, and lock failures of other tasks can be reduced. Instead of this, the WAIT process (time
Before task 2 transitions to the wait state at t 3 ), or task 1
Before the waiting state of the task 2 is released by the POST processing (time t 4 ), the task 2 is given priority to the CPU 1 or another CPU by increasing the execution priority of the task 2, and The above period can be shortened.

〔発明の効果〕〔The invention's effect〕

本発明によれば、オンライン・データベース・システ
ム等において、共有リソースの占有使用要求をWAIT・PO
ST方式で制御し、かつ、POST処理オーバーヘッドを共有
リソース占有時間から除外でき、かつ、POST受理タスク
のリトライ回数増加を一定の上限値以下に抑え、レスポ
ンスが悪化する現象を回避できるので、前記システムの
スループツト性能向上に効果がある。特にマルチ・プロ
セツサ・システムの場合、ロツク占有率を低く抑える本
発明の方式は性能向上に効果がある。
According to the present invention, in an online database system or the like, a request for exclusive use of a shared resource
Controlled by the ST method, and the POST processing overhead can be excluded from the occupation time of the shared resource, and the increase in the number of retries of the POST accepting task can be suppressed to a certain upper limit or less, and the phenomenon that the response deteriorates can be avoided. This is effective for improving the throughput performance of the apparatus. In particular, in the case of a multi-processor system, the method of the present invention for keeping the lock occupancy low is effective in improving the performance.

更に、リトライ上限値は各共有リソース毎に設定可能
であり、システムのスループツト性能モニタ・プログラ
ムやレスポンス性能モニタ・プログラムと本発明の方式
を統合化し、リトライ上限値を動的に変更することで、
システム全体の性能の自動チユーニングを行なうことも
可能である。
Furthermore, the retry upper limit can be set for each shared resource, and the system of the present invention is integrated with the system throughput performance monitor program and response performance monitor program, and the retry upper limit is dynamically changed,
Automatic tuning of the performance of the entire system is also possible.

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

第1図は本発明のロツク制御のためのタスク制御方式の
概略フローを示す図、第2図はTCBの形式を示す図、第
3図はWCBの形式を示す図、第4図はLRBの形式を示す
図、第5図はロツク確保処理のフローを示す図、第6図
はロツク解放処理のフローを示す図、第7図は本発明の
実施例のマルチ・プロセツサ構成オンライン・データベ
ース・システムの構成概略を示す図、第8図はWAITキユ
ーの形式を示す図、第9図はタスクキユーの形式を示す
図、第10図〜第13図は本発明の作用を示す図である。 130……WAITキユー、131……WCB(WAIT Control Bloc
k)、132……LRB(Lock Request Block)、140……タス
クキユー、141……タスクキユー先頭ポインタ、142……
タスクキユー末尾ポインタ、143……TCB(Task Control
Block)、312……POSTビツト、313……WAITビツト、31
4……POSTコード。
FIG. 1 is a diagram showing a schematic flow of a task control system for lock control according to the present invention, FIG. 2 is a diagram showing a TCB format, FIG. 3 is a diagram showing a WCB format, and FIG. FIG. 5 is a diagram showing a flow of a lock securing process, FIG. 6 is a diagram showing a flow of a lock release process, and FIG. 7 is an online database system having a multi-processor configuration according to an embodiment of the present invention. FIG. 8 is a diagram showing the format of a WAIT key, FIG. 9 is a diagram showing the format of a task queue, and FIGS. 10 to 13 are diagrams showing the operation of the present invention. 130 …… WAIT Queue, 131 …… WCB (WAIT Control Bloc)
k), 132: LRB (Lock Request Block), 140: Task queue, 141: Start pointer of task queue, 142 ...
Task queue end pointer, 143 ... TCB (Task Control
Block), 312 …… POST bit, 313 …… WAIT bit, 31
4… POST code.

フロントページの続き (72)発明者 山本 章治 神奈川県横浜市戸塚区戸塚町区5030番地 株式会社日立製作所ソフトウエア工場 内 (72)発明者 正井 一夫 神奈川県横浜市戸塚区戸塚町区5030番地 株式会社日立製作所ソフトウエア工場 内 (72)発明者 斉藤 鉄郎 東京都小平市上水本町1479番地 日立マ イクロコンピュータエンジニアリング株 式会社内 (56)参考文献 特開 昭59−172029(JP,A) 特開 昭62−262171(JP,A) (58)調査した分野(Int.Cl.6,DB名) G06F 15/16 JICST科学技術文献データベースContinued on the front page (72) Inventor Shoji Yamamoto 5030 Totsuka-cho, Totsuka-ku, Yokohama-shi, Kanagawa Prefecture Inside the Hitachi, Ltd.Software Factory (72) Inventor Kazuo Masai 5030 Totsuka-cho, Totsuka-ku, Yokohama-shi, Kanagawa Prefecture Co., Ltd. Hitachi, Ltd. Software Factory (72) Inventor Tetsuro Saito 1479, Kamizuhoncho, Kodaira-shi, Tokyo Hitachi Microcomputer Engineering Co., Ltd. (56) References JP-A-59-172029 (JP, A) JP-A Sho 62-262171 (JP, A) (58) Field surveyed (Int. Cl. 6 , DB name) G06F 15/16 JICST Science and Technology Literature Database

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】共有リソースがタスク1により占有使用中
(ロック)であったために該共有リソースのロック権確
保に失敗したタスク2を待ち状態に遷移させるWAIT処理
と、前記タスク1が該共有リソースの使用を終了したと
きに前記タスク2を実行可能状態に遷移させるPOST処理
と、実行可能状態のタスクにプロセッサ使用権を割り当
てるディスパッチ処理とによって、共有リソースの占有
使用権のタスク間排他制御を行なう、マルチ・タスク方
式のマルチ・プロセッサ・システムにおけるロック制御
のためのタスク制御方式において、 POST処理によるタスク2の待ち状態解除後、タスク1の
実行を中断し、タスク1が走行していたプロセッサをタ
スク2に割り当てる手段を備え、さらに、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースを解放する手段、該開放後にPOST処理によ
ってタスク2を実行可能状態に遷移させる手段、該タス
ク2の実行可能状態への遷移後にディスパッチ処理によ
ってプロセッサ使用権を得たタスク2が前記共有リソー
スのロック権確保をリトライする手段、及び、前記開放
後であって前記タスク2がロック権を確保する前に他の
プロセッサ上で実行中の第3のタスクが前記共有リソー
スの使用を要求したことに応じて、前記第3のタスクに
よる前記共有リソースのロックを許可する手段を有する
第1のロック制御方式と、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースのロック権をタスク2へ直接譲渡する手
段、POST処理によってタスク2を実行可能状態に遷移さ
せる手段、及び、ディスパッチ処理によってプロセッサ
使用権を得たタスク2が該共有リソースのロック権を解
放するまでの間、タスク2以外のタスクによる前記共有
リソースのロックを禁止する手段を有する第2のロック
制御方式とを含み、 前記第1のロック制御方式と第2のロック制御方式とを
動的に切り替える切り替え手段を備えたことを特徴とす
るタスク制御方式。
1. A WAIT process for transitioning a task 2 that has failed in securing a right to lock a shared resource because the shared resource is being used exclusively (locked) by a task 1 to a wait state, and the task 1 Exclusive control of the exclusive use right of the shared resource is performed by a POST process for transitioning the task 2 to the executable state when the use of the task 2 is completed and a dispatch process for assigning the processor use right to the task in the executable state. In a task control method for lock control in a multi-task type multi-processor system, after releasing a wait state of task 2 by POST processing, execution of task 1 is interrupted, and the processor on which task 1 is running is stopped. Means for allocating to the task 2; and when the task 1 has finished using the shared resource, Means for releasing the shared resource, means for transitioning the task 2 to the executable state by the POST processing after the release, and task 2 which has obtained the processor use right by the dispatch processing after the transition to the executable state for the task 2 is the shared resource. Means for retrying to secure the lock right, and that the third task running on another processor requests use of the shared resource after the release and before the task 2 secures the lock right. A first lock control method having means for permitting the third task to lock the shared resource, and a task right to lock the shared resource when the task 1 finishes using the shared resource. Means for transferring the task 2 to an executable state by POST processing, and means for processing by dispatch processing. A second lock control method having means for prohibiting a task other than the task 2 from locking the shared resource until the task 2 that has obtained the right to use the shared resource releases the lock right to the shared resource. A task control system comprising a switching unit for dynamically switching between the first lock control system and the second lock control system.
【請求項2】共有リソースがタスク1により占有使用中
(ロック)であったために該共有リソースのロック権確
保に失敗したタスク2を待ち状態に遷移させるWAIT処理
と、前記タスク1が該共有リソースの使用を終了したと
きに前記タスク2を実行可能状態に遷移させるPOST処理
と、実行可能状態のタスクにプロセッサ使用権を割り当
てるディスパッチ処理とによって、共有リソースの占有
使用権のタスク間排他制御を行なう、マルチ・タスク方
式のマルチ・プロセッサ・システムにおけるロック制御
のためのタスク制御方式において、 WAIT処理によってタスク2が待ち状態に遷移する前に、
タスク2の実行優先順位を高める優先順位変更を行な
い、タスク2の共有リソース解放時に前記変更を施した
実行優先順位を復元する手段を備え、さらに、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースを解放する手段、該開放後にPOST処理によ
ってタスク2を実行可能状態に遷移させる手段、該タス
ク2の実行可能状態への遷移後にディスパッチ処理によ
ってプロセッサ使用権を得たタスク2が前記共有リソー
スのロック権確保をリトライする手段、及び、前記開放
後であって前記タスク2がロック権を確保する前に他の
プロセッサ上で実行中の第3のタスクが前記共有リソー
スの使用を要求したことに応じて、前記第3のタスクに
よる前記共有リソースのロックを許可する手段を有する
第1のロック制御方式と、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースのロック権をタスク2へ直接譲渡する手
段、POST処理によってタスク2を実行可能状態に遷移さ
せる手段、及び、ディスパッチ処理によってプロセッサ
使用権を得たタスク2が該共有リソースのロック権を解
放するまでの間、タスク2以外のタスクによる前記共有
リソースのロックを禁止する手段を有する第2のロック
制御方式とを含み、 前記第1のロック制御方式と第2のロック制御方式とを
動的に切り替える切り替え手段を備えたことを特徴とす
るタスク制御方式。
2. A WAIT process for transitioning a task 2 in which a lock right to the shared resource has failed to be secured because the shared resource is being used exclusively (locked) by the task 1 to a waiting state; Exclusive control of the exclusive use right of the shared resource is performed by a POST process for transitioning the task 2 to the executable state when the use of the task 2 is completed and a dispatch process for assigning the processor use right to the task in the executable state. In a task control method for lock control in a multi-task multiprocessor system, before a task 2 transitions to a wait state by WAIT processing,
Means for performing a priority change to increase the execution priority of the task 2 and restoring the changed execution priority when the shared resource of the task 2 is released, and further comprising: when the task 1 finishes using the shared resource. Means for releasing the shared resource, means for transitioning task 2 to an executable state by POST processing after the release, and task 2 which has obtained a processor use right by dispatch processing after transition to the executable state of task 2. Means for retrying to secure the lock right of the shared resource, and a third task running on another processor after the release and before the task 2 secures the lock right, requests the use of the shared resource. A first lock control method having means for permitting the third task to lock the shared resource, Means for directly transferring the lock right of the shared resource to the task 2 when the task 1 has finished using the shared resource, means for transitioning the task 2 to the executable state by the POST process, and processor use right by the dispatch process. A second lock control method having means for inhibiting a task other than the task 2 from locking the shared resource until the task 2 that has obtained the lock resource releases the shared resource. A task control method comprising a switching unit for dynamically switching between a lock control method and a second lock control method.
【請求項3】共有リソースがタスク1により占有使用中
(ロック)であったために該共有リソースのロック権確
保に失敗したタスク2を待ち状態に遷移させるWAIT処理
と、前記タスク1が該共有リソースの使用を終了したと
きに前記タスク2を実行可能状態に遷移させるPOST処理
と、実行可能状態のタスクにプロセッサ使用権を割り当
てるディスパッチ処理とによって、共有リソースの占有
使用権のタスク間排他制御を行なう、マルチ・タスク方
式のマルチ・プロセッサ・システムにおけるロック制御
のためのタスク制御方式において、 タスク1がPOST処理によってタスク2の待ち状態を解除
する前に、タスク2の実行優先順位を高める優先順位変
更を行ない、タスク2の共有リソース解放時に前記変更
を施した実行優先順位を復元する手段を備え、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースを解放する手段、該開放後にPOST処理によ
ってタスク2を実行可能状態に遷移させる手段、該タス
ク2の実行可能状態への遷移後にディスパッチ処理によ
ってプロセッサ使用権を得たタスク2が前記共有リソー
スのロック権確保をリトライする手段、及び、前記開放
後であって前記タスク2がロック権を確保する前に他の
プロセッサ上で実行中の第3のタスクが前記共有リソー
スの使用を要求したことに応じて、前記第3のタスクに
よる前記共有リソースのロックを許可する手段を有する
第1のロック制御方式と、 タスク1が前記共有リソースの使用を終了した時点で該
共有リソースのロック権をタスク2へ直接譲渡する手
段、POST処理によってタスク2を実行可能状態に遷移さ
せる手段、ディスパッチ処理によってプロセッサ使用権
を得たタスク2が該共有リソースのロック権を解放する
までの間、タスク2以外のタスクによる前記共有リソー
スのロックを禁止する手段を有する第2のロック制御方
式とを含み、 前記第1のロック制御方式と第2のロック制御方式とを
動的に切り替える切り替え手段を備えたことを特徴とす
るタスク制御方式。
3. A WAIT process for transitioning a task 2 in which a lock right to the shared resource has failed to be secured because the shared resource has been exclusively used (locked) by the task 1 to a waiting state; Exclusive control of the exclusive use right of the shared resource is performed by a POST process for transitioning the task 2 to the executable state when the use of the task 2 is completed and a dispatch process for assigning the processor use right to the task in the executable state. In a task control method for lock control in a multi-task type multi-processor system, a priority change that raises the execution priority of task 2 before task 1 releases the wait state of task 2 by POST processing And a means for restoring the changed execution priority when the shared resource of task 2 is released. Means for releasing the shared resource when the task 1 finishes using the shared resource, means for causing the task 2 to transition to the executable state by POST processing after the release, and transition to the executable state for the task 2 Means for retrieving the lock right for the shared resource by the task 2 which has obtained the processor use right by the dispatch process later, and executed on another processor after the release and before the task 2 obtains the lock right A first lock control method having means for permitting the third task to lock the shared resource in response to a third task of the shared task requesting use of the shared resource; A means for directly transferring the lock right of the shared resource to the task 2 when the use of the resource is finished, and the task 2 can be executed by the POST processing. And a means for inhibiting a task other than the task 2 from locking the shared resource until the task 2 which has obtained the processor use right by the dispatch processing releases the lock right on the shared resource. A task control method, comprising: a lock control method; and a switching unit for dynamically switching between the first lock control method and the second lock control method.
【請求項4】請求項1、2または3記載のタスク制御方
式を使用したオンライン・トランザクション・システ
ム。
4. An online transaction system using the task control method according to claim 1, 2 or 3.
JP63127150A 1988-05-26 1988-05-26 Task control system and online transaction system Expired - Fee Related JP2804478B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP63127150A JP2804478B2 (en) 1988-05-26 1988-05-26 Task control system and online transaction system
DE1989625064 DE68925064T2 (en) 1988-05-26 1989-05-24 Task execution control method for a multiprocessor system with post / wait procedure
EP19890109410 EP0343646B1 (en) 1988-05-26 1989-05-24 Task execution control method for a multiprocessor system with enhanced post/wait procedure
US07/940,347 US5274809A (en) 1988-05-26 1992-09-03 Task execution control method for a multiprocessor system with enhanced post/wait procedure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63127150A JP2804478B2 (en) 1988-05-26 1988-05-26 Task control system and online transaction system

Publications (2)

Publication Number Publication Date
JPH01297760A JPH01297760A (en) 1989-11-30
JP2804478B2 true JP2804478B2 (en) 1998-09-24

Family

ID=14952859

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63127150A Expired - Fee Related JP2804478B2 (en) 1988-05-26 1988-05-26 Task control system and online transaction system

Country Status (1)

Country Link
JP (1) JP2804478B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007052511A (en) * 2005-08-15 2007-03-01 Sony Computer Entertainment Inc Scheduling method and scheduling device
CN100472457C (en) * 2005-09-09 2009-03-25 国际商业机器公司 Method and system to recover from control block hangs in a heterogenous multiprocessor environment
US7529861B2 (en) 2006-07-25 2009-05-05 Ntt Docomo, Inc. Peripheral switching device and a peripheral switching control device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02126330A (en) * 1988-11-04 1990-05-15 Nec Corp Resources queuing system
JP5725162B2 (en) 2011-03-31 2015-05-27 富士通株式会社 Exclusive control method and exclusive control program
US10579413B2 (en) 2013-08-14 2020-03-03 International Business Machines Corporation Efficient task scheduling using a locking mechanism
CN116841691A (en) * 2023-06-15 2023-10-03 海光信息技术股份有限公司 Encryption hardware configuration method, data confidentiality calculation method and related equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59172029A (en) * 1983-03-18 1984-09-28 Fujitsu Ltd Lock control system for asynchronous common bus
JPS62262171A (en) * 1986-05-09 1987-11-14 Nec Corp Exclusive control system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007052511A (en) * 2005-08-15 2007-03-01 Sony Computer Entertainment Inc Scheduling method and scheduling device
US8375390B2 (en) 2005-08-15 2013-02-12 Sony Computer Entertainment Inc. Scheduling method and scheduling apparatus
CN100472457C (en) * 2005-09-09 2009-03-25 国际商业机器公司 Method and system to recover from control block hangs in a heterogenous multiprocessor environment
US7529861B2 (en) 2006-07-25 2009-05-05 Ntt Docomo, Inc. Peripheral switching device and a peripheral switching control device

Also Published As

Publication number Publication date
JPH01297760A (en) 1989-11-30

Similar Documents

Publication Publication Date Title
US5274809A (en) Task execution control method for a multiprocessor system with enhanced post/wait procedure
JP2866241B2 (en) Computer system and scheduling method
EP0428006B1 (en) Multilevel locking system and method
US5333319A (en) Virtual storage data processor with enhanced dispatching priority allocation of CPU resources
US5784618A (en) Method and system for managing ownership of a released synchronization mechanism
US7810098B2 (en) Allocating resources across multiple nodes in a hierarchical data processing system according to a decentralized policy
US6449614B1 (en) Interface system and method for asynchronously updating a share resource with locking facility
US5448732A (en) Multiprocessor system and process synchronization method therefor
EP0563624B1 (en) Method and apparatus for performing conditional operations on externally shared data
JP2514299B2 (en) Serialization method of interrupt handling for process level programming
US5010482A (en) Multi-event mechanism for queuing happened events for a large data processing system
US7174552B2 (en) Method of accessing a resource by a process based on a semaphore of another process
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
EP0682312A2 (en) Hardware implemented locking mechanism for parallel/distributed computer system
US20040122953A1 (en) Communication multiplexor for use with a database system implemented on a data processing system
US20020029239A1 (en) Method and system for enhanced concurrency in a computing environment
JPH04308961A (en) Means and apparatus for notifying state of synchronous locking of occupied process
EP1163581B1 (en) Monitor conversion in a multi-threaded computer system
US7793023B2 (en) Exclusion control
US6976260B1 (en) Method and apparatus for serializing a message queue in a multiprocessing environment
JP2804478B2 (en) Task control system and online transaction system
EP0362903B1 (en) A special purpose processor for off-loading many operating system functions in a large data processing system
US20020112100A1 (en) System and method for data exchange
EP0343646B1 (en) Task execution control method for a multiprocessor system with enhanced post/wait procedure
US6701429B1 (en) System and method of start-up in efficient way for multi-processor systems based on returned identification information read from pre-determined memory location

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees