JPH09282182A - Pre-emptive control method for computer system - Google Patents

Pre-emptive control method for computer system

Info

Publication number
JPH09282182A
JPH09282182A JP8097997A JP9799796A JPH09282182A JP H09282182 A JPH09282182 A JP H09282182A JP 8097997 A JP8097997 A JP 8097997A JP 9799796 A JP9799796 A JP 9799796A JP H09282182 A JPH09282182 A JP H09282182A
Authority
JP
Japan
Prior art keywords
task
counter
function
preemption
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8097997A
Other languages
Japanese (ja)
Inventor
Osamu Takeuchi
理 竹内
Masaaki Iwasaki
正明 岩嵜
Masahiko Nakahara
雅彦 中原
Takahiro Nakano
隆裕 中野
Hajime Serizawa
一 芹沢
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
Original Assignee
Hitachi 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 filed Critical Hitachi Ltd
Priority to JP8097997A priority Critical patent/JPH09282182A/en
Publication of JPH09282182A publication Critical patent/JPH09282182A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To improve efficiency for developing an operating system by enabling the nest control of pre-emptive by inhibiting the interruption of a task under execution when the value of a counter is positive and enabling the interruption of the task under execution correspondently when the value of the counter becomes '0'. SOLUTION: Concerning a computer system for parallelly executing plural tasks, when a function for requesting the inhibition of execution stop for the task under execution is issued from an application or a system call routine, a counter 12 showing the possibility/impossibility of execution stop for the task under execution is incremented. When the value of the counter 12 is positive, a real scheduling operation is delayed until the inhibition of execution stop for the task under execution is canceled. Further, when the value of the counter 12 is '0' and a scheduling request to the other task is generated, the scheduling operation is immediately performed. Through such control, the nest control of pre-emptive is enabled.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は計算機システムにお
けるプリエンプト制御方法に係り、特にマルチタスク環
境を提供するオぺレーティング・システムに好適な計算
機システムにおけるプリエンプト制御方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a preemption control method in a computer system, and more particularly to a preemption control method in a computer system suitable for an operating system providing a multitask environment.

【0002】[0002]

【従来の技術】オペレーティング・システムは、その機
能をアプリケーション・プログラム(以後、単にアプリ
ケーションと呼ぶ)に提供するために、アプリケーショ
ンとの間にシステム・コールと呼ぶインタフェースを設
けている。アプリケーションがシステム・コールを発行
すると、オペレーティング・システム内部のルーチン
(システムコール・ルーチン)が起動される。ところ
で、アプリケーションばかりでなくシステムコール・ル
ーチンを実行中でも、実行中のタスクに割り当てられた
CPU時間が使いきられるなどの理由により、タスクの
実行が中断され、一定時間間隔にCPUが駆動するルー
チンなどから他タスクのスケジューリング要求が発行さ
れる可能性がある。このようにタスクの実行が一時的に
中断されたとき、実行中のタスクは「プリエンプト」さ
れたと言う。
2. Description of the Related Art An operating system is provided with an interface called an "system call" with an application in order to provide its function to an application program (hereinafter referred to simply as "application"). When an application issues a system call, a routine inside the operating system (system call routine) is started. By the way, while not only the application but also the system call routine is being executed, the execution of the task is interrupted due to the CPU time allotted to the task being executed being used up, and the routine driven by the CPU at certain time intervals. May issue a scheduling request for another task. When the task execution is temporarily suspended in this way, the task being executed is said to be "preempted".

【0003】アプリケーション又はシステムコール・ル
ーチンは、危険区域と呼ばれるコード部分を持ち、ある
タスクが危険区域内を走行中は、他のいかなるタスクも
その危険区域内を走行することは許されない。(ピータ
ーソン/シルバーシャッツ共著、宇津宮孝一/福田晃共
訳、「オペレーティングシステムの概念」上巻、培風
館、314ページ16行目〜319ページ31行目、1
987年)。実行中タスクが危険区域を走行中に他タス
クのスケジューリング要求が発行された場合、即時に他
タスクをスケジューリングしてしまうと、危険区域内を
走行中のタスクが存在するにも関わらず、新たにスケジ
ューリングされたタスクがその危険区域を走行する可能
性がある。
An application or system call routine has a piece of code called the danger zone, and while one task is running in the danger zone, no other task is allowed to run in the danger zone. (Co-authored by Peterson / Silver Shatz, co-translated by Koichi Utsumiya / Akira Fukuda, "The Concept of Operating Systems", Volume 1, Baifukan, page 314, line 16 to page 319, line 31.
987). If a request for scheduling another task is issued while a running task is running in the dangerous area, if another task is scheduled immediately, a new task will be created even if there is a task running in the dangerous area. Scheduled tasks may run in the danger zone.

【0004】従来、危険区域を走行するタスクの上限数
を1に制限する手法として、「プリエンプト制御」によ
る手法が知られている。例えばμITRON3.0で
は、プリエンプト制御を行なうため、以下のインタフェ
ースを提供している。(坂村健監修、「μITRON
3.0標準ハンドブック」、パーソナルメディア、74
ページ〜77ページ、1993年) (1)dis_dsp:実行中タスクをプリエンプト禁
止状態(後述)に遷移させる。
Conventionally, as a method of limiting the upper limit of the number of tasks that run in a dangerous area to 1, a method using "preemption control" is known. For example, μITRON3.0 provides the following interfaces for performing preemption control. (Supervised by Ken Sakamura, "μITRON
3.0 Standard Handbook ", Personal Media, 74
(Page to page 77, 1993) (1) dis_dsp: transitions a running task to a preemption prohibited state (described later).

【0005】(2)ena_dsp:実行中タスクをプ
リエンプト可能状態(後述)に遷移させる。
(2) ena_dsp: Transitions the running task to the preemptible state (described later).

【0006】アプリケーション又はシステムコール・ル
ーチンがdis_dsp関数を発行すると、次にena
_dsp関数を発行するまで、実行中タスクは「プリエ
ンプト禁止状態」、即ち、他タスクのスケジューリング
要求が発行されても、実行中タスクはプリエンプトされ
ない状態に遷移する。dis_dsp関数とena_d
sp関数は必ず対になって呼び出される。
When an application or system call routine issues the dis_dsp function, then ena
Until the _dsp function is issued, the running task is in the "preemption disabled state", that is, the running task transits to a state where it is not preempted even if a scheduling request for another task is issued. dis_dsp function and ena_d
The sp functions are always called in pairs.

【0007】また、アプリケーション又はシステムコー
ル・ルーチンがena_dsp関数を発行すると、実行
中タスクは「プリエンプト可能状態」、すなわち、他タ
スクのスケジューリング要求が発行されれば、即時に実
行中のタスクがプリエンプトされる状態に復帰する。ま
た、実行中タスクがプリエンプト禁止状態にある間に発
行された他タスクのスケジューリング要求が存在する場
合には、このena_dsp関数が発行された時点で他
タスクがスケジューリングされる。
When the application or system call routine issues the ena_dsp function, the task under execution is in the "preemptable state", that is, if a scheduling request for another task is issued, the task under execution is immediately preempted. To return to the normal state. If there is a scheduling request for another task issued while the running task is in the preemption disabled state, the other task is scheduled when this ena_dsp function is issued.

【0008】「プリエンプト制御」とは、実行中タスク
のプリエンプト状態(「プリエンプト禁止状態」と「プ
リエンプト可能状態」の総称)を遷移させることを言
う。
The "preemption control" is to change the preemption state (general term of "preemption prohibited state" and "preemption enabled state") of the task under execution.

【0009】そして、プリエンプト制御により危険区域
を走行するタスクの上限数を制限するには、危険区域に
入る直前に実行中タスクをプリエンプト禁止状態に遷移
させ、かつ、危険区域から抜けた直後にプリエンプト可
能状態に復帰させれば良い。
In order to limit the upper limit of the number of tasks running in the dangerous area by the preemption control, the running task is transited to the preemption prohibition state immediately before entering the dangerous area, and the preemption is performed immediately after leaving the dangerous area. All you have to do is return to the enabled state.

【0010】このようにすると、タスクが危険区域内を
走行中はプリエンプト禁止状態に置かれる。よって、あ
るタスクが危険区域走行中に他タスクがスケジューリン
グされ、かつそのスケジューリングされたタスクが危険
区域内に侵入してくることはありえない。
In this way, the task is placed in the preemption prohibited state while the task is running in the dangerous area. Therefore, it is not possible that another task is scheduled while one task is running in the dangerous area and the scheduled task enters the dangerous area.

【0011】[0011]

【発明が解決しようとする課題】プリエンプト制御を用
いて危険区域を走行するタスクの上限数を制限するた
め、システムコール・ルーチンにはプリエンプト制御の
関数が埋め込まれる。従って、実行中タスクをプリエン
プト可能状態に遷移させる関数(ena_dsp関数)
も、システムコール・ルーチンに埋め込まれる。
In order to limit the upper limit of the number of tasks that run in a dangerous area using preempt control, a preempt control function is embedded in the system call routine. Therefore, a function (ena_dsp function) that transitions the running task to the preemptible state
Is also embedded in the system call routine.

【0012】いま、実行中タスクがプリエンプト禁止状
態にあるときにシステムコール・ルーチンの危険区域内
から、他のシステムコール・ルーチンを呼び出す場合を
考える。呼び出されるシステムコール・ルーチンでは、
実行中タスクをプリエンプト可能状態に遷移させる関数
が使用されているとする。
Now, consider a case where another system call routine is called from within the danger area of the system call routine when the task under execution is in the preemption disabled state. In the called system call routine,
It is assumed that a function that changes the running task to the preemptible state is used.

【0013】この場合、このシステムコール・ルーチン
呼び出し前に、実行中のタスクをプリエンプト禁止状態
に遷移させたにもかかわらず、呼び出したシステムコー
ル・ルーチン中で、実行中タスクをプリエンプト可能状
態に遷移させる関数が発行されるため、実行中タスクは
プリエンプト可能状態に戻ってしまう。すなわち、危険
区域内にも関わらず実行中タスクはプリエンプト可能状
態になり、プログラムが誤動作する。
In this case, even though the task being executed is transited to the preemption disabled state before this system call routine is called, the task being executed is transited to the preemptible state in the called system call routine. Since the function to issue is issued, the running task returns to the preemptible state. That is, the task under execution becomes preemptible even though it is in the dangerous area, and the program malfunctions.

【0014】そのため、危険区域内から他のシステムコ
ール・ルーチンを呼び出す場合には、呼び出すシステム
コール・ルーチンからプリエンプト制御の関数を除いた
ルーチンを別に用意し、そのルーチンを呼び出す必要が
あり、オペレーティング・システムの開発効率が低下す
るという問題があった。
Therefore, when calling another system call routine from within the dangerous area, it is necessary to separately prepare a routine excluding the preemption control function from the system call routine to be called, and call that routine. There was a problem that the development efficiency of the system was reduced.

【0015】実行中タスクをプリエンプト可能状態に遷
移させる関数を使用するライブラリ・ルーチン(複数の
システムコール・ルーチンから使用される共用のルーチ
ン)を危険区域内から呼び出す場合にも同様の問題が発
生し、やはりオペレーティング・システムの開発効率が
低下する。
A similar problem occurs when a library routine (a shared routine used by a plurality of system call routines) that uses a function for shifting a running task to a preemptable state is called from within the dangerous area. Again, the operating system development efficiency is reduced.

【0016】危険区域内からでも、実行中タスクをプリ
エンプト可能状態に遷移させる関数を使用するシステム
コール・ルーチンやライブラリ・ルーチン(以後、これ
ら二つをまとめてシステムコール・ルーチンと呼ぶこと
にする)を呼び出し可能とするためには、プリエンプト
状態を遷移させる関数の対をネスト可能なプリエンプト
制御方法が必要となる。
A system call routine or a library routine that uses a function for transitioning a task under execution to a preemptible state even from inside the dangerous area (hereinafter, these two are collectively referred to as a system call routine) In order to be able to call, a preemption control method capable of nesting a pair of functions that transit the preemption state is required.

【0017】本発明の目的は、ネスト可能なプリエンプ
ト制御方法を提供することにある。
An object of the present invention is to provide a nestable preemption control method.

【0018】[0018]

【課題を解決するための手段】本発明では、複数のタス
クを並列に実行する計算機システムにおいて、実行中タ
スクの実行中断の禁止を要求する関数が、アプリケーシ
ョン又はシステムコール・ルーチンから発行されたとき
に、実行中タスクの実行中断の可否を示すカウンタをイ
ンクリメントする。また、実行中タスクの実行中断の禁
止解除を要求する関数が、アプリケーション又はシステ
ムコール・ルーチンから発行されたときに、上記カウン
タをデクリメントする。そして、上記カウンタの値が正
であるならば、他タスクへのスケジューリング要求が発
生しても、実際のスケジューリング動作を実行中タスク
の実行中断の禁止が解除されるまで遅延させる。さら
に、上記カウンタの値が0であるならば、他タスクへの
スケジューリング要求が発生したら、即時にスケジュー
リング動作を行なう。
According to the present invention, in a computer system which executes a plurality of tasks in parallel, when a function requesting prohibition of interruption of execution of a task under execution is issued from an application or a system call routine. Then, the counter indicating whether or not the execution of the task under execution can be interrupted is incremented. Also, when a function requesting cancellation of the suspension of execution of a running task is issued from an application or a system call routine, the counter is decremented. If the value of the counter is positive, the actual scheduling operation is delayed until the suspension of execution of the executing task is released even if a scheduling request is issued to another task. Furthermore, if the value of the counter is 0, the scheduling operation is immediately performed when a scheduling request to another task is generated.

【0019】以上の制御により、プリエンプトのネスト
制御が可能となる。
The above control enables preempt nest control.

【0020】[0020]

【発明の実施の形態】以下、本発明の実施の形態を、図
を用いて詳細に説明する。
Embodiments of the present invention will be described below in detail with reference to the drawings.

【0021】図1は、本発明を実現するのに必要なモジ
ュール群、及びデータの概要図である。
FIG. 1 is a schematic diagram of a module group and data necessary for implementing the present invention.

【0022】図1において、11はプリエンプト禁止フ
ラグを示す。オペレーティング・システムは、プリエン
プト禁止フラグ11のON/OFFによってスケジュー
ラ14の動作を変え、プリエンプト状態を遷移させる。
該フラグをONにすると、実行中タスクのプリエンプト
状態はプリエンプト禁止状態になり、OFFにするとプ
リエンプト可能状態になる。
In FIG. 1, 11 indicates a preemption prohibition flag. The operating system changes the operation of the scheduler 14 by turning ON / OFF the preemption prohibition flag 11 and transits the preemption state.
When the flag is turned ON, the preemption state of the task under execution is in the preemption prohibited state, and when it is OFF, it is in the preemption enabled state.

【0023】スケジューラ14のフローチャートを図4
に示す。
The flow chart of the scheduler 14 is shown in FIG.
Shown in

【0024】スケジューラ14は、まず、ステップ41
において、プリエンプト禁止フラグ11を検査する。プ
リエンプト禁止フラグ11がONであれば、実行中タス
クはプリエンプト禁止状態にあることを示す。従って、
スケジューラ14は、ステップ42において、スケジュ
ーリング要求フラグ13をONにしたら即時にスケジュ
ーラを呼び出したルーチン(例えばシステムコール・ル
ーチン17)にリターンする。
The scheduler 14 starts with step 41.
In, the preemption prohibition flag 11 is checked. When the preemption prohibition flag 11 is ON, it indicates that the running task is in the preemption prohibition state. Therefore,
When the scheduling request flag 13 is turned ON in step 42, the scheduler 14 immediately returns to the routine that called the scheduler (for example, the system call routine 17).

【0025】ステップ41において、プリエンプト禁止
フラグ11がOFFであれば、実行中タスクはプリエン
プト可能状態にある。従ってスケジューラは、ステップ
43において通常のスケジューリング動作を行ないスケ
ジューラを呼び出したルーチンにリターンする。
In step 41, if the preemption prohibition flag 11 is OFF, the task under execution is in the preemption enabled state. Therefore, the scheduler performs the normal scheduling operation in step 43 and returns to the routine that called the scheduler.

【0026】カウンタ12は本発明に従って組み込まれ
たプリエンプト禁止要求の受理回数を保持するカウンタ
である。システムコール・ルーチン17から発行される
プリエンプト禁止要求はプリエンプト禁止関数15で処
理されるが、その中で、該カウンタ12のインクリメン
トも行なう。一方、プリエンプト禁止の解除要求はプリ
エンプト禁止解除関数16において処理され、この中
で、該カウンタ12のデクリメントを行なう。これにつ
いては、後ほど詳述する。
The counter 12 is a counter for holding the number of times of acceptance of the preemption prohibition request incorporated according to the present invention. The preemption prohibition request issued from the system call routine 17 is processed by the preemption prohibition function 15, in which the counter 12 is also incremented. On the other hand, the request for canceling the preemption prohibition is processed in the preemption prohibition cancellation function 16, in which the counter 12 is decremented. This will be described later in detail.

【0027】カウンタ12の値が正である場合には、プ
リエンプト禁止関数15発行回数が、プリエンプト禁止
解除関数16の発行回数より上回っていることを示すた
め、実行中のタスクはプリエンプト禁止状態になければ
ならない。同様に、カウンタ12の値が0である場合に
は、実行中のタスクはプリエンプト可能状態になければ
ならない。従って、カウンタ12の値が正の場合にはプ
リエンプト禁止フラグ11がONとなるように、またカ
ウンタの値が0である場合には、プリエンプト禁止フラ
グ11がOFFとなるように、プリエンプト禁止関数1
5及びプリエンプト禁止解除関数16を実現する。これ
についても後ほど詳述する。
When the value of the counter 12 is positive, it indicates that the number of times the preemption prohibition function 15 is issued is greater than the number of times the preemption prohibition cancel function 16 is issued, so that the task being executed cannot enter the preemption prohibition state. I have to. Similarly, when the value of the counter 12 is 0, the task being executed must be in the preemptable state. Therefore, when the value of the counter 12 is positive, the preemption prohibition flag 11 is turned on, and when the value of the counter is 0, the preemption prohibition flag 11 is turned off.
5 and the preemption prohibition cancellation function 16 are realized. This will also be described later in detail.

【0028】システムコール・ルーチン17は、危険区
域実現のため、実行中タスクのプリエンプト状態をプリ
エンプト禁止状態、又はプリエンプト可能状態に遷移さ
せる必要がある。その場合、以下のインタフェースを用
いて、プリエンプト禁止関数15、プリエンプト禁止解
除関数16を呼び出す。
The system call routine 17 needs to transit the preemption state of the task being executed to the preemption prohibited state or the preemption enabled state in order to realize the dangerous area. In that case, the following interfaces are used to call the preemption prohibition function 15 and the preemption prohibition release function 16.

【0029】<関数名> preempt_disable(*level) <引数> *level:本関数と関数preempt_enab
leで形成される対のネストの深さを受け取るアドレス
を指定する。
<Function name> preempt_disable (* level) <argument> * level: This function and function preempt_enab
Specifies the address that receives the depth of the nest of pairs formed by le.

【0030】<説明>本関数は実行中タスクをプリエン
プト禁止状態に遷移させる。本関数を発行しプリエンプ
ト禁止状態に遷移してから、関数preempt_en
ableを発行してプリエンプト可能状態に復帰するま
での区間で、本関数と関数preempt_enabl
eを対にして発行しても良い。すなわち、本関数と関数
preempt_enableの対はネスト可能であ
る。ネストの内側で発行される本関数と関数preem
pt_enableは、プリエンプト禁止状態とプリエ
ンプト可能状態との間の状態遷移は行なわない。*le
velで示されるメモリ領域には、このネストの深さが
返る。
<Description> This function shifts the task under execution to the preemption disabled state. After issuing this function and transitioning to the preemption disabled state, the function preempt_en
This function and the function preempt_enable are in the interval from issuing the "able" to returning to the preemptible state.
You may issue e as a pair. That is, the pair of this function and the function preempt_enable can be nested. This function and function preem issued inside the nest
pt_enable does not make a state transition between the preemption prohibited state and the preemption enabled state. * Le
The depth of this nest is returned to the memory area indicated by vel.

【0031】<関数名> preempt_enable(level) <引数> level:本関数と対となる関数preempt_d
isableが返したネスト・レベルを指定する。
<Function name> preempt_enable (level) <argument> level: function preempt_d which is a pair with this function
Specifies the nesting level returned by isable.

【0032】<説明>本関数は実行中タスクをプリエン
プト可能状態に復帰させる。関数preempt_di
sableを発行しプリエンプト禁止状態に遷移してか
ら、本関数を発行してプリエンプト可能状態に復帰する
までの区間で、関数preempt_disableと
本関数を対にして発行しても良い。すなわち、関数pr
eempt_disableと本関数の対はネスト可能
である。ネストの内側で発行される関数preempt
_disableと本関数は、プリエンプト禁止状態と
プリエンプト可能状態との間の状態遷移は行なわない。
levelには、このネストの深さ、すなわち対となる
関数preempt_disableの発行により得ら
れたlevelの値を指定する。カーネルもこのネスト
の深さを保持しており、引数で指定されたネストの深さ
と一致しない場合には、システムコール・ルーチン17
にエラーを通知する。
<Description> This function returns the running task to the preemptible state. Function preempt_di
The function preempt_disable and this function may be issued as a pair in the interval from issuing the "save" command to transit to the preemption prohibited state and then issuing this function and returning to the "preemption enabled" state. That is, the function pr
The pair of eempt_disable and this function can be nested. Function preempt issued inside the nest
_Disable and this function do not perform the state transition between the preemption prohibited state and the preemption enabled state.
In the level, the depth of this nest, that is, the value of the level obtained by issuing the paired function preempt_disable is specified. The kernel also holds this nest depth, and if it does not match the nest depth specified by the argument, the system call routine 17
Notify the error.

【0033】システムコール・ルーチン17がプリエン
プト制御関数を使用する場合には、まずプリエンプト禁
止関数15(preempt_disable関数)を
呼び出した際に、同関数により返される現在のネストの
深さを、自関数の作業領域18に格納する。そして、プ
リエンプト禁止解除関数16(preempt_ena
ble関数)を呼び出す際に、その作業領域18に格納
されている値を、同関数の引数として指定する。プリエ
ンプト禁止解除関数16では、この引数の値とカウンタ
12の値を比較し、両者が一致しない場合にシステムコ
ール・ルーチン17にエラーを通知するため、pree
mpt_enable関数と対となるべきpreemp
t_disable関数が存在しないというプログラム
ミスを、容易に検出可能になる。
When the system call routine 17 uses the preemption control function, first, when the preemption prohibition function 15 (preempt_disable function) is called, the current nesting depth returned by the preemption disable function 15 is determined by the function itself. Stored in the work area 18. Then, the preemption prohibition release function 16 (preempt_ena)
When calling the ble function), the value stored in the work area 18 is specified as an argument of the function. The preemption prohibition canceling function 16 compares the value of this argument with the value of the counter 12 and, if they do not match, notifies the system call routine 17 of an error.
premp to be paired with the mpt_enable function
It is possible to easily detect a program error that the t_disable function does not exist.

【0034】preempt_disable関数の処
理手順を図2を用いて説明し、preempt_ena
ble関数の処理手順を図3を用いて説明する。
The processing procedure of the preempt_disable function will be described with reference to FIG. 2, and preempt_ena will be described.
The processing procedure of the ble function will be described with reference to FIG.

【0035】preempt_disable関数で
は、まず、ステップ21において、カウンタ12の値を
インクリメントする。そして、ステップ22において、
インクリメント後のカウンタ12の値を、第1引数で与
えられたアドレスに複写する。そして、ステップ23に
おいて、プリエンプト禁止フラグ11をONにしてリタ
ーンする。
In the preempt_disable function, first, in step 21, the value of the counter 12 is incremented. Then, in step 22,
The value of the counter 12 after the increment is copied to the address given by the first argument. Then, in step 23, the preemption prohibition flag 11 is turned on and the process returns.

【0036】preempt_enable関数では、
まず、ステップ31において、カウンタ12を参照し、
第1引数の値と比較する。その結果、一致していれば、
ステップ32においてカウンタ12の値をデクリメント
する。一致していなければシステムコール・ルーチン1
7にエラーを通知する。次に、ステップ33で、デクリ
メント後のカウンタ12の値を検査する。この時、カウ
ンタ12の値が0でなければ、正常終了する。また、0
であれば、ステップ34においてプリエンプト禁止フラ
グをOFFにする。さらに、ステップ35において、ス
ケジューリング要求フラグ13を検査し、これがONで
あれば、ステップ36においてスケジューリング要求フ
ラグ13をOFFにした後、ステップ37でスケジュー
ラを起動し、正常終了する。ステップ35において、ス
ケジューリング要求フラグ13がOFFであれば、ステ
ップ36〜37は行なわない。
In the preempt_enable function,
First, in step 31, referring to the counter 12,
Compare with the value of the first argument. As a result, if they match,
In step 32, the value of the counter 12 is decremented. If they do not match, system call routine 1
Notify 7 of the error. Next, in step 33, the value of the counter 12 after decrement is checked. At this time, if the value of the counter 12 is not 0, the process ends normally. Also, 0
If so, in step 34, the preemption prohibition flag is turned off. Further, in step 35, the scheduling request flag 13 is checked, and if it is ON, the scheduling request flag 13 is turned OFF in step 36, and then the scheduler is activated in step 37 to normally end. If the scheduling request flag 13 is OFF in step 35, steps 36 to 37 are not performed.

【0037】上記のような、preempt_disa
ble、preempt_enable関数を用いれ
ば、両関数の対が複数ネストした場合でも、発行したp
reempt_disable関数と同じ回数だけpr
eempt_enable関数を発行しない限り、実行
中タスクはプリエンプト可能状態に復帰しない。従っ
て、危険区域内から(実行中タスクがプリエンプト禁止
状態にある場合)でも、実行中タスクをプリエンプト可
能状態に遷移させる関数を使用するシステムコール・ル
ーチンを呼び出し可能になる。
Preempt_disa as described above
If the ble and preemptt_enable functions are used, the issued p
pr the same number of times as the reempt_disable function
Unless the empty_enable function is issued, the running task does not return to the preemptable state. Therefore, even from inside the dangerous area (when the running task is in the preemption disabled state), it becomes possible to call a system call routine that uses a function for transitioning the running task to the preemptable state.

【0038】[0038]

【発明の効果】以上述べた如く、本発明によれば、プリ
エンプトの禁止要求とプリエンプトの禁止解除要求の対
をネストして発行できる。そして、発行したプリエンプ
ト禁止関数と同じ回数だけプリエンプト禁止解除関数を
発行しない限り、実行中タスクはプリエンプト可能状態
に復帰しない。そのため、実行中タスクがプリエンプト
禁止状態にある場合でも、実行中タスクをプリエンプト
可能状態に遷移させる関数を使用するシステムコール・
ルーチンを呼び出し可能になり、オペレーティング・シ
ステムの開発効率が向上する。
As described above, according to the present invention, a pair of a preemption prohibition request and a preemption prohibition cancellation request can be issued in a nested manner. Then, unless the preemption prohibition cancel function is issued the same number of times as the issued preemption prohibition function, the task under execution does not return to the preemption enabled state. Therefore, even if the running task is in the preempt disabled state, a system call that uses a function that transitions the running task to the preempt enabled state.
Routines can be called, improving the operating system development efficiency.

【0039】また、プリエンプトの禁止要求とプリエン
プトの禁止解除要求が正しく対になっていなくても、プ
リエンプト禁止解除関数のエラーリターンによりそのこ
とが検出可能になっているため、オペレーティング・シ
ステムの信頼性を高めることができる。
Even if the preemption prohibition request and the preemption prohibition cancellation request are not correctly paired, the fact can be detected by the error return of the preemption prohibition cancellation function, so that the reliability of the operating system is improved. Can be increased.

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

【図1】本発明を適用したシステムの概要図FIG. 1 is a schematic diagram of a system to which the present invention is applied.

【図2】プリエンプト禁止を行う処理のフローチャートFIG. 2 is a flowchart of processing for prohibiting preemption.

【図3】プリエンプト禁止を解除する処理のフローチャ
ート
FIG. 3 is a flowchart of processing for canceling preemption prohibition.

【図4】スケジューラのフローチャートFIG. 4 is a flowchart of the scheduler.

【符号の説明】[Explanation of symbols]

11:プリエンプト禁止フラグ、12:カウンタ、1
3:スケジューリング要求フラグ
11: preemption prohibition flag, 12: counter, 1
3: Scheduling request flag

───────────────────────────────────────────────────── フロントページの続き (72)発明者 中野 隆裕 神奈川県川崎市麻生区王禅寺1099番地 株 式会社日立製作所システム開発研究所内 (72)発明者 芹沢 一 神奈川県川崎市麻生区王禅寺1099番地 株 式会社日立製作所システム開発研究所内 ──────────────────────────────────────────────────続 き Continued on the front page (72) Inventor Takahiro Nakano 1099 Ozenji Temple, Aso-ku, Kawasaki City, Kanagawa Prefecture Inside the Hitachi, Ltd.System Development Laboratory (72) Inventor Kazuto Serizawa 1099 Ozenji Temple, Aso-ku, Kawasaki City, Kanagawa Prefecture Stock Company Hitachi, Ltd. System Development Laboratory

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】複数のタスクを並列に実行する計算機シス
テムにおけるプリエンプト制御方法であって、 実行中タスクの中断禁止を要求する関数を、当該タスク
に対応するアプリケーションあるいは当該タスクの実行
に係わるオペレーティング・システム内部のルーチンが
発行したことに応じて、実行中タスクの中断禁止のネス
トの数を示すカウンタをインクリメントし、 実行中タスクの中断禁止の解除を要求する関数を、当該
タスクに対応するアプリケーションあるいは当該タスク
の実行に係わるオペレーティング・システム内部のルー
チンが発行したことに応じて、上記カウンタをデクリメ
ントし、 前記カウンタの値が正のとき、実行中タスクの中断を禁
止し、 前記カウンタの値が0になったことに応じて、実行中の
タスクを中断可能とすることを特徴とする計算機システ
ムにおけるプリエンプト制御方法。
1. A preemption control method in a computer system for executing a plurality of tasks in parallel, wherein a function for requesting prohibition of interruption of a running task is executed by an application corresponding to the task or an operating system related to the execution of the task. In response to the issuance of a routine inside the system, a function that increments the counter that indicates the number of nests for which suspension of a running task is prohibited and requests cancellation of suspension of the running task is executed by the application or The counter is decremented in response to the issuance of a routine inside the operating system related to the execution of the task. When the value of the counter is positive, interruption of the task under execution is prohibited, and the value of the counter is 0. It becomes possible to interrupt the running task depending on A preemption control method in a computer system, comprising:
【請求項2】請求項1に記載の計算機システムにおける
プリエンプト制御方法であって、 タスクのスケジューリング要求が発生したことに応じ
て、前記カウンタの値を判定し、 上記カウンタの値が正ならば、スケジューリング動作を
実行中タスクが中断可能となるまで遅延させ、 上記カウンタの値が0ならば、即時にスケジューリング
動作を行なうことを特徴とする計算機システムにおける
プリエンプト制御方法。
2. The preemption control method for a computer system according to claim 1, wherein the value of the counter is determined in response to a task scheduling request, and if the counter value is positive, A preemption control method in a computer system, wherein a scheduling operation is delayed until a task under execution can be interrupted, and when the value of the counter is 0, the scheduling operation is immediately performed.
【請求項3】請求項1あるいは2に記載の計算機システ
ムにおけるプリエンプト制御方法であって、 実行中タスクの中断禁止を要求する関数のリターン情報
として、上記カウンタの更新後の値を返し、 実行中タスクの中断禁止の解除を要求する関数の引数
に、実行中タスクの中断禁止のネストの数を指定し、 上記引数と上記カウンタの値が一致しなかったことに応
じて、該実行中タスクに対応し中断禁止の解除を要求す
る関数を発行したアプリケーションあるいは当該タスク
の実行に係わるオペレーティング・システム内部のルー
チンにエラーを通知することを特徴とする計算機システ
ムにおけるプリエンプト制御方法。
3. The preemption control method in a computer system according to claim 1, wherein the updated value of the counter is returned as return information of a function requesting prohibition of interruption of an executing task, and Specify the number of nests of suspending prohibition of the running task in the argument of the function that requests cancellation of suspending prohibition of the task. If the above argument and the value of the above counter do not match, A preemption control method in a computer system, characterized in that an error is notified to an application that has issued a function requesting cancellation of suspension inhibition or a routine inside the operating system related to execution of the task.
JP8097997A 1996-04-19 1996-04-19 Pre-emptive control method for computer system Pending JPH09282182A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8097997A JPH09282182A (en) 1996-04-19 1996-04-19 Pre-emptive control method for computer system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8097997A JPH09282182A (en) 1996-04-19 1996-04-19 Pre-emptive control method for computer system

Publications (1)

Publication Number Publication Date
JPH09282182A true JPH09282182A (en) 1997-10-31

Family

ID=14207311

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8097997A Pending JPH09282182A (en) 1996-04-19 1996-04-19 Pre-emptive control method for computer system

Country Status (1)

Country Link
JP (1) JPH09282182A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7386707B2 (en) 2002-01-09 2008-06-10 Matsushita Electric Industrial Co., Ltd. Processor and program execution method capable of efficient program execution
US7735087B2 (en) 2003-03-13 2010-06-08 Panasonic Corporation Task switching apparatus, method and program
JP4704613B2 (en) * 2001-06-07 2011-06-15 三菱電機株式会社 Processor power-saving control device

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4704613B2 (en) * 2001-06-07 2011-06-15 三菱電機株式会社 Processor power-saving control device
US7386707B2 (en) 2002-01-09 2008-06-10 Matsushita Electric Industrial Co., Ltd. Processor and program execution method capable of efficient program execution
US7921281B2 (en) 2002-01-09 2011-04-05 Panasonic Corporation Processor and program execution method capable of efficient program execution
US7930520B2 (en) 2002-01-09 2011-04-19 Panasonic Corporation Processor and program execution method capable of efficient program execution
US8006076B2 (en) 2002-01-09 2011-08-23 Panasonic Corporation Processor and program execution method capable of efficient program execution
US8719827B2 (en) 2002-01-09 2014-05-06 Panasonic Corporation Processor and program execution method capable of efficient program execution
US9823946B2 (en) 2002-01-09 2017-11-21 Socionext Inc. Processor and program execution method capable of efficient program execution
US7735087B2 (en) 2003-03-13 2010-06-08 Panasonic Corporation Task switching apparatus, method and program
US7950016B2 (en) 2003-03-13 2011-05-24 Panasonic Corporation Apparatus for switching the task to be completed in a processor by switching to the task assigned time slot
US8276156B2 (en) 2003-03-13 2012-09-25 Panasonic Corporation Task switching based on assigned time slot

Similar Documents

Publication Publication Date Title
US7287135B2 (en) Adapting RCU for real-time operating system usage
US6006247A (en) Method and system for scheduling threads and handling exceptions within a multiprocessor data processing system
US5375239A (en) Use of build status indicators in connection with building of complex computer programs from source code parts
US5842016A (en) Thread synchronization in a garbage-collected system using execution barriers
US6061709A (en) Integrated hardware and software task control executive
US7971205B2 (en) Handling of user mode thread using no context switch attribute to designate near interrupt disabled priority status
WO2006055864A2 (en) Method and apparatus for implementing task management of computer operations
CN113010275B (en) Interrupt processing method and device
JP2004288162A (en) Operating system architecture using synchronous task
JPH1115675A (en) Interruption controller and control system
EP2664989A1 (en) Task scheduling
EP1820100A2 (en) Efficient switching between prioritized tasks
Poledna et al. ERCOS: an operating system for automotive applications
JPH10511484A (en) How to control technical processes
JP2007035066A (en) Multi-os configuration method
JPH09282182A (en) Pre-emptive control method for computer system
JP2004206692A (en) Method and device for determining priority value about thread for execution on multithread processor system
US5758161A (en) Testing method for checking the completion of asynchronous distributed collective operations
US20090187261A1 (en) Control Apparatus for Process input-Output Device
JPH08297581A (en) Interruption management system of real-time operating system
CN110825501A (en) Processor core optimization method and device and storage medium
JPWO2018211865A1 (en) Vehicle control device
CN117251393B (en) Interrupt response method, interrupt response device, interrupt response chip, interrupt response computer device and interrupt response medium
JPH09282188A (en) Interruption processing method and system using the method
WO2023188905A1 (en) Information processing device and method for controlling operation of information processing device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040902

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040907

A521 Written amendment

Effective date: 20041105

Free format text: JAPANESE INTERMEDIATE CODE: A523

A131 Notification of reasons for refusal

Effective date: 20050105

Free format text: JAPANESE INTERMEDIATE CODE: A131

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050304

A131 Notification of reasons for refusal

Effective date: 20050412

Free format text: JAPANESE INTERMEDIATE CODE: A131

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20050802

A521 Written amendment

Effective date: 20051003

Free format text: JAPANESE INTERMEDIATE CODE: A523

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20051012

A912 Removal of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20051111

A521 Written amendment

Effective date: 20071026

Free format text: JAPANESE INTERMEDIATE CODE: A523