JPH09319597A - Scheduling method for cyclic process - Google Patents

Scheduling method for cyclic process

Info

Publication number
JPH09319597A
JPH09319597A JP2757797A JP2757797A JPH09319597A JP H09319597 A JPH09319597 A JP H09319597A JP 2757797 A JP2757797 A JP 2757797A JP 2757797 A JP2757797 A JP 2757797A JP H09319597 A JPH09319597 A JP H09319597A
Authority
JP
Japan
Prior art keywords
time
group
priority
cpu
execution
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
JP2757797A
Other languages
Japanese (ja)
Other versions
JP2904483B2 (en
Inventor
Osamu Takeuchi
理 竹内
Masahiko Nakahara
雅彦 中原
Takahiro Nakano
隆裕 中野
Masaaki Iwasaki
正明 岩嵜
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 JP2757797A priority Critical patent/JP2904483B2/en
Publication of JPH09319597A publication Critical patent/JPH09319597A/en
Application granted granted Critical
Publication of JP2904483B2 publication Critical patent/JP2904483B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To keep constant the execution interval of respective process groups as much as possible in the case of parallelly executing the plural process groups including a process group to be cyclically executed. SOLUTION: When a group master process 102 of respective process groups 103 requests the allocation of CPU time while designating a start interval cycle and the CPU time required for each cycle, the CPU allocation time of the designated process group 103 is secured so as not to compete with the CPU allocation time of the other process group 103, and a CPU allocation order description table is prepared so as to keep the designated start interval cycle. At the point of the time of activating any one process group 103, a kernel process 101 is activated by changing the execution priority of a process belonging to this process group 103 into the peak priority inside a system and afterwards, the peak priority is kept only for the continuously allocated CPU allocation time.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明はプロセスのスケジュ
ーリング方法に係わり、特に各プロセスを周期的に起動
するプロセススケジューリング方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a process scheduling method, and more particularly to a process scheduling method for periodically activating each process.

【0002】[0002]

【従来の技術】従来、連続メディア処理を行なうプロセ
スのスケジューリング方法としては、Conductor/Perfor
mer モデル(1st International Workshop on Real-Tim
e Operating Systems and Applications,1994 )を用い
たスケジューリング方法が知られていた。連続メディア
処理とは、画像や音声などをデジタル化したデータを変
換、転送する処理を指す。
2. Description of the Related Art Conventionally, as a scheduling method of a process for performing continuous media processing, Conductor / Perfor
mer model (1st International Workshop on Real-Tim
A scheduling method using e Operating Systems and Applications, 1994) has been known. Continuous media processing refers to processing for converting and transferring data obtained by digitizing images and sounds.

【0003】この方法では、システムに存在するストリ
ームが一つの場合、ストリームに属するプロセスが周期
的にスケジューリングされることを保証する。ただし、
ここで言うストリームとは、加工した連続メディアデー
タを直接または間接に受け渡しあうプロセス群を指す。
同一ストリームに属するプロセスは、連続メディア処理
データの加工処理を行なう順番が一意に決められてい
る。先頭のプロセスは、外部装置(例えばビデオデジタ
イザ)から連続メディアデータの入力を得る。以後のプ
ロセスは、順番が一つ前のプロセスから前のプロセスが
加工した連続メディアデータを受け取り、自分が行なう
べきデータ加工(例えば圧縮処理)を行ない、順番が一
つ後のプロセスに自分が加工した連続メディアデータを
送り渡す。最後尾のプロセスは、外部装置(例えばネッ
トワークアダプタ)に連続メディアデータを出力する。
In this method, when there is one stream in the system, the processes belonging to the stream are guaranteed to be periodically scheduled. However,
The stream here refers to a process group that directly or indirectly passes the processed continuous media data.
The processes belonging to the same stream are uniquely determined in the order of processing the continuous media processing data. The first process gets an input of continuous media data from an external device (eg a video digitizer). Subsequent processes receive the continuous media data processed by the previous process from the process in the previous order, perform the data processing (such as compression processing) that they should do, and process it in the process after the one in the order. Send continuous media data. The last process outputs continuous media data to an external device (eg network adapter).

【0004】Conductor/Performer モデルを用いたスケ
ジューリング方法の概要を以下に示す。ストリームごと
に、周期駆動の Conductor プロセスが一つ準備され
る。Conductor プロセスが起動すべき Performer プロ
セス(ストリームに属するプロセス)の順番は予め登録
されている。Conductor プロセスは、この登録されてい
る順番に従い Performer プロセスを起動する。そのた
めに、Conductor プロセスおよび Performer プロセス
は、共に自プロセスの起床通知用のメッセージキューを
保持する。他プロセスの起動は、そのプロセスが保持す
るメッセージキューに対してメッセージを送信すること
により行なう。
The outline of the scheduling method using the Conductor / Performer model is shown below. One cyclically driven Conductor process is prepared for each stream. The order of Performer processes (processes belonging to streams) that the Conductor process should start is registered in advance. The Conductor process starts the Performer process according to the registered order. Therefore, the Conductor process and Performer process both have a message queue for waking up their own process. The other process is activated by sending a message to the message queue held by that process.

【0005】Conductor プロセスは、指定された周期で
駆動される。Conductor プロセスは、登録されている P
erformer プロセスの順番に従い、次の順番の Performe
r プロセスが所有するメッセージキューへのメッセージ
送信と Conductor プロセスが所有者であるメッセージ
キューへのメッセージ到達待ちを行なうコール(関数呼
び出し)を繰り返し発行する。すなわち、Conductor プ
ロセスは、登録されている Performer プロセスの順番
に従い、 Performer プロセスの起動と、起動したPerfo
rmer プロセスが一周期分の実行を完了するまでの休眠
を繰り返す。最後の順番の Performer プロセスが実行
を完了したら、Conductor プロセスは次の周期駆動のト
リガがタイマ割り込みを契機にかけられるまで休眠す
る。
The Conductor process is driven at specified intervals. Conductor process is registered P
Performer in the next order according to the order of the erformer process
r Repeatedly issues a call (function call) that sends a message to the message queue owned by the process and waits for a message to arrive at the message queue owned by the Conductor process. That is, the Conductor process starts the Performer process according to the order of the registered Performer processes and the Perfo that has started.
The sleep is repeated until the rmer process finishes executing one cycle. Once the last Performer process has completed execution, the Conductor process sleeps until the next period-driven trigger is triggered by a timer interrupt.

【0006】一方、Performer プロセスは、Conductor
プロセスからメッセージを受け取ることにより起床し、
一周期分の連続メディア処理を行なう。一周期分の連続
メディア処理を完了したら、Conductor プロセスが所有
者であるメッセージキューにメッセージ送信と自プロセ
スが所有するメッセージキューへのメッセージ到達待ち
を行なうコールを発行する。Performer プロセスは、次
の周期の起動を通知するメッセージが Conductor プロ
セスから送信されるまで休眠することになる。
On the other hand, the Performer process is based on Conductor
Wake up by receiving a message from the process,
Perform continuous media processing for one cycle. When one cycle of continuous media processing is completed, the Conductor process issues a call to send a message to the owner's message queue and wait for the arrival of the message in the message queue owned by the own process. The Performer process will sleep until the Conductor process sends a message announcing the start of the next cycle.

【0007】上記スケジューリング方法は、システムに
存在するストリームが一つの場合、Performer プロセス
が周期的に CPU を割り当てられることを保証する。
[0007] The above scheduling method guarantees that the Performer process is periodically assigned a CPU when there is one stream in the system.

【0008】[0008]

【発明が解決しようとする課題】Conductor/Performer
モデルに従ったスケジューリング方法は、システム上に
存在するストリームが複数になった場合、以下の問題が
生じる。
[Problems to be Solved by the Invention] Conductor / Performer
The scheduling method according to the model causes the following problems when there are a plurality of streams existing on the system.

【0009】(a)各 Conductor プロセス及び Perfor
mer プロセスの優先度が時間と共に変動しない。そのた
め、駆動周期が異なる Conductor プロセスが混在した
場合、Conductor プロセスの実行開始間隔が変動する。
すなわち Conductor プロセスが起床されたときに、同
等の優先度又はより高い優先度をもつ他の Conductorプ
ロセスや他の Performer プロセスが実行中である可能
性がある。すなわち起床された Conductor プロセスと
他の Conductor プロセス又は他の Performerプロセス
との間で CPU 時間の競合が生じ、これに伴い Conducto
r プロセスの実行開始間隔が変動するとともに後続する
Performer プロセスの実行間隔も変動する。
(A) Each Conductor process and Perfor
mer process priority does not change over time. Therefore, when Conductor processes with different drive cycles coexist, the execution start interval of Conductor processes fluctuates.
That is, when the Conductor process is awakened, it is possible that another Conductor process with equal or higher priority or another Performer process is running. That is, the CPU time contention occurs between the awakened Conductor process and another Conductor process or another Performer process, and this causes the Conducto process.
r Process execution start interval fluctuates and continues
The execution interval of the Performer process also changes.

【0010】(b)起床通知がプロセス間通信(IPC)
により行なわれるため、メッセージ送信とメッセージ受
信の関数呼び出しが発生し、起床通知に伴うオーバーヘ
ッドが大きい。
(B) Wakeup notification is interprocess communication (IPC)
The function call for message transmission and message reception occurs, and the overhead associated with wakeup notification is large.

【0011】これらの問題点は、マルチメディアデータ
のリアルタイム MPEG 圧縮処理などの高スループットを
要求される連続メディア処理の実現を困難にする。これ
らの処理では、連続メディアデータ入力時のバッファ管
理を割り込みを使わずに行なわなければ、割り込みオー
バーヘッドにより十分なスループットが得られなくな
る。そのためには、システムに複数のストリームが存在
する場合でも、Performer プロセスの実行間隔をできる
だけ一定に保ち、割り込みによる通知なしに Performer
プロセスが自発的に入力バッファの切り替えを行なわ
ねばならない。同様に起床通知に用いる IPC のオーバ
ーヘッドもスループットの低下を招く。
These problems make it difficult to realize continuous media processing requiring high throughput such as real-time MPEG compression processing of multimedia data. In these processes, unless the buffer management at the time of continuous media data input is performed without using interrupts, sufficient throughput cannot be obtained due to interrupt overhead. To do this, keep the Performer process execution intervals as constant as possible, even if there are multiple streams in the system, and perform them without interrupt notification.
The process must voluntarily switch input buffers. Similarly, the overhead of IPC used for wake-up notification also lowers the throughput.

【0012】また、Conductor/Performer モデルに従っ
たスケジューリング方法は、デッドラインミス(Conduc
tor プロセスの駆動から指定された時間内で一周期分の
処理を完了できなかった状態)を Conductor プロセス
へのシグナル通知により行なう。シグナルハンドラの優
先度は、通常、対象プロセスと同じ優先度を持つため、
シグナルハンドラ処理により、他のストリームのプロセ
スの実行が遅延される可能性がある。すなわち一つのス
トリームの処理遅延が他ストリームの処理遅延を引き起
こす可能性がある。
Further, a scheduling method according to the Conductor / Performer model has a deadline miss (Conducer
The state where the processing for one cycle could not be completed within the specified time from the driving of the tor process) is notified by the signal to the Conductor process. Signal handlers usually have the same priority as the target process, so
The signal handler process may delay the execution of processes in other streams. That is, the processing delay of one stream may cause the processing delay of another stream.

【0013】本発明は、(a)複数ストリームがシステ
ム内に存在する場合でも、連続メディア処理を行なうプ
ロセスの実行間隔を一定に保ち、(b)プロセスの起
床、休眠の制御に伴うオーバーヘッドをより小さくし、
(c)処理遅延の回復処理を行なうシグナルハンドラを
実行することによって、一つのストリームの処理遅延が
生じても、他ストリームの処理遅延を引き起こさない、
(d)ネットワーク・パケットの到達など非同期イベン
トが発生した際に、連続メディア処理を行うプロセスの
実行間隔の変動を防止する周期的プロセスのスケジュー
リング方法を提供する。
The present invention (a) keeps the execution interval of the process for performing continuous media processing constant even if a plurality of streams exist in the system, and (b) reduces the overhead associated with the control of the process wake-up and sleep. Make it smaller,
(C) By executing a signal handler that performs processing delay recovery processing, even if processing delay of one stream occurs, processing delay of other streams does not occur.
(D) To provide a periodic process scheduling method for preventing fluctuations in the execution interval of a process that performs continuous media processing when an asynchronous event such as arrival of a network packet occurs.

【0014】[0014]

【課題を解決するための手段】本発明は、周期的に実行
される少なくとも1つのプロセスを含むプロセスグルー
プが複数存在し、これら複数のプロセスグループを並行
実行させる周期的プロセスのスケジューリング方法にお
いて、各プロセスグループごとに起動間隔周期と一周期
ごとの必要CPU時間が指定されたとき、指定されたプ
ロセスグループのCPU割り当て時間が他のプロセスグ
ループのCPU割り当て時間と衝突しないように確保
し、かつ指定された各プロセスグループの起動間隔周期
を保つように調整する周期的プロセススケジューリング
方法を特徴とする。
According to the present invention, there are provided a plurality of process groups including at least one process that is periodically executed, and a method for scheduling a periodic process in which these plurality of process groups are executed in parallel, When the activation interval cycle and the required CPU time for each cycle are specified for each process group, ensure that the CPU allocation time of the specified process group does not conflict with the CPU allocation time of other process groups, and it is specified. It is characterized by a periodic process scheduling method that adjusts so as to maintain the activation interval period of each process group.

【0015】また本発明は、プロセスグループの1つを
起動する時点に達したとき、このプロセスグループに属
するプロセスの実行優先度をシステム内で最高の優先度
に変更することによって起動し、その後連続して割り当
てられたCPU割り当て時間分だけ最高の優先度を保つ
プロセス起動方法を特徴とする。
Further, according to the present invention, when it is time to start one of the process groups, the process is started by changing the execution priority of the process belonging to this process group to the highest priority in the system, and then continuously. It is characterized by a process start-up method that keeps the highest priority for the CPU allocation time that has been allocated.

【0016】また本発明は、連続して割り当てられたC
PU割り当て時間が経過しかつ必要CPU時間を消費し
たとき、起動されたプロセスの実行優先度をシステム内
で最高の優先度から基準の優先度に変更し、このプロセ
スにタイムアウトを通知するプロセス起動方法を特徴と
する。
The present invention also provides for the consecutively assigned C
When the PU allocation time has passed and the required CPU time has been consumed, the execution priority of the started process is changed from the highest priority in the system to the reference priority, and a timeout is notified to this process. Is characterized by.

【0017】さらに本発明は、システム内で最高の優先
度をもつプロセスの実行中に、ネットワーク・パケット
の到達など情報を受信すべき非同期イベントが発生した
とき、直ちに最高優先度で走行中のプロセスの実行を停
止し、情報の受信バッファを確保して情報を受信する準
備を行った後に実行を停止したプロセスの実行を再開
し、周期的に起動されるプロセスによって受信した情報
を参照して処理する非同期イベント処理方法を特徴とす
る。
Further, according to the present invention, when an asynchronous event for receiving information such as arrival of a network packet occurs during execution of a process having the highest priority in the system, the process running at the highest priority is immediately executed. Stop the execution of the process, secure the information reception buffer and prepare to receive the information, then restart the execution of the process that has stopped execution, and process by referring to the information received by the process that is started periodically. It is characterized by an asynchronous event processing method.

【0018】[0018]

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

【0019】(1)第1の実施形態 本発明のスケジューリング方法を実現するためのプロセ
ス起動の流れ、および連続メディアデータの流れを図1
に示す。システムには一つの周期駆動カーネルプロセス
(101)が存在する。周期駆動カーネルプロセス(101)は、
タイマ割り込みハンドラ(104)により周期的に駆動され
る制御プロセスである。周期駆動カーネルプロセス(10
1)は、CPU 割り当て順序記述テーブル(900)を参照して
次に連続メディアデータを処理するプロセス(以後周期
プロセスと呼ぶ)(102)群を選択し、選択した周期プロ
セス(102)群の優先度を変更することにより、各周期プ
ロセス(102)の周期的なスケジューリングを実現する。
また、スケジューリングすべき周期プロセス(102)が存
在しない場合には、それ以外の通常プロセス(109)をス
ケジューリングする。この動作の詳細は後述する。
(1) First Embodiment FIG. 1 shows the flow of process activation and the flow of continuous media data for realizing the scheduling method of the present invention.
Shown in The system has one cycle-driven kernel process
(101) exists. The cycle-driven kernel process (101)
It is a control process that is periodically driven by the timer interrupt handler (104). Periodically driven kernel process (10
1) refers to the CPU allocation order description table (900), selects a process (hereinafter referred to as periodic process) (102) group that processes continuous media data next, and gives priority to the selected periodic process (102) group. By changing the degree, the periodic scheduling of each periodic process (102) is realized.
When there is no periodic process (102) to be scheduled, the other normal processes (109) are scheduled. Details of this operation will be described later.

【0020】同一の連続メディアデータを処理する少な
くとも1つの周期プロセス(102)は、一つのプロセスグ
ループ(103)を形成する。プロセスグループ(103)に属す
る周期プロセス(102)は、その処理順が予め定められて
いる。処理順が最初の周期プロセス(102)は、周期駆動
カーネルプロセス(101)による優先度変更によって優先
的に駆動され、外部入力装置(105)からの入力連続メデ
ィアデータを入力バッファ(106)を介して読み取り、デ
ータの加工を行なう。加工されたデータは共有バッファ
(110)などを介して処理順が次の周期プロセス(102)に渡
される。プロセスグループ(103)内の周期プロセス(102)
の優先度は次々に継承され、処理順が最後の周期プロセ
ス(102)は、出力バッファ(107)を介して外部出力装置(1
08)に出力し、自プロセスの優先度を下げることによっ
て実質的にこのプロセスグループ(103)の1周期の処理
を終了する。システムには複数のプロセスグループ(10
3)、例えば音声情報を処理するプロセスグループと画像
情報を処理するプロセスグループなど、が存在し得る。
At least one periodic process (102) that processes the same continuous media data forms a process group (103). The processing order of the periodic processes (102) belonging to the process group (103) is predetermined. The cyclic process (102) with the first processing order is preferentially driven by the priority change by the cyclic driving kernel process (101) and receives the input continuous media data from the external input device (105) through the input buffer (106). Read and process the data. Shared buffer for processed data
The processing order is passed to the next periodic process (102) via (110) and the like. Periodic process (102) in process group (103)
The priority of each process is inherited one after another, and the cyclic process (102) with the last processing order receives the external output device (1) via the output buffer (107).
This is output to 08) and the priority of the own process is lowered to substantially end the processing of one cycle of this process group (103). The system has multiple process groups (10
3) There may be, for example, a process group that processes audio information and a process group that processes image information.

【0021】なお図示しないスケジューラが関数呼び出
しによって呼び出され、CPU 割り当て順序記述テーブル
(900)を作成したり、指定されたプロセスを駆動する処
理を行う。スケジューラは、呼び出されたプロセスによ
って動作しスケジューリングに関連する処理を行うプロ
グラム・モジュールの集まりである。
A scheduler (not shown) is called by a function call, and a CPU allocation order description table
Create (900) or perform the process to drive the specified process. The scheduler is a group of program modules operated by the called process to perform processing related to scheduling.

【0022】プロセスグループには、グループマスタプ
ロセスが存在する。グループマスタプロセスは、プロセ
スグループに属するプロセスのうち、処理順が先頭であ
るプロセスである。プロセスグループに属するプロセス
で、グループマスタプロセス以外のプロセスはスレーブ
プロセスと呼ばれる。プロセスグループ(103)の生成、
削除は、グループマスタプロセスによって以下のインタ
フェースを用いて行われる。
A group master process exists in the process group. The group master process is a process having the first processing order among the processes belonging to the process group. Processes belonging to a process group other than the group master process are called slave processes. Creating a process group (103),
Deletion is performed by the group master process using the following interface.

【0023】<関数名> create_proc_group(master_pid, slave_pid_array,proc
_array_number,pgroupid) <引数> master_pid: グループマスタプロセスのプロセス識別子 slave_pid_array: グループを構成するスレーブプロセ
ス識別子の配列 proc_array_number: グループを構成するスレーブプロ
セス識別子の数 pgroupid: 生成されたプロセスグループの識別子がリタ
ーンする。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>create_proc_group 関数は、master_pid で指
定されるプロセスをグループマスタとするプロセスグル
ープを生成する。生成されたプロセスグループは、mast
er_pid で指定されるプロセスの他に、slave_pid_arra
y, proc_array_number で指定されるプロセス群から構
成される。pgroupid に生成されたプロセスグループ識
別子が返る。なお master_pid 及び slave_pid_array
で指定するプロセス識別子をもつ個々のプロセスはすで
に生成済であることが前提である。
<Function name> create_proc_group (master_pid, slave_pid_array, proc
_array_number, pgroupid) <Argument> master_pid: Process identifier of the group master process slave_pid_array: Array of slave process identifiers that make up the group proc_array_number: Number of slave process identifiers that make up the group pgroupid: The identifier of the created process group is returned. <Return value> SUCCESS: Normal termination or various error codes <Description> The create_proc_group function creates a process group with the process specified by master_pid as the group master. The created process group is mast
In addition to the process specified by er_pid, slave_pid_arra
It consists of the process group specified by y and proc_array_number. The generated process group identifier is returned in pgroupid. Note that master_pid and slave_pid_array
It is assumed that the individual process with the process identifier specified by is already created.

【0024】<関数名> destroy_proc_group(pgroupid) <引数> pgroupid: プロセスグループ識別子 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>destroy_proc_group 関数は、pgroupid で指定
されるプロセスグループを削除する。
<Function name> destroy_proc_group (pgroupid) <Argument> pgroupid: Process group identifier <Return value> SUCCESS: Normal termination or various error codes <Explanation> The destroy_proc_group function deletes the process group specified by pgroupid.

【0025】プロセスグループの管理に用いる配列デー
タ及び制御ブロックのデータ構造を図2に示す。
FIG. 2 shows the data structure of the array data and control block used for managing the process group.

【0026】プロセスグループは、プロセスグループ制
御ブロック(202)を用いて管理される。プロセスグルー
プ制御ブロック(202)は、master_pid フィールド(20
3)、pid_array フィールド(204)、nproc フィールド(20
5)からなる。master_pid フィールド(203)は、プロセス
グループのグループマスタプロセスのプロセス識別子を
格納する。pid_array フィールド(204)は、プロセス識
別子配列(206)へのポインタを格納する。プロセス識別
子配列(206)は、プロセスグループを構成するスレーブ
プロセスのプロセス識別子の配列である。nproc フィー
ルド(205)は、プロセス識別子配列(206)に格納されてい
るプロセス識別子の数を格納する。また、プロセスグル
ープ識別子からプロセスグループ制御ブロック(202)へ
の変換は、プロセスグループ制御ブロックポインタ配列
(201)を用いて行なう。すなわち、プロセスグループ制
御ブロックポインタ配列(201)の、プロセスグループ識
別子をインデックスに持つ要素に、プロセスグループ制
御ブロック(202)へのポインタが格納されている。プロ
セスグループ識別子に対応するプロセスグループ制御ブ
ロック(202)が存在しない場合には、プロセスグループ
制御ブロックポインタ配列(201)の該当要素には、nil
ポインタが格納されている。
The process group is managed by using the process group control block (202). The process group control block (202) has a master_pid field (20
3), pid_array field (204), nproc field (20
It consists of 5). The master_pid field (203) stores the process identifier of the group master process of the process group. The pid_array field (204) stores a pointer to the process identifier array (206). The process identifier array (206) is an array of process identifiers of slave processes that form a process group. The nproc field (205) stores the number of process identifiers stored in the process identifier array (206). In addition, conversion from the process group identifier to the process group control block (202) is performed by the process group control block pointer array.
Use (201). That is, the pointer to the process group control block (202) is stored in the element of the process group control block pointer array (201) having the process group identifier as an index. If the process group control block (202) corresponding to the process group identifier does not exist, nil is set in the corresponding element of the process group control block pointer array (201).
The pointer is stored.

【0027】create_proc_group 関数の処理フローを図
3に示す。
The processing flow of the create_proc_group function is shown in FIG.

【0028】ステップ301で、プロセス制御ブロックポ
インタ配列(201)の要素のうち、nilポインタが格納され
ている要素を一つ検索する。そのインデックス値を pgr
oupid のリターン値とする。
In step 301, one of the elements of the process control block pointer array (201) in which the nil pointer is stored is searched. Its index value pgr
It is the return value of oupid.

【0029】ステップ302で、プロセスグループ制御ブ
ロック(202)に用いるメモリ領域を確保する。
In step 302, a memory area used for the process group control block (202) is secured.

【0030】ステップ303で、プロセス識別子配列(206)
に用いるメモリ領域を確保する。
In step 303, the process identifier array (206)
Reserve a memory area for use.

【0031】ステップ304で、create_proc_group 関数
の引数 master_pid で指定されたグループマスタプロセ
スの識別子を、ステップ302でメモリ領域を確保したプ
ロセスグループ制御ブロック(202)の master_pid フィ
ールド(203)に格納する。
In step 304, the identifier of the group master process designated by the argument master_pid of the create_proc_group function is stored in the master_pid field (203) of the process group control block (202) whose memory area was secured in step 302.

【0032】ステップ305で、create_proc_group 関数
の引数 slave_pid_array で指定されたスレーブプロセ
スのプロセス識別子の配列を、ステップ303でメモリ領
域を確保したプロセス識別子配列(206)にコピーする。
At step 305, the array of process identifiers of the slave processes specified by the argument slave_pid_array of the create_proc_group function is copied to the process identifier array (206) which secured the memory area at step 303.

【0033】ステップ306で、プロセス識別子配列(206)
へのポインタをpid_array フィールド(204)に格納す
る。
In step 306, the process identifier array (206)
Store a pointer to the pid_array field (204).

【0034】ステップ307で、create_proc_group 関数
の引数 proc_array_number で指定されたプロセスグル
ープを構成するスレーブプロセス識別子の数を、ステッ
プ302でメモリ領域を確保したプロセスグループ制御ブ
ロック(202)の nproc フィールド(203)に格納する。
In step 307, the number of slave process identifiers forming the process group specified by the argument proc_array_number of the create_proc_group function is stored in the nproc field (203) of the process group control block (202) whose memory area is secured in step 302. Store.

【0035】destroy_proc_group 関数の処理フローを
図4に示す。
The processing flow of the destroy_proc_group function is shown in FIG.

【0036】ステップ401で、destroy_proc_group 関数
の引数 pgroupid をインデックスに持つプロセスグルー
プ制御ブロックポインタ配列(201)の要素を検索し、そ
の要素により指されるプロセスグループ制御ブロック(2
02)が使用していたメモリ領域を解放する。
In step 401, an element of the process group control block pointer array (201) having the argument pgroupid of the destroy_proc_group function as an index is searched, and the process group control block (2
Release the memory area used by 02).

【0037】ステップ402で、上記プロセスグループ制
御ブロック(202)の pid_array フィールド(204)により
指されるプロセス識別子配列(206)が使用していたメモ
リ領域を解放する。
In step 402, the memory area used by the process identifier array (206) pointed to by the pid_array field (204) of the process group control block (202) is released.

【0038】ステップ403で、プロセスグループ制御ブ
ロックポインタ配列(201)の、解放するプロセスグルー
プに対応する要素に nil ポインタを代入する。
In step 403, the nil pointer is assigned to the element corresponding to the process group to be released in the process group control block pointer array (201).

【0039】プロセスグループ(103)は、スケジューリ
ングの単位になる。プロセスグループ(103)のグループ
マスタは、その初期化時において、alloc_time_slot 関
数を用いて、指定周期ごとに指定時間にわたりプロセス
グループ(103)に対し CPU が割り当てられることを予約
する。また、CPU 時間の割り当てが不要になった場合に
は、dealloc_time_slot 関数を呼び出し、その予約を解
除する。
The process group (103) serves as a scheduling unit. At the time of initialization, the group master of the process group (103) uses the alloc_time_slot function to reserve that the CPU is allocated to the process group (103) for the specified time at each specified cycle. When CPU time allocation becomes unnecessary, call the dealloc_time_slot function to release the reservation.

【0040】alloc_time_slot 関数が呼び出されると、
スケジューラは、各プロセスグループが要求する周期と
1周期あたりの実行時間を満たすような CPU の割り当
て順序を決定し、CPU 割り当て順序記述テーブル(900)
を作成する。この作成アルゴリズムについては後述す
る。
When the alloc_time_slot function is called,
The scheduler determines the CPU allocation order that satisfies the cycle required by each process group and the execution time per cycle, and the CPU allocation order description table (900)
Create This creation algorithm will be described later.

【0041】周期カーネルプロセス(101)は、CPU 割り
当て順序記述テーブル(900)に基づいて各周期プロセス
(102)のスケジューリングを行なう。プロセスグループ
(103)に対して CPU を割り当てるべき時間が到達する
と、周期駆動カーネルプロセス(101)はそのプロセスグ
ループ(103)のグループマスタプロセスの優先度を rais
edにする。優先度が raised の周期プロセス(102)は、
ユーザプロセスの中で最高の優先度を持つことが保証さ
れる。また、優先度が raised のプロセス(102)は、周
期駆動カーネルプロセス(101)よりも優先度が高いこと
も保証される。
The cyclic kernel process (101) is based on the CPU allocation order description table (900).
The scheduling of (102) is performed. Process group
When the time to allocate the CPU for (103) is reached, the periodical kernel process (101) raises the priority of the group master process of that process group (103)
to ed. The periodic process (102) with priority raised is
Guaranteed to have the highest priority of any user process. It is also guaranteed that the process (102) with a raised priority has a higher priority than the cyclically driven kernel process (101).

【0042】グループマスタプロセスの優先度が raise
d になってから指定時間経過すると、タイマ割り込みハ
ンドラ(104)は、プロセスグループ(103)に属する周期プ
ロセス(102)のうち優先度が raised である周期プロセ
ス(102)の優先度を depressedにする(グループマスタ
プロセスは、同じプロセスグループ(103)に属する他の
周期プロセス(102)に優先度を継承することが可能であ
る。これについては後述する)。優先度が depressed
のプロセス(102)は、ユーザプロセスの中で最低の優先
度を持つことが保証される。
The priority of the group master process is raise
When the specified time elapses after d, the timer interrupt handler (104) sets the priority of the periodic process (102) whose priority is raised among the periodic processes (102) belonging to the process group (103) to depressed. (A group master process can inherit the priority to another periodic process (102) belonging to the same process group (103). This will be described later). Priority is depressed
Process (102) is guaranteed to have the lowest priority among the user processes.

【0043】これにより、プロセスグループ(103)に CP
U が割り当てられるべき時間は、優先度が raised であ
るプロセスグループ(103)に属する周期プロセス(102)が
実行可能状態にある限り、プロセスグループ(103)に属
さないユーザプロセスや周期駆動カーネルプロセス(10
1)がスケジューリングされることはない。また、CPUが
割り当てられるべきでない時間は、プロセスグループ(1
03)に属する周期プロセス(102)がスケジューリングされ
ることはない。いずれの周期プロセス(102)にも割り当
てられない CPU 時間は、通常プロセス(109)又は無限ル
ープを実行し常に実行可能状態にあるアイドルプロセス
に割り当てられる。アイドルプロセスの優先度を depre
ssed に次いで低い優先度に設定することによって周期
プロセス(102)又は周期駆動カーネルプロセス(101)に C
PU が割り当てられるべきでない時間にスケジューリン
グされないことが保証される。
As a result, the CP is assigned to the process group (103).
As long as the cyclic process (102) belonging to the process group (103) whose priority is raised is in the runnable state, the time to which U should be allocated is as long as the user process or the cycle-driven kernel process (103) that does not belong to the process group (103) Ten
1) is never scheduled. Also, the time that the CPU should not be allocated is the process group (1
The periodic process (102) belonging to 03) is not scheduled. CPU time that is not allocated to any periodic process (102) is allocated to a normal process (109) or an idle process that executes an endless loop and is always ready to run. Idle process priority depre
C to the periodic process (102) or periodic drive kernel process (101) by setting ssed to the next lowest priority.
It is guaranteed that PUs are not scheduled at times when they should not be allocated.

【0044】alloc_time_slot 関数、dealloc_time_slo
t 関数の外部仕様は以下の通りである。
Alloc_time_slot function, dealloc_time_slo
The external specifications of the t function are as follows.

【0045】<関数名> alloc_time_slot(pgroupid, interval, length) <引数> pgroupid: CPU の割り当てを保証されるプロセスグルー
プ識別子 interval: プロセスの起動間隔 length: 確保すべき一周期あたりのプロセスグループの
実行時間 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>alloc_time_slot 関数は、pgroupid で指定さ
れるプロセスグループが、interval で指定される周期
で、length で指定される時間にわたり CPU が割り当て
られることを要求する。interval 及びlength は、所定
のタイムスロットを単位として指定する。interval で
指定される周期で、グループマスタプロセスの優先度が
raised になる。グループマスタプロセスは、proc_rai
se_handoff 関数(後述)を用いて、プロセスグループ
に属する他のプロセスの優先度を raised にし、自プロ
セスを depressed (もしくは基準優先度)に変更する
ことが可能である。グループマスタプロセスの優先度が
raised になってから length で指定した時間が経過す
ると、プロセスグループに属するプロセスのうち優先度
が raised になっているプロセスの優先度が強制的に d
epressed に変化する。さらにそのプロセスに対してタ
イムアウトシグナルが送信される。
<Function name> alloc_time_slot (pgroupid, interval, length) <Argument> pgroupid: Process group identifier for which CPU allocation is guaranteed interval: Process startup interval length: Process group execution time per cycle to be secured <Return value> SUCCESS: Normal termination or various error codes <Explanation> The alloc_time_slot function indicates that the process group specified by pgroupid will be allocated the CPU for the period specified by interval at the cycle specified by interval. Request. The interval and length are specified in units of a given time slot. At the cycle specified by interval, the priority of the group master process is
become raised. The group master process is proc_rai
By using the se_handoff function (described later), it is possible to set the priority of other processes belonging to the process group to raised and change the own process to depressed (or reference priority). Group master process priority
When the time specified by length elapses after being raised, the priority of the processes in the process group whose priority is raised is forced to d.
Change to epressed. In addition, a timeout signal is sent to that process.

【0046】interval の値は2のべき乗でなければな
らない。それ以外の値が指定された場合には、指定値以
下で最大の2のべき乗値が指定されたものとしてスケジ
ューラは処理する。
The value of interval must be a power of two. If any other value is specified, the scheduler processes as if the maximum power-of-two value less than the specified value was specified.

【0047】<関数名> dealloc_time_slot(pgroupid) <引数> pgroupid: CPU の割り当て保証を解除するプロセスグル
ープ識別子 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>dealloc_time_slot 関数は、pgroupid で指定
されるプロセスグループが保持していた CPU の割り当
て要求を解除する。
<Function name> dealloc_time_slot (pgroupid) <Argument> pgroupid: Process group identifier for canceling CPU allocation guarantee <Return value> SUCCESS: Normal termination or various error codes <Explanation> The dealloc_time_slot function is specified by pgroupid. Releases the CPU allocation request held by the specified process group.

【0048】alloc_time_slot 関数により、CPU の割り
当てを要求されたスケジューラは、すべてのプロセスグ
ループ(103)の要求通りにプロセスグループ(103)のスケ
ジューリングが行なえるとは限らない。図5に示す様
に、同じ時刻に複数のプロセスグループ(501,502)をス
ケジューリングできないため、重なっているプロセスグ
ループ(501,502)のうちいずれか一つのプロセスグルー
プ(501)の CPU の割り当て時間(503)の重なっている時
間を別の時間(504)にずらす必要が生じるためである。
The scheduler requested to allocate the CPU by the alloc_time_slot function cannot always schedule the process group (103) as requested by all the process groups (103). As shown in FIG. 5, since multiple process groups (501, 502) cannot be scheduled at the same time, the CPU allocation time (503) of any one of the overlapping process groups (501, 502) This is because it is necessary to shift the overlapping time to another time (504).

【0049】スケジューラは、以下のアルゴリズムに従
い各プロセスグループ(103)の CPUの割り当て時間を決
定し、その結果を後述の CPU 割り当て順序記述テーブ
ル(900)に登録する。CPU の割り当てはタイマ割り込み
発生間隔を単位に行なう。実時間を、タイマ割り込みの
発生する時刻を境界にタイムスロット群に分割する。以
下のアルゴリズムに従い、各タイムスロットごとに割り
当てるべきプロセスグループ(103)を決定していく。
The scheduler determines the CPU allocation time of each process group (103) according to the following algorithm, and registers the result in the CPU allocation order description table (900) described later. CPUs are assigned in units of timer interrupt generation intervals. The real time is divided into time slot groups at the time when the timer interrupt occurs. The process group (103) to be assigned to each time slot is determined according to the following algorithm.

【0050】アルゴリズムのフローチャートを図6に示
す。
A flowchart of the algorithm is shown in FIG.

【0051】ステップ 601 において、割り当てるべき
プロセスグループ(103)(alloc_time_slot 関数によ
り、既に CPU の割り当て予約要求が発行されているプ
ロセスグループ(103))が要求している Interval 値の
うち、最大の Interval 値と同じサイズを持つ図7に示
すタイムスロットテーブル(700)を作成する。タイムス
ロットテーブル(700)は1次元の配列であり、配列の各
要素には、対応するタイムスロットに割り当てられるべ
きプロセスグループ(103)識別子を格納していく。各要
素の初期値として、該当タイムスロットが未割り当てで
あることを示す識別子が格納される。
In step 601, the maximum Interval value among the Interval values requested by the process group (103) to be allocated (the process group (103) for which the CPU allocation reservation request has already been issued by the alloc_time_slot function) The time slot table (700) shown in FIG. 7 having the same size as that of is created. The time slot table (700) is a one-dimensional array, and each element of the array stores a process group (103) identifier to be assigned to the corresponding time slot. An identifier indicating that the corresponding time slot has not been assigned is stored as the initial value of each element.

【0052】ステップ 602 において、割り当てるタイ
ムスロットをまだ決定していないプロセスグループ(10
3)の存在を調べる。すべてのプロセスグループ(103)に
対してタイムスロットの割り当てが完了している場合に
は正常終了(ステップ613)する。
In step 602, the process group (10
Examine the existence of 3). When the time slots have been assigned to all the process groups (103), the process ends normally (step 613).

【0053】ステップ 603 において、まだ割り当てる
タイムスロットを決定していないプロセスグループ(10
3)のうち、alloc_time_slot 関数発行時に要求した Int
erval値が最小のプロセスグループ(103)を選択する。
In step 603, the process group (10
Of the 3), Int requested when the alloc_time_slot function was issued
Select the process group (103) with the smallest erval value.

【0054】ステップ 604 において、ステップ 603 で
選択されたプロセスグループ(103)の要求している Inte
rval 値を I に、Length 値を L に代入する。
In step 604, the Inte required by the process group (103) selected in step 603 is requested.
Assign the rval value to I and the Length value to L.

【0055】ステップ 605 において、タイムスロット
0〜I−1までのうち、未割り当てのタイムスロット
を、隣接しているタイムスロットごとにグループ化す
る。以後、本ステップでグループ化されたタイムスロッ
ト群 Xi (i=1,2,・・・n) を連続空きタイムスロットと呼
ぶことにする。
In step 605, unassigned time slots among time slots 0 to I-1 are grouped into adjacent time slots. Hereinafter, the time slot group X i (i = 1, 2, ... N) grouped in this step will be referred to as a continuous empty time slot.

【0056】ステップ 606 において、ステップ 605 で
得られた連続空きタイムスロット群のサイズ(タイムス
ロット数)の合計が L よりも少ない場合には、すべて
のプロセスグループ(103)の要求を満たすタイムスロッ
トの割り当てが不可能であると判断して異常終了(ステ
ップ 614)する。
In step 606, if the total size (number of time slots) of the continuous empty time slot group obtained in step 605 is smaller than L, the time slots satisfying the requirements of all process groups (103) are When it is determined that the allocation is impossible, the process ends abnormally (step 614).

【0057】ステップ 607 において、ステップ 605 で
得られた連続空きタイムスロットのうち最大サイズをも
つものと L の大小を比較する。
In step 607, the size of L is compared with the one having the largest size among the consecutive empty time slots obtained in step 605.

【0058】L の方が小さければ、ステップ 608 にお
いて、L のサイズ以上のサイズを持つ連続空きタイムス
ロットのうち、サイズが最小のものを選択する。
If L is smaller, then in step 608, of the consecutive free time slots having a size equal to or larger than the size of L, the one with the smallest size is selected.

【0059】ステップ 609 において、ステップ 608 で
選択した連続空きタイムスロットの先頭の L タイムス
ロットを、ステップ 603 で選択したプロセスグループ
(103)に割り当てる。ここで割り当てられたタイムスロ
ットの他に、I, 2I,3I... タイムスロット後のタイムス
ロットもステップ 603 に選択したプロセスグループ(10
3)に割り当てる。これで、ステップ 603 で選択したプ
ロセスグループ(103)に対するタイムスロットの割り当
てを完了し、ステップ 602 にジャンプする。
In step 609, the first L time slots of the continuous empty time slots selected in step 608 are set to the process group selected in step 603.
Assign to (103). In addition to the timeslots assigned here, the timeslots after the I, 2I, 3I ... timeslots are also assigned to the process group (10
Assign to 3). This completes the time slot assignment for the process group (103) selected in step 603 and jumps to step 602.

【0060】ステップ 607 において、L の方が、ステ
ップ 605 で得られた最大の連続空きタイムスロットサ
イズより大きければ、ステップ 610 において、サイズ
が最大の連続空きタイムスロットを選択する。
In step 607, if L is larger than the largest contiguous empty timeslot size obtained in step 605, in step 610 the largest contiguous empty timeslot is selected.

【0061】ステップ 611 において、ステップ 610 で
選択した連続空きタイムスロットに属する全タイムスロ
ットをステップ 603 で選択したプロセスグループ(103)
に割り当てる。さらに、ここで割り当てられたタイムス
ロットの他に、I,2I,3I ...タイムスロット後のタイム
スロットもステップ 603 に選択したプロセスグループ
(103)に割り当てる。
In step 611, all the time slots belonging to the continuous empty time slots selected in step 610 are selected as process groups (103) selected in step 603.
Assign to. In addition to the timeslots assigned here, the timeslots after I, 2I, 3I ... timeslots are also the process groups selected in step 603.
Assign to (103).

【0062】ステップ 612 では、L からステップ 610
で選択した連続空きタイムスロットのサイズを引いた値
を新しい L の値として、ステップ 605 にジャンプす
る。
In Step 612, from L to Step 610
The value obtained by subtracting the size of the continuous empty time slot selected in is set as a new L value, and the process jumps to step 605.

【0063】タイムスロットテーブル(700)の作成例を
図7と図8を用いて示す。
An example of creating the time slot table (700) will be described with reference to FIGS. 7 and 8.

【0064】タイムスロットを割り当てるプロセスグル
ープ(103)は3つとする。各プロセスグループ(103)が要
求している Interval 値(801)、Length 値(802)を図8
に示す。
There are three process groups (103) to which time slots are assigned. Figure 8 shows the Interval value (801) and Length value (802) required by each process group (103).
Shown in

【0065】まず、3つのプロセスグループ(103)が要
求している Interval 値(801)の最大値である 32 の大
きさを持つタイムスロットテーブル(700)を作成する。
タイムスロットテーブル(700)の各要素は、未割り当て
を示す識別子に初期化する。
First, the time slot table (700) having a size of 32 which is the maximum value of the Interval value (801) requested by the three process groups (103) is created.
Each element of the time slot table (700) is initialized to an identifier indicating unallocated.

【0066】Interval 値(801)が最小のプロセスグルー
プAに割り当てるタイムスロットを決定する。タイムス
ロット0〜7のタイムスロット群から連続空きタイムス
ロットを生成する。この場合は、タイムスロット0〜7
からなるサイズ8の連続空きタイムスロットが一つ生成
される。
The time slot assigned to the process group A having the smallest Interval value (801) is determined. Continuous empty time slots are generated from the time slot group of time slots 0 to 7. In this case, time slots 0-7
One continuous empty time slot of size 8 is generated.

【0067】プロセスグループAが要求している Lengt
h 値(802)2は、先程生成した連続空きタイムスロット
のサイズ8より小さいため、この連続空きタイムスロッ
トの先頭2タイムスロット、すなわち、タイムスロット
0と1がプロセスグループAに割り当てられる。この他
に、プロセスグループAが要求している Interval 値(8
01)8の整数倍後のタイムスロットもプロセスグループ
Aに割り当てられる。すなわち、タイムスロット0、1
の他に、8、9、16、17、24、25がプロセスグループA
に割り当てられる。これに従い、タイムスロットテーブ
ル(700)の該当要素を更新する。これでプロセスグルー
プAに対するタイムスロットの割り当ては完了する。
Lengt requested by process group A
Since the h value (802) 2 is smaller than the size 8 of the continuous empty time slot generated earlier, the first two time slots of this continuous empty time slot, that is, time slots 0 and 1 are assigned to the process group A. In addition to this, the Interval value (8
The time slot after the integer multiple of 01) 8 is also assigned to the process group A. That is, time slots 0, 1
In addition, 8, 9, 16, 17, 24, and 25 are process groups A
Assigned to. According to this, the corresponding element of the time slot table (700) is updated. This completes the time slot allocation for process group A.

【0068】次に、Interval 値(801)が2番目に小さい
プロセスグループBに割り当てるタイムスロットを決定
する。タイムスロット0〜15から、連続空きタイムスロ
ットを生成する。この場合、タイムスロット2〜7及び
タイムスロット10〜15からなる各サイズ6の連続空きタ
イムスロットが2つ生成される。
Next, the time slot to be assigned to the process group B having the second smallest Interval value (801) is determined. A continuous empty time slot is generated from the time slots 0 to 15. In this case, two consecutive empty time slots of size 6 each including time slots 2 to 7 and time slots 10 to 15 are generated.

【0069】プロセスグループBが要求している Lengt
h 値(802)3は、このサイズ6より小さい。3以上のサ
イズを持つ連続空きタイムスロットのうちサイズが最小
の連続空きタイムスロットを選択する。ここでは、タイ
ムスロット2〜7からなる連続タイムスロットが選択さ
れる。この連続空きタイムスロットの先頭3タイムスロ
ットがプロセスグループBに割り当てられる。すなわ
ち、タイムスロット2〜4がプロセスグループBに割り
当てられる。同様に、タイムスロット18〜20もプロセス
グループBに割り当てられる。これに従い、タイムスロ
ットテーブル(700)の該当要素を更新する。これでプロ
セスグループBに対するタイムスロットの割り当ては完
了する。
Lengt requested by process group B
The h value (802) 3 is smaller than this size 6. A consecutive empty time slot having the smallest size is selected from consecutive empty time slots having a size of 3 or more. Here, a continuous time slot consisting of time slots 2 to 7 is selected. The first 3 time slots of the continuous empty time slots are assigned to the process group B. That is, the time slots 2 to 4 are assigned to the process group B. Similarly, the time slots 18 to 20 are also assigned to the process group B. According to this, the corresponding element of the time slot table (700) is updated. This completes the time slot allocation for process group B.

【0070】最後にプロセスグループCに割り当てるタ
イムスロットを決定する。タイムスロット0〜31から、
連続空きスロットを生成する。この場合、以下の連続空
きタイムスロットが生成される。 ・タイムスロット5〜7からなるサイズ3の連続空きタ
イムスロット ・タイムスロット10〜15からなるサイズ6の連続空きタ
イムスロット ・タイムスロット21〜23からなるサイズ3の連続空きタ
イムスロット ・タイムスロット26〜31からなるサイズ6の連続空きタ
イムスロット プロセスグループCが要求している Length 値(802)7
は、上記連続空きタイムスロットの最大サイズ6より大
きい。そこで、まず、最大サイズ6を持つ連続空きタイ
ムスロットを一つ選択する。ここではタイムスロット10
〜15からなる連続空きタイムスロットが選択されたとす
る。この連続タイムスロットに属するすべてのタイムス
ロット、すなわち、タイムスロット10〜15がプロセスグ
ループCに割り当てられる。これに従いタイムスロット
テーブル(700)の該当要素を更新する。
Finally, the time slot assigned to the process group C is determined. From time slots 0-31,
Create consecutive empty slots. In this case, the following consecutive empty time slots are generated. -Size 3 consecutive empty time slots consisting of time slots 5-7-Size 6 consecutive empty time slots consisting of time slots 10-15-Size 3 consecutive empty time slots consisting of time slots 21-23-Time slot 26- Consecutive free time slot of size 6 consisting of 31 Length value (802) 7 requested by process group C
Is larger than the maximum size 6 of the consecutive empty time slots. Therefore, first, one continuous empty time slot having the maximum size 6 is selected. Here is time slot 10
Suppose a continuous empty time slot consisting of ~ 15 is selected. All time slots belonging to this continuous time slot, that is, time slots 10 to 15 are assigned to the process group C. According to this, the corresponding element of the time slot table (700) is updated.

【0071】プロセスグループCが要求している Lengt
h 値(802)7から、先に選択した連続空きタイムスロッ
トのサイズ6を引いた残り1タイムスロットの割り当て
を次に行なう。再び、連続空きスロットを生成する。こ
の場合は、以下の連続空きタイムスロットが生成され
る。 ・タイムスロット5〜7からなるサイズ3の連続空きタ
イムスロット ・タイムスロット21〜23からなるサイズ3の連続空きタ
イムスロット ・タイムスロット26〜31からなるサイズ6の連続空きタ
イムスロット 1以上のサイズを持つ連続空きタイムスロットのうち、
サイズが最小のものを選択する。この場合、タイムスロ
ット5〜7からなる連続空きタイムスロットが選択され
る。この連続空きタイムスロットの先頭1タイムスロッ
ト、すなわちタイムスロット5がプロセスグループCに
割り当てられる。これに従い、タイムスロットテーブル
(700)の該当要素を更新する。これでプロセスグループ
Cに対するタイムスロットの割り当ては完了する。
Lengt requested by process group C
The remaining 1 time slot is assigned by subtracting the size 6 of the previously selected continuous empty time slot from the h value (802) 7. Again, consecutive empty slots are generated. In this case, the following continuous empty time slots are generated.・ Size 3 continuous empty time slots consisting of time slots 5 to 7 ・ Size 3 continuous empty time slot consisting of time slots 21 to 23 ・ Size 6 continuous empty time slot consisting of time slots 26 to 31 1 or more sizes Of the continuous free time slots that we have,
Select the one with the smallest size. In this case, consecutive empty time slots consisting of time slots 5 to 7 are selected. The first one time slot of the continuous empty time slots, that is, the time slot 5 is assigned to the process group C. According to this, the time slot table
Update the corresponding element in (700). This completes the time slot allocation for process group C.

【0072】以上の処理によってタイムスロットごとに
割り当てられるプロセスグループは図7に示す通りに決
定される。これから、スケジューラは図9に示す CPU
割り当て順序記述テーブル(900)を生成する。この CPU
割り当て順序記述テーブル(900)は、CPU を割り当てる
べきプロセスグループ(915)の順序とその割り当て時間
(916)(タイムスロット数)を記述したテーブルであ
る。また、終了予定フラグ(917)は、その行の CPU 割り
当てが完了したとき、プロセスグループ(915)の一周期
分の割り当てが終了するか否かを示す。例えば、903 の
終了予定フラグ(917)は、プロセスグループCにタイム
スロット5を割り当てても一周期分の割り当てを完了し
ていないため OFF あるいは FALSE になっているが、90
6 の終了予定フラグ(917)は、タイムスロット10〜15を
割り当てれば一周期分の割り当てを完了するため ON あ
るいは TRUE になっている。タイムスロットテーブル(7
00)からCPU 割り当て順序記述テーブル(900)への変換ア
ルゴリズムは自明であるため省略する。インデックス(9
14)は、次に CPU を割り当てる CPU 割り当て順序記述
テーブル(900)の行(エントリ)を示すポインタである。
プロセスグループ(915)がOTHERS を指定するタイムスロ
ットは、通常プロセス(109)に割り当てられるタイムス
ロットである。OTHERS(907)は、プロセスグループCに
割り当てられた6タイムスロットが経過する前にプロセ
スグループC中の周期プロセスの実行が終了した場合に
空いたタイムスロットが通常プロセス(109)に割り当て
られることを示している。
By the above processing, the process group assigned to each time slot is determined as shown in FIG. From now on, the scheduler is the CPU shown in FIG.
An allocation order description table (900) is generated. This CPU
The allocation sequence description table (900) shows the order of the process group (915) to which the CPU should be allocated and its allocation time.
This table describes (916) (number of time slots). Further, the scheduled end flag (917) indicates whether or not the allocation for one cycle of the process group (915) will be completed when the CPU allocation for the row is completed. For example, the scheduled end flag (917) of 903 is OFF or FALSE because the allocation for one cycle is not completed even if the time slot 5 is allocated to the process group C, but 90
The end scheduled flag (917) of 6 is ON or TRUE because allocation of one cycle is completed if time slots 10 to 15 are allocated. Time slot table (7
The conversion algorithm from 00) to the CPU allocation order description table (900) is self-explanatory, and is therefore omitted. Index (9
14) is a pointer indicating a row (entry) of the CPU allocation order description table (900) to which the CPU is allocated next.
The time slot in which the process group (915) specifies OTHERS is the time slot assigned to the normal process (109). OTHERS (907) indicates that the free time slot is assigned to the normal process (109) when the execution of the periodic process in the process group C ends before the 6 time slots assigned to the process group C have elapsed. Shows.

【0073】スケジューラは、alloc_time_slot 関数が
発行されるごとに図8のような既存のテーブルと新しい
alloc_time_slot 関数による要求とを基にして CPU 割
り当て順序記述テーブル(900)を作成し直す。
Whenever the alloc_time_slot function is issued, the scheduler creates a new table and an existing table as shown in FIG.
Recreate the CPU allocation order description table (900) based on the request from the alloc_time_slot function.

【0074】上記アルゴリズムに従って生成された CPU
割り当て順序記述テーブル(900)に従い、周期駆動カー
ネルプロセス(101)はプロセスグループ(103)のスケジュ
ーリングを行なう。周期駆動カーネルプロセス(101)
が、周期的な CPU 割り当てを要求してきたプロセスグ
ループ(103)に属する周期プロセス(102)の優先度を rai
sed または depressed または基準優先度に変更するこ
とにより、このスケジューリングを実現する。
CPU generated according to the above algorithm
According to the allocation order description table (900), the periodic drive kernel process (101) schedules the process group (103). Periodically driven kernel process (101)
Rai the priority of the periodic process (102) that belongs to the process group (103) that requested periodic CPU allocation.
Achieve this scheduling by changing to sed or depressed or the base priority.

【0075】また、周期駆動カーネルプロセス(101)に
よって優先度が raised になった周期プロセスは、自プ
ロセスの優先度を depressed に変更し、かつ同一プロ
セスグループに属する他の周期プロセスの優先度を rai
sed に変更することにより、プロセス・グループ内のハ
ンドオフ・スケジューリングを実現する。
A periodic process whose priority has been raised by the periodic driving kernel process (101) changes its own priority to depressed and sets the priority of other periodic processes belonging to the same process group to rai.
Enables handoff scheduling within a process group by changing to sed.

【0076】優先度の変更は、proc_raise, proc_raise
_cancel, proc_raise_handoff, proc_depress, proc_de
press_cancel 関数を用いて行う。これら関数の外部仕
様を以下に示す。
To change the priority, proc_raise, proc_raise
_cancel, proc_raise_handoff, proc_depress, proc_de
Use the press_cancel function. The external specifications of these functions are shown below.

【0077】<関数名> proc_raise(pid, time, flags) <引数> pid: プロセス識別子 time: 優先度を raised に保つ時間 flags: 指定時間経過後の優先度を指定するフラグ。以
下のフラグが指定可能である。 RIORITY_NORMAL プロセスの優先度を基準優先度に変更する。 PRIORITY_DEPRESSED プロセスの優先度を depressed に変更する。また、指
定時間経過時に pid で指定されるプロセスにシグナル
を送信するか否かを以下のフラグで指定する。 SEND_SIGNAL 指定時間経過時に pid で指定されるプロセスにタイム
アウトシグナルを送信する。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>proc_raise 関数は、pid で指定されるプロセ
スの優先度を time で指定される時間(タイムスロット
数)だけ raised に設定する。time にはそのプロセス
が属するプロセスグループに割り当てられた時間(916)
又は INFINITY を指定する。優先度が raised であるプ
ロセスは、他のいかなるユーザプロセスよりも優先度が
高いことが保証される。
<Function name> proc_raise (pid, time, flags) <argument> pid: process identifier time: time to keep priority in raised flags: flag to specify priority after the specified time has elapsed. The following flags can be specified. RIORITY_NORMAL Change the process priority to the standard priority. PRIORITY_DEPRESSED Change the process priority to depressed. Also, the following flag specifies whether to send a signal to the process specified by pid when the specified time has elapsed. SEND_SIGNAL Send a timeout signal to the process specified by pid when the specified time has elapsed. <Return value> SUCCESS: Normal termination or various error codes <Description> The proc_raise function sets the priority of the process specified by pid to raised for the time (number of time slots) specified by time. time is the time assigned to the process group to which the process belongs (916)
Or specify INFINITY. A process with a raised priority is guaranteed to have a higher priority than any other user process.

【0078】複数のプロセスの優先度を同時に raised
にすることはできない。すでに優先度が raised である
プロセスが存在するときに本関数がコールされた場合、
本関数はエラーリターンする。
Raise the priority of multiple processes simultaneously
You can't. If this function is called when there is already a process whose priority is raised,
This function returns with an error.

【0079】time に INFINITY が設定されている場合
には、該当プロセスに対し proc_raise_cancel 関数か
proc_raise_handoff 関数が発行されるまで、該当プロ
セスの優先度は raised に保たれる。INFINITY は、例
えばタイマ割り込みハンドラ(104)が周期駆動カーネル
プロセス(101)を起動するときに指定される。周期プロ
セス(102)を起動するときには、通常 INFINITY は指定
されない。
When INFINITY is set for time, the proc_raise_cancel function for the process
The priority of the process is kept raised until the proc_raise_handoff function is issued. INFINITY is specified, for example, when the timer interrupt handler (104) starts the cyclically driven kernel process (101). INFINITY is not normally specified when invoking the periodic process (102).

【0080】time に INFINITY 以外の値が指定されて
いる場合には、 time で指定した時間が経過しても、該
当プロセスに対して proc_raise_cancel 関数か proc_r
aise_handoff 関数が発行されなければ、flags で指定
されているフラグに応じて、プロセスの優先度が強制的
に変更される。flags に PRIORITY_NORMAL が指定され
ていると、プロセスの優先度が raised から基準優先度
に変更される。flagsに PRIORITY_DE
PRESSED が指定されていると、プロセスの優先
度が raised からdepressed に変化する。さらに flags
に SEND_SIGNAL が指定されていれば、そのプロセスに
対してタイムアウトシグナルが送信される。タイムアウ
トシグナルを受信したプロセスは、設定された優先度に
従って起動され、タイムアウトの場合の処理を行うこと
ができる。
If a value other than INFINITY is specified for time, the proc_raise_cancel function or proc_r will be executed for the process even if the time specified by time has elapsed.
If the aise_handoff function is not issued, the process priority is forcibly changed according to the flags specified in flags. If PRIORITY_NORMAL is specified in flags, the process priority is changed from raised to the standard priority. PRIORITY_DE on flags
If PRESSED is specified, the priority of the process changes from raised to depressed. Furthermore flags
If SEND_SIGNAL is specified in, a timeout signal is sent to that process. The process that receives the time-out signal is started according to the set priority, and the process in the case of time-out can be performed.

【0081】<関数名> proc_raise_cancel(pid, flags) <引数> pid: プロセス識別子 flags: 変更後の優先度を指定するフラグ。以下が指定
可能である。 PRIORITY_NORMAL プロセスの優先度を基準優先度に変更する。 PRIORITY_DEPRESSED プロセスの優先度を depressed に変更する。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>proc_raise_cancel 関数は、proc_raise 関数
により raised に設定されたプロセスの優先度を flags
に応じて変更する。flags に PRIORITY_NORMAL が指定
されている場合には、変更後の優先度は、スケジューリ
ング属性に従って基準優先度になる。flags に PRIORIT
Y_DEPRESSED が指定されている場合には、変更後の優先
度は depressed になる。
<Function name> proc_raise_cancel (pid, flags) <Argument> pid: Process identifier flags: Flags that specify the priority after the change. The following can be specified. PRIORITY_NORMAL Change process priority to base priority. PRIORITY_DEPRESSED Change the process priority to depressed. <Return value> SUCCESS: Normal termination or various error codes <Explanation> The proc_raise_cancel function flags the priority of the process set to raised by the proc_raise function.
Change accordingly. When PRIORITY_NORMAL is specified in flags, the changed priority becomes the standard priority according to the scheduling attribute. PRIORIT in flags
If Y_DEPRESSED is specified, the changed priority will be depressed.

【0082】<関数名> proc_raise_handoff(pid, flags) <引数> pid: プロセス識別子 flags: ハンドオフ後の優先度を指定するフラグ。以下
が指定可能である。 PRIORITY_NORMAL プロセスの優先度を基準優先度に変更する。 PRIORITY_DEPRESSED プロセスの優先度を depressed に変更する。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>proc_raise_handoff 関数は、pid で指定され
るプロセスの優先度をraised にし、かつ自プロセスの
優先度を flags に応じて変更する。pid で指定される
プロセスは、呼び出しプロセスと同じプロセスグループ
に属していなければならない。そうでなければエラーリ
ターンする。flags に PRIORITY_NORMAL が指定されて
いる場合には、ハンドオフ後の呼び出しプロセスの優先
度は基準優先度になる。flags に PRIORITY_DEPRESSED
が指定されている場合には、ハンドオフ後の呼び出しプ
ロセスの優先度は depressed になる。
<Function name> proc_raise_handoff (pid, flags) <Argument> pid: Process identifier flags: Flags that specify the priority after handoff. The following can be specified. PRIORITY_NORMAL Change process priority to base priority. PRIORITY_DEPRESSED Change the process priority to depressed. <Return value> SUCCESS: Normal termination or various error codes <Explanation> The proc_raise_handoff function raises the priority of the process specified by pid and changes the priority of its own process according to flags. The process specified by pid must belong to the same process group as the calling process. Otherwise, it returns with an error. If PRIORITY_NORMAL is specified in flags, the priority of the calling process after handoff becomes the standard priority. PRIORITY_DEPRESSED in flags
If is specified, the priority of the calling process after handoff is depressed.

【0083】呼び出しプロセスの優先度は raised でな
ければならない。優先度が raisedでないプロセスが本
関数を呼び出すとエラーリターンする。
The priority of the calling process must be raised. If a process whose priority is not raised calls this function, an error will be returned.

【0084】呼び出しプロセスの優先度が raised に保
たれる上限時間が指定されている場合(proc_raise 関
数の time 引数に INFINITY 以外が指定されている場
合)には、ハンドオフ先のプロセスの優先度が raised
に保たれる時間は、呼び出し時点で残っている、ハンド
オフ元のプロセスの優先度が raised に保たれる時間と
なる。呼び出しプロセスの優先度が raised に保たれる
上限時間が指定されていない場合は、ハンドオフ先のプ
ロセスの優先度が raised に保たれる上限時間も存在し
ない。
When the upper limit time for which the priority of the calling process is kept raised is specified (when a time argument other than INFINITY is specified in the time argument of the proc_raise function), the priority of the handoff destination process is raised.
The time that is kept at this time is the time that the priority of the process of the handoff source that remains at the time of the call is kept at raised. If no time limit is specified for the calling process to keep its priority raised, there is no time limit to keep the priority of the handoff process raised.

【0085】<関数名> proc_depress(pid, time, flags) <引数> pid: プロセス識別子 time: 優先度を depressed に保つ時間 flags: 指定時間経過後の優先度を指定するフラグ。以
下のフラグが指定可能である。 PRIORITY_NORMAL プロセスの優先度を基準優先度に変更する。 PRIORITY_RAISED プロセスの優先度を raised に変更する。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>proc_depress 関数は、pid で指定されるプロ
セスの優先度を time で指定される時間(タイムスロッ
ト数)だけ depressed に設定する。優先度が depresse
d であるプロセスは、他のいかなるユーザプロセスより
も優先度が低いことが保証される。proc_depress 関数
は、主として周期駆動カーネルプロセス(101)が自プロ
セスの優先度を下げて通常プロセス(109)を起動するこ
とを目的として発行される。
<Function name> proc_depress (pid, time, flags) <Argument> pid: Process identifier time: Time to keep priority priority depressed: Flag to specify priority after the specified time has elapsed. The following flags can be specified. PRIORITY_NORMAL Change process priority to base priority. PRIORITY_RAISED Change process priority to raised. <Return value> SUCCESS: Normal termination or various error codes <Description> The proc_depress function sets the priority of the process specified by pid to depressed for the time (number of time slots) specified by time. Priority is depresse
A process that is d is guaranteed to have a lower priority than any other user process. The proc_depress function is issued mainly for the purpose of causing the periodical kernel process (101) to lower the priority of its own process and activate the normal process (109).

【0086】time に INFINITY が設定されている場合
には、該当プロセスに対し proc_depress_cancel 関数
か proc_raise_handoff 関数が発行されるまで、該当プ
ロセスの優先度は depressed に保たれる。
When INFINITY is set for time, the priority of the process is kept depressed until the proc_depress_cancel function or the proc_raise_handoff function is issued to the process.

【0087】time に INFINITY 以外の値が指定されて
いる場合には、 time で指定した時間が経過しても、該
当プロセスに対して proc_depress_cancel 関数が発行
されなければ、flags で指定されているフラグに応じ
て、プロセスの優先度が強制的に変更される。flags に
PRIORITY_NORMAL が指定されていると、プロセスの優
先度が depressed から基準優先度に変更される。flags
に PRIORITY_RAISED が指定されていると、プロセスの
優先度が depressed から raised に変化する。
When a value other than INFINITY is specified for time, if the proc_depress_cancel function is not issued to the process even if the time specified by time has elapsed, the flag specified by flags is set. The process priority is forced to change accordingly. in flags
If PRIORITY_NORMAL is specified, the process priority is changed from depressed to the standard priority. flags
If PRIORITY_RAISED is specified in, the process priority changes from depressed to raised.

【0088】<関数名> proc_depress_cancel(pid, flags) <引数> pid: プロセス識別子 flags: 変更後の優先度を指定するフラグ。以下が指定
可能である。 PRIORITY_NORMAL プロセスの優先度を基準優先度に変更する。 PRIORITY_RAISED プロセスの優先度を raised に変更する。 <リターン値> SUCCESS: 正常終了 もしくは、各種エラーコード <説明>proc_depress_cancel 関数は、proc_depress
関数により depressed に設定されたプロセスの優先度
を flags に応じて変更する。flags に PRIORITY_NORMA
Lが指定された場合には、変更後のプロセスの優先度は
基準優先度になる。flagsに PRIORITY_RAISED が指定さ
れた場合には、変更後のプロセスの優先度は raised に
なる。
<Function name> proc_depress_cancel (pid, flags) <Argument> pid: Process identifier flags: Flag designating the changed priority. The following can be specified. PRIORITY_NORMAL Change process priority to base priority. PRIORITY_RAISED Change process priority to raised. <Return value> SUCCESS: Normal termination or various error codes <Explanation> proc_depress_cancel function calls proc_depress
Change the priority of processes set to depressed by the function according to flags. PRIORITY_NORMA in flags
If L is specified, the priority of the changed process will be the reference priority. If PRIORITY_RAISED is specified in flags, the priority of the changed process will be raised.

【0089】上記関数群を実現するために必要な配列デ
ータ及び制御ブロックのデータ構造を図10に示す。
FIG. 10 shows the data structure of the array data and control block necessary for realizing the above-mentioned function group.

【0090】プロセス管理はプロセス制御ブロック(100
2)を用いて行なわれる。実行可能(レディ)状態にある
プロセスのプロセス制御ブロック(1002)は、優先度別
に、レディキューヘッダ配列(1001)の要素をキューヘッ
ダに持つ双方向キュー(以後、双方向レディキューと呼
ぶ)に接続される。レディキューヘッダ配列(1001)は、
優先度をインデックス値とした、優先度別の双方向レデ
ィキューのキューヘッダ(プロセス制御ブロックを指す
ポインタ)の配列である。ただし、優先度は値が小さい
ほど高優先度であるものとする。また、最高優先度の値
は raised、最低優先度の値は depressed で表す。
Process management is performed by the process control block (100
2) is performed. The process control block (1002) of the process in the ready (ready) state is assigned to the bidirectional queue (hereinafter referred to as the bidirectional ready queue) that has the elements of the ready queue header array (1001) in the queue header for each priority. Connected. Ready queue header array (1001) is
It is an array of queue headers (pointers pointing to process control blocks) of bidirectional ready queues for each priority, with the priority index. However, the smaller the value of the priority, the higher the priority. The highest priority value is represented by raised and the lowest priority value is represented by depressed.

【0091】プロセス制御ブロック(1002)は、優先度別
の双方向レディキューに接続するために、next_proc フ
ィールド(1003)および prev_proc フィールド(1004)を
保持する。それぞれ、双方向キューの後ろのプロセス制
御ブロック(1002)へのポインタ、前のプロセス制御ブロ
ック(1002)へのポインタが格納される。但し、双方向レ
ディキューの先頭プロセス制御ブロック(1002)の prev_
proc フィールド(1004)には、レディキューヘッダ配列
(1001)の要素へのポインタが格納される。また、双方向
レディキューの末尾プロセス制御ブロック(1002)の nex
t_proc フィールド(1003)には、nil ポインタが格納さ
れる。
The process control block (1002) holds the next_proc field (1003) and the prev_proc field (1004) in order to connect to the bidirectional ready queue for each priority. A pointer to the process control block (1002) behind the bidirectional queue and a pointer to the previous process control block (1002) are stored respectively. However, prev_ of the first process control block (1002) of the bidirectional ready queue
The proc field (1004) contains the ready queue header array.
The pointer to the element of (1001) is stored. It also includes a nexus to the tail process control block (1002) of the bidirectional ready queue.
A nil pointer is stored in the t_proc field (1003).

【0092】プロセス制御ブロック(1002)には、その他
に、counter フィールド(1005)、flags フィールド(100
6)、context フィールド(1007)、base_pri フィールド
(1010)が存在する。counter フィールド(1005)には、そ
のプロセスが raised もしくはdepressed の優先度を保
てる残り時間(タイムスロット数)を保持する。flags
フィールド(1006)には、raised もしくは depressed の
優先度を保てる時間が経過した後に、変更されるべきプ
ロセスの優先度を示すフラグが格納される。context フ
ィールド(1007)は、プロセスの実行コンテクストの退避
領域である。base_pri フィールド(1010)は、プロセス
の基準優先度が、プロセス生成時に格納される。
The process control block (1002) also includes a counter field (1005) and flags field (100
6), context field (1007), base_pri field
(1010) exists. The counter field (1005) holds the remaining time (the number of time slots) that the process can maintain the priority of raised or depressed. flags
The field (1006) stores a flag indicating the priority of the process to be changed after the time in which the priority of raised or depressed can be maintained. The context field (1007) is a save area for the execution context of the process. The base_pri field (1010) stores the reference priority of the process when the process is created.

【0093】プロセス識別子からプロセス制御ブロック
(1002)への変換は、プロセス制御ブロックポインタ配列
(1009)を用いて行なう。すなわち、プロセス制御ブロッ
クポインタ配列(1009)の、プロセス識別子をインデック
スに持つ要素に、プロセス制御ブロック(1002)へのポイ
ンタが格納されている。プロセス識別子に対応するプロ
セス制御ブロック(1002)が存在しない場合には、プロセ
ス制御ブロックポインタ配列(1009)の該当要素には、ni
l ポインタが格納されている。
Process identifier to process control block
Conversion to (1002) is a process control block pointer array
Use (1009). That is, the pointer to the process control block (1002) is stored in the element of the process control block pointer array (1009) having the process identifier as an index. If the process control block (1002) corresponding to the process identifier does not exist, ni is set in the corresponding element of the process control block pointer array (1009).
l Stores the pointer.

【0094】また、ctxproc(1008)は、現在実行中のプ
ロセスのプロセス制御ブロック(1002)へのポインタを格
納する。
The ctxproc (1008) also stores a pointer to the process control block (1002) of the currently executing process.

【0095】proc_raise 関数の処理フローを図11に
示す。
The processing flow of the proc_raise function is shown in FIG.

【0096】ステップ1101で、スケジューラはプロセス
制御ブロックポインタ配列(1009)の、proc_raise 関数
の引数 pid をインデックスに持つ要素を求め、その要
素から指されるプロセス制御ブロック(1002)を、双方向
レディキューからデキューする。
In step 1101, the scheduler obtains the element of the process control block pointer array (1009) having the argument pid of the proc_raise function as an index, and sets the process control block (1002) pointed to by the element to the bidirectional ready queue. Dequeue from.

【0097】ステップ1102で、レディキューヘッダ配列
(1001)の raised をインデックスに持つ要素を求め、そ
の要素をキューヘッダとする双方向レディキューの末尾
に、ステップ1101で得られたプロセス制御ブロック(100
2)をエンキューする。
At step 1102, ready queue header array
Find the element whose index is raised in (1001), and add the process control block (100
Enqueue 2).

【0098】ステップ1103で、proc_raise 関数の引数
time で指定した値を、ステップ1102で得られたプロセ
ス制御ブロック(1002)の counter フィールド(1005)に
格納する。
At step 1103, the argument of the proc_raise function
The value specified by time is stored in the counter field (1005) of the process control block (1002) obtained in step 1102.

【0099】ステップ1104で、proc_raise 関数の引数
flags で指定した値を、ステップ1102で得られたプロセ
ス制御ブロック(1002)の flags フィールド(1006)に格
納する。
At step 1104, arguments of the proc_raise function
The value specified by flags is stored in the flags field (1006) of the process control block (1002) obtained in step 1102.

【0100】ステップ1105で、現在の実行コンテクスト
(各種レジスタの値)を、ctxproc(1008)から指される
プロセス制御ブロック(1002)の context フィールド(10
07)に退避する。
At step 1105, the current execution context (values of various registers) is set to the context field (10) of the process control block (1002) pointed to by ctxproc (1008).
Move to 07).

【0101】ステップ1106で、ctxproc(1008)に、シス
テム内で最高優先度を持つプロセスのプロセス制御ブロ
ック(1002)へのポインタを格納する。システム内で最高
優先度を持つプロセスのプロセス制御ブロックは以下の
手順で検索できる。まず、レディキューヘッダ配列(100
1)に格納されている各双方向レディキューのうち、キュ
ー長が1以上であり、かつ、インデックス値が最小の双
方向レディキューを求める。その双方向レディキューの
先頭にキューイングされているプロセス制御ブロック(1
002)が、求めるプロセス制御ブロック(1002)になる。こ
こでは、proc_raise 関数の引数 pid で指定され、ステ
ップ1102で raised の値をもってレディキューヘッダ配
列(1001)に接続されたプロセスが最高優先度を持つプロ
セスである。
At step 1106, a pointer to the process control block (1002) of the process having the highest priority in the system is stored in ctxproc (1008). The process control block of the process with the highest priority in the system can be retrieved using the following procedure. First, the ready queue header array (100
Among the bidirectional ready queues stored in 1), the bidirectional ready queue with a queue length of 1 or more and the smallest index value is obtained. The process control block (1
002) becomes the desired process control block (1002). Here, the process specified by the argument pid of the proc_raise function and connected to the ready queue header array (1001) with the value raised in step 1102 is the process with the highest priority.

【0102】ステップ1107で、ステップ1106で得られた
プロセス制御ブロックの contextフィールド(1007)に退
避されている実行コンテクストを回復する。ステップ11
07の処理によってプロセスのスイッチが生じ、実行コン
テクストの回復されたプロセスがディスパッチされる。
なおステップ1104とステップ1105との間でシステム内で
最高優先度を持つプロセスのプロセス制御ブロックポイ
ンタと ctxproc(1008)の内容を比較し、両者が同じであ
ればステップ1105〜1107の処理をスキツプできる。
In step 1107, the execution context saved in the context field (1007) of the process control block obtained in step 1106 is restored. Step 11
The process of 07 causes the process to be switched, and the process whose execution context has been recovered is dispatched.
Note that between step 1104 and step 1105, the contents of ctxproc (1008) and the process control block pointer of the process with the highest priority in the system are compared, and if both are the same, the processing of steps 1105 to 1107 can be skipped. .

【0103】proc_raise_cancel, proc_raise_handoff,
proc_depress, proc_depress_cancel 関数も、ステッ
プ1101から1102と同様のレディキュー操作、および、
(必要ならば)ステップ1103から1104と同様のプロセス
制御ブロック(1002)の各種フィールドの更新、および、
ステップ1105と同様の実行コンテクストの退避、およ
び、ステップ1106から1107と同様のシステム内で最高優
先度を持つプロセスの実行コンテクストの回復、を行な
うことで実現できる。処理フローは proc_raise 関数と
同様になるため、省略する。
Proc_raise_cancel, proc_raise_handoff,
The proc_depress and proc_depress_cancel functions also have the same ready queue operation as in steps 1101 to 1102, and
Update various fields of the process control block (1002) similar to steps 1103 to 1104 (if necessary), and
This can be realized by saving the execution context similar to step 1105 and recovering the execution context of the process having the highest priority in the system similar to steps 1106 to 1107. The process flow is the same as the proc_raise function, so it is omitted.

【0104】proc_raise 関数及びproc_depress 関数が
発行された場合、その関数発行から、引数 time で指定
された時間が経過したか否かの検査を行なう必要があ
る。この検査は、プロセス制御ブロックの counter フ
ィールド(1005)を用いてタイマ割り込みハンドラ(104)
内で行なわれる。またタイマ割り込みハンドラ(104)
は、周期駆動カーネルプロセス(101)の駆動処理も併せ
て行う。これらを行うタイマ割り込みハンドラ(104)の
処理フローを図12に示す。あらかじめ設定したタイム
スロットごとにタイマ割り込みが発生してタイマ割り込
みハンドラ(104)に制御が渡り、図12に示す処理が実
行される。
When the proc_raise function and the proc_depress function are issued, it is necessary to check whether or not the time designated by the argument time has elapsed since the function was issued. This check uses the counter field (1005) of the process control block to timer interrupt handler (104).
Done within Also timer interrupt handler (104)
Also performs the driving process of the periodical driving kernel process (101). FIG. 12 shows a processing flow of the timer interrupt handler (104) which performs these operations. A timer interrupt is generated for each preset time slot, control is passed to the timer interrupt handler (104), and the processing shown in FIG. 12 is executed.

【0105】ステップ1201では、レディキューヘッダ配
列(1001)の raised をインデックスに持つ要素を求め、
その要素に格納されているプロセス制御ブロック(1002)
へのポインタを変数 PCB に代入する。
At step 1201, the element having raised in the ready queue header array (1001) as an index is obtained,
Process control block stored in that element (1002)
Assign a pointer to to the variable PCB.

【0106】ステップ1202では、ステップ1201で更新さ
れた PCB の値が nil ポインタであるか否かのチェック
を行なう。nil ポインタであればステップ1207に、nil
ポインタでなければステップ 1203 にジャンプする。
In step 1202, it is checked whether the PCB value updated in step 1201 is a nil pointer. If it is a nil pointer, go to step 1207 and nil
If it is not a pointer, jump to step 1203.

【0107】ステップ1203では、PCB で指されるプロセ
ス制御ブロック(1002)の counterフィールド(1005)を1
だけデクリメントする。ただし、counter フィールド(1
005)に INFINITY が格納されている場合には、何も行な
わない。
At step 1203, the counter field (1005) of the process control block (1002) pointed to by the PCB is set to 1
Only decrement. However, the counter field (1
If INFINITY is stored in (005), do nothing.

【0108】ステップ1204では、PCB で指されるプロセ
ス制御ブロック(1002)の counterフィールド(1005)の値
が0であるか否かのチェックを行なう。counter フィー
ルド(1005)の値が0であればステップ1205に、0以外で
あればステップ1206にジャンプする。
At step 1204, it is checked whether or not the value of the counter field (1005) of the process control block (1002) pointed to by PCB is 0. If the value of the counter field (1005) is 0, the process jumps to step 1205, and if it is not 0, the process jumps to step 1206.

【0109】ステップ1205では、PCB で指されるプロセ
ス制御ブロック(1002)の flags フィールド(1006)に応
じてレディキュー操作を行なう。すなわち以下の操作を
行なう。まず、PCB で指されるプロセス制御ブロック(1
002)を、双方向レディキューからデキューする。次に、
flags フィールド(1006)に PRIORITY_NORMAL が格納さ
れている場合には、レディキューヘッダ配列(1001)の b
ase_pri フィールド(1010)に格納されている値をインデ
ックスとする要素を求め、その要素をキューヘッダとす
る双方向レディキューの末尾に PCB で指されるプロセ
ス制御ブロック(1002)をエンキューする。また、flags
フィールド(1006)に PRIORITY_DEPRESSEDが格納されて
いる場合には、レディキューヘッダ配列(1001)の depre
ssed をインデックスとする要素を求め、その要素をキ
ューヘッダとする双方向レディキューの末尾に PCB で
指されるプロセス制御ブロック(1002)をエンキューす
る。
In step 1205, the ready queue operation is performed according to the flags field (1006) of the process control block (1002) pointed to by the PCB. That is, the following operation is performed. First, the process control block (1
002) is dequeued from the bidirectional ready queue. next,
If PRIORITY_NORMAL is stored in the flags field (1006), b in the ready queue header array (1001)
Find the element whose index is the value stored in the ase_pri field (1010), and enqueue the process control block (1002) pointed to by PCB at the end of the bidirectional ready queue with that element as the queue header. Also, flags
When PRIORITY_DEPRESSED is stored in the field (1006), depre in the ready queue header array (1001)
Find the element with ssed as the index and enqueue the process control block (1002) pointed to by PCB at the end of the bidirectional ready queue with that element as the queue header.

【0110】ステップ1206では、PCB の値を、PCB で指
されているプロセス制御ブロック(1002)の next_proc
フィールド(1003)の値に更新する。その後ステップ1202
にジャンプする。
At step 1206, the value of PCB is set to the next_proc of the process control block (1002) pointed to by PCB.
Update to the value of field (1003). Then step 1202
Jump to.

【0111】ステップ1207では、レディキューヘッダ配
列(1001)の depressed をインデックスに持つ要素を求
め、その要素に格納されている制御ブロック(1002)への
ポインタを変数 PCB に代入する。
In step 1207, the element having depressed in the ready queue header array (1001) as an index is obtained, and the pointer to the control block (1002) stored in that element is assigned to the variable PCB.

【0112】ステップ1208では、ステップ1207で更新さ
れた PCB の値が nil ポインタであるか否かのチェック
を行なう。nil ポインタであればステップ1213に、nil
ポインタでなければステップ 1209 にジャンプする。
In step 1208, it is checked whether or not the PCB value updated in step 1207 is a nil pointer. If it is a nil pointer, go to step 1213, nil
If it is not a pointer, jump to step 1209.

【0113】ステップ1209では、PCB で指されるプロセ
ス制御ブロック(1002)の counterフィールド(1005)を1
だけデクリメントする。ただし、counter フィールド(1
005)に INFINITY が格納されている場合には、何も行な
わない。
At step 1209, the counter field (1005) of the process control block (1002) pointed to by the PCB is set to 1
Only decrement. However, the counter field (1
If INFINITY is stored in (005), do nothing.

【0114】ステップ1210では、PCB で指されるプロセ
ス制御ブロック(1002)の counterフィールド(1005)の値
が0であるか否かのチェックを行なう。counter フィー
ルド(1005)の値が0であればステップ1211に、0以外で
あればステップ1212にジャンプする。
At step 1210, it is checked whether or not the value of the counter field (1005) of the process control block (1002) pointed to by PCB is 0. If the value of the counter field (1005) is 0, the process jumps to step 1211. If it is not 0, the process jumps to step 1212.

【0115】ステップ1211では、PCB で指されるプロセ
ス制御ブロック(1002)の flags フィールド(1006)に応
じてレディキュー操作を行なう。すなわち、以下の操作
を行なう。まず、PCB で指されるプロセス制御ブロック
(1002)を、双方向レディキューからデキューする。次
に、flags フィールド(1006)に PRIORITY_NORMAL が格
納されている場合には、レディキューヘッダ配列(1001)
の base_pri フィールド(1010)に格納されている値をイ
ンデックスとする要素を求め、その要素をキューヘッダ
とする双方向レディキューの末尾に PCB から指される
プロセス制御ブロック(1002)をエンキューする。また、
flags フィールド(1006)に PRIORITY_RAISED が格納さ
れている場合には、レディキューヘッダ配列(1001)の r
aised をインデックスとする要素を求め、その要素をキ
ューヘッダとする双方向レディキューの末尾に PCB か
ら指されるプロセス制御ブロック(1002)をエンキューす
る。
In step 1211, the ready queue operation is performed according to the flags field (1006) of the process control block (1002) pointed to by the PCB. That is, the following operation is performed. First, the process control block pointed to by the PCB
Dequeue (1002) from the bidirectional ready queue. Next, if PRIORITY_NORMAL is stored in the flags field (1006), the ready queue header array (1001)
Find the element whose index is the value stored in the base_pri field (1010) of the, and enqueue the process control block (1002) pointed to by the PCB at the end of the bidirectional ready queue with that element as the queue header. Also,
If PRIORITY_RAISED is stored in the flags field (1006), r in the ready queue header array (1001)
Find the element whose index is aised, and enqueue the process control block (1002) pointed to by the PCB at the end of the bidirectional ready queue with that element as the queue header.

【0116】ステップ1212では、PCB の値を、PCB で指
されているプロセス制御ブロック(1002)の next_proc
フィールド(1003)の値に更新する。その後、ステップ12
08にジャンプする。
At step 1212, the value of PCB is set to the next_proc of the process control block (1002) pointed to by PCB.
Update to the value of field (1003). Then step 12
Jump to 08.

【0117】ステップ1213からステップ1216において、
周期駆動カーネルプロセス(101)の駆動処理を行う。周
期駆動カーネルプロセス(101)は、以下の事象が生じた
場合に駆動される。
In steps 1213 to 1216,
The driving process of the periodic driving kernel process (101) is performed. The cycle-driven kernel process (101) is driven when the following events occur.

【0118】(a)プロセスグループ(915)に割り当て
られるべき CPU 時間が経過したとき 周期駆動カーネルプロセス(101)は、CPU 割り当て順序
記述テーブル(900)に従い、テーブルに記述された時間
(916)を各プロセスグループ(915)に順次与えていく。プ
ロセスグループ(915)に与えられた時間(916)が経過した
とき、そのプロセスグループ(915)に属する優先度が ra
ised のプロセスの PCB の counter が0になるので、
ステップ1204及びステップ1205によってそのプロセスの
優先度が PCB -> flags に応じてより低い優先度に変更
され、結果として raised の次に優先度の高い周期駆動
カーネルプロセス(101)が駆動される。周期駆動カーネ
ルプロセス(101)は、CPU を割り当てるべきプロセスグ
ループ(915)を変更する。次にCPU を割り当てるべきプ
ロセスグループ(915)が存在しない場合、周期駆動カー
ネルプロセス(101)は自らの優先度を depressed に変更
することにより、通常プロセス(109)への CPU 時間の割
り当てを実現する。
(A) When the CPU time to be allocated to the process group (915) elapses The cycle-driven kernel process (101) follows the CPU allocation order description table (900) to describe the time described in the table.
(916) is sequentially given to each process group (915). When the time (916) given to the process group (915) has elapsed, the priority belonging to that process group (915) is ra.
Since the PCB counter of the ised process becomes 0,
Steps 1204 and 1205 change the priority of the process to a lower priority according to PCB-> flags, and as a result, the cycle-driven kernel process (101) having the next highest priority after raised is driven. The cycle-driven kernel process (101) changes the process group (915) to which the CPU should be allocated. If there is no process group (915) to allocate the CPU next, the cycle-driven kernel process (101) changes its priority to depressed, thereby allocating the CPU time to the normal process (109). .

【0119】(b)CPU の割り当てを要求しているプロ
セスグループ(915)の最小 Interval(例えば図8の例で
は8タイムスロットであり、以後最小 Interval と略
す)が経過した場合 (a)で述べたように、周期駆動カーネルプロセス(10
1)は、次に CPU を割り当てるべきプロセスグループ(91
5)が存在しない場合、自プロセスの優先度を depressed
に変更する。しかし、最小 Interval が経過するたび
に、最小 Interval での駆動を要求しているプロセスグ
ループ(915)に CPU 時間を割り当てる必要が生じる。そ
のため、最小 Interval 周期で周期駆動カーネルプロセ
ス(101)を駆動し、該当プロセスグループ(915)に対する
CPU 時間の割り当て処理を行う。
(B) When the minimum Interval of the process group (915) requesting the CPU allocation (for example, 8 time slots in the example of FIG. 8 and abbreviated as the minimum Interval thereafter) has passed. As described above, the period-driven kernel process (10
1) is the process group (91
If 5) does not exist, the priority of the own process is depressed.
Change to However, every time the minimum Interval elapses, it becomes necessary to allocate CPU time to the process group (915) requesting to drive at the minimum Interval. Therefore, drive the period-driven kernel process (101) with the minimum Interval period, and
Performs CPU time allocation processing.

【0120】最小 Interval による周期駆動カーネルプ
ロセス(101)の駆動間隔は、kproc_timer という変数に
よって管理される。この変数は、alloc_time_slot 関数
によって CPU 割り当て順序記述テーブル(900)を作成す
るときスケジューラによって最小Interval に初期化さ
れる。
The driving interval of the cyclically driven kernel process (101) with the minimum Interval is managed by a variable called kproc_timer. This variable is initialized to the minimum Interval by the scheduler when creating the CPU allocation order description table (900) by the alloc_time_slot function.

【0121】ステップ1213で、kproc_timer を1だけデ
クリメントする。
In step 1213, kproc_timer is decremented by 1.

【0122】ステップ1214では、ステップ1213で更新さ
れた kproc_timer の値が0であるか否かをチェックす
る。0であれば、上記(b)の周期駆動カーネルプロセ
ス(101)の駆動契機であることを示す。周期駆動カーネ
ルプロセス(101)の駆動処理のため、kproc_timer の再
初期化後ステップ1215にジャンプする。
In step 1214, it is checked whether the value of kproc_timer updated in step 1213 is 0. If it is 0, it indicates that it is the driving trigger of the cyclically driven kernel process (101) in (b) above. After the re-initialization of kproc_timer, the process jumps to step 1215 for the process of driving the cyclically driven kernel process (101).

【0123】kproc_timer が0以外の場合には、ステッ
プ1105からステップ1107で示される実行コンテクストの
退避回復処理を実行する。プロセスグループ(915)に割
り当てられるべき CPU 時間が経過した場合(上記
(a)の場合)、周期駆動カーネルプロセス(101)がシ
ステム内で最高優先度を保持するプロセスとなり、ステ
ップ1105からステップ1107の実行によって周期駆動カー
ネルプロセス(101)が駆動される。
When kproc_timer is other than 0, the execution context save / recovery processing shown in steps 1105 to 1107 is executed. When the CPU time that should be allocated to the process group (915) has elapsed (in the case of (a) above), the cycle-driven kernel process (101) becomes the process holding the highest priority in the system, and steps 1105 to 1107 are executed. Execution drives the Periodically Driven Kernel Process (101).

【0124】ステップ1215で、CPU 割り当て順序記述テ
ーブル(900)の Index(914)を、プロセスグループ(915)
のフィールドに OTHERS が格納されているエントリまで
進める。例えば、図9で、Index(914)が906のエントリ
を指していた場合、本ステップはIndex(914)が907のエ
ントリを指すように更新する。本ステップにより、ステ
ップ1216で駆動される周期駆動カーネルプロセス(101)
が、プロセスグループ(915)のフィールドに OTHERS が
格納されているエントリの次のエントリから、プロセス
グループ(915)への CPU 時間の割り当て処理を開始する
ことができる。Index(914)がすでにプロセスグループ(9
15)のフィールドに OTHERS が格納されているエントリ
を指している場合には、何も行わない。
In step 1215, the Index (914) of the CPU allocation order description table (900) is set to the process group (915).
Go to the entry that stores OTHERS in the field. For example, in FIG. 9, when Index (914) points to the entry of 906, this step is updated to point to the entry of Index (914) to 907. By this step, the cyclically driven kernel process (101) driven in step 1216
However, the CPU time allocation process to the process group (915) can be started from the entry next to the entry having OTHERS stored in the field of the process group (915). Index (914) is already in process group (9
If it points to an entry in which OTHERS is stored in the field of 15), do nothing.

【0125】ステップ1216で、proc_depress_cancel(ke
rn_proc, PRIORITY_NORMAL)関数を呼び出す。kern_proc
は、周期駆動カーネルプロセス(101)のプロセス識別子
を表す。本関数の実行により、周期駆動カーネルプロセ
ス(101)の優先度が depressed であれば depressed か
ら基準優先度(raised の次に高い優先度)に変更され
る。周期駆動カーネルプロセス(101)の優先度が基準優
先度であれば、この関数の実行によって優先度の変更は
ない。この時点で、優先度が raised であるプロセスは
存在しないことが保証される(各プロセスグループ(91
5)に、周期駆動カーネルプロセス(101)の駆動契機を待
たないで CPU 時間を割り当てないように、CPU 割り当
て順序記述テーブル(900)を設定している)ので、上記
(b)の場合の周期駆動カーネルプロセス(101)の駆動
が実現できる。
At step 1216, proc_depress_cancel (ke
rn_proc, PRIORITY_NORMAL) function is called. kern_proc
Represents the process identifier of the cycle-driven kernel process (101). By executing this function, if the priority of the cyclically driven kernel process (101) is depressed, it is changed from depressed to the reference priority (the next highest priority to raised). If the priority of the cycle-driven kernel process (101) is the reference priority, execution of this function does not change the priority. At this point, it is guaranteed that no process has priority raised (each process group (91
In 5), the CPU allocation order description table (900) is set so that CPU time is not allocated without waiting for the drive trigger of the cyclically driven kernel process (101). The driving kernel process (101) can be realized.

【0126】なお周期プロセス(102)の PCB->counter
がタイムスロットの間隔ごとに正しくデクリメントされ
るためには、周期プロセス(102)の PCB が常にレディキ
ューに接続されている必要がある。従って周期プロセス
(102)の PCB がレディキューから外されるようなウェイ
トは禁止される。周期プロセス(102)は、ウェイトする
場合、割り当てられた CPU 時間内でダイナミック・ジャ
ンプ等の手段によってウェイトする必要がある。
PCB-> counter of the periodic process (102)
The PCB of the periodic process (102) must always be attached to the ready queue in order to be correctly decremented every time slot interval. Therefore the cyclic process
(102) PCBs are not allowed to be removed from the ready queue. When the cyclic process (102) waits, it needs to wait by means such as dynamic jump within the allocated CPU time.

【0127】周期駆動カーネルプロセス(101)の動作の
フローチャートを図13に示す。
FIG. 13 shows a flowchart of the operation of the cyclically driven kernel process (101).

【0128】周期駆動カーネルプロセス(101)は、CPU
の割り当てを要求しているプロセスグループ(103)に割
り当てられた時間(916)又は最小 Interval ごとに、タ
イマ割り込みハンドラ(104)によって駆動される。すな
わちそのときタイマ割り込みハンドラ(104)を実行して
いたプロセスが周期駆動カーネルプロセス(101)を起動
する。周期駆動カーネルプロセス(101)は、基準優先度
で動作する。
The cycle-driven kernel process (101) is a CPU
It is driven by a timer interrupt handler (104) at every time (916) or at least every Interval allotted to the process group (103) requesting the allocation. That is, the process that was executing the timer interrupt handler (104) at that time activates the cyclically-driven kernel process (101). The cycle-driven kernel process (101) operates at the standard priority.

【0129】ステップ 1301 において、CPU 割り当て順
序記述テーブル(900)の Index(914)をテーブルの1エン
トリ分インクリメントする。CPU 割り当て順序記述テー
ブル(900)の Index(914) は、次に周期駆動カーネルプ
ロセス(101)により CPUを割り当てられるべきプロセス
グループ(915)などを示すエントリを指している。
In step 1301, the Index (914) of the CPU allocation order description table (900) is incremented by one entry in the table. The Index (914) of the CPU allocation order description table (900) points to an entry indicating a process group (915) to which a CPU should be allocated next by the cycle-driven kernel process (101).

【0130】ステップ 1302 において、Index(914) に
より指される CPU 割り当て順序記述テーブル(900)のエ
ントリを検索する。
In step 1302, the CPU allocation order description table (900) pointed to by Index (914) is searched for an entry.

【0131】ステップ 1303 において、ステップ 1302
で得られたエントリのプロセスグループ(915)のフィー
ルドが OTHERS であるか否かの検査を行なう。
In Step 1303, Step 1302
Check whether the field of process group (915) of the entry obtained in is OTHERS.

【0132】プロセスグループ(915)が OTHERS である
場合には、ステップ 1304において proc_depress(MYSEL
F, INFINITY, PRIORITY_NORMAL) をコールする。これに
より、周期駆動カーネルプロセス(101)は proc_depres
s_cancel 関数が発行されるまで、優先度が depressed
になる。周期的な CPU の割り当てを要求しているプロ
セスグループ(103)の最小 Interval ごとに、タイマ割
り込みハンドラ(104)からproc_depress_cancel 関数が
発行される。それまで、連続メディア処理を行なわない
通常プロセス(109)(alloc_time_slot 関数により周期
的なスケジューリングを要求していないプロセス)がス
ケジューリングされる。
If the process group (915) is OTHERS, in step 1304 proc_depress (MYSEL
F, INFINITY, PRIORITY_NORMAL). This will make the Periodic Driven Kernel process (101) proc_depres
The priority is depressed until the s_cancel function is issued.
become. The timer interrupt handler (104) issues the proc_depress_cancel function at every minimum Interval of the process group (103) requesting periodic CPU allocation. Until then, a normal process (109) that does not perform continuous media processing (process that has not requested periodic scheduling by the alloc_time_slot function) is scheduled.

【0133】プロセスグループ(915)が OTHERS でない
場合には、ステップ 1305 において、次に CPU を割り
当てるべきプロセスグループ(915)が一周期分の実行を
完了しているか否かを検査する。これは、図14に示す
ような、実行状態記述テーブル(1400)の done フィール
ド(1401)のフラグを用いて判定される。これは、alloc
_time_slot 関数を用いて周期的なスケジューリングを
要求しているプロセスグループ(103)ごとに、一周期分
の実行が完了したか否かを記述するフィールドである。
周期的なスケジューリングを要求しているプロセスグル
ープ(103)に属している周期プロセス(102)は、一周期分
の実行完了時に proc_raise_cancel 関数を自プロセス
に対して発行する(後述)。この関数を呼び出した周期
プロセス(102)が属するプロセスグループ(103)の done
フラグは、この関数の処理ルーチン内でセットされる。
If the process group (915) is not OTHERS, it is checked in step 1305 whether the process group (915) to which the CPU is to be allocated next has completed the execution of one cycle. This is determined using the flag of the done field (1401) of the execution state description table (1400) as shown in FIG. This is alloc
This field describes whether or not the execution for one cycle is completed for each process group (103) requesting cyclic scheduling using the _time_slot function.
The periodic process (102) belonging to the process group (103) requesting the periodic scheduling issues the proc_raise_cancel function to its own process when the execution for one period is completed (described later). Done of the process group (103) to which the periodic process (102) that called this function belongs
The flag is set in the processing routine of this function.

【0134】ステップ 1302 で得られたエントリのプロ
セスグループ(915)が一周期分の実行を完了していた場
合には、ステップ 1306 においてそのエントリの終了予
定フラグ(917)を検索する。
When the process group (915) of the entry obtained in step 1302 has completed the execution for one cycle, the end scheduled flag (917) of the entry is searched in step 1306.

【0135】終了予定フラグ(917)が FALSE であれば、
ステップ 1301 に戻る。
If the end schedule flag (917) is FALSE,
Return to step 1301.

【0136】終了予定フラグ(917)が TRUE であれば、
ステップ 1308 において実行状態記述テーブル(1400)の
done フィールド(1401)の該当フラグをクリアする。さ
らにactive pid フィールド(1402)も初期化する。この
初期化方法はすぐ後で述べる。この後、ステップ 1301
に戻る。
If the end schedule flag (917) is TRUE,
In step 1308, the execution status description table (1400)
Clear the corresponding flag in the done field (1401). It also initializes the active pid field (1402). This initialization method will be described immediately below. After this, step 1301
Return to

【0137】ステップ 1305 で一周期分の実行を完了し
ていないと判定された場合には、ステップ 1309 におい
て、ステップ 1302 で得られたエントリの終了予定フラ
グ(917)を検査する。
If it is determined in step 1305 that the execution for one cycle has not been completed, in step 1309 the scheduled end flag (917) of the entry obtained in step 1302 is checked.

【0138】終了予定フラグ(917)が TRUE であれば、
ステップ 1307 で proc_raise(pid,TIME, PRIORITY_DEP
RESS | SEND_SIGNAL) を発行する。pid には、実行状態
記述テーブル(1400)の active pid フィールド(1402)に
格納されているプロセス識別子が使用される。TIME に
はエントリの時間フィールド(916)の値が使用される。
実行状態記述テーブル(1400)の active pid フィールド
(1402)は、現在、プロセスグループ(103)に属するどの
周期プロセス(102)が連続メディア処理を実行中である
かを示す。このステップの直後に、TIME で指定した時
間にわたり pid で指定した周期プロセス(102)がスケジ
ューリングされる。
If the end schedule flag (917) is TRUE,
In step 1307 proc_raise (pid, TIME, PRIORITY_DEP
RESS | SEND_SIGNAL) is issued. The process identifier stored in the active pid field (1402) of the execution state description table (1400) is used for pid. The value of the entry's time field (916) is used for TIME.
Active pid field of execution status description table (1400)
(1402) indicates which periodic process (102) belonging to the process group (103) is currently executing continuous media processing. Immediately following this step, the periodic process (102) specified by pid is scheduled for the time specified by TIME.

【0139】ステップ 1308 で該当エントリが初期化さ
れる。ステップ 1308 では、ステップ 1302 で選択され
たプロセスグループ(915)に対応する active pid フィ
ールド(1402)内のエントリが、そのプロセスグループ(9
15)のグループマスタのプロセス識別子に初期化され
る。また、proc_raise_handoff 関数が発行されると、
その処理ルーチン内で、ハンドオフ先のプロセス識別子
に active pid フィールド(1402)の該当エントリが更新
される。また proc_raise_cancel 関数が発行される
と、終了予定フラグ(917)が TRUE の場合、その処理ル
ーチン内で active pid フィールド(1402)の該当エント
リが初期化される。
At step 1308, the corresponding entry is initialized. In step 1308, the entry in the active pid field (1402) corresponding to the process group (915) selected in step 1302 has the process group (9
It is initialized to the process identifier of the group master in 15). Also, when the proc_raise_handoff function is issued,
In the processing routine, the corresponding entry in the active pid field (1402) is updated to the process identifier of the handoff destination. When the proc_raise_cancel function is issued, if the termination schedule flag (917) is TRUE, the corresponding entry of the active pid field (1402) is initialized in the processing routine.

【0140】ステップ 1309 で終了予定フラグ(917)が
FALSE であると判定されれば、ステップ 1310 において
、proc_raise(pid, TIME, PRIORITY_DEPRESS) を発行
し、処理を終了する。pid, TIME の設定方法はステップ
1307 の場合と同様である。やはり、このステップの直
後に、TIME で指定した時間にわたり pid で指定した周
期プロセス(102)がスケジューリングされる。
At step 1309, the end schedule flag (917) is set.
If it is determined to be FALSE, in step 1310, proc_raise (pid, TIME, PRIORITY_DEPRESS) is issued and the process ends. Steps for setting pid and TIME
Same as for 1307. Again, immediately after this step, the periodic process (102) specified by pid is scheduled for the time specified by TIME.

【0141】周期的なスケジューリングを要求している
プロセスグループ(103)に属する周期プロセス(102)群の
動作を図15から図17に示す。
The operation of the group of periodic processes (102) belonging to the process group (103) requesting periodic scheduling is shown in FIGS.

【0142】図15は、プロセスグループ(103)内に属
する周期プロセス(102)の起動順序を示す図である。
FIG. 15 is a diagram showing the starting order of the periodic processes (102) belonging to the process group (103).

【0143】プロセスグループ(103)に属する周期プロ
セス(102)は、その処理順が予め定められている。プロ
セスグループ(103)のグループマスタプロセス(1501)
は、周期駆動カーネルプロセス(101)の proc_raise 関
数により優先度が raised になり、起動する。プロセス
グループ(103)に属する各プロセス(102)は、proc_raise
_handoff 関数を用いて、次の順番の周期プロセス(102)
に優先度を継承する。継承後の自プロセス(102)の優先
度は depressed になる。最後の順番の周期プロセス(10
2)は、proc_raise_cancel 関数を用いて、一周期分の実
行を完了する。
The processing order of the periodic processes (102) belonging to the process group (103) is predetermined. Group master process (1501) of process group (103)
Starts up after the priority is raised by the proc_raise function of the periodical kernel process (101). Each process (102) belonging to the process group (103) has a proc_raise
Using the _handoff function, the next periodic process (102)
Inherit the priority to. After inheritance, the priority of the local process (102) becomes depressed. The last cycle process (10
In 2), the execution of one cycle is completed using the proc_raise_cancel function.

【0144】図16は、グループマスタプロセス(1501)
の動作を示すプログラムである。
FIG. 16 shows the group master process (1501).
Is a program showing the operation of.

【0145】1601 行目で、自プロセスをグループマス
タプロセス(1501)とするプロセスグループ(103)を生成
する。以後、このプロセスグループ(103)がスケジュー
リングの単位になる。
At line 1601, a process group (103) having its own process as a group master process (1501) is created. Thereafter, this process group (103) becomes a scheduling unit.

【0146】1602 行目で、1601 行目で生成したプロセ
スグループ(103)に、interval で指定される間隔で、le
ngth で指定される CPU 時間を割り当てることを要求す
る。この関数発行後、図15で示されるように、周期駆
動カーネルプロセス(101)からグループマスタプロセス
(1501)に対し proc_raise 関数が発行されるようにな
る。
On line 1602, the process group (103) created on line 1601 has the le specified at the interval specified by interval.
Requests to allocate the CPU time specified by ngth. After issuing this function, as shown in FIG. 15, from the periodical driving kernel process (101) to the group master process
The proc_raise function will be issued for (1501).

【0147】1603 行目から 1606 行目までが、連続メ
ディア処理を行なうループである。一周期分の連続メデ
ィア処理を行なった後、1605 行目で proc_raise_hando
ff関数を呼び出し、次に処理を行なうべき 1601 行目で
生成したプロセスグループ(103)に属するプロセス(102)
の優先度を raised にする。自プロセスの優先度はdepr
essed になる。
Lines 1603 to 1606 are a loop for performing continuous media processing. After performing one cycle of continuous media processing, proc_raise_hando at line 1605
Process (102) belonging to the process group (103) created in the 1601st line that should call the ff function and perform the next processing
Make the priority of raised. Own process priority is depr
Become essed.

【0148】連続メディア処理の実行ループを指定回数
実行すると、1607 行目で、1602 行目で発行した CPU
時間の割り当て要求を解除する。
When the execution loop of continuous media processing is executed a specified number of times, the CPU issued at line 1607 and the CPU issued at line 1602
Cancel the time allocation request.

【0149】さらに、1608 行目で、1601 行目で生成し
たプロセスグループ(103)を削除する。
Further, in the 1608th line, the process group (103) generated in the 1601st line is deleted.

【0150】図17は、スレーブプロセス(102)の動作
を示すプログラムである。
FIG. 17 is a program showing the operation of the slave process (102).

【0151】1702 行目から 1704 行目までが連続メデ
ィア処理を行なうループである。
Lines 1702 to 1704 are a loop for performing continuous media processing.

【0152】一周期分の連続メディア処理を行なった
後、1703 行目で proc_raise_handoff関数を呼び出し、
次に処理を行なうべき 1601 行目で生成したプロセスグ
ループ(103)に属する周期プロセス(102)の優先度を rai
sed にする。自プロセスの優先度は depressed にな
る。ただし、最後の順番の周期プロセス(102)は、1704
行目で proc_raise_cancel 関数を発行し、自プロセス
の優先度を depressed に変更する。連続メディア処理
の実行ループを指定回数実行すると、プログラムは終了
する。
After performing continuous media processing for one cycle, call the proc_raise_handoff function at line 1703,
The priority of the periodic process (102) belonging to the process group (103) created in the 1601st line to be processed next is rai
set to sed. The priority of our process is depressed. However, the last sequential cyclic process (102) is 1704
On the second line, issue the proc_raise_cancel function to change the priority of the own process to depressed. When the execution loop of continuous media processing is executed a specified number of times, the program ends.

【0153】一周期分の CPU の割り当て時間内に一周
期分の実行が完了しなかった場合には、実行状態記述テ
ーブル(1400)の active pid フィールド(1402)に登録さ
れているプロセス(102)に対しタイムアウトのシグナル
が送信される。かつ、実行状態記述テーブル(1400)の d
one フィールド(1401)内フラグに、IN_SIGNAL_TRANSACT
ION を示すフラグが立てられる。
When the execution for one cycle is not completed within the CPU allocation time for one cycle, the process (102) registered in the active pid field (1402) of the execution status description table (1400). A timeout signal is sent to. And d in the execution status description table (1400)
IN_SIGNAL_TRANSACT in the flag in the one field (1401)
A flag indicating ION is set.

【0154】このフラグが立っているプロセスグループ
(103)に関しては、ステップ 1305におけるプロセスグル
ープ(915)の実行終了判定が常に TRUE と判定される。
また、ステップ 1308 の done フィールド(1401)のクリ
アも行なわれない。すなわち、シグナルハンドラは、周
期プロセス(102)の基準優先度で、通常プロセス(109)と
同様にスケジューリングされ実行されることになる。こ
れにより、一つのストリームの処理遅延が他ストリーム
処理に影響を及ぼさないことを保証できる。
Process group for which this flag is set
Regarding (103), the execution end judgment of the process group (915) in step 1305 is always judged to be TRUE.
Also, the done field (1401) in step 1308 is not cleared. That is, the signal handler is scheduled and executed in the same manner as the normal process (109) with the reference priority of the cyclic process (102). This can ensure that the processing delay of one stream does not affect the processing of other streams.

【0155】第1の実施形態によれば、単一の周期駆動
カーネルプロセス(101)が CPU 割り当て順序記述テーブ
ル(900)に基づいてすべてのプロセスグループ(103)の周
期的スケジューリングをするので、複数のプロセスグル
ープ(103)の間で CPU 時間の競合が生じることによって
周期プロセス(102)の実行が遅延することはない。また
周期プロセス(102)の実行優先度を変更した後、プロセ
ス・ディスパッチに依存した周期プロセス(102)の起動を
行うので、プロセス間通信を介して周期プロセスを起動
する場合に比べて起床通知に伴うオーバヘッドがより小
さい。また指定した CPU 時間を使い果たし、タイムア
ウトとなつたプロセスのシグナルハンドラ処理は、その
プロセスの基準優先度で実行されるため、シグナルハン
ドラ処理によつて他のプロセスグループの実行遅延を引
き起こすことはない。
According to the first embodiment, since a single periodic driving kernel process (101) performs periodic scheduling of all process groups (103) based on the CPU allocation order description table (900), a plurality of There is no delay in the execution of the periodic process (102) due to the CPU time contention between the process groups (103). In addition, after changing the execution priority of the periodic process (102), the periodic process (102) is started depending on process dispatch, so the wake-up notification is issued compared to the case where the periodic process is started via interprocess communication. Less overhead involved. In addition, the signal handler processing of the process that has run out of the specified CPU time and has timed out is executed with the standard priority of the process, so the signal handler processing does not cause the execution delay of other process groups.

【0156】(2)第2の実施形態 第1の実施形態では、プロセスグループ(103)に割り当
てられた時間(916)又は最小 Interval ごとにタイマ割
り込みハンドラ(104)を実行するプロセスから周期駆動
カーネルプロセス(101)へプロセス・スイッチするので、
このときプロセス・スイッチのオーバヘッドが介入す
る。第2の実施形態は、周期駆動カーネルプロセス(10
1)の代わりにプロセスのスケジューリングを制御するモ
ジュール(以後、スケジューラと呼ぶ)を設けてタイマ
割り込みハンドラ(104)とスケジューラを同一プロセス
で実行することによつてタイマ割り込みハンドラ(104)
から周期駆動カーネルプロセス(101)へのプロセス・スイ
ッチのオーバヘッドを削減する。スケジューラを用いて
本発明を実現するシステムの構成を図18に示す。
(2) Second Embodiment In the first embodiment, from the process executing the timer interrupt handler (104) at every time (916) or the minimum Interval assigned to the process group (103), the cyclic drive kernel is executed. Process switch to process (101),
At this time, the process switch overhead intervenes. In the second embodiment, the cycle-driven kernel process (10
A timer interrupt handler (104) is provided by executing a timer interrupt handler (104) and a scheduler in the same process by providing a module (hereinafter referred to as a scheduler) for controlling process scheduling instead of 1).
To reduce the process switch overhead from to the Periodically Driven Kernel Process (101). FIG. 18 shows the configuration of a system that implements the present invention using a scheduler.

【0157】システムには、一つのスケジューラ(1801)
が存在する。スケジューラは、周期プロセスの優先度変
更、次にスケジューリングするプロセスの決定、及びそ
のプロセスのディスパッチ動作を行なう。スケジューラ
は、タイマ割り込みハンドラ(104)により周期的に呼び
出される。また、連続メディア処理を行なう周期プロセ
ス(102)が、処理順が次の周期プロセス(102)に優先度の
継承を行なう際、また、処理順が最後の周期プロセス(1
02)が、1周期分の実行を完了し、自プロセスの優先度
を変更する際にも、各関数の処理ルーチン内でスケジュ
ーラは呼び出される。これらのスケジューラ呼び出し方
法の詳細は後述する。
The system has one scheduler (1801)
Exists. The scheduler changes the priority of a periodic process, determines the process to be scheduled next, and dispatches the process. The scheduler is periodically called by the timer interrupt handler (104). When the periodic process (102) that performs continuous media processing inherits the priority to the next periodic process (102), the periodic process (1
When 02) completes execution for one cycle and changes the priority of its own process, the scheduler is called in the processing routine of each function. Details of these scheduler calling methods will be described later.

【0158】第1の実施形態と同様に、同一の連続メデ
ィア処理データを処理する周期プロセス(102)は、プロ
セスグループ(103)を形成する。プロセスグループ(103)
の生成、削除は、前述の create_proc _group、destroy
_proc_group 関数を用いて行なう。プロセスグループ(1
03)内で処理順の先頭の周期プロセス(102)は、外部入力
装置(105)から入力バッファ(106)を介して連続メディア
データを読み取り、データ加工を行なう。加工されたデ
ータは共有バッファ(110)を介して、処理順が次の周期
プロセス(102)に渡される。処理順が最後の周期プロセ
ス(102)は、出力バッファ(107)を介して外部出力装置(1
08)に出力する。
Similar to the first embodiment, the periodic process (102) for processing the same continuous media processing data forms the process group (103). Process Group (103)
To create or delete, create_proc _group, destroy
This is done using the _proc_group function. Process group (1
The cyclic process (102) at the head of the processing order in 03) reads continuous media data from the external input device (105) via the input buffer (106) and processes the data. The processed data is passed through the shared buffer (110) to the next periodic process (102) in the processing order. The cyclic process (102) with the last processing order is connected to the external output device (1) via the output buffer (107).
Output to 08).

【0159】プロセスグループ(103)は、スケジューリ
ングの単位となる。プロセスグループ(103)のグループ
マスタプロセスは、その初期化時において、前述の all
oc_time_slot 関数を用いて、指定周期ごとに指定時間
にわたりプロセスグループ(103)に対し CPU が割り当て
られることを予約する。また、CPU 時間の割り当てが不
要になった場合には、前述の dealloc_time_slot 関数
を呼び出し、その予約を解除する。
The process group (103) serves as a scheduling unit. When the group master process of the process group (103) is initialized,
Use the oc_time_slot function to reserve CPU allocation for the process group (103) every specified period for the specified time. When CPU time allocation becomes unnecessary, the dealloc_time_slot function is called to cancel the reservation.

【0160】alloc_time_slot 関数が呼び出されると、
スケジューラは、各プロセスグループが要求する周期と
1周期あたりの実行時間を満たすような CPU の割り当
て順序を決定し、CPU 割り当て順序記述テーブル(900)
を作成する。この作成アルゴリズムは第1の実施形態で
述べた通りである。
When the alloc_time_slot function is called,
The scheduler determines the CPU allocation order that satisfies the cycle required by each process group and the execution time per cycle, and the CPU allocation order description table (900)
Create This creation algorithm is as described in the first embodiment.

【0161】スケジューラ(1801)は、CPU 割り当て順序
記述テーブル(900)に基づいて各周期プロセス(102)のス
ケジューリングを行なう。プロセスグループ(103)に対
してCPU を割り当てるべき時間が到達すると、スケジュ
ーラ(1801)はそのプロセスグループ(103)のグループマ
スタプロセスの優先度を raised にする(前述の proc_
raise 関数を呼び出す)。グループマスタプロセスの優
先度が raised になってから指定時間経過すると、タイ
マ割り込みハンドラ(104)から呼び出されたスケジュー
ラ(1801)は、プロセスグループ(103)に属する周期プロ
セス(102)のうち優先度が raised である周期プロセス
(102)の優先度を depressed にする。このタイマ割り込
みハンドラ(104)からのスケジューラの呼び出し方法、
スケジューラの動作の詳細は後述する。これにより、プ
ロセスグループ(103)に CPU が割り当てられるべき時間
は、優先度が raised であるプロセスグループ(103)に
属する周期プロセス(102)が実行可能状態にある限り、
プロセスグループ(103)に属さないユーザプロセスがス
ケジューリングされることはない。また、CPU が割り当
てられるべきでない時間は、プロセスグループ(103)に
属する周期プロセス(102)がスケジューリングされるこ
とはない。いずれのプロセスグループ(103)にも割り当
てられない CPU 時間は、通常プロセス(109)又はアイド
ルプロセスに割り当てられる。
The scheduler (1801) schedules each periodic process (102) based on the CPU allocation order description table (900). When the time to allocate CPU for the process group (103) has been reached, the scheduler (1801) sets the priority of the group master process of that process group (103) to raised (proc_
call the raise function). When the specified time has passed since the priority of the group master process was raised, the scheduler (1801) called from the timer interrupt handler (104) determines that the priority of the periodic processes (102) belonging to the process group (103) is higher. a periodic process that is raised
Set the priority of (102) to depressed. How to call the scheduler from this timer interrupt handler (104),
Details of the operation of the scheduler will be described later. As a result, the time that CPU should be allocated to the process group (103) is as long as the periodic process (102) belonging to the process group (103) with the priority raised is in the executable state.
User processes that do not belong to the process group (103) are not scheduled. Further, during the time when the CPU should not be allocated, the periodic process (102) belonging to the process group (103) is not scheduled. CPU time that is not allocated to any process group (103) is allocated to the normal process (109) or idle process.

【0162】上記で述べたように、スケジューラ(1801)
は、タイマ割り込みハンドラ(104)または、自プロセス
もしくは他プロセスの優先度変更を要求する周期プロセ
ス(102)から呼ばれ得る。スケジューラを呼び出すとき
に用いるコマンドリストの形式を図19に示す。
As mentioned above, the scheduler (1801)
Can be called from the timer interrupt handler (104) or the periodic process (102) requesting the priority change of its own process or another process. The format of the command list used to call the scheduler is shown in FIG.

【0163】スケジューラ(1801)を呼び出すタイマ割り
込みハンドラ(104)、周期プロセス(102)は、その呼び出
し関数の引数として図19で示されるコマンドリストの
先頭エントリへのポインタ(1901)を指定する。コマンド
リストは、スケジューラの動作の指示をリスト形式で示
したものである。コマンドリストの各エントリは、next
_command フィールド(1902)、flag フィールド(1903)、
pid フィールド(1904)からなる。next_command フィー
ルド(1902)は、次のエントリへのポインタが格納され
る。リストの最後尾のエントリの next_command フィー
ルドの値は nilである。flag フィールドには、HANDOF
F、CANCEL、INTERVAL、TIMER が指定可能である。ま
た、pid フィールドは、flag フィールドが HANDOFF の
ときのみ意味を持つ。
The timer interrupt handler (104) and the cyclic process (102) that call the scheduler (1801) specify the pointer (1901) to the head entry of the command list shown in FIG. 19 as an argument of the calling function. The command list is a list of operation instructions of the scheduler. Each entry in the command list is next
_command field (1902), flag field (1903),
It consists of a pid field (1904). The next_command field (1902) stores a pointer to the next entry. The value of the next_command field of the last entry in the list is nil. HANDOF in the flag field
F, CANCEL, INTERVAL and TIMER can be specified. Also, the pid field is meaningful only when the flag field is HANDOFF.

【0164】タイマ割り込みハンドラ(104)は、その駆
動のたびに flag に TIMER を格納したエントリからな
るコマンドリストをスケジューラ(1801)に渡す。また、
CPU の割り当てを要求しているプロセスグループ(103)
の最小 Interval ごとに、上記エントリの他に、flag
に INTERVAL を格納したエントリをもスケジューラに渡
す。従ってタイマ割り込みハンドラ(104)は前述の kpro
c_timer によって最小 Interval を判定する必要があ
る。
Each time the timer interrupt handler (104) is driven, it passes to the scheduler (1801) a command list consisting of entries in which TIMER is stored in flag. Also,
Process group requesting CPU allocation (103)
In addition to the above entries, flag every minimum Interval of
The entry that stores INTERVAL in is also passed to the scheduler. Therefore, the timer interrupt handler (104) is
It is necessary to judge the minimum Interval by c_timer.

【0165】周期プロセス(102)が、処理順が次の周期
プロセス(102)に優先度を継承する場合、flags に HAND
OFF を、pid に処理順が次の周期プロセス(102)の識別
子を格納したエントリからなるコマンドリストをスケジ
ューラに渡す。
When the periodic process (102) inherits the priority to the next periodic process (102) in the processing order, HAND is set in flags.
OFF is passed to the scheduler as a command list consisting of entries in which the identifier of the periodic process (102) whose processing order is next is stored in pid.

【0166】また、処理順が最後の周期プロセス(102)
が一周期分の実行を完了し、自プロセスの優先度を dep
ressed に変更する場合は、flags に CANCEL を格納し
たエントリからなるコマンドリストをスケジューラに渡
す。
Further, the cyclic process (102) is the last in the processing order.
Completes one cycle of execution and dep
When changing to ressed, pass the command list consisting of the entries in which CANCEL is stored in flags to the scheduler.

【0167】最後に、上記コマンドリストを受け取り駆
動するスケジューラの動作フローを図20を用いて説明
する。
Finally, the operation flow of the scheduler that receives and drives the command list will be described with reference to FIG.

【0168】ステップ2001において、スケジューラは、
渡されたコマンドリストの先頭エントリの flag フィー
ルドを検索する。flag フィールドが HANDOFF であれば
ステップ2002に、flag フィールドが CANCEL であれば
ステップ2003に、ジャンプする。flag フィールドが IN
TERVAL であればステップ1215を実行後、ステップ2006
にジャンプする。flag フィールドが TIMER であればス
テップ1201〜1212を実行した後、ステップ1204で PCB -
> counter が0と判定されたプロセス、すなわちプロセ
スグループ(915)に割り当てられた CPU の時間(916)が
経過したプロセスであり、かつ next_command フィール
ドによって指される flag フィールドがINTERVAL でな
ければステップ2015にジャンプする。この条件を満足し
ない場合にはステップ2012にジャンプする。
In step 2001, the scheduler
Search the flag field of the first entry in the passed command list. If the flag field is HANDOFF, jump to step 2002, and if the flag field is CANCEL, jump to step 2003. flag field is IN
If it is TERVAL, after executing step 1215, step 2006
Jump to. If the flag field is TIMER, perform steps 1201-1212, then step 1204 PCB-
> If the counter has been determined to be 0, that is, the process has passed the CPU time (916) allocated to the process group (915) and the flag field pointed to by the next_command field is not INTERVAL, go to step 2015. To jump. If this condition is not met, jump to step 2012.

【0169】ステップ2015において、スケジューラ起動
直前に CPU 時間が割り当てられていたプロセスグルー
プ( CPU 割り当て順序記述テーブル(900)の Index(91
4)で指されるエントリ)の終了予定フラグ(917)を検索
する。終了予定フラグ(917)がON であれば、第1の実施
形態で述べたタイムアウトのシグナル送信処理を行い、
ステップ2006にジャンプする。終了予定フラグ(917)が
OFF であれば直接ステップ2006にジャンプする。
In step 2015, the process group to which the CPU time has been allocated immediately before the scheduler is started (Index (91) in the CPU allocation order description table (900)
Search the end scheduled flag (917) of the entry pointed to in 4). If the termination flag (917) is ON, the timeout signal transmission processing described in the first embodiment is performed,
Jump to step 2006. Expected end flag (917)
If OFF, jump directly to step 2006.

【0170】ステップ2002において、優先度の継承元と
なる周期プロセス(1202)及び継承先となる周期プロセス
(1202)の優先度、プロセス制御ブロック(1002)内のカウ
ンタフィールド(1005)、フラグフィールド(1006)を更新
する。この更新方法は、図11で示したフローチャート
と同様になるので省略する。そして、ステップ2012にジ
ャンプする。
In step 2002, the periodic process (1202) from which the priority is inherited and the periodic process from which the priority is inherited
The priority of (1202), the counter field (1005) and the flag field (1006) in the process control block (1002) are updated. This updating method is the same as the flowchart shown in FIG. Then jump to step 2012.

【0171】ステップ2003において、スケジューラ起動
直前に CPU 時間が割り当てられていたプロセスグルー
プ(CPU 割り当て順序記述テーブル(900)の Index(914)
で指されるエントリ)の終了予定フラグ(917)を検索す
る。終了予定フラグ(917)が ON であればステップ2005
に、OFF であればステップ2004にジャンプする。
In step 2003, the process group to which the CPU time was allocated immediately before the scheduler was activated (Index (914) in the CPU allocation order description table (900)
Search for the end scheduled flag (917) of the entry pointed to by. If the end scheduled flag (917) is ON, step 2005
If it is OFF, jump to step 2004.

【0172】ステップ2004において、実行状態記述テー
ブル(1400)の該当エントリの doneフィールド(1401)を
セットしてステップ2006にジャンプする。
At step 2004, the done field (1401) of the corresponding entry of the execution state description table (1400) is set and the process jumps to step 2006.

【0173】ステップ2005は、ステップ1308と同じ動作
を行ない、ステップ2006にジャンプする。
Step 2005 performs the same operation as step 1308, and jumps to step 2006.

【0174】ステップ2006は、ステップ1301〜1302と同
じ動作を行ない、ステップ2007にジャンプする。
At step 2006, the same operation as that at steps 1301 to 1302 is performed, and the process jumps to step 2007.

【0175】ステップ2007において、ステップ2006で得
られたエントリのプロセスグループ(915)のフィールド
が OTHERS であるか否かの検査を行なう。OTHERS であ
ったらステップ2012に、それ以外であったらステップ20
08にジャンプする。
In step 2007, it is checked whether or not the field of the process group (915) of the entry obtained in step 2006 is OTHERS. If it is OTHERS, go to step 2012. If not, go to step 20.
Jump to 08.

【0176】ステップ2008において、ステップ2006でイ
ンクリメントされた Index(914)で指されるエントリの
終了予定フラグ(917)、及び、そのエントリに対応する
実行状態記述テーブル(1400)の done フィールド(1401)
を検索する。両ビットが共にセットされていたらステッ
プ2009に、done フィールドのみセットされていたらス
テップ2006に、終了予定フラグのみセットされていれば
ステップ2010に、共にクリアされていたらステップ2011
にジャンプする。
In step 2008, the end scheduled flag (917) of the entry pointed to by Index (914) incremented in step 2006, and the done field (1401) of the execution state description table (1400) corresponding to that entry
Search for. If both bits are set together, it goes to step 2009. If only the done field is set, it goes to step 2006. If only the end schedule flag is set, it goes to step 2010. If both bits are cleared, it goes to step 2011.
Jump to.

【0177】ステップ2009は、ステップ1308と同じ動作
を行ない、ステップ2006にジャンプする。
Step 2009 performs the same operation as step 1308, and jumps to step 2006.

【0178】ステップ2010は、Index(914)で指されるエ
ントリに登録されているプロセスグループ(103)のグル
ープマスタプロセス(1501)である周期プロセス(102)
を、エントリの時間(916)のフィールドで指定された時
間にわたり優先度を raised に変更し、かつ、その時間
の経過後にシグナルを送信すべく、プロセスの優先度、
及び対応するプロセス制御ブロック(1002)のカウンタフ
ィールド(1005)、フラグフィールド(1006)の更新を行な
う。この更新方法は、図11で示したフローチャートと
同様になるので省略する。その後ステップ2012にジャン
プする。
Step 2010 is the periodic process (102) which is the group master process (1501) of the process group (103) registered in the entry pointed to by Index (914).
To change the priority to raised for the time specified in the entry's time (916) field, and to send a signal after that time, the process priority,
Also, the counter field (1005) and the flag field (1006) of the corresponding process control block (1002) are updated. This updating method is the same as the flowchart shown in FIG. Then jump to step 2012.

【0179】ステップ2011は、Index(914)で指されるエ
ントリに登録されているプロセスグループ(103)のグル
ープマスタ(1501)である周期プロセス(102)を、エント
リの時間フィールド(916)で指定された時間にわたり優
先度を raised に変更し、かつ、その時間の経過後にシ
グナルを送信しないように、プロセスの優先度、対応す
るプロセス制御ブロック(1002)のカウンタフィールド(1
005)、フラグフィールド(1006)の更新を行なう。この更
新方法は、図11で示したフローチャートと同様になる
ので省略する。その後ステップ2012にジャンプする。
In step 2011, the periodic process (102) which is the group master (1501) of the process group (103) registered in the entry pointed to by Index (914) is designated by the time field (916) of the entry. The priority of the process, the counter field (1) of the corresponding process control block (1002) so that the priority is raised to raised for a specified time and no signal is sent after that time.
005) and the flag field (1006) are updated. This updating method is the same as the flowchart shown in FIG. Then jump to step 2012.

【0180】ステップ2012では、ステップ2001から2011
で処理したエントリの next_command フィールドを検索
する。その値が nil でなければステップ2001に戻る。n
ilであれば、ステップ1105から1107を実行後終了する。
In step 2012, steps 2001 to 2011
Search the next_command field of the entry processed in. If the value is not nil, the process returns to step 2001. n
If it is il, steps 1105 to 1107 are executed and the process ends.

【0181】(3)第3の実施形態 第1の実施形態又は第2の実施形態の周期プロセスのス
ケジューリング方法に従ってシステムが動作中にネット
ワーク・パケットの到達などの非同期イベントが多発す
ると、周期プロセス(102)の実行が阻害され、周期プロ
セス(102)の駆動周期間隔のゆらぎが大きくなる。すな
わちネットワーク・パケットの受信処理などの非同期イ
ベント処理は、ある程度の応答性能が求められるため、
非同期イベント処理を優先し、その処理を行なうプロセ
スの優先度を周期プロセス(102)より高くすると、周期
プロセス(102)の実行時間に遅れが生じ得る。第3の実
施形態は、この問題を解決するために、ネットワーク・
パケットの受信処理を行う割り込みハンドラを階層化す
るものである。第1の実施形態又は第2の実施形態のタ
イマ割り込みハンドラ(104)、周期駆動カーネルプロセ
ス(101)、スケジューラ(1801)及びプロセスグループ(10
3)には変更がなく、第3の実施形態は第1の実施形態又
は第2の実施形態を補強する形で実施される。以下非同
期割り込みハンドラとしてネットワーク・パケットの受
信処理を行なう割り込みハンドラを例にとってこの割り
込みハンドラの構成、及びその動作方法を説明する。
(3) Third Embodiment When an asynchronous event such as arrival of a network packet occurs frequently while the system is operating according to the periodic process scheduling method of the first or second embodiment, the periodic process ( The execution of 102) is hindered, and the fluctuation of the driving cycle interval of the periodic process (102) becomes large. In other words, asynchronous event processing such as network packet reception processing requires a certain level of response performance.
If priority is given to asynchronous event processing and the priority of the process performing the processing is set higher than that of the periodic process (102), the execution time of the periodic process (102) may be delayed. In the third embodiment, in order to solve this problem, a network
An interrupt handler for receiving packets is layered. The timer interrupt handler (104), the cycle driven kernel process (101), the scheduler (1801) and the process group (10) of the first or second embodiment.
There is no change in 3), and the third embodiment is implemented in a form that reinforces the first embodiment or the second embodiment. The configuration of this interrupt handler and its operating method will be described below by taking an interrupt handler for receiving a network packet as an asynchronous interrupt handler as an example.

【0182】図21に、本割り込みハンドラを中心とす
るシステムの構成、及び割り込みハンドラの構成を示
す。タイマ割り込みハンドラ(104)、周期駆動カーネル
プロセス(101)、スケジューラ(1801)等は図示を省略す
る。
FIG. 21 shows the configuration of the system centering on this interrupt handler and the configuration of the interrupt handler. Illustration of the timer interrupt handler (104), the cycle-driven kernel process (101), the scheduler (1801), etc. is omitted.

【0183】本システムは、ハードウェアとして CPU(2
101)と、Ether ボード(2102)を有する。Etherボード(21
02)は、パケットを受信した際に、そのパケット到達をC
PU(2101)に通知し、パケット受信処理を行なうルーチン
(割り込みハンドラ)をCPU(2101)上で駆動する機能を
備える。また、CPU(2101)上には、パケット受信によっ
て駆動される第1レベル割り込みハンドラ(2103)の他
に、第2レベル割り込みハンドラ(2104)、アプリケーシ
ョン・プログラム(2105)が設けられる。第2レベル割り
込みハンドラ(2104)は、周期プロセス(102)の一つとし
て、前述したスケジューリング方法に従って周期駆動カ
ーネルプロセス(101)又はスケジューラ(1801)により周
期的に駆動される。アプリケーション・プログラム(210
5)は、受信したパケットを処理する業務プログラムであ
り、周期プロセス(102)又は通常プロセス(109)によって
走行する。
In this system, the CPU (2
101) and an Ether board (2102). Ether board (21
02), when receiving a packet, C
It has a function of notifying the PU (2101) and driving a routine (interrupt handler) for performing packet reception processing on the CPU (2101). In addition to the first level interrupt handler (2103) driven by packet reception, a second level interrupt handler (2104) and an application program (2105) are provided on the CPU (2101). The second level interrupt handler (2104) is, as one of the periodic processes (102), periodically driven by the periodic driving kernel process (101) or the scheduler (1801) according to the scheduling method described above. Application Program (210
5) is a business program that processes the received packet, and runs by the periodic process (102) or the normal process (109).

【0184】第1レベル割り込みハンドラ(2103)の動作
フローを図22に示す。
FIG. 22 shows an operation flow of the first level interrupt handler (2103).

【0185】先に述べたように、第1レベル割り込みハ
ンドラ(2103)は、Etherボード(2102)のパケット到達通
知を契機に駆動される。そしてまずステップ2201で、受
信したパケットをパケットキュー(2106)にエンキューす
る。ステップ2202で、空きバッファ群(2108)の中から受
信バッファを一つ確保する。ステップ2203で、ステップ
2202で確保した受信バッファに対するパケット受信を要
求するコマンドをEtherボード(2102)に対し発行する。
すなわち第1レベル割り込みハンドラ(2103)は、受信バ
ッファを確保してパケットを受信する準備を行うだけで
あり、受信バッファ内の情報を参照するような処理を一
切しない。Ether ボード(2102)は、パケット到達を通知
してから、ステップ2203が実行されるまでの間に到達し
たパケットを受信することができない。なぜなら、第1
割り込みハンドラ(2103)から、受信パケットを格納すべ
き受信バッファのアドレスを指定されていないためであ
る。従ってその間にパケットが到達しても、Etherボー
ド(2102)はパケット受信に失敗し、そのパケットは喪失
されるが、その時間は最小限に抑えられる。
As described above, the first level interrupt handler (2103) is driven by the packet arrival notification of the Ether board (2102). First, in step 2201, the received packet is enqueued in the packet queue (2106). In step 2202, one reception buffer is secured from the empty buffer group (2108). Step 2203, Step
A command requesting packet reception for the reception buffer secured in 2202 is issued to the Ether board (2102).
That is, the first level interrupt handler (2103) only secures the reception buffer and prepares to receive the packet, and does not perform any processing that refers to the information in the reception buffer. The Ether board (2102) cannot receive the packet that arrives between the notification of arrival of the packet and the execution of step 2203. Because the first
This is because the interrupt handler (2103) has not specified the address of the reception buffer in which the reception packet should be stored. Therefore, even if a packet arrives in the meantime, the Ether board (2102) fails to receive the packet and the packet is lost, but the time is minimized.

【0186】第2レベル割り込みハンドラ(2104)は、指
定した周期で周期駆動される。そして、第1レベル割り
込みハンドラ(2103)によりエンキューされたパケットキ
ュー(2106)に繋がれたパケットをデキューし、デキュー
したパケットを参照してプロトコル処理を行なう。そし
て、このプロトコル処理の結果、アプリケーション・プ
ログラム(2105)に渡すべき受信データが得られたなら
ば、受信データキュー(2107)にその受信データをエンキ
ューする。従って第2レベル割り込みハンドラ(2104)
は、単にあるプロセスグループ(103)に属する周期プロ
セス(102)の一つとして、スケジューリングされる。
The second level interrupt handler (2104) is cyclically driven at the specified cycle. Then, the packet connected to the packet queue (2106) enqueued by the first level interrupt handler (2103) is dequeued, and the protocol processing is performed by referring to the dequeued packet. Then, as a result of the protocol processing, if the received data to be passed to the application program (2105) is obtained, the received data is enqueued in the received data queue (2107). Therefore, the second level interrupt handler (2104)
Is scheduled as only one of the periodic processes (102) belonging to a certain process group (103).

【0187】アプリケーション・プログラム(2105)は、
受信データキュー(2107)にエンキューされた受信データ
のデキューと、受信データが格納されている受信バッフ
ァの解放処理を行なう。
The application program (2105) is
Dequeuing the reception data enqueued in the reception data queue (2107) and releasing the reception buffer storing the reception data are performed.

【0188】周期プロセス(102)実行中にパケットが到
達した場合、周期プロセス(102)の実行は停止され、第
1割り込みハンドラ(2103)の実行が開始される。第1割
り込みハンドラ(2103)の実行を最優先で行なうことによ
り、Etherボード(2102)のパケット受信失敗によるパケ
ット喪失の発生を防いでいる。すなわち第1の実施形態
又は第2の実施形態に第3の実施形態を適用することに
よって、従来のように第1レベル割り込みハンドラ(210
3)と第2レベル割り込みハンドラ(2104)を1つのパケッ
ト受信割り込みハンドラで処理する場合に比べて、パケ
ット喪失の確率を小さくするとともに、周期プロセス(1
02)の実行遅れを少なくし、この両者の利点を両立させ
るものである。
When a packet arrives during the execution of the cyclic process (102), the execution of the cyclic process (102) is stopped and the execution of the first interrupt handler (2103) is started. By executing the first interrupt handler (2103) with the highest priority, the occurrence of packet loss due to the packet reception failure of the Ether board (2102) is prevented. That is, by applying the third embodiment to the first embodiment or the second embodiment, the first level interrupt handler (210
3) and the second level interrupt handler (2104) are processed by one packet reception interrupt handler, the probability of packet loss is reduced and the periodic process (1
The execution delay of 02) is reduced, and the advantages of both are compatible.

【0189】第2レベル割り込みハンドラ(2104)は、周
期プロセス(102)としてスケジューリングされるため、
自プロセスに CPU(2101)が割り当てられる時刻になるま
では、パケットキュー(2106)にパケットがキューイング
されていても、その実行を開始することはない。そのた
め、第1割り込みハンドラ(2103)の実行が完了したら直
ちに周期プロセス(102)の実行は再開される。このよう
に割り込みハンドラを階層化することにより、パケット
到達に伴う周期プロセス(102)の実行停止時間を、第1
レベル割り込みハンドラ(2103)の実行時間のみに抑える
ことが可能になっている。
Since the second level interrupt handler (2104) is scheduled as the periodic process (102),
Until the time when the CPU (2101) is assigned to the own process, even if the packet is queued in the packet queue (2106), the execution is not started. Therefore, the execution of the periodic process (102) is resumed immediately after the execution of the first interrupt handler (2103) is completed. By layering the interrupt handlers in this way, the execution stop time of the periodic process (102) accompanying the arrival of a packet can be
It is possible to limit the execution time of the level interrupt handler (2103).

【0190】また、第2レベル割り込みハンドラ(2104)
は周期駆動が保証されている。そのため、パケットが到
達してからその駆動周期に相当する時間が経過する間
に、必ず1回は第2レベル割り込みハンドラ(2104)が駆
動される。すなわち、パケット到達から受信データキュ
ー(2107)へのエンキューまでに要する時間の上限も第2
レベル割り込みハンドラ(2104)の駆動周期となり、ネッ
トワーク・パケットの受信処理の応答性能の保証も可能
となる。
A second level interrupt handler (2104)
Is guaranteed to be cycled. Therefore, the second-level interrupt handler (2104) is driven once at least once during the time corresponding to the driving cycle after the packet arrives. That is, the upper limit of the time required from the arrival of a packet to the enqueuing of the reception data queue (2107) is also the second
It becomes the driving cycle of the level interrupt handler (2104), and the response performance of the network packet reception processing can be guaranteed.

【0191】[0191]

【発明の効果】本発明のスケジューリング方法は、複数
の周期的な CPU の割り当て要求を同時に満たす CPU 時
間の割り当てアルゴリズムを提供する。このアルゴリズ
ムを用いた、一周期分の連続メディア処理の実行開始間
隔の変動は、周期駆動カーネルプロセスの駆動間隔より
短くなることが保証される。かつ、要求周期の短いプロ
セス、すなわち実行開始間隔の変動の絶対値を小さく抑
えねばならないプロセスほど周期駆動カーネルプロセス
の駆動後すぐに CPU 時間が割り当てられる。そのた
め、周期の短いプロセスほど、実行開始間隔の変動を小
さく抑えることが可能になる。
The scheduling method of the present invention provides a CPU time allocation algorithm that simultaneously satisfies a plurality of periodic CPU allocation requests. It is guaranteed that the fluctuation of the execution start interval of continuous media processing for one cycle using this algorithm will be shorter than the driving interval of the cyclically driven kernel process. In addition, a process with a short request cycle, that is, a process in which the absolute value of the fluctuation of the execution start interval must be kept small, is assigned CPU time immediately after the driving of the cycle-driven kernel process. Therefore, it becomes possible to suppress the variation in the execution start interval to be smaller as the process has a shorter cycle.

【0192】連続メディアデータの到達レートが一定で
ある場合、入力バッファの切り替えなどの入力バッファ
管理は周期的に行なえば良い。そのため、周期的なプロ
セスのスケジューリングが保証できれば、連続メディア
処理を行なうプロセスが自発的に入力バッファを切り替
えれば良く、入力連続メディアデータ到達の割り込みに
よる通知を必要としなくなる。割り込みオーバーヘッド
削減による連続メディア処理の性能向上が期待できる。
When the arrival rate of continuous media data is constant, input buffer management such as input buffer switching may be performed periodically. Therefore, if periodic process scheduling can be assured, a process that performs continuous media processing may spontaneously switch input buffers, and notification of arrival of input continuous media data is not required. It can be expected to improve the performance of continuous media processing by reducing the interrupt overhead.

【0193】また、本発明のスケジューリング方法で
は、連続メディア処理を行なう各プロセスの起床、休眠
は優先度の変更により実現している。従来の IPC を用
いた方式よりも、起床、休眠に要するオーバーヘッドが
削減できる。この点からも連続メディア処理の性能向上
が期待できる。
Further, in the scheduling method of the present invention, wake-up and sleep of each process for performing continuous media processing are realized by changing the priority. The overhead required to wake up and sleep can be reduced compared to the conventional method using IPC. From this point as well, improvement in performance of continuous media processing can be expected.

【0194】さらに、本発明のスケジューリング方法で
は、一つのプロセスグループにデッドラインミスが発生
し、対象プロセスにシグナルが配送された場合、シグナ
ルハンドラの優先度は、連続メディア処理を行なうプロ
セスよりも低優先度であることが保証される。そのた
め、一つのストリームの処理遅延が他ストリーム処理に
影響を及ぼさないことを保証できる。
Furthermore, according to the scheduling method of the present invention, when a deadline miss occurs in one process group and a signal is delivered to the target process, the priority of the signal handler is lower than that of the process which performs continuous media processing. Guaranteed to be a priority. Therefore, it can be guaranteed that the processing delay of one stream does not affect the processing of other streams.

【0195】さらに、本発明の CPU 割り当てアルゴリ
ズムでは、各プロセスグループに割り当てられる時間を
できるだけ連続にとる。そのため、プロセススイッチ回
数が最小限に押さえられる。プロセススイッチに要する
オーバーヘッド削減による連続メディア処理の性能向上
も期待できる。
Further, in the CPU allocation algorithm of the present invention, the time allocated to each process group is set as continuous as possible. Therefore, the number of process switches can be minimized. It is expected that the performance of continuous media processing will be improved by reducing the overhead required for process switching.

【0196】さらに、本発明の CPU 割り当てアルゴリ
ズムでは、各プロセスグループ間の実行時間比は常に一
定に保たれる。そのため、ランデブなどの同期機構を使
用しなくとも、ストリーム間同期の実現が可能になる。
Further, in the CPU allocation algorithm of the present invention, the execution time ratio between process groups is always kept constant. Therefore, synchronization between streams can be realized without using a synchronization mechanism such as rendezvous.

【0197】さらに本発明は、非同期イベントが発生し
た際の連続メデイア処理を行うプロセスの実行間隔の変
動を防止できる。
Further, according to the present invention, it is possible to prevent the variation of the execution interval of the process for performing continuous media processing when an asynchronous event occurs.

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

【図1】本発明のスケジューリング方法におけるプロセ
ス起動及びデータの流れを示す図である。
FIG. 1 is a diagram showing a process activation and a data flow in a scheduling method of the present invention.

【図2】プロセスグループを管理するデータの構造を示
す図である。
FIG. 2 is a diagram showing a structure of data for managing a process group.

【図3】create_proc_group 関数のフローチャートであ
る。
FIG. 3 is a flowchart of a create_proc_group function.

【図4】destroy_proc_group 関数のフローチャートで
ある。
FIG. 4 is a flowchart of a destroy_proc_group function.

【図5】プロセスグループに割り当てる CPU 時間の重
なりを解消する方法を示す図である。
FIG. 5 is a diagram showing a method for eliminating the overlap of CPU times assigned to process groups.

【図6】タイムスロットテーブル作成のフローチャート
である。
FIG. 6 is a flowchart for creating a time slot table.

【図7】タイムスロットテーブルの作成例の結果を示す
図である。
FIG. 7 is a diagram showing a result of an example of creating a time slot table.

【図8】タイムスロットテーブルの作成例のための入力
データを示す図である。
FIG. 8 is a diagram showing input data for an example of creating a time slot table.

【図9】CPU 割り当て順序記述テーブルの構成を示す図
である。
FIG. 9 is a diagram showing a configuration of a CPU allocation order description table.

【図10】プロセスを管理するデータの構造を示す図で
ある。
FIG. 10 is a diagram showing a structure of data for managing a process.

【図11】proc_raise 関数のフローチャートである。FIG. 11 is a flowchart of the proc_raise function.

【図12】タイマ割り込みハンドラのフローチャートで
ある。
FIG. 12 is a flowchart of a timer interrupt handler.

【図13】周期駆動カーネルプロセスのフローチャート
である。
FIG. 13 is a flow chart of a period driven kernel process.

【図14】実行状態記述テーブルの構成を示す図であ
る。
FIG. 14 is a diagram showing a configuration of an execution state description table.

【図15】連続メディア処理プロセスの起動の流れを示
す図である。
FIG. 15 is a diagram showing a flow of activation of a continuous media processing process.

【図16】グループマスタプロセスのプログラムを示す
図である。
FIG. 16 is a diagram showing a program of a group master process.

【図17】スレーブプロセスのプログラムを示す図であ
る。
FIG. 17 is a diagram showing a program of a slave process.

【図18】本発明のスケジューリング方法におけるプロ
セス起動及びデータの流れを示す図である。
FIG. 18 is a diagram showing process activation and data flow in the scheduling method of the present invention.

【図19】コマンドリストの構成を示す図である。FIG. 19 is a diagram showing the structure of a command list.

【図20】スケジューラのフローチャートである。FIG. 20 is a flowchart of a scheduler.

【図21】ネットワーク・パケット受信システムの構成
を示す図である。
FIG. 21 is a diagram showing a configuration of a network packet reception system.

【図22】第1レベル割り込みハンドラのフローチャー
トである。
FIG. 22 is a flowchart of a first level interrupt handler.

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

101:周期駆動カーネルプロセス、102:周期プロ
セス、103:プロセスグループ、700:タイムスロ
ットテーブル、900:CPU 割り当て順序記述テーブ
ル、1400:実行状態記述テーブル、1801:スケ
ジューラ、
101: Cyclic drive kernel process, 102: Cyclic process, 103: Process group, 700: Time slot table, 900: CPU allocation order description table, 1400: Execution state description table, 1801: Scheduler,

───────────────────────────────────────────────────── フロントページの続き (72)発明者 岩嵜 正明 神奈川県川崎市麻生区王禅寺1099番地 株 式会社日立製作所システム開発研究所内 ─────────────────────────────────────────────────── ─── Continuation of the front page (72) Inventor Masaaki Iwasaki 1099, Ozenji, Aso-ku, Kawasaki-shi, Kanagawa Ltd. System Development Laboratory, Hitachi, Ltd.

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】周期的に実行される少なくとも1つのプロ
セスを含むプロセスグループが複数存在し、これら複数
のプロセスグループを並行実行させる計算機システムの
周期的プロセススケジューリング方法において、 各プロセスグループごとに起動間隔周期と一周期ごとの
必要CPU時間が指定されたとき、指定されたプロセス
グループのCPU割り当て時間が他のプロセスグループ
のCPU割り当て時間と衝突しないように確保し、かつ
指定された各プロセスグループの起動間隔周期を保つよ
うに調整することを特徴とする周期的プロセススケジュ
ーリング方法。
1. A periodic process scheduling method for a computer system in which there are a plurality of process groups including at least one process that is periodically executed, and in which a plurality of process groups are executed in parallel, an activation interval for each process group. When a cycle and the required CPU time for each cycle are specified, ensure that the CPU allocation time of the specified process group does not conflict with the CPU allocation time of other process groups, and start each specified process group. A periodic process scheduling method characterized by adjusting so as to maintain an interval period.
【請求項2】請求項1記載の周期的プロセススケジュー
リング方法において、 タイムスロットを単位としてCPU時間を割り当てるプ
ロセスグループの順番を登録するテーブルを作成するス
テップと、 起動間隔周期が短いプロセスグループから順にタイムス
ロットを割り当てるようにプロセスグループを選択する
ステップと、 選択したプロセスグループの起動間隔周期の範囲で連続
して空いているタイムスロットである連続空きスロット
を抽出するステップと、 必要CPU時間以上のサイズをもつ連続空きスロット群
が存在するならば、必要CPU時間以上で最小のサイズ
をもつ連続空きスロットの先頭から必要CPU時間だけ
の連続する空きタイムスロットを選択したプロセスグル
ープに割り当てるステップと、 必要CPU時間以上のサイズをもつ連続空きスロット群
が存在しなければ、サイズが最大の連続空きスロットの
全タイムスロットを選択したプロセスグループに割り当
て、さらに必要CPU時間から割り当てたタイムスロッ
ト分を差し引いた残り時間分について前ステップと本ス
テップにより該プロセスグループに割り当てるステッ
プ、とを有することを特徴とする周期的プロセススケジ
ューリング方法。
2. The cyclic process scheduling method according to claim 1, wherein a step of creating a table for registering a sequence of process groups to which CPU time is allocated in units of time slots, and a process group having a short activation interval period are sequentially processed. Select a process group to allocate slots, extract continuous empty slots that are time slots that are continuously open in the range of the startup interval cycle of the selected process group, and set a size equal to or greater than the required CPU time. If there is a group of consecutive empty slots that have the required CPU time, a step of allocating consecutive empty time slots of the required CPU time from the beginning of the consecutive empty slots having a size equal to or larger than the required CPU time to the selected process group, More than If there is no continuous empty slot group with a size, all time slots of the continuous empty slot with the largest size are assigned to the selected process group, and the remaining time obtained by subtracting the assigned time slot from the required CPU time And a step of assigning the process group to the process group by this step.
【請求項3】請求項1記載の周期的プロセススケジュー
リング方法に従ってスケジュールされたプロセスを起動
する方法であって、 該プロセスグループの1つを起動する時点に達したと
き、該プロセスグループに属するプロセスの実行優先度
をシステム内で最高の優先度に変更することによって起
動し、その後連続して割り当てられたCPU割り当て時
間分だけ最高の優先度を保つことを特徴とするプロセス
起動方法。
3. A method of activating a process scheduled according to the periodic process scheduling method according to claim 1, wherein a process belonging to said process group is reached when the time to activate one of said process groups is reached. A process starting method characterized by starting by changing the execution priority to the highest priority in the system, and then maintaining the highest priority for the continuously allocated CPU allocation time.
【請求項4】請求項3記載のプロセス起動方法におい
て、 連続して割り当てられたCPU割り当て時間が経過した
とき該プロセスの実行優先度をシステム内で最低の優先
度に変更することを特徴とするプロセス起動方法。
4. The process starting method according to claim 3, wherein when the CPU allocation time that is continuously allocated has elapsed, the execution priority of the process is changed to the lowest priority in the system. Process startup method.
【請求項5】請求項3記載のプロセス起動方法におい
て、 連続して割り当てられた該CPU割り当て時間が経過す
る前に同一プロセスグループに属する第1のプロセスか
ら第2のプロセスへ優先度を継承するよう指示されたと
き、第1プロセスの実行優先度をシステム内で最高の優
先度から最低の優先度に変更し、第2プロセスの実行優
先度を最高の優先度に変更することによって起動するこ
とを特徴とするプロセス起動方法。
5. The process starting method according to claim 3, wherein the priority is inherited from the first process belonging to the same process group to the second process before the consecutively allocated CPU allocation time elapses. Start by changing the execution priority of the first process from the highest priority in the system to the lowest priority and the execution priority of the second process to the highest priority. A method for starting a process characterized by.
【請求項6】請求項3記載のプロセス起動方法におい
て、 連続して割り当てられたCPU割り当て時間が経過しか
つ該必要CPU時間を消費したとき、起動されたプロセ
スの実行優先度をシステム内で最高の優先度から基準の
優先度に変更し、該プロセスにタイムアウトを通知する
ことを特徴とするプロセス起動方法。
6. The process starting method according to claim 3, wherein when the continuously allocated CPU allocation time has elapsed and the required CPU time has been consumed, the execution priority of the started process is the highest in the system. A method for starting a process, characterized in that the priority is changed to a reference priority and a timeout is notified to the process.
【請求項7】請求項3記載のプロセス起動方法におい
て、 連続して割り当てられたCPU割り当て時間が経過した
とき、該プロセスグループを起動する単一の制御プロセ
スを起動し、該制御プロセスによって次の連続するCP
U割り当て時間を割り当てられたプロセスグループに属
するプロセスを起動することを特徴とするプロセス起動
方法。
7. The process activation method according to claim 3, wherein when a CPU allocation time that is continuously allocated has elapsed, a single control process that activates the process group is activated, and the control process Consecutive CP
A process starting method characterized by starting a process belonging to a process group to which U-allocated time is allocated.
【請求項8】請求項3記載のプロセス起動方法におい
て、 該プロセスグループの1つを起動する時点を検出してか
ら該プロセスグループに属するプロセスを起動するまで
の処理を単一のプロセスによって実行することを特徴と
するプロセス起動方法。
8. The process start-up method according to claim 3, wherein a process from detecting a time point at which one of the process groups is started to starting a process belonging to the process group is executed by a single process. A process starting method characterized by the above.
【請求項9】請求項3記載のプロセス起動方法におい
て、 システム内で最高優先度をもつプロセスの実行中に、ネ
ットワーク・パケットの到達など情報を受信すべき非同
期イベントが発生したとき、直ちに最高優先度で走行中
のプロセスの実行を停止し、情報の受信バッファを確保
して情報を受信する準備を行った後に実行を停止したプ
ロセスの実行を再開し、 周期的に起動されるプロセスによって受信した情報を参
照して処理することを特徴とする非同期イベント処理方
法。
9. The process starting method according to claim 3, wherein during execution of a process having the highest priority in the system, when an asynchronous event for receiving information such as arrival of a network packet occurs, the highest priority is immediately given. Each time the process that is running is stopped, the reception buffer for the information is secured and preparations for receiving the information are made, and then the process that has stopped the execution is restarted, and the process that is started periodically is received. An asynchronous event processing method characterized by processing by referring to information.
JP2757797A 1996-03-28 1997-02-12 Scheduling a periodic process Expired - Lifetime JP2904483B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2757797A JP2904483B2 (en) 1996-03-28 1997-02-12 Scheduling a periodic process

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8-73673 1996-03-28
JP7367396 1996-03-28
JP2757797A JP2904483B2 (en) 1996-03-28 1997-02-12 Scheduling a periodic process

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP17163198A Division JP3653176B2 (en) 1998-06-18 1998-06-18 Process execution control method

Publications (2)

Publication Number Publication Date
JPH09319597A true JPH09319597A (en) 1997-12-12
JP2904483B2 JP2904483B2 (en) 1999-06-14

Family

ID=26365522

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2757797A Expired - Lifetime JP2904483B2 (en) 1996-03-28 1997-02-12 Scheduling a periodic process

Country Status (1)

Country Link
JP (1) JP2904483B2 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6430594B1 (en) 1997-02-17 2002-08-06 Nec Corporation Real-time operating system and a task management system therefor
JP2002529850A (en) * 1998-11-09 2002-09-10 インテル コーポレイション Scheduling requests in the system
JP2006185303A (en) * 2004-12-28 2006-07-13 Oki Electric Ind Co Ltd Multicall processing thread processing method
JP2007519061A (en) * 2003-12-26 2007-07-12 松下電器産業株式会社 Task scheduling apparatus, task scheduling method, task scheduling program, recording medium, and transmission medium
JP2010073214A (en) * 2009-11-13 2010-04-02 Oki Electric Ind Co Ltd Thread processing in multi-call processing and call processing system
JP2010277371A (en) * 2009-05-28 2010-12-09 Panasonic Corp Multithread processor, compiler and operating system
JP2013214331A (en) * 2013-07-22 2013-10-17 Panasonic Corp Compiler
JP2013250988A (en) * 2013-07-22 2013-12-12 Panasonic Corp Multithread processor
JP2014041480A (en) * 2012-08-22 2014-03-06 Oki Electric Ind Co Ltd Data processor and program
US10430236B2 (en) 2016-03-18 2019-10-01 Samsung Electronics Co., Ltd. Electronic device and method for resuming process thereof

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6430594B1 (en) 1997-02-17 2002-08-06 Nec Corporation Real-time operating system and a task management system therefor
JP2002529850A (en) * 1998-11-09 2002-09-10 インテル コーポレイション Scheduling requests in the system
JP2007519061A (en) * 2003-12-26 2007-07-12 松下電器産業株式会社 Task scheduling apparatus, task scheduling method, task scheduling program, recording medium, and transmission medium
JP2006185303A (en) * 2004-12-28 2006-07-13 Oki Electric Ind Co Ltd Multicall processing thread processing method
JP4609070B2 (en) * 2004-12-28 2011-01-12 沖電気工業株式会社 Multi-call processing thread processing method
JP2010277371A (en) * 2009-05-28 2010-12-09 Panasonic Corp Multithread processor, compiler and operating system
JP2010073214A (en) * 2009-11-13 2010-04-02 Oki Electric Ind Co Ltd Thread processing in multi-call processing and call processing system
JP2014041480A (en) * 2012-08-22 2014-03-06 Oki Electric Ind Co Ltd Data processor and program
JP2013214331A (en) * 2013-07-22 2013-10-17 Panasonic Corp Compiler
JP2013250988A (en) * 2013-07-22 2013-12-12 Panasonic Corp Multithread processor
US10430236B2 (en) 2016-03-18 2019-10-01 Samsung Electronics Co., Ltd. Electronic device and method for resuming process thereof

Also Published As

Publication number Publication date
JP2904483B2 (en) 1999-06-14

Similar Documents

Publication Publication Date Title
EP0798638B1 (en) Periodic process scheduling method
US7039012B2 (en) Process execution method and apparatus
EP0617361B1 (en) Scheduling method and apparatus for a communication network
CN102455940B (en) Processing method and system of timers and asynchronous events
JP2000242512A (en) Computer executing plural operating systems
CN103297395A (en) Achievement method, system and device of internet business
Kitayama et al. RT-IPC: An IPC Extension for Real-Time Mach.
CN111897637B (en) Job scheduling method, device, host and storage medium
US5768572A (en) Timer state control optimized for frequent cancel and reset operations
JPH09319597A (en) Scheduling method for cyclic process
WO2012094862A1 (en) Method, apparatus and computer for task scheduling in operating system
US6907606B1 (en) Method for implementing event transfer system of real time operating system
US7116635B2 (en) Process execution method and apparatus
Li et al. Task scheduling algorithm for heterogeneous real-time systems based on deadline constraints
US8458508B2 (en) Information processing device which specifies a waiting time until execution of a given event and makes a system call
CN111158875B (en) Multi-module-based multi-task processing method, device and system
JP2004517424A (en) Server architecture
JP2000322278A (en) Process execution controlling method
JP3653176B2 (en) Process execution control method
AU714853B2 (en) Job scheduling for instruction processor
US6952826B1 (en) Method for implementing a multi-level system model for deterministically handling selected data
CN114924849A (en) High-concurrency execution and resource scheduling method and device for industrial control system
CN115576665A (en) Method, system and device for setting coroutine running environment and storage medium
CN115686774A (en) High-efficiency read-write strategy supporting data priority and implementation method
WO2001029655A2 (en) Method for implementing a multi-level system model for deterministically handling selected data

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090326

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20090326

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20100326

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20110326

Year of fee payment: 12

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

Free format text: PAYMENT UNTIL: 20110326

Year of fee payment: 12

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

Free format text: PAYMENT UNTIL: 20120326

Year of fee payment: 13

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

Free format text: PAYMENT UNTIL: 20130326

Year of fee payment: 14

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

Free format text: PAYMENT UNTIL: 20130326

Year of fee payment: 14

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

Free format text: PAYMENT UNTIL: 20140326

Year of fee payment: 15

EXPY Cancellation because of completion of term