JPH01297760A - System for lock control and task control in multiprocessor - Google Patents

System for lock control and task control in multiprocessor

Info

Publication number
JPH01297760A
JPH01297760A JP12715088A JP12715088A JPH01297760A JP H01297760 A JPH01297760 A JP H01297760A JP 12715088 A JP12715088 A JP 12715088A JP 12715088 A JP12715088 A JP 12715088A JP H01297760 A JPH01297760 A JP H01297760A
Authority
JP
Japan
Prior art keywords
task
lock
shared resource
control method
processing
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.)
Granted
Application number
JP12715088A
Other languages
Japanese (ja)
Other versions
JP2804478B2 (en
Inventor
Masaaki Iwasaki
正明 岩嵜
Yoshifumi Takamoto
良史 高本
Akiji Yamamoto
山本 章治
Kazuo Masai
一夫 正井
Tetsuro Saito
斉藤 鉄郎
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 Microcomputer System Ltd
Hitachi Ltd
Original Assignee
Hitachi Ltd
Hitachi Microcomputer Engineering 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 Microcomputer Engineering Ltd filed Critical Hitachi Ltd
Priority to JP63127150A priority Critical patent/JP2804478B2/en
Priority to EP19890109410 priority patent/EP0343646B1/en
Priority to DE1989625064 priority patent/DE68925064T2/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

Abstract

PURPOSE:To lower a lock failure rate by enabling the task of a third party to use a shared resource at the time of completing the use of the shared resource and to prevent a lock occupant task from being sunk by changing the priority order of the execution of a POST accepting task. CONSTITUTION:When a POST issuing task completes the use of the shared resource, the lock of the shared resource is permitted to use by a third task if the number of times of retrying of the POST accepting task is less than a prescribed value. When it exceeds the prescribed value, a lock right is delivered directly to the POST accepting task. Also, the execution of the POST issuing task is interrupted after processing POST, and a processor is allocated to the POST accepting task, and also, the priority order of the execution is changed before the POST accepting task transits to a waiting state by a WAIT processing and before the wait state is cancelled by a POST processing, and the priority order of the execution is recovered at the time of releasing the shared resource.

Description

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

〔従来の技術〕[Conventional technology]

旧算機システム内で実行される処理単位(タスク)CJ
、各種の共有リソースを使用する。TCMPのように複
数のタスクが同時に動作するシステムでは、これらのタ
スク間で共有リソースの占有使用権に関する競合が発生
するので、このための排他制御が必要となる。例えば−
、オンライン・システムで複数のタスクがそれぞれ別々
の「売上げ処理1を行っている場合、共通の記憶域上に
ある「売上げ現在高」を、別々のタスクが参照・更新す
る。この様な状況では、あるタスクがこの「売−ヒげ現
在高1を参照し、更新している間、別のタスクがこのデ
ータにアクセスすることを禁止する必要がある。
Processing unit (task) CJ executed within the old computer system
, using various shared resources. In a system such as TCMP in which a plurality of tasks operate simultaneously, competition occurs among these tasks regarding the right to exclusively use a shared resource, so exclusive control is required for this purpose. For example -
, When multiple tasks are each performing separate ``sales processing 1'' in an online system, the separate tasks refer to and update the ``current sales amount'' stored in a common storage area. In such a situation, it is necessary to prohibit another task from accessing this data while one task is referencing and updating this "Sell/Hold Current Amount 1".

現在実用化されている計算機システムの多くは、排他制
御のための基本機能として、メモリ (主メモリ)−ヒ
の1ワードの参照と更新を不可分の操作として実行する
命令をハードウェア・レヘルでサポートしている(例え
ば、TEST  AND  SET命令(TS命令)あ
るいはCOMPARE  AND  5WAP命令(C
8命令)等。K、Hwa、ng、 F、八、Br1gg
5共著llComputerArchitecture
  and  Parallel  Processi
ng″。
Many of the computer systems currently in practical use support, at the hardware level, an instruction that executes the reference and update of a single word in memory (main memory) as an inseparable operation as a basic function for exclusive control. (for example, TEST AND SET instruction (TS instruction) or COMPARE AND 5WAP instruction (C
8 instructions) etc. K, Hwa, ng, F, 8, Br1gg
5 co-authorll Computer Architecture
and Parallel Process
ng''.

McGraw  l1ill出版、pp、559〜56
0参照)。しかし、排他制御の対象となる共有リソース
は、主メモリ上の1ワードとは限らず、ディスク装置上
のデータヘースの場合もある。一般に、この種の共有リ
ソースに対する排他制御は、次のようにして行なわれる
。即ち、主メモリ上に共有リソースのデータ(それぞれ
数KBにも及ぶ多数のデータA、B。
McGraw Illill Publishing, pp. 559-56.
(see 0). However, the shared resource subject to exclusive control is not limited to one word on the main memory, but may also be a data cache on a disk device. Generally, exclusive control over this type of shared resource is performed as follows. That is, shared resource data (a large number of data A and B, each of which is several KB in size) is stored on the main memory.

C2・・・・・・等からなる)の格納領域のほかに、こ
れらのデータを参照するための参照テーブルを設け、こ
のテーブルに前記共有のデータA、B、C,・・・・・
・にそれぞれ対応して1ワードの参照情@(ロックワー
ド)を割り当て記述しておく。そして、各データA、B
、C,・・・・・・に対するアクセスは、このロックワ
ードを通じて行なう。このロックワードに上記の命令を
用いて占有使用中(ロック中)のフラグを書き込むこと
により共有リソースの各データに対する排他制御を実現
することができる。
In addition to the storage area for C2..., etc.), a reference table is provided to refer to these data, and this table contains the shared data A, B, C,...
・One word of reference information @ (lock word) is assigned and written corresponding to each. And each data A, B
, C, . . . are accessed through this lock word. Exclusive control over each data of the shared resource can be realized by writing an exclusive use (locked) flag in this lock word using the above instruction.

但し、この方式では共有リソースの占有使用権が得られ
なかった場合の処理が必要となる。この点を考慮した排
他制御方式のひとつとしてWA I T・PO8T方式
(Suspend−Resume方式、B 1ock−
Activate方式、S 1sep−Wakeup方
式等とも呼ばれる。上記文献参照)が知られている。
However, this method requires processing when exclusive usage rights for shared resources cannot be obtained. One of the exclusive control methods that takes this point into consideration is the WAIT/PO8T method (Suspend-Resume method, B 1ock-
It is also called the Activate method, S1sep-Wakeup method, etc. (see above-mentioned literature) is known.

WAIT−PO5T方式は、共有リソースがタスク1に
より占有中であった場合に、この共有リソースの占有に
失敗したタスク2を1待ち状態」にするWAIT処理と
、タスク1が共有リソースを解放する時に、タスク2の
「待ち状態」を解除するPOST処理(通知処理)によ
って、共有リソースを占有使用権のタスク間排他制御を
行なう(以下、本明細書中で共有リソースの占有使用権
を得る事をロックを取る、ロック権を確保する等表現す
る。又、ロックを取ろうとして、他のタスクが占有使用
中であった為にロックが取れなかった事を、ロック失敗
、ロック確保失敗等と表現する)。
The WAIT-PO5T method is a WAIT process that puts task 2, which has failed in occupying the shared resource, into a 1-waiting state when the shared resource is being occupied by task 1, and a WAIT process when task 1 releases the shared resource. , POST processing (notification processing) that releases the "waiting state" of task 2 performs exclusive control between tasks of the right to use the shared resource exclusively (hereinafter, in this specification, obtaining the right to use the shared resource exclusively is referred to as "obtaining the right to use the shared resource") It is expressed as taking a lock, securing lock rights, etc.Also, when attempting to take a lock but being unable to do so because it was being occupied by another task, it is expressed as lock failure, lock acquisition failure, etc. do).

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

各タスクはロック失敗するとWAIT処理ルーチンへ制
御を渡す。WAIT処理ルーチンはロック失敗したタス
クを「待ち状態」にし、ディスパッチャを呼び出す。デ
ィスパッチャは、「待ち状態」となったタスクを実行し
ていたCPUに「実行可能状態」の別タスク(第3.第
4.・・・・・・のタスク)を割り当てる。「実行可能
状態」のタスクには、タスク毎にあらかしめ設定した実
行優先順位に従い、ディスパッチャがCPUを割り当て
る。
When each task fails to lock, it passes control to the WAIT processing routine. The WAIT processing routine puts the task that failed to lock into a "wait state" and calls the dispatcher. The dispatcher assigns another task (third, fourth, . . . tasks) in the "ready state" to the CPU that was executing the task in the "waiting state". A dispatcher allocates a CPU to a task in an "executable state" according to an execution priority set roughly for each task.

また一方、各タスク(今まで実行していたタスク)は共
有リソース解放(アンロツタ)直前に「待ち状態」のタ
スク(WAITタスク)の有無を調べ、WAITタスク
があればPOSTO3用−チンへ制御を渡す。POST
O3用−チンはWAITタスクを「実行可能状態」に戻
す。「実行可能状態」に戻ったタスクは、後にデイスパ
ツヤによってCPUを割り当てられ、共有リソース占有
使用権を得て処理を再開する。
On the other hand, each task (task that has been running so far) checks whether there is a task in a "waiting state" (WAIT task) immediately before releasing the shared resource (unrotting), and if there is a WAIT task, it transfers control to the POSTO3 queue. hand over. POST
The O3-chin returns the WAIT task to the "ready state". The task that has returned to the "executable state" is later assigned a CPU by the dispatcher, obtains exclusive use of the shared resource, and resumes processing.

この様にWAIT−POST方式では、WAIT処理で
ロック失敗したタスクを「待ち状態」にし、POST処
理でこのタスクを「実行可能状態」に戻すことで排他制
御を実現する。以下、PO8T処理を起動するタスク(
通常はそれまで実行状態にあったタスク)をPOST発
行タスク、POST処理により「待ち状態」を解除され
るWAITタスクをPOST受理タスクと呼ぶ(POS
T発行タスク、POST受理タスク、WAITタスク等
は各タスクの固有名称ではない。各タスクがPOST発
行タスクになる場合もあれば、PO8T受理タスクにな
る場合もある)。現在実用化されている多くの汎用計算
機システムのスーパーバイザには、上記のPOSTO3
用−チン、WAIT処理ルーチンが組み込まれている。
In this manner, in the WAIT-POST method, exclusive control is achieved by placing a task that has failed in locking in WAIT processing into a "waiting state" and returning the task to an "executable state" in POST processing. Below, the task that starts PO8T processing (
Usually, the task that was in the running state until then) is called the POST issuing task, and the WAIT task that is released from the "waiting state" by POST processing is called the POST receiving task (POS
T-issue task, POST acceptance task, WAIT task, etc. are not unique names of each task. Each task may be a POST issuing task or a PO8T receiving task). The supervisor of many general-purpose computer systems currently in use includes the above-mentioned POSTO3.
It has a built-in WAIT processing routine.

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

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

この問題を第10図により説明する。第10図G4、従
来方式におレフるロック競合発生時のタスクの動作例を
示すタイミング図であって、時間軸は十から下に向かう
方向である。第10図は、3台のCPU1.2.3によ
り、複数のタスク1,2゜3.4.5.・・・・・・が
実行される状況を示している。
This problem will be explained with reference to FIG. FIG. 10G4 is a timing diagram showing an example of the operation of a task when a lock conflict occurs in the conventional method, and the time axis is in a downward direction from 10. FIG. 10 shows that three CPUs 1.2.3 perform multiple tasks 1, 2, 3.4.5. . . . shows a situation in which . . . is executed.

左下りのハツチ部はタスク1、右下りのハツチ部はタク
ス2、白枠部分ば第3のタスク(タスク3〜5)、相い
梨地状部分はいずれのタスクにも属さないスーパバイザ
(タスク相互の橋渡しを行なう)部、細かい梨地状部分
は、共有リソースに対する1コツク権(占を使用権)を
示す。L OG’ Kはロック処理、p o s ’r
はボヌト処理、FALLはそこてのタスクによるロック
失敗、D I S I)はその下に示すタスクに対する
ディスパッチャの処理を示す。
The hatched area at the bottom left is task 1, the hatched area at the bottom right is task 2, the white frame area is the third task (tasks 3 to 5), and the opaque area is the supervisor who does not belong to any task (task mutual The small satin-like part (which acts as a bridge between the two) indicates the right to use the shared resource (the right to use it). L OG' K is lock processing, p o s 'r
indicates bonut processing, FALL indicates a lock failure by that task, and DISI) indicates processing by the dispatcher for the task shown below.

最初に、タスク1はCP U l上でロック権を得(時
刻t1)、次にタスク2はIコック失敗しく時刻tz)
待ち状態に入る。タスク1は、これをみ冊 て、共有リソースの使用が終ると、ロック権を手放しタ
スク2にPO8T処理を発行する(時刻t3)、これに
より、タスク2は御名共有リソースに対するロック権(
占有権)を獲得したことになるが、その時CPUが空い
ていなため(CPUの使用権を有しないため)直ちに実
行状態にはならない(実行可能状態)。一方、実行可能
状態の複数のタスクに優先順位があるため、CPUが空
いたときディスパッチされるタスクは、必ずしも、今通
知を受&Jたタスク2になる訳ではなく、例えば、CP
U2が空いたとき、優先順位の高いタスク4が先にディ
スパッチされ(時刻t5〜t6)実行される(16〜t
’s)ことがある。その場合は、タスク4が先に実行さ
れその処理が終った後に、タスク2がディスパッチされ
実行されることになる(時刻t、〜t8〜tq)。タス
ク1によるタスク2に対するPOSTO3外らタスク2
による実行状態に移るまでの間に(時刻t3〜to)、
タスク3の如き他のCPU1の別のタスクがロック要求
を発行しても(時刻t4)、この間共有りソースはいず
れのタスクも使っていないのにあたかもロックがかか゛
つた状態になっているためロック失敗となる。
First, task 1 obtains the lock on the CPU (time t1), then task 2 fails to lock the CPU (time tz).
Enters wait state. After task 1 takes note of this and finishes using the shared resource, task 1 releases the lock right and issues PO8T processing to task 2 (time t3).
However, since the CPU is not available at that time (because it does not have the right to use the CPU), it cannot immediately enter the execution state (executable state). On the other hand, since multiple tasks in the executable state have priorities, the task that is dispatched when the CPU becomes free is not necessarily task 2, which has just received the notification.
When U2 becomes vacant, task 4 with a higher priority is dispatched first (times t5 to t6) and executed (times 16 to t).
's) sometimes. In that case, task 4 is executed first, and after its processing is completed, task 2 is dispatched and executed (times t, ~t8~tq). Task 1 outside the POSTO3 for task 2
Until the state moves to the execution state (time t3 to to),
Even if another task of another CPU 1, such as task 3, issues a lock request (time t4), the shared source is in a locked state even though no task is using it during this time. Lock will fail.

また、タスク2にとって、時刻t3でPOSTを受理し
ても、他にタスク4のような高実行優先順位のタスクが
あると、このタスク4の処理が実行され終るまで、タス
ク2ばCPU使用権が得られないことになる。
Furthermore, even if task 2 receives POST at time t3, if there is another task with a high execution priority such as task 4, task 2 will receive CPU usage rights until the processing of task 4 is finished. will not be obtained.

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

(課uljPOST発行タスク(この場合タスク1)が
I) OS T受理タスク(この場合タスク2)に対し
PO5T処理を開始した後、POST受理タスクがディ
スパッチャによりCPUを害すリ当てられて実行状態に
移るまでの間、POST受理タスク以外のタスク (第
3者のタスク3)か共有リソースを使用できないため、
全処理ステップに対するロック占有ステップの比率(ロ
ック占有率)が高(なり、システムの性能が低下する。
(Section ulj POST issuing task (task 1 in this case) is I) After starting PO5T processing for the OS T receiving task (task 2 in this case), the POST receiving task is reassigned by the dispatcher to harm the CPU and moves to the execution state. Until then, tasks other than the POST acceptance task (third party task 3) or shared resources cannot be used.
The ratio of lock occupancy steps to all processing steps (lock occupancy rate) becomes high, and system performance deteriorates.

特にマルチ・プロセッサ・システムでは、POST発行
タスクがPOSTO3外開始した後、POST受理タク
スがディスパッチャによりCPUを割り当てられて実行
状態に移るまでの間、他プロセッサ上で実行中のタスク
がロック要求を発行するため、ロック失敗率(ロック確
保を試みて失敗する確率)が高くなり、PO5T処理・
WA’l T処理のオーバーヘッドが増加する。
In particular, in multi-processor systems, after a POST issuing task starts outside of POST3, a task running on another processor issues a lock request until the POST receiving task is assigned a CPU by the dispatcher and enters the execution state. As a result, the lock failure rate (probability of attempting to secure a lock and failing) increases, and PO5T processing
WA'lT processing overhead increases.

(課題2)POST受理タスクが待ち状態を解除されて
実行可能状態となった時、POST受理タスク以外の高
実行優先順位タスクが先にディスパッチされるために、
POST受理タスクが即座にCPU使用権を得られない
場合がある(以下、このように、共有リソースのロック
占有権は得られても、CPUの使用権を得られない場合
を「ロック占有タスクの沈み込み」と呼ぶ)。ロック占
有タスクが沈め込んだ状態で、他のタスクがロック要求
を発行すると必ずロック失敗してしまい、POSTO3
外WへIT処理のオーバーヘッドが増加する。
(Issue 2) When the POST receiving task is released from the waiting state and becomes executable, high execution priority tasks other than the POST receiving task are dispatched first.
There are cases where the POST receiving task cannot immediately obtain the right to use the CPU. (called "sinking"). If another task issues a lock request while the lock-occupying task is stuck, the lock will always fail and the POSTO3
IT processing overhead increases for external W.

従って、本発明の目的は、上記従来技術の問題点(課題
1及2)を解消し、POST受理タスクがディス、ペラ
チャによりCPUを割り当てられて実行状態に移るまで
の間に、第3者のタスクが共有リソースを使用できるよ
うにして、ロック失敗率を低減するとjJ:に、ロック
占有タスクの沈み込みを防止して更にロック失敗をなく
したマルチ・タスク方式のマルチ・プロセッサ・システ
ムにおけるロック制御及びタスク制御方式を堤供するこ
とにある。
Therefore, an object of the present invention is to solve the above-mentioned problems of the prior art (problems 1 and 2), and to prevent the POST receiving task from being assigned by a third party until it is assigned a CPU by the disk perature and enters the execution state. Lock control in a multi-processor system using a multi-tasking system that allows tasks to use shared resources and reduces the lock failure rate, prevents lock-occupying tasks from sinking, and further eliminates lock failures and to provide a task control method.

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

上記課題1を解決するため、本発明のロック制御方式G
A、つぎの解決手段1又は2のように構成する。
In order to solve the above problem 1, the lock control method G of the present invention
A. Configure as in Solution 1 or 2 below.

(解決手段1)POST全3Tスクが該共有リソースの
使用を終了した時点で該共存リソースを解放し、他プロ
セッサ上で実行中の第3のタスクによる該共有リソース
のロックを許可する手段と、しかる後、POST処理に
よってPOST受理タスクを実行可能状態に遷移させる
手段と、しかる後、ディスパッチ処理によってプロセッ
サ使用権を得たPOST受理タースクが該共有リソース
のロック権確保をりトライ (再試行)する手段とを備
えた構成する。
(Solution 1) means for releasing the coexisting resource when all 3 POST tasks finish using the shared resource, and allowing a third task running on another processor to lock the shared resource; Thereafter, there is a means for transitioning the POST receiving task to an executable state through POST processing, and after that, the POST receiving task, which has obtained the right to use the processor through dispatch processing, attempts to secure the lock right for the shared resource (retry). and means.

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

(解決手段2)POST全3Tスクが該共有リソースの
使用を終了した時点で該共有リソースを解放し、他プロ
セッサ上で実行中の第3のタスクによる該共有リソース
のロックを許可した後、POST処理によってPOST
受理タスクを実行可能状態に遷移し7、しかる後、ディ
スパッチ処理によ−ってプロセッサ使用権を得たPOS
T受理タスクが該共有リソースのロック権確保をり1−
ライする第1のロック制御方式と、 PO5T発行タスクが該共有リソースの使用を終了した
時点で該共有リソースのロック権をPOST受理タスク
へ直接譲渡し、P OS T処理によってPOST受理
タスクを実行可能状態に遷移させた後、ディスパッチ処
理によってプロセッサ使用権を得たPOST受理タスク
が該共有リソースのロック権を解放するまでの間、PO
3,T受理タスク以外のタスクによる該共有リソースの
ロックを禁止する第2のロック制御方式とを含み、前記
第1のロック制御方式と第2のロック制御方式とを動的
に切り替える切り替え手段を設ける構成とする。
(Solution 2) When all 3 POST tasks finish using the shared resource, the shared resource is released, and after allowing the third task running on another processor to lock the shared resource, the POST POST by processing
The POS transitions the accepting task to an executable state7, and then obtains processor usage rights through dispatch processing.
The T-accepting task secures the lock right for the shared resource1-
When the PO5T issuing task finishes using the shared resource, the lock right of the shared resource is directly transferred to the POST receiving task, and the POST receiving task can be executed by POST processing. After transitioning to the POST state, the POST receiving task, which has obtained the right to use the processor through dispatch processing, releases the lock right for the shared resource.
3. A switching means for dynamically switching between the first lock control method and the second lock control method, the switching means including a second lock control method for prohibiting tasks other than the T-receiving task from locking the shared resource; The configuration is such that

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

次に、上記課題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全3Tスクの実行を中断し
、POST全3Tスクが走行していたプロセッサをPO
ST受理タスクに割り当てるように構成する。
(Solution 3) After the POST acceptance task is released from the waiting state by POST processing, execution of all 3T POST tasks is interrupted, and the processor on which all 3T POST tasks are running is switched to POST.
Configure it to be assigned to the ST receiving task.

(解決手段4)WAIT処理によってPOST受理タス
クが待ち状態に遷移する前に、POST受理タスクの実
行優先順位を高める優先順位変更を行ない、このPOS
T受理タスクの共有リソース解放時に前記変更を施した
実行優先順位を復元するように構成する。
(Solution 4) Before the POST receiving task transitions to the waiting state by WAIT processing, change the priority to increase the execution priority of the POST receiving task, and this POS
The modified execution priority is restored when the shared resource of the T-receiving task is released.

(解決手段5)POST全3TスクがPOST処理によ
ってPO5T受理タスクの待ち状態を解除する前に、P
OST受理タスクの実行優先順位を高める優先順位変更
を行ない、このPOST受理タスクの共有リソース解放
時に前記変更を施した実行優先順位を復元するように構
成する。
(Solution 5) Before all 3T POST tasks release the waiting state of the PO5T receiving tasks through POST processing,
The priority order is changed to raise the execution priority of the OST receiving task, and the changed execution priority is restored when the shared resource of the POST receiving task is released.

〔作用〕[Effect]

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

まず(解決手段1)の作用について説明する。First, the operation of (Solution Means 1) will be explained.

従来方式では、さきに第10図により説明したように、
待ち状態となったタスク2が、タスク1によってPOS
Tされて、CPU2で再び実行状態となるまでの期間に
、CPU3上で実行中のタスク3がロック失敗してしま
う。これに対し、本発明の(解決手段1)の方式では、
タスク1がPOSTO3間始前に共有リソースを解放す
るまで、待ち状態となったタスク2が、タスク1によっ
てPOSTされて、CPUIで再び実行状態となるまで
の期間に、CPUa上で実行中のタスク3が共有リソー
スをロックできる。このためWAIT処理、POST処
理の回数を減らすことができる(詳細は第11図により
後述する)。
In the conventional method, as explained earlier using FIG.
Task 2, which is in a waiting state, is sent to POS by task 1.
Task 3, which is being executed on CPU 3, fails to lock during the period until CPU 2 returns to the execution state. On the other hand, in the method (Solution 1) of the present invention,
Task 2, which was in the waiting state until task 1 released the shared resource before the start of POST3, is POSTed by task 1 and the task running on CPUa is re-entered into the running state by the CPU. 3 can lock shared resources. Therefore, the number of WAIT processes and POST processes can be reduced (details will be described later with reference to FIG. 11).

次に(解決手段2)の作用について説明する。Next, the operation of (Solution Means 2) will be explained.

上述の(解決手段1)の方式では、待ち状態となったタ
スク2が、タスク1によってPOSTされて実行状態に
戻った後、再びロック失敗する可能性がある。最悪の場
合、タスク2が無限にリトライを繰り返すことになる。
In the method of (Solution 1) described above, after task 2 in the waiting state is POSTed by task 1 and returns to the execution state, there is a possibility that the lock will fail again. In the worst case, task 2 will be retried endlessly.

そこで、タスク2のリトライ回数を計数し1、このリト
ライ回数が所定の上限値を越えた場合は、POSTO3
間始前に共有リソースを解放しないで、POSTされて
実行状態に戻ったタスク2が確実にロック権を得るよう
にロック制御を切り替える。
Therefore, the number of retries for task 2 is counted 1, and if this number of retries exceeds the predetermined upper limit, the POSTO3
Lock control is switched so that task 2, which has been POSTed and returned to an execution state, securely obtains the lock right without releasing the shared resource before the start.

次に(解決手段3−5 )の作用について説明する。従
来方式では、タスク1によってPOSTされたタスク2
がディスパッチされるまでの期間に、CPUI上で実行
中のタスク1やCPUZ上で実行中のタスク3がロック
失敗している。これに比べ、本発明の(解決手段3〜5
)の方式では、P○ST処理の後、タスク2を優先的・
にディスパラチしてCPUI上で実行しているので、P
OSTO3間始からタスク2がディスパッチされるまで
の期間を短縮でき、他タスクのロック失敗を少なくでき
る。
Next, the operation of (Solution 3-5) will be explained. In the conventional method, task 2 POSTed by task 1
Task 1 running on the CPUI and Task 3 running on CPUZ fail to lock during the period until the task is dispatched. In comparison, the present invention (solutions 3 to 5)
) method gives priority to task 2 after P○ST processing.
Since it is executed on the CPUI by dispatching to
The period from the start of OSTO 3 until task 2 is dispatched can be shortened, and lock failures of other tasks can be reduced.

〔実施例〕〔Example〕

以下、本発明の一実施例を第1図から第9図を使って説
明する。本実施例は、オンライン・データベース・シス
テムの例である。
Hereinafter, one embodiment of the present invention will be described using FIGS. 1 to 9. This embodiment is an example of an online database system.

本発明のロック制御方式、タスク制御方式について述べ
る前に、本実施例の適用されるオンライン・データベー
ス・システムの概略を説明する。
Before describing the lock control method and task control method of the present invention, an outline of the online database system to which this embodiment is applied will be explained.

なお、本発明はオンラインシステムに限らず、マルチ・
タスク方式のマルチプロセッサ・システム全般に適用で
きる。第7図は、システムの構成概略を表わす。CPU
IとCPU2 (101および102)を共有メモリ1
03を介して結合する。
Note that the present invention is not limited to online systems, but can also be applied to multi-systems.
Applicable to all task-based multiprocessor systems. FIG. 7 shows a schematic configuration of the system. CPU
I and CPU2 (101 and 102) share memory 1
Connect via 03.

2つのCPUは各々メモリ上のプロゲラ11を動作させ
、メモリ上のデータを参照して、並列に処理を行なうこ
とができる。各CP Uば、通信制潤製W2O3を介し
て、端末装置105とデータの送受を行なうことができ
る。また、各CPUはディスク制窃1装置106を介し
て、ディスク」−のデータベース107ヘアクセスでき
る。
The two CPUs can each operate the pro gamer 11 on the memory, refer to data on the memory, and perform processing in parallel. Each CPU is capable of transmitting and receiving data to and from the terminal device 105 via Tsushin Fujun's W2O3. Further, each CPU can access the database 107 of the disk "-" through the disk theft device 106.

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

次にタスクの基本的な管理方法について説明する。トラ
ンザクションが入力されると、スーパーバイザがこのト
ランザクシコンに対応する1個以上のタスクを生成する
。具体的には、スーパーバイザがタスクの生成時にタス
ク毎に制御情報を格納したTCB (Task Con
trol  Block)を作成し、これらのTCBを
トランザクションの終了時まで第9図に示すタスクキュ
ー140に登録して管理する。タスクキューに登録中の
各タスクは、「待ち状態」、「実行可能状態」、または
「実行状態」のいずれかの状態をとる。「待ち状態」の
タスクは、待ちの原因となっている事象を完了し、「実
行可能状態」となるまでCPUを割り付けられない。「
実行可能状態」のタスクは、システム内のいずれかのC
PUが空き次第、CPUを割り付けて「実行状態」に遷
移させることが可能である。「実行状態」のタスクとは
CPU使用権を得て実行中のタスクである。「実行可能
状態」のタスクが複数ある場合には、タスク毎に割り当
てた実行優先順位に従って、ディスパッチャがCPUを
割り付ける。タスクキュー140は、タスクキュー先頭
ポインタ141、タスクキュー末尾ポインタ142、お
よび0個以上のTCB143のチエインで構成する。T
CBは以下のフィールドから構成する(第2図)。
Next, the basic method of managing tasks will be explained. When a transaction is entered, the supervisor creates one or more tasks corresponding to this transaction. Specifically, when the supervisor generates a task, the supervisor creates a TCB (Task Con) in which control information is stored for each task.
trol Block), 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 is in one of the following states: "waiting state", "executable state", or "executing state". A task in a "waiting state" cannot be assigned a CPU until it completes the event that caused it to wait and becomes "ready to run.""
A task in the "ready to run" state is
As soon as a PU becomes available, it is possible to allocate a CPU and make the transition to the "execution state". A task in the "execution state" is a task that has obtained the right to use the CPU and is being executed. If there are multiple tasks in the "ready to execute" state, the dispatcher allocates CPUs according to the execution priority assigned to each task. The task queue 140 includes a task queue head pointer 141, a task queue end pointer 142, and a chain of zero or more TCBs 143. T
The CB consists of the following fields (Figure 2).

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

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

(3)次TCBポインタ403 TCBをチエインしてタスクキューを構成する際、次の
TCBアドレスを格納する。タスクキュー末尾のTCB
の場合は本フィールドはOを格納する。
(3) Next TCB pointer 403 Stores the next TCB address when chaining TCBs to form a task queue. TCB at the end of the task queue
In this case, this field stores O.

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

次に本発明のロック競合の制御方式について説明する。Next, a lock contention control method according to the present invention will be explained.

以下、本実施例のオンライン・データベース・システム
ではロック競合の対象となる共有リソースはひとつのデ
ータベースのみと仮定する。
Hereinafter, it is assumed that in the online database system of this embodiment, the shared resource subject to lock contention is only one database.

即ち、共有リソースが単一と仮定する。また、各トラン
ザクションによって生成されるタスクも単一とする。即
ち、トランザクションとタスクとの間に1対1の対応が
成り立つ場合を考える。これらの仮定によって、本発明
の方式の利点は失われない。
That is, it is assumed that there is only one shared resource. Also, each transaction generates a single task. That is, consider a case where there is a one-to-one correspondence between transactions and tasks. These assumptions do not detract from the advantages of our scheme.

まず、第1図を用いて本発明のロック制御、タスク制御
方式の概略について説明する。各タスクは共有リソース
をロックする場合、L OCKマクロ551を発行し、
ロック処理ルーチン500を呼び出す。必要な共有リソ
ースが他タスクによって占有使用中の為に確保できない
場合、ロック制御方式の切替え判定(処理502)に従
い、ロック制御方式の切替え処理(503)を行い、P
OSTO3間始前に共有リソースを解放する第1のロッ
ク制御方式か、POSTO3間始前に共有リソースを解
放しない第2のロック制御方式かを選択する。次に、ス
ーパーバイザ内のWAIT処理ルーチン510を呼出し
て(504)LOCKマクロを発行したタスクを「待ち
状態」にする(処理511)。この場合、スーパーバイ
ザ内めディスパッチャ530が他の「実行可能状態」の
タスクにCPUを割当てる(処理53’l、532)。
First, an outline of the lock control and task control method of the present invention will be explained using FIG. When each task locks a shared resource, it issues a LOCK macro 551,
Call the lock processing routine 500. If the necessary shared resource cannot be secured because it is being exclusively used by another task, the lock control method switching process (503) is performed according to the lock control method switching determination (process 502), and P
Select either the first lock control method that releases shared resources before the start of OSTO3 or the second lock control method that does not release the shared resources before the start of POST03. Next, the WAIT processing routine 510 in the supervisor is called (504) and the task that issued the LOCK macro is placed in a "waiting state" (processing 511). In this case, the supervisor-internal dispatcher 530 allocates the CPU to another task in the "ready to execute" state (processes 53'l, 532).

CPUを割当てられたタスクは「実行状態」となす、割
込み等によりCPU使用権を奪われるまで処理を継続す
る。一方、「待ち状態」となったタスクはPOST処理
によって「実行可能状態」に戻されるまで1待ち状態」
を継続する。
A task to which a CPU is assigned is placed in an "execution state" and continues processing until the right to use the CPU is taken away due to an interrupt or the like. On the other hand, a task that is in a ``wait state'' is in a 1-wait state until it is returned to an ``executable state'' by POST processing.''
Continue.

一方、共有リソースを占有使用していたタスクは、共有
リソースをアンロックする場合、UNLKマクロ552
を発行し、アンロック処理ルーチン520を呼び出す。
On the other hand, when a task that is exclusively using a shared resource unlocks the shared resource, it uses the UNLK macro 552
and calls the unlock processing routine 520.

アンロック処理ルーチンでは、待ち状態のタスクがある
かどうか調べる(処理521)。もし、待ち状態のタス
クがあれば、ロック制御方式の切替え処理(503)に
より、いずれのロック制御方式が選択されているか判定
する(処理522)。POSTO3間始前に共有リソー
スを解放する第1のロック制御方式が選択されていれば
、共有リソースを解放しく処理523)、WAITタス
クに共有リソース解放を通知する為にPO5T処理ルー
チンを呼び出す(524)。
In the unlock processing routine, it is checked whether there is any task in a waiting state (process 521). If there is a task in a waiting state, the lock control method switching process (503) determines which lock control method is selected (process 522). If the first lock control method of releasing the shared resource is selected before the start of POST3, the shared resource is released (523), and the PO5T processing routine is called to notify the WAIT task of the shared resource release (524). ).

P、O3T処理開始前に共有リソースを解放しない第2
のロック制御方式が選択されていれば、共有リソースを
解放しないで、WAITタスクに共有リソース解放をj
m知する為にPOST処理ルーチンを呼び出す(524
,)。
P, the second method that does not release shared resources before starting O3T processing.
If the lock control method is selected, the shared resource is not released and the WAIT task is sent
Call the POST processing routine (524
,).

POSTO3用−チン540ば、p o s ′r発行
タスクを「実行状態」から「実行可能状態」に移し、p
 o s ”r受理タスクを1待ち状態」から「実行可
能状態」に移す(処理541)。ロック制御方式の切替
え処理(503)により、いずれのロック制御方式が選
択されているか判定する(処理542)。第1のロック
制御方式が選択されていれば、ディスパッチャ530を
呼び出す(処理544)。第2のロック制御方式が選択
されていれば、POST受理タスクに優先的にCPUを
割り当てる(処理543,532)。CPU使用権を与
えられたPOST受理タスクは、共有リソースを占有し
て処理を再開することができる。
For POSTO3 - Chin 540, move the pos 'r issuing task from the "execution state" to the "ready state", and
o s ``r-receiving task is moved from 1 waiting state'' to ``executable state'' (process 541). The lock control method switching process (503) determines which lock control method is selected (process 542). If the first lock control method is selected, the dispatcher 530 is called (processing 544). If the second lock control method is selected, the CPU is assigned preferentially to the POST receiving task (processes 543, 532). A POST receiving task that is given CPU usage rights can occupy the shared resources and resume processing.

以上、WAITタスクがひとつの場合について説明して
きたが、一般にはWAITタスクが複数存在し得るので
、WAITタスク用の待ち行列(WAITキュー130
)を用いる。ロック失敗したタスクは、WAITマクロ
を発行してWAIT処理ルーチンをコールする前に、L
 RB (I−0CkRequest  Blockの
略)を作成してWAITキューにチエインする。また、
各タスクは共有リソースを解放する前に、WAITキュ
ーを参照して待′ら状態のタスクがあるかどうか8周べ
る。もし、希ち状態のタスクかあれば、即ち、WAIT
キューに1個以上L RBがチエインしていれば、先頭
の(時間的に最も古い)LRB(第7図と第8図で最も
左側のLRB 132)をWAITキューから取り出し
、このL R13に対応するWAITタスクに対して共
有リソース解放を通知するPOSTマクロを発行する。
Above, we have explained the case where there is one WAIT task, but in general there can be multiple WAIT tasks, so the wait queue for WAIT tasks (WAIT queue 130
) is used. The task that has failed to lock must
Create an RB (abbreviation for I-0CkRequest Block) and chain it to the WAIT queue. Also,
Each task refers to the WAIT queue eight times to see if there are any tasks in a wait state before releasing the shared resource. If there is a task in rare state, i.e. WAIT
If one or more LRBs are chained in the queue, the first (oldest in time) LRB (the leftmost LRB 132 in Figures 7 and 8) is taken out from the WAIT queue and corresponds to this LRB13. A POST macro is issued to notify the WAIT task of releasing the shared resource.

次に、このWAITキュー130および管理ブロックの
データ構造について第3〜4図及び第7〜8図により説
明する。WAITキューは共有メモリ103上に設け、
システム内の各タスクからアクセス可能とする。WAI
Tキューは、各共有リソース毎にひとつ設+Jる。本実
施例では、前述のとおり共有リソースが単一の場合を考
えているので、WAITキューはシステム内に唯一であ
る。
Next, the data structure of this WAIT queue 130 and management block will be explained with reference to FIGS. 3-4 and 7-8. A WAIT queue is provided on the shared memory 103,
Make it accessible from each task in the system. W.A.I.
One T queue is provided for each shared resource. In this embodiment, as described above, the case where there is a single shared resource is considered, so there is only one WAIT queue in the system.

WΔITキューは、ひとつのWCB(WA、ITCon
trol  B 1ockの略)131と各タスク毎に
設けた0個以上のLRB 132から構成する。第3図
〜第4図にw CBとLRBの構造を示す。
A WΔIT queue consists of one WCB (WA, ITCon
Trol B (abbreviation for 1ock) 131 and zero or more LRBs 132 provided for each task. The structures of w CB and LRB are shown in FIGS. 3 and 4.

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

(1)WAITキュー・ロックワード301W、CB自
身の更新の排他制御に用いる。
(1) WAIT queue lock word 301W, used for exclusive control of updating of the CB itself.

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

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

(3)、WAITキュー先頭ポインタ303WAITキ
ュー先頭の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キュー末尾ポインタ304WAITキュ
ー末尾の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, □ stores 0.

(5)最大リトライ回数(MAχ−RETRY −CO
UNT)WAITキュー中のLRB中のりトライ回数の
最大値を示す。
(5) Maximum number of retries (MAχ-RETRY-CO
UNT) Indicates the maximum number of tries for LRB in the WAIT queue.

(6)す1〜ライ上限値(RETRY、−LIl’1l
T) 3.060ツク失敗回数の上限値を示す正整数。
(6) RETRY, -LIl'1l
T) 3.060 A positive integer indicating the upper limit of the number of failures.

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

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

(1) ECB(Event  Control  B
lock)311一般にWAIT−POST方式におい
てPO8T発行タスクとWAITタスクの間で、待ち事
象の発生・未発生を管理する制御情報である。POST
O3上312がOの時は事象未発生、■の時は事象発生
完了を示す。WAIT、1の時はWAIT中を示す。本
実施例では、共有リソースの解放を通知する為に用いる
。また、ECB内のPOSTl−1’ニーフイールド3
14を用いてPOST発行タスクからP OS T受理
タスクへロックキーを渡す。
(1) ECB (Event Control B)
lock) 311 Generally, this is control information for managing the occurrence or non-occurrence of a wait event between the PO8T issuing task and the WAIT task in the WAIT-POST system. POST
When the upper O3 312 is O, the event has not occurred, and when it is ■, the event has completed. When WAIT is 1, it indicates that WAIT is in progress. In this embodiment, it is used to notify the release of shared resources. Also, POSTl-1' knee field 3 in ECB
14 to pass the lock key from the POST issuing task to the POST receiving task.

(2)リトライ回数(RETRY −COUNT) 3
15当タスクが何回ロック失敗したかを示すカウンタで
ある。ロックが確保できるとOクリアする。
(2) Number of retries (RETRY -COUNT) 3
15 This is a counter indicating how many times the task has failed to lock. Clears O when the lock is secured.

(3)次LRBボインク316 L RBをチエインしてWAITキューを構成する際、
次のり、 RBのアドレスを格納する。
(3) Next LRB Boink 316 When chaining L RBs to form a WAIT queue,
Next, store the RB address.

(4)WAITタスクTCBポインタ317当L RB
に対応するWAITタスクのTCBア・ドレスを格納す
る。
(4) WAIT task TCB pointer 317 L RB
The TCB address of the WAIT task corresponding to the WAIT task is stored.

次に共有リソースのロック処理、及びアンロツタ処理の
アルゴリズトについて説明する。尚、以下の説明ではリ
ソース・ロックワード302を単にロックワードと呼ぶ
Next, the algorithms for locking shared resources and unrotting processing will be explained. Note that in the following description, the resource lockword 302 will be simply referred to as a lockword.

共有リソース占有時は占有しているタスクの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 it is not occupied, '0' is stored in the lock word. Since the TCB is generated corresponding to each task, the TCB address is used as the task identification information ID. Hereinafter, this TCB address will be used as a lock key.

ます、第5図を用いてロック処理を説明する。First, lock processing will be explained using FIG.

まず、判定処理701によって、他タスクからPOST
された後、即ち「待ち状態」の後か否かの判定を行なう
。これはECB1.32内のPOSTビット312が0
か1かにより判定できる。もし、POSTされた後なら
ば、レジスタ1(R1)に旧ロックキー、即ちECB 
132内のPO5TO5上314をロードする(処理7
02)。posTコードにはPOST発行タスクの識別
情報ID(POST発行タスクのTCBアドレス)が格
納されている。そうでなけれは、レジスタ1に0をロー
ドする(処理703)。次に、レジスタ2(R2)に新
ロックキー、即ち自タスクの識別情報TD(自タスクの
TCBアドレス)をロードする(処理704)。判定処
理705はCS命令を用いて次の様に行なう。
First, by determination processing 701, POST from another task is
It is determined whether or not it is after the "waiting state". This means that POST bit 312 in ECB1.32 is 0.
It can be determined by whether it is 1 or 1. If after POST, register 1 (R1) contains the old lock key, that is, ECB.
Load 314 on PO5TO5 in 132 (processing 7
02). The posT code stores the identification information ID of the POST issuing task (TCB address of the POST issuing task). Otherwise, 0 is loaded into register 1 (process 703). Next, the new lock key, that is, the identification information TD of the self-task (TCB address of the self-task) is loaded into the register 2 (R2) (processing 704). Determination processing 705 is performed as follows using a CS command.

cs  R1,R2,LOCKIIORDこの命令は、
レジスタ1の内容である旧ロックキーとロックワード3
02のイ直を比較し、もし等しければ、ロックワードの
値をレジスタ2の内容である新ロックキーで置換する(
ロック成功)。
cs R1, R2, LOCKIIORD This command is
Old lock key and lock word 3, which are the contents of register 1
02 are compared, and if they are equal, the value of the lock word is replaced with the new lock key that is the contents of register 2 (
lock success).

前記の比較の結果が等しくない場合は、ロックワードの
置換を行なわない(ロック失敗)。C8命令の機能の重
要な点は、上記のロックワードの読み出しから、比較、
更新の間、他のCPUによるロックワードへのアクセス
を禁止できる事である。
If the results of the above comparison are not equal, no lock word replacement is performed (lock failure). The important features of the C8 instruction are from reading the lock word mentioned above to comparing and
During the update, access to the lock word by other CPUs can be prohibited.

これによって、共有リソースが非占有状態の場合、ある
いは、POST発行タスクからPOSTコードとして渡
された旧ロックキーの値がロックワードの現在、(即ち
CS命令実行時)の値に等しい場合以外は、ロック処理
を試みたタスクはロック失敗となる。
As a result, unless the shared resource is in an unoccupied state or the value of the old lock key passed as a POST code from the POST issuing task is equal to the current value of the lock word (i.e. at the time of executing the CS instruction), A task attempting lock processing will fail to lock.

判定処理705によって、ロック成功となった場合は、
処理706でリトライ回数315をOに戻しロック処理
完了となる。ロック失敗した場合、リトライ回数を1増
加しく処理707) 、LRBを作成しく始めてロック
失敗したとき)又はLRBのりトライ回数を更新しく7
15)、WAITキュー130をロックする(処理70
8)。他りスフかWAITキューをロック中ば、他タス
クの処理が完了するまでループして待つ(708a)。
If the lock is successful in the determination process 705,
In process 706, the retry count 315 is returned to O, and the locking process is completed. If the lock fails, the number of retries is increased by 1 (707), or when the lock fails after starting to create an LRB), or the number of retries for LRB is updated 707).
15), lock the WAIT queue 130 (processing 70
8). If another task is locking the WAIT queue, it waits in a loop until the processing of other tasks is completed (708a).

WAITキューがロックできたら、す;ライ回数315
と最大りトライ回数(WAITキューのチェーン中でリ
トライした回数が最大のもの)305を比較する(処理
709)。
Once the WAIT queue is locked, the number of runs is 315.
and the maximum number of retries (the one with the largest number of retries in the WAIT queue chain) 305 (processing 709).

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

リトライ回数〈最大リトライ回数 ならばWAITキュー末尾へ自タスクのLRBをチエイ
ンする(処理712)。WA■Tキューの更新中(WA
ITキューをチェーンに繋いだり、チェノからはずした
り、カウンタを書き替える処理中)は、WAITキフー
ーに他のプロセサから入れないように、W A I T
キュー自体ロックされ′ているが、LRBのWA’IT
キフー−へのチエインが完了したらW、AITキューを
解放しく713)、WAITマクロを呼び出ずく処理7
14)。WAITマクロを発行したタスクは「待ち状態
」となり、POSTされるまで「待ち状態」をm続する
If the number of retries is the maximum number of retries, the LRB of the own task is chained to the end of the WAIT queue (processing 712). WA■T queue is being updated (WA
During the process of connecting an IT queue to a chain, removing it from a chain, or rewriting a counter, W A I T is used to prevent other processors from entering the WAIT queue.
Although the queue itself is locked, the WA'IT of LRB
When the chain to Kifu is completed, release the AIT queue (713) and call the WAIT macro. Processing 7
14). The task that issued the WAIT macro enters the "waiting state" and continues to be in the "waiting state" for m times until POST is performed.

p o s ’rされろと再度処理701Lこ戻り、ロ
ック確保を試みる。
When the process 701L is requested, the process returns again to try to secure the lock.

尚、ECB51]の初期化(PO5Tビット312のク
リア)は処理702の直後に行なう。
Note that initialization of the ECB 51 (clearing the PO5T bit 312) is performed immediately after processing 702.

又、処理711および処理712では、WAITキュー
のロック時間短縮のため、WAITキュー先頭ポインタ
303.、WAITキュー末尾ポインタ303を使用し
、WAITキューをサーチする処理は行なわない。又、
WAITキューをロック中は割込タスクとのデッドロッ
ク防止のため、割込禁止とする。
In addition, in processing 711 and processing 712, in order to shorten the locking time of the WAIT queue, the WAIT queue head pointer 303. , the WAIT queue end pointer 303 is used, and no process of searching the WAIT queue is performed. or,
While the WAIT queue is locked, interrupts are disabled to prevent deadlock with interrupt tasks.

次に第6図を用いてアンロック処理を説明する。Next, the unlocking process will be explained using FIG. 6.

第6図は、第1図のアンロック処理520の部分を詳細
に示すものである。アンロック処理では、まずWAIT
キューをロックする(処理801)。
FIG. 6 shows the unlocking process 520 in FIG. 1 in detail. In the unlock process, first WAIT
The queue is locked (process 801).

他タスクがW/’、ITキューを占有中は、ロックでき
るまでループして待つ。WAITキューがロックできた
ら、WA、ITキューが空か否か、即ち、共有リソース
の解放を待っているタスクの有無をチエツクする(処理
802)。もし、WAITタスクがなげねば、WAIT
キューおよび共有リソースを解放゛づる(処理803〜
804)。WAI′丁゛ギコーー、共有リソースの解放
は、ロックワード(301及び302)&こ0を書き込
む事で行なう。
If another task is occupying the W/', IT queue, it waits in a loop until it can be locked. Once the WAIT queue has been locked, it is checked whether the WA and IT queues are empty, that is, whether there are any tasks waiting for the release of the shared resource (process 802). If the WAIT task fails, the WAIT
Release queues and shared resources (processing 803~
804). The shared resource is released by writing the lock word (301 and 302) &0.

WAI]”タスクがある場合は、まず最大リトライ回数
305きりトライ上限値(予じめ設定した値で、ごの値
を境に制御を切換える)306を比較する(処理805
)。
WAI]" If there is a task, first compare the maximum number of retries 305 with the upper limit of retries (preset value, control is switched at each value) 306 (processing 805
).

最大リトライ回数〈リトライ上限値 ならば、即ち、失敗回数が1−限値に達していなげれば
、共有リソースを解放しく処理807)、PQSTコー
ト3]4にOをセットする(処理808)。
If the maximum number of retries is the retry upper limit, that is, if the number of failures has not reached 1-limit, the shared resource is released (process 807), and PQST code 3]4 is set to O (process 808).

最大リトライ回数≧リトライ上限値 ならば、即ち、失敗回数が上限値に達していれば、PO
STコードに現ロックキー、即ち、現ロック権占有タス
ク(現在ロック権を占有中のタスク)の識別情1(TC
Bアドレス307)をセラ1〜する(処理806)。次
にWAITキュー先頭のLRB(前記最大リトライ回数
を有するタスクに相当)を取り出しく処理809)、最
大リトライ回数305を更新しく処理811または81
2)、WAITキューを解放しく処理813)、処理8
09にて取り出したL RBに対応するタスクに、PO
STマクロを発行しく処理814)、共有リソースの解
放を通知する。この時、処理806または処理808で
セットしたPOSTコードをP○ST受理タスクへ渡す
。このp o s =「コードは、処理702または7
03 (第5図)によってp。
If the maximum number of retries ≧ the retry upper limit, that is, if the number of failures has reached the upper limit, the PO
The ST code contains the current lock key, that is, the identification information 1 (TC
B address 307) is set to cell number 1 (processing 806). Next, a process 809 for extracting the LRB at the head of the WAIT queue (corresponding to the task with the maximum number of retries) and a process 811 or 81 for updating the maximum number of retries 305
2), Process to release WAIT queue 813), Process 8
Add PO to the task corresponding to the L RB retrieved in 09.
The ST macro is issued (step 814) to notify the release of the shared resource. At this time, the POST code set in process 806 or process 808 is passed to the P*ST receiving task. This p o s = "Code is processing 702 or 7
03 (Figure 5) p.

ST受理タスクが受は取る。この機構により、lコック
失敗回数が」二限値未滴の場合は、処理807によって
解放した共有リソースは、POST受理タスクとそれ以
外のタスクの間で「早い者勝ち」で争われる。しかし、
ロック失敗回数が上限値以」−になった場合、PO8T
全8Tスクでの共有リソースの解放は行なわず、p o
 s ”r受理タスクへ直接ロック権を渡す。
The ST receiving task accepts the request. With this mechanism, if the number of l-cock failures is less than the two-limit value, the shared resources released in process 807 are contested on a "first come, first served" basis between the POST acceptance task and other tasks. but,
If the number of lock failures exceeds the upper limit, PO8T
Shared resources are not released in all 8T disks, and po
s ”r Pass the lock right directly to the receiving task.

次に、上記実施例による作用(動作)を、第10図ない
し第13図を用いて従来方式と対比しながら説明する!
これらの図における左下り2右下りのハツチ、梨地状部
、文字記号の意味は1.第10図について前述したとこ
ろと同じである。
Next, the effect (operation) of the above embodiment will be explained using FIGS. 10 to 13 while comparing it with the conventional system!
In these figures, the meanings of the hatches, satin-like parts, and letter symbols on the left and right sides are 1. This is the same as described above with respect to FIG.

まず(解決手段1)に関する実施例の作用について説明
する。第10図は、前述したように、従来方式にiける
ロック競合発生時のタスクの動作例を示すタイミング図
である。第11図ば(解決手段1)の方式におけるロッ
ク競合発生時のタスクの動作例を示すタイミング図であ
る。第11図でも、第10と同じく、CP U 1で実
行中のタスり1によりロック占有中のために、CPU2
で実行中のタスク2がロック失敗した場合の動作例を示
している。第10図に示す従来方式では、前記のように
、待ち状態となったタスク2が、タスク1によってPO
STされて、CPU2で再び実行状態となるまでの期間
に、CPU3上で実行中のタスク3がロック失敗してし
まう。これに対し、第11図に示す(解決手段1の実施
例)の方式では、タスク1がPOSTO3間始(時刻t
s)前に(時刻t3)共有リソースを解放するので、時
刻t4で待ち状態となったタスク2が、タスク1によっ
てPOSTされて、CPUIで再び実行状態となるまで
の期間(時刻t5〜t’s)に、CPU3上で実行中の
タスク3が共有リソースをロックできる(時刻t6)。
First, the operation of the embodiment regarding (Solution Means 1) will be explained. FIG. 10 is a timing diagram showing an example of the operation of a task when a lock conflict occurs in the conventional method, as described above. FIG. 11 is a timing diagram showing an example of the operation of a task when a lock conflict occurs in the method of B (Solution Means 1). In FIG. 11, as in FIG. 10, the lock is occupied by task 1 being executed on CPU 1, so CPU 2
An example of the operation when Task 2, which is being executed, fails to lock is shown. In the conventional method shown in FIG. 10, as mentioned above, task 2 in the waiting state is
During the period from ST to the time when the CPU 2 returns to the execution state, the task 3 being executed on the CPU 3 fails to lock. On the other hand, in the method shown in FIG. 11 (embodiment of solution means 1), task 1
s) (time t3), the shared resource is released before (time t3), so task 2, which was in the waiting state at time t4, is POSTed by task 1 and the period from time t5 to t' until it becomes running again on the CPU At step s), task 3 running on CPU 3 can lock the shared resource (time t6).

このためWA I T処理、POST処理の回数を減ら
すことができる。
Therefore, the number of WAIT processing and POST processing can be reduced.

次に(解決手段2)に関する実施例の作用について説明
する。上述の(解決手段1)の方式では、待ち状態とな
ったタスク2が、タスク1によってPOSTされて実行
状態に戻った後、再びロック失敗する可能性がある。最
悪の場合、タスク2が無限にリトライを繰り返すことに
なる。そこで、タスク2のりトライ回数を計数し、この
りトライ回数が所定の上限値を越えた場合は、p o 
s ’r処理開始前に共有リソースを解放しないで、P
O31゛されて実行状態に戻ったタスク2が確実にロッ
ク権を得るようにロック制御を切り替える。ロック失敗
率(ロック確保を試みて失敗する確率)をβ、リトライ
回数の上限値をNとすると、N回連続してロック失敗す
る確率はβ8となり、O〈β〈1であるからβ8は十分
率さな値となる。即ち、リトライ回数が上限値を越えて
、POSTO3間始からタスク2か再び実行状態となる
までの期間に渡って共有リソースがロックされる確率(
−βN)を極めて小さく抑え、同時にタスク2のリトラ
イ回数をN回収下に抑えることができる。
Next, the operation of the embodiment regarding (Solution Means 2) will be explained. In the method of (Solution 1) described above, after task 2 in the waiting state is POSTed by task 1 and returns to the execution state, there is a possibility that the lock will fail again. In the worst case, task 2 will be retried endlessly. Therefore, the number of attempts to cross task 2 is counted, and if the number of cross trials exceeds a predetermined upper limit, po
Without releasing the shared resources before starting s 'r processing, P
Lock control is switched so that task 2, which has returned to the execution state after O31, securely obtains the lock right. If the lock failure rate (probability of attempting to secure a lock and failing) is β and the upper limit of the number of retries is N, then the probability of lock failure N times in a row is β8, and since O〈β〈1, β8 is sufficient. It will be a small value. In other words, the probability (
-βN) can be kept extremely small, and at the same time, the number of retries of task 2 can be kept below N recoveries.

次に(解決手段3〜5)に関する実施例の作用について
説明する。第12図は従来方式におけるロック競合発生
時のタスクの動作例を示すタイミング図である。第13
図はく解決手段3〜5)の方式の実施例におけるロック
競合発生時のタスクの動作例を示すタイミング図である
。第12図。
Next, the effects of the embodiments related to (Solutions 3 to 5) will be explained. FIG. 12 is a timing diagram showing an example of task operation when a lock conflict occurs in the conventional system. 13th
FIG. 6 is a timing diagram showing an example of the operation of a task when a lock conflict occurs in an embodiment of the method of solving means 3 to 5); Figure 12.

第13図ともにCPUIで実行中のタスク1によりロッ
ク占有中のために、CPU2で実行中のタスク2がロッ
ク失敗した場合の動作例を示している。第12図の従来
方式では、タスク1によってPO8Tされたタスク2が
デイスパックされるまでの期間に、CPUI上で実行中
のタスク1やCPUZ上で実行中のタスク3がロック失
敗している。これに比べ、第13図の(解決手段3〜5
)の方式では、CPUIのタスク1を中断して該CPU
Iをタスク2に割り当てることによりPO8T処理(時
刻t4)の後、タスク2を優先的にディスパッチして(
時刻t、)CPUI上で実行しているので、POSTO
3間始からタスク2がディスパッチされるまでの期間を
短縮でき、他タスクのロック失敗を少なくできる。また
、これに代えて、タスク2のWAIT処理(時刻t3)
でタスク2が待ち状態に遷移する前、又はタスク1のP
OST処理(時刻t4)によりタスク2の待ち状態が解
除される前に、タスク2の実行優先順位を高めることに
よって、タスク2はCPUI又は他のCPUに優先的に
割り当てられ、同様に上記jlJ間を短縮できる。
Both FIGS. 13A and 13B show an example of the operation in the case where Task 2, which is being executed by CPU 2, fails to lock because Task 1, which is executing by CPU 2, is occupying the lock. In the conventional method shown in FIG. 12, during the period until task 2, which has been PO8Ted by task 1, is dispatched, task 1 running on the CPUI and task 3 running on CPUZ fail to lock. In comparison, in Figure 13 (solutions 3 to 5)
) method, CPU task 1 is interrupted and the CPU
By assigning I to task 2, after PO8T processing (time t4), task 2 is dispatched preferentially (
Time t,) Since it is running on the CPUI, the POSTO
The period from the start of task 2 until task 2 is dispatched can be shortened, and lock failures of other tasks can be reduced. In addition, instead of this, WAIT processing of task 2 (time t3)
before task 2 transitions to the waiting state, or task 1's P
By raising the execution priority of task 2 before the waiting state of task 2 is released by the OST processing (time t4), task 2 is preferentially assigned to the CPUI or another CPU, and similarly can be shortened.

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

本発明によれば、オンライン・データヘース・システム
等において、共有リソースの占有使用要求をWAIT−
POST方式で制御し、かつ、1)O3T処理オーバー
ヘッドを共有リソース占有時間から除外でき、かつ、P
OST受理タスクのりトライ回数増加を一定の上限値以
下に抑え、レスポンスが悪化する現象を回避できるので
、前記システムのスループット性能向上に効果がある。
According to the present invention, in an online data storage system or the like, a request for exclusive use of a shared resource is
1) O3T processing overhead can be excluded from the shared resource occupancy time, and
Since it is possible to suppress the increase in the number of OST acceptance task retries to below a certain upper limit and avoid a phenomenon in which the response deteriorates, this is effective in improving the throughput performance of the system.

特にマルチ・プロセッサ・システムの場合、ロック  
    −占有率を低く抑える本発明の方式は性能向上
に効果がある。
Locks, especially on multiprocessor systems
- The method of the present invention that keeps the occupancy low is effective in improving performance.

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

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

第1図は本発明のロック制御及びタスク制御方式の概略
フローを示す図、第2図はT” CBの形式を示す図、
第3図はWCBの形式を示す図、第4図はLRBの形式
を示す図、第5閾はロック確保処理のフローを示す図、
第6図はロック解放処理のフローを示す図、第7図は本
発明の実施例のマルチ・プロセッサ構成オンライン・デ
ータヘース・システムの構成概略を示す図、第8図はW
AITキューの形式を示す図、第9図はタスクキューの
形式を示す口、第10図〜第13図は本発明の作用を示
す図である。 130・・・・・・・・WAITキュー、131・・・
・・・・・・WCB   (WAIT   Contr
ol   旧ock)  、  1 3 2−−−1−
1RB (Lock  Request  Block
) 、、  + 40−タスクキュー、141・・・・
・・・・タスクキュー先頭ポインタ、142・・・・・
・・・・タフスキュー末尾ポインタ、143−TCB 
(Task  Control  Block)、31
2・・・・・・・・・POSTビ゛ンI・、313・・
・・ ・・Wへ] Tヒラl−1314・・・・・・・
・・P OS i’コート。 代 理 人 弁理士 弐 顕次部(外1名)″ 〒→ 第11図 第12N
FIG. 1 is a diagram showing a schematic flow of the lock control and task control method of the present invention, FIG. 2 is a diagram showing the format of T'' CB,
FIG. 3 is a diagram showing the format of WCB, FIG. 4 is a diagram showing the format of LRB, and the fifth threshold is a diagram showing the flow of lock securing processing.
FIG. 6 is a diagram showing the flow of lock release processing, FIG. 7 is a diagram showing a schematic configuration of a multi-processor configured online data storage system according to an embodiment of the present invention, and FIG. 8 is a diagram showing a W
FIG. 9 is a diagram showing the format of the AIT queue, FIG. 9 is a diagram showing the format of the task queue, and FIGS. 10 to 13 are diagrams showing the operation of the present invention. 130...WAIT queue, 131...
・・・・・・WCB (WAIT Contr
ol old ock), 1 3 2---1-
1RB (Lock Request Block
) ,, + 40-task queue, 141...
...Task queue head pointer, 142...
...Tough skew end pointer, 143-TCB
(Task Control Block), 31
2......POST bin I..., 313...
... to W] T Hilla l-1314...
・・POS i' coat. Agent Patent Attorney 2 Kenjibu (1 other person) 〒→ Figure 11 Figure 12N

Claims (1)

【特許請求の範囲】 1、共有リソースがタスク1により占有使用(ロック)
中であつたために該共有リソースのロック権確保に失敗
したタスク2を待ち状態に遷移させるWAIT処理と、
前記タスク1が該共有リソースの使用を終了したときに
前記タスク2を実行可能状態に遷移させるPOST処理
と、実行可能状態のタスクにプロセッサ使用権を割り当
てるディスパッチ処理とによつて、共有リソースの占有
使用権のタスク間排他制御を行なう、マルチ・タスク方
式のマルチ・プロセッサ・システムにおけるロック制御
方式において、タスク1が前記共有リソースの使用を終
了した時点で該共有リソースを解放し、他プロセッサ上
で実行中の第3のタスクによる該共有リソースのロック
を許可する手段と、該ロックの許可後にPOST処理に
よつてタスク2を実行可能状態に遷移させる手段と、該
タスク2の実行可能状態への遷移後にディスパッチ処理
によつてプロセッサ使用権を得たタスク2が前記共有リ
ソースのロック権確保をリトライする手段とを備えたこ
とを特徴とするロック制御方式。2、共有リソースがタ
スク1によりロック中であつたために該共有リソースの
ロック権確保に失敗したタスク2を待ち状態に遷移させ
るWAIT処理と、前記タスク1が該共有リソースの使
用を終了したときに前記タスク2を実行可能状態に遷移
させるPOST処理と、実行可能状態のタスクにプロセ
ッサ使用権を割り当てるディスパッチ処理とによつて、
共有リソースの占有使用権のタスク間排他制御を行なう
、マルチ・タスク方式のマルチ・プロセッサ・システム
におけるロック制御方式において、 タスク1が該共有リソースの使用を終了した時点で該共
有リソースを解放し、他プロセッサ上で実行中の第3の
タスクによる該共有リソースのロックを許可した後、P
OST処理によつてタスク2を実行可能状態に遷移させ
た後、ディスパッチ処理によつてプロセッサ使用権を得
たタスク2が該共有リソースのロック権確保をリトライ
する第1のロック制御方式と、 タスク1が該共有リソースの使用を終了した時点で該共
有リソースのロック権をタスク2へ直接譲渡し、POS
T処理によつてタスク2を実行可能状態に遷移させた後
、ディスパッチ処理によつてプロセッサ使用権を得たタ
スク2が該共有リソースのロック権を解放するまでの間
、タスク2以外のタスクによる該共有リソースのロック
を禁止する第2のロック制御方式とを含み、 前記第1のロック制御方式と第2のロック制御方式とを
動的に切り替える切り替え手段を備えたことを特徴とす
るロック制御方式。 3、前記切り替え手段として、タスク2のリトライ回数
を計数し、このリトライ回数が所定の上限値未満ならば
、前記第1のロック制御を行う手段により構成したこと
を特徴とする請求項2記載のロック制御方式。 4、前記切り替え手段として、タスク2のリトライ回数
を計数し、リトライ回数が所定の上限値以上に達すると
、前記第2のロック制御を行う手段により構成したこと
を特徴とする請求項2記載のロック制御方式。 5、POST処理によるタスク2の待ち状態解除後、タ
スク1の実行を中断し、タスク1が走行していたプロセ
ッサをタスク2に割り当てる手段を備えたことを特徴と
する請求項2ないし4記載のロック制御方式のためのタ
スク制御方式。 6、WAIT処理によつてタスク2が待ち状態に遷移す
る前に、タスク2の実行優先順位を高める優先順位変更
を行ない、タスク2の共有リソース解放時に前記変更を
施した実行優先順位を復元する手段を備えたことを特徴
とする請求項2ないし4記載のロック制御方式のための
タスク制御方式。 7、タスク1がPOST処理によつてタスク2の待ち状
態を解除する前に、タスク2の実行優先順位を高める優
先順位変更を行ない、タスク2の共有リソース解放時に
前記変更を施した実行優先順位を復元する手段を備えた
ことを特徴とする請求項2ないし4記載のロック制御方
式のためのタスク制御方式。 8、請求項1ないし7記載のロック制御方式又はタスク
制御方式を使用したオンライン・トランザクション・シ
ステム。
[Claims] 1. Shared resource is exclusively used (locked) by task 1
a WAIT process in which task 2, which has failed to secure the lock right for the shared resource because the task was inside the shared resource, is placed in a waiting state;
Occupation of the shared resource is achieved by a POST process that transitions the task 2 to an executable state when the task 1 finishes using the shared resource, and a dispatch process that allocates processor usage rights to the task in the executable state. In a lock control method in a multi-task multi-processor system that performs exclusive control of usage rights between tasks, when task 1 finishes using the shared resource, the shared resource is released and used on other processors. means for allowing a third task being executed to lock the shared resource; means for transitioning task 2 to an executable state by POST processing after the lock is granted; and means for transitioning task 2 to an executable state by POST processing; 1. A lock control method, comprising means for causing a task 2, which has obtained the right to use a processor through dispatch processing after the transition, to retry securing the right to lock the shared resource. 2. A WAIT process in which task 2, which has failed to secure the lock right for the shared resource because the shared resource was locked by task 1, is placed in a waiting state, and when task 1 finishes using the shared resource. Through the POST process that transitions the task 2 to an executable state and the dispatch process that allocates processor usage rights to the task in the executable state,
In a lock control method in a multi-task multi-processor system that performs exclusive control between tasks on the exclusive right to use a shared resource, when task 1 finishes using the shared resource, the shared resource is released; After allowing the third task running on another processor to lock the shared resource, P
A first lock control method in which task 2, which has obtained processor usage rights through dispatch processing after transitioning task 2 to an executable state through OST processing, retries securing lock rights for the shared resource; When task 1 finishes using the shared resource, it directly transfers the locking right of the shared resource to task 2, and
After task 2 is transitioned to an executable state through T processing, tasks other than task 2 may be unable to access the shared resource until task 2, which has acquired processor usage rights through dispatch processing, releases the lock rights for the shared resource. a second lock control method for prohibiting locking of the shared resource, and further comprising a switching means for dynamically switching between the first lock control method and the second lock control method. method. 3. The switching means comprises means for counting the number of retries of task 2 and performing the first lock control if the number of retries is less than a predetermined upper limit value. Lock control method. 4. The switching means comprises means for counting the number of retries of task 2 and performing the second lock control when the number of retries reaches a predetermined upper limit or more. Lock control method. 5. The computer system according to any one of claims 2 to 4, further comprising means for interrupting the execution of task 1 after releasing the waiting state of task 2 by POST processing, and assigning the processor on which task 1 was running to task 2. A task control scheme for lock control schemes. 6. Before task 2 transitions to the wait state by WAIT processing, change the priority to raise the execution priority of task 2, and restore the changed execution priority when the shared resource of task 2 is released. 5. A task control method for a lock control method according to claim 2, further comprising means. 7. Before task 1 releases task 2 from the waiting state through POST processing, change the priority to raise task 2's execution priority, and when task 2's shared resources are released, the execution priority with the above change is changed. 5. The task control method for a lock control method according to claim 2, further comprising means for restoring the lock control method. 8. An online transaction system using the lock control method or task control method according to any one of claims 1 to 7.
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
EP19890109410 EP0343646B1 (en) 1988-05-26 1989-05-24 Task execution control method for a multiprocessor system with enhanced post/wait procedure
DE1989625064 DE68925064T2 (en) 1988-05-26 1989-05-24 Task execution control method for a multiprocessor system with 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 true JPH01297760A (en) 1989-11-30
JP2804478B2 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 (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
WO2012132017A1 (en) * 2011-03-31 2012-10-04 富士通株式会社 Exclusion control method and exclusion control program
JP2016530625A (en) * 2013-08-14 2016-09-29 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, system, and program for 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

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4963018B2 (en) 2005-08-15 2012-06-27 株式会社ソニー・コンピュータエンタテインメント Scheduling method and scheduling apparatus
US20070083867A1 (en) * 2005-09-09 2007-04-12 International Business Machines Corporation Method and system to recover from control block hangs in a heterogenous multiprocessor environment
JP4233585B2 (en) 2006-07-25 2009-03-04 株式会社エヌ・ティ・ティ・ドコモ Peripheral switching device and peripheral switching control device

Citations (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

Patent Citations (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 (7)

* 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
WO2012132017A1 (en) * 2011-03-31 2012-10-04 富士通株式会社 Exclusion control method and exclusion control program
JP5725162B2 (en) * 2011-03-31 2015-05-27 富士通株式会社 Exclusive control method and exclusive control program
US9632842B2 (en) 2011-03-31 2017-04-25 Fujitsu Limited Exclusive access control method prohibiting attempt to access a shared resource based on average number of attempts and predetermined threshold
JP2016530625A (en) * 2013-08-14 2016-09-29 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, system, and program for efficient task scheduling using a locking mechanism
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

Also Published As

Publication number Publication date
JP2804478B2 (en) 1998-09-24

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
US7797704B2 (en) System and method for performing work by one of plural threads using a lockable resource
US7975271B2 (en) System and method for dynamically determining a portion of a resource for which a thread is to obtain a lock
CN101203831B (en) Device, method and system for caching memory update
EP0661633B1 (en) Method and system for managing ownership of a released synchronization mechanism
JP2514299B2 (en) Serialization method of interrupt handling for process level programming
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
US20030105796A1 (en) Method and apparatus for controlling access to shared resources in an environment with multiple logical processors
US20020029239A1 (en) Method and system for enhanced concurrency in a computing environment
JPH03161859A (en) Request control method and access control system
US10579413B2 (en) Efficient task scheduling using a locking mechanism
US20110047549A1 (en) Manipulating a spin bit within the wait primitive
US7793023B2 (en) Exclusion control
US6976260B1 (en) Method and apparatus for serializing a message queue in a multiprocessing environment
US20020112100A1 (en) System and method for data exchange
JPH01297760A (en) System for lock control and task control in multiprocessor
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
JP7346649B2 (en) Synchronous control system and method
CN111989651A (en) Method and device for managing kernel service in multi-core system
US11119831B2 (en) Systems and methods for interrupting latency optimized two-phase spinlock
CN103995743A (en) Two-stage mixed task scheduling method based on resource reservation
JPH02171952A (en) Dispatching system for multiprocessor
CN117112235B (en) Task execution method and device

Legal Events

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