JPH1124946A - Device and method for scheduling task - Google Patents

Device and method for scheduling task

Info

Publication number
JPH1124946A
JPH1124946A JP9193389A JP19338997A JPH1124946A JP H1124946 A JPH1124946 A JP H1124946A JP 9193389 A JP9193389 A JP 9193389A JP 19338997 A JP19338997 A JP 19338997A JP H1124946 A JPH1124946 A JP H1124946A
Authority
JP
Japan
Prior art keywords
task
scheduling
shared resource
group
round robin
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP9193389A
Other languages
Japanese (ja)
Inventor
Hiroyasu Watanabe
浩康 渡辺
Seiji Sasaki
誠司 佐々木
Atsushi Hirahara
厚志 平原
Masataka Bessho
正隆 別所
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP9193389A priority Critical patent/JPH1124946A/en
Publication of JPH1124946A publication Critical patent/JPH1124946A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To obtain a task scheduling device which improves the reliability of a system by using round robin scheduling for task groups which access common resources, using pre-empt scheduling for task groups irrelevant to the common resources and performing processing that realizes the pre-empt scheduling among both task groups. SOLUTION: Task groups 300 and 310 which access common resources use round robin scheduling. Task groups 320 and 330 irrelevant to the common resources use pre-empt scheduling. And the pre-empt scheduling is performed among both task groups 300 to 330. Then, even if the tasks 300 and 310 which access the common resources occupy a CPU 140 and continue execution, the tasks 320 and 330 irrelevant to the common resources are preemptible. Because of this, the possessory right of the CPU 140 is obtained and executed, and effects are prevented from being given to an entire system.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、タスクスケジュー
リング装置および方法に関する。
[0001] The present invention relates to a task scheduling apparatus and method.

【0002】[0002]

【従来の技術】従来、マルチタスク間で共有資源アクセ
スを行う際、排他制御を必要とするシステムでは、以下
の方式により排他制御を実現していた。
2. Description of the Related Art Conventionally, when a shared resource is accessed between multitasks, in a system that requires exclusive control, exclusive control has been realized by the following method.

【0003】第1の方式では、各タスクで共有資源アク
セスの直前にオペレーティングシステム(OS)に対し
てセマフォ(アクセス権)を獲得し、共有資源アクセス
が終了すると、OSに対してセマフォを返却することに
より排他制御を実現する。
In the first method, each task acquires a semaphore (access right) to an operating system (OS) immediately before access to a shared resource, and returns the semaphore to the OS when the access to the shared resource ends. This realizes exclusive control.

【0004】第2の方式では、ラウンドロビンスケジュ
ーリングを使用し、自タスクから明示的にCPU使用権
を放すまでタスクスイッチングをしないこと(ノンプリ
エンティブであること)を保証することにより排他制御
を実現する。
In the second method, exclusive control is realized by using round-robin scheduling and guaranteeing that task switching is not performed (being non-preemptive) until the CPU right is explicitly released from the invoking task. I do.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、上記従
来の排他制御方式には以下に掲げる問題があった。すな
わち、第1の方式では、共有資源に対するアクセス毎に
該当するセマフォの獲得、返却を行うので、オーバーヘ
ッドがかかってしまう(問題点1)。
However, the above-mentioned conventional exclusive control method has the following problems. That is, in the first method, a corresponding semaphore is acquired and returned for each access to the shared resource, so that overhead is required (problem 1).

【0006】また、複雑なデータ構造中に複数の共有資
源が含まれ、複数のタスクからのアクセス時にもデータ
構造全体の整合性を保証する必要がある場合、セマフォ
を割り当てるための共有資源の切り出しが難しい(問題
点2)。
When a plurality of shared resources are included in a complicated data structure and it is necessary to guarantee the consistency of the entire data structure even when accessing from a plurality of tasks, the extraction of shared resources for semaphore allocation Is difficult (Problem 2).

【0007】さらに、複数の共有資源に対し、タスク毎
に異なる連続したアクセス順番を保証しなければならな
い場合、デッドロックする危険性がある(問題点3)。
Further, when it is necessary to guarantee a continuous access order different for each task for a plurality of shared resources, there is a risk of deadlock (problem 3).

【0008】一方、第2の方式では、ラウンドロビンス
ケジューリングを用いることにより上記問題を解決して
いるが、イベントドリブンやタイムスライスによるプリ
エンブト(横取り)スケジューリングができないので、
共有資源をアクセスしているタスクがCPUを占有して
実行し続けると、共有資源とは無関係なタスクであって
も実行されず、システム全体に影響を及ぼしてしまう
(問題点4)。
On the other hand, in the second system, the above problem is solved by using round robin scheduling. However, pre-embedding (preemption) scheduling by event driven or time slice cannot be performed.
If the task accessing the shared resource occupies the CPU and continues to execute, even a task unrelated to the shared resource is not executed, affecting the entire system (problem 4).

【0009】また、タイムスライスによるプリエンプト
(横取り)スケジューリングができないので、複数の共
有資源がある場合、それぞれの共有資源毎の累積アクセ
ス時間を均等に割り振ることができず、アクセスするタ
スクの数が多い共有資源の方が累積アクセス時間が長く
なる(問題点5)。
In addition, since preemption (preemption) scheduling by time slice cannot be performed, when there are a plurality of shared resources, the accumulated access time for each of the shared resources cannot be equally allocated, and the number of tasks to be accessed is large. The accumulated access time of the shared resource is longer (problem 5).

【0010】これらの問題のうち、1つまたは部分的に
解決する手段はいくつか提案されている。例えば、問題
点1を改善する手段として、特開平5−120039号
公報では高速処理が必要なタスクは別にテーブルを設
け、資源の確保、解放処理を不要とする方式が提案され
ている。
Several means have been proposed to solve one or some of these problems. For example, Japanese Patent Laid-Open No. 5-120039 proposes a method of improving problem 1 by providing a table separately for tasks requiring high-speed processing and eliminating the need for resource securing and release processing.

【0011】また、問題点3の単純なケースである1つ
の共有資源に対するタスクの優先度逆転現象(プライオ
リティインバージョン)に対応する手段として、特開平
5−250188号公報や特開平8−77025号公報
に示されるように、共有資源占有期間のみタスクの優先
度を上げる方式が提案されている。
As means for coping with the task priority inversion phenomenon (priority inversion) for one shared resource, which is the simple case of Problem 3, JP-A-5-250188 and JP-A-8-77025 As disclosed in the gazette, a method has been proposed in which the priority of a task is raised only during a shared resource occupation period.

【0012】そこで、本発明は、上記問題点1〜4、問
題点1〜3および問題点5、または問題点1〜5を解決
することにより、システムの信頼性を高めることができ
るタスクスケジューリング装置を提供することを目的と
する。
The present invention solves the above problems 1-4, problems 1-3 and problems 5, or problems 1-5, thereby improving the reliability of the system. The purpose is to provide.

【0013】[0013]

【課題を解決するための手段】上記目的を達成するため
に、本発明の請求項1に記載のタスクスケジューリング
装置は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング装置において、スケジュー
リング調整機構と、プリエンプトスケジューリング機構
と、ラウンドロビンスケジューリング機構とを備え、共
有資源をアクセスするタスク群ではラウンドロビンスケ
ジューリングを用い、前記共有資源と無関係なタスク群
ではプリエンプトスケジューリングを用い、両タスク群
の間ではプリエンプトスケジューリングを実現する処理
を行うことを特徴とする。
In order to achieve the above object, a task scheduling apparatus according to a first aspect of the present invention is a task scheduling apparatus for scheduling a multitask program, comprising: a scheduling adjustment mechanism; a preemptive scheduling; And a round-robin scheduling mechanism, wherein round-robin scheduling is used for a task group accessing a shared resource, pre-emption scheduling is used for a task group irrelevant to the shared resource, and pre-emption scheduling is realized between both task groups. Processing is performed.

【0014】請求項2に記載のタスクスケジューリング
装置は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング装置において、スケジュー
リング調整機構と、プリエンプトスケジューリング機構
と、ラウンドロビンスケジューリング機構とを備え、共
有資源毎にアクセスするタスク群をタスクグループとし
て切り出し、各タスクグループ内で独立してラウンドロ
ビンスケジューリングを用い、前記タスクグループの間
ではプリエンプトスケジューリングを実現する処理を行
うことを特徴とする。
According to a second aspect of the present invention, in the task scheduling apparatus for scheduling a multitask program, the task scheduling apparatus includes a scheduling adjustment mechanism, a preemption scheduling mechanism, and a round robin scheduling mechanism, and accesses each shared resource. A task group is cut out as a task group, round robin scheduling is independently used in each task group, and processing for realizing preemption scheduling is performed between the task groups.

【0015】請求項3に記載のタスクスケジューリング
装置は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング装置において、スケジュー
リング調整機構と、プリエンプトスケジューリング機構
と、ラウンドロビンスケジューリング機構とを備え、共
有資源毎にアクセスするタスク群をタスクグループとし
て切り出し、各タスクグループ内で独立してラウンドロ
ビンスケジューリングを用い、前記共有資源と無関係な
タスク群ではプリエンプトスケジューリングを用い、前
記タスクグループの間および前記タスクグループと前記
共有資源とは無関係なタスク群の間ではプリエンプトス
ケジューリングを実現する処理を行うことを特徴とす
る。
According to a third aspect of the present invention, in the task scheduling apparatus for scheduling a multitask program, the task scheduling apparatus includes a scheduling adjustment mechanism, a preemption scheduling mechanism, and a round robin scheduling mechanism, and accesses each shared resource. Cut out the task group as a task group, use round robin scheduling independently in each task group, use preemption scheduling for the task group unrelated to the shared resource, and use the pre-emption scheduling between the task groups and between the task group and the shared resource. Is characterized by performing processing for realizing preemption scheduling between unrelated task groups.

【0016】請求項4に記載のタスクスケジューリング
方法は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング方法において、共有資源を
アクセスするタスク群ではラウンドロビンスケジューリ
ングを用い、前記共有資源と無関係なタスク群ではプリ
エンプトスケジューリングを用い、両タスク群の間では
プリエンプトスケジューリングを実現する処理を行うこ
とを特徴とする。
According to a fourth aspect of the present invention, in the task scheduling method for scheduling a multitask program, round robin scheduling is used for a task group accessing a shared resource, and preemption is performed for a task group irrelevant to the shared resource. Using scheduling, a process for realizing preemption scheduling is performed between both task groups.

【0017】請求項5に記載のタスクスケジューリング
方法は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング方法において、共有資源毎
にアクセスするタスク群をタスクグループとして切り出
し、各タスクグループ内で独立してラウンドロビンスケ
ジューリングを用い、前記タスクグループの間ではプリ
エンプトスケジューリングを実現する処理を行うことを
特徴とする。
According to a fifth aspect of the present invention, in the task scheduling method for scheduling a multi-task program, a task group to be accessed for each shared resource is cut out as a task group, and round robin is independently performed in each task group. A process for realizing preemption scheduling is performed between the task groups by using scheduling.

【0018】請求項6に記載のタスクスケジューリング
方法は、マルチタスクプログラムのスケジューリングを
行うタスクスケジューリング方法において、共有資源毎
にアクセスするタスク群をタスクグループとして切り出
し、各タスクグループ内で独立してラウンドロビンスケ
ジューリングを用い、前記共有資源と無関係なタスク群
ではプリエンプトスケジューリングを用い、前記タスク
グループの間および前記タスクグループと前記共有資源
とは無関係なタスク群の間ではプリエンプトスケジュー
リングを実現する処理を行うことを特徴とする。
According to a sixth aspect of the present invention, in the task scheduling method for scheduling a multi-task program, a task group to be accessed for each shared resource is cut out as a task group, and round robin is independently performed in each task group. Using scheduling, preempt scheduling is used for a task group unrelated to the shared resource, and processing for realizing preempt scheduling is performed between the task groups and between task groups unrelated to the shared resource. Features.

【0019】[0019]

【発明の実施の形態】本発明のタスクスケジューリング
装置および方法の実施の形態について説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of a task scheduling apparatus and method according to the present invention will be described.

【0020】[第1の実施の形態]第1の実施形態で
は、前述した問題点1〜問題点4を解決するタスクスケ
ジューリング装置について説明する。図1は第1の実施
形態におけるタスクスケジューリング装置が適用された
システムの構成を示すブロック図である。タスクスケジ
ューリング装置が適用されるシステムはCPU140、
ROM110、RAM100、タイマ150およびI/
Oインターフェース130から構成される。
[First Embodiment] In a first embodiment, a task scheduling apparatus that solves the above-mentioned problems 1 to 4 will be described. FIG. 1 is a block diagram showing a configuration of a system to which the task scheduling device according to the first embodiment is applied. The system to which the task scheduling device is applied is a CPU 140,
ROM 110, RAM 100, timer 150 and I /
It comprises an O interface 130.

【0021】図において、ROM110にはRAM10
0内の全てのコードおよび初期化データが格納されてい
る。CPU140にリセットがかかると、システムは立
ち上がり、ROM110に格納されているコードおよび
データを全てRAM100にコピーし、スケジューリン
グ調整機構600の初期化処理610に起動をかける
(図2参照)。
In FIG. 1, a ROM 110 stores a RAM 10
All codes in 0 and initialization data are stored. When the CPU 140 is reset, the system starts up, copies all the codes and data stored in the ROM 110 to the RAM 100, and starts the initialization processing 610 of the scheduling adjustment mechanism 600 (see FIG. 2).

【0022】初期化処理610では、I/Oインターフ
ェース130およびタイマ150のハードウェアを初期
化することで、I/O割込み処理400およびタイマ割
込み処理410を有効にする。
In the initialization processing 610, the hardware of the I / O interface 130 and the timer 150 is initialized, thereby enabling the I / O interruption processing 400 and the timer interruption processing 410.

【0023】プリエンプトスケジューリング機構700
の初期化処理720(図3参照)、およびラウンドロビ
ンスケジューリング機構800の初期化処理810(図
4参照)により、初期化データ500を基にしてマルチ
タスク環境を立ち上げる。
Preemption scheduling mechanism 700
The initialization process 720 (see FIG. 3) and the initialization process 810 (see FIG. 4) of the round robin scheduling mechanism 800 start up a multitask environment based on the initialization data 500.

【0024】この時点で、共有資源(変数データ等)2
00にアクセスしないタスク群(タスク1(320)、
タスク2(330)、…)、およびアクセスするタスク
群(タスクA(300)、タスクB(310)、…)の
うち1つだけ(タスクA(300))がプリエンプトス
ケジューリング機構700に登録され、それ以外のタス
ク群(タスクB(310)、…)はラウンドロビンスケ
ジューリング機構800に登録される。
At this point, the shared resources (variable data, etc.) 2
Tasks that do not access 00 (task 1 (320),
), And only one (task A (300)) of the group of tasks to be accessed (task A (300), task B (310), ...) are registered in the preempt scheduling mechanism 700, Other task groups (task B (310),...) Are registered in the round robin scheduling mechanism 800.

【0025】プリエンプトスケジューリング機構700
に登録されたタスク群(タスク1(320)、タスク2
(330)…、タスクA(300))のうち、スケジュ
ーリング処理730により、実行待キュー770の中で
優先順位が最も高く、待ち行列の最も先端のタスク1つ
だけがCPU140を占有して実行される。
Preemption scheduling mechanism 700
Task group (task 1 (320), task 2
(330)... Of the task A (300)), only one task at the top of the queue in the execution waiting queue 770 is executed by the scheduling process 730 while occupying the CPU 140. You.

【0026】プリエンプトスケジューリング機構700
に登録されたタスクAが中断状態905に遷移した時、
ラウンドロビンスケジューリング機構800に登録され
たタスク群(タスクB(310)、……)のうち、ラウ
ンドロビンキュー840の先頭のタスク(タスクB)1
つだけを取り出し、プリエンプトスケジューリング機構
700に追加登録する(図5参照)。
Preempt scheduling mechanism 700
When the task A registered in the state transitions to the suspended state 905,
Of the task group (task B (310),...) Registered in the round robin scheduling mechanism 800, the first task (task B) 1 in the round robin queue 840
Only one of them is taken out and additionally registered in the preempt scheduling mechanism 700 (see FIG. 5).

【0027】タスクA(300)は中断状態905が解
除されたタイミングで、プリエンプトスケジューリング
機構700から削除され、タスクB(310)の代わり
にラウンドロビンスケジューリング機構800に登録さ
れる。
When the suspended state 905 is released, the task A (300) is deleted from the preemption scheduling mechanism 700 and registered in the round robin scheduling mechanism 800 instead of the task B (310).

【0028】このように、共有資源をアクセスするタス
ク群(タスクA(300)、タスクB(310)、…
…)ではラウンドロビンスケジューリングを用いること
により、共有資源と無関係なタスク群(タスク1(32
0)、タスク2(330)、……)ではプリエンプト
(横取り)スケジューリングを用いることにより、両タ
スク群の間でプリエンプト(横取り)スケジューリング
を行う。
As described above, a group of tasks (task A (300), task B (310),.
..) Use round-robin scheduling to create a task group (task 1 (32
0), task 2 (330),...) Performs preemption (stealing) scheduling between both task groups by using preemptive scheduling.

【0029】以下に、タスクスケジューリング装置の構
成および動作を、図面に基づいて詳細に説明する。図2
はスケジューリング調整機構600の構成を示す図であ
る。スケジューリング調整機構600が装備する処理6
01は、初期化処理610、中断処理620、中断解除
処理640およびタイマ割込み処理660である。ま
た、スケジューリング調整機構600が保持するデータ
602は共有資源管理テーブル680である。
Hereinafter, the configuration and operation of the task scheduling device will be described in detail with reference to the drawings. FIG.
FIG. 4 is a diagram showing a configuration of a scheduling adjustment mechanism 600. Processing 6 provided for scheduling adjustment mechanism 600
01 is an initialization process 610, a suspension process 620, a suspension release process 640, and a timer interrupt process 660. Data 602 held by the scheduling adjustment mechanism 600 is a shared resource management table 680.

【0030】図3はプリエンプトスケジューリング機構
700の構成を示す図である。プリエンプトスケジュー
リング機構700が装備する処理701は、初期化処理
720、スケジューリング処理730、指定実行待キュ
ー後尾へ追加処理740、指定実行待キューからの取得
処理741、中断キュー後尾へ追加処理742、中断キ
ューからの取得処理743である。プリエンプトスケジ
ューリング機構700が保持するデータは、現在CPU
を占有しているタスクを示す現実行タスク703、各タ
スク毎にタスク状態などを管理するTCB(タスクコン
トロールブロック)750である。
FIG. 3 is a diagram showing the configuration of the preempt scheduling mechanism 700. The process 701 provided in the preemption scheduling mechanism 700 includes an initialization process 720, a scheduling process 730, an addition process 740 to the tail of the designated execution wait queue, a process 741 for acquisition from the designated execution queue, an addition process 742 to the end of the suspension queue, and a suspension queue. This is an acquisition process 743 from. The data held by the preemption scheduling mechanism 700 is
A task execution block 703 that indicates a task that occupies the same, and a TCB (task control block) 750 that manages a task state and the like for each task.

【0031】また、プリエンプトスケジューリング機構
700はタスクのスケジューリングを実行するための実
行待キュー770および中断キュー790も保持してい
る。実行待キュー770は、優先順位毎に実行待状態9
03のタスクのTCB750をリストに保持し、その並
び順を待ち行列としてFIFOのキューとして管理す
る。プリエンプトスケジューリング機構700の処理7
01は、これらのキューにリンクされたTCB750の
中で、共有資源にアクセスするタスクのTCB750は
1つだけ(図3ではタスクA(777))であることを
保証する。中断キュー790は、中断状態905のタス
クのTCB750をリストに保持し、その並び順を待ち
行列としてFIFOのキューとして管理する。
The preemption scheduling mechanism 700 also has an execution queue 770 and an interruption queue 790 for executing task scheduling. The execution waiting queue 770 has an execution waiting state 9 for each priority.
The TCB 750 of the task 03 is held in a list, and its arrangement order is managed as a queue and a FIFO queue. Processing 7 of preempt scheduling mechanism 700
01 guarantees that among the TCBs 750 linked to these queues, there is only one TCB 750 (task A (777) in FIG. 3) for the task accessing the shared resource. The suspension queue 790 holds the TCBs 750 of the tasks in the suspended state 905 in a list, and manages the arrangement order as a queue and a FIFO queue.

【0032】図4はラウンドロビンスケジューリング機
構800の構成を示す図である。ラウンドロビンスケジ
ューリング機構800が装備する処理801は、初期化
処理810、ラウンドロビンキュー後尾へ追加処理83
0およびラウンドロビンキューからの取得処理831で
ある。また、ラウンドロビンスケジューリング機構80
0はタスクスケジューリングを実現するためのラウンド
ロビンキュー840を保持する。ラウンドロビンキュー
840は、ラウンドロビン待状態904のタスクのTC
B750をリストに保持し、その並び順を待ち行列とし
てFIFOのキューとして管理する。
FIG. 4 is a diagram showing the configuration of the round robin scheduling mechanism 800. The processing 801 provided in the round robin scheduling mechanism 800 includes an initialization processing 810, an addition processing 83 after the round robin queue.
This is an acquisition process 831 from 0 and the round robin queue. The round robin scheduling mechanism 80
0 holds a round robin queue 840 for implementing task scheduling. The round robin queue 840 stores the TC of the task in the round robin wait state 904.
B750 is held in a list, and its arrangement order is managed as a queue and a FIFO queue.

【0033】図5はタスクの状態遷移を示す図である。
タスクは初期状態902、実行待状態903、実行状態
901、中断状態905、ラウンドロビン待状態904
の各状態を取り得る。それぞれの状態間の遷移は、スケ
ジューリング処理730、中断処理620、中断解除処
理640、初期化処理720、初期化処理810、タイ
マ割込み処理660の起動によって発生する。タスクの
状態は各タスク毎にTCB750内のタスク状態756
に保持される(図8参照)。
FIG. 5 is a diagram showing a state transition of a task.
Tasks are in an initial state 902, an execution waiting state 903, an execution state 901, a suspended state 905, a round robin waiting state 904.
Each state of can be taken. The transition between the states is caused by activation of the scheduling process 730, the suspension process 620, the suspension release process 640, the initialization process 720, the initialization process 810, and the timer interrupt process 660. The task state is a task state 756 in the TCB 750 for each task.
(See FIG. 8).

【0034】初期状態902は、TCB750が確保さ
れた直後の立ち上がり時の状態である。実行状態901
は、タスクがCPU140を占有して実行している状態
で優先順位が最高で待ち行列の先頭の1タスクだけがな
り得る状態である。この状態のタスクはTCB750が
実行待キュー770にリンクされている(図3参照)。
The initial state 902 is a state at the time of rising immediately after the TCB 750 is secured. Execution state 901
Is a state in which the task is occupying the CPU 140 and is being executed, and only the first task in the queue has the highest priority and can be the first task in the queue. In the task in this state, the TCB 750 is linked to the execution waiting queue 770 (see FIG. 3).

【0035】実行待状態903は実行可能であるが、優
先順位等の関係で他のタスクがCPU140を占有して
いるためにこれが空くのを待っている状態である。この
状態のタスクではTCB750が実行待キュー770に
リンクされている。
The execution waiting state 903 is a state in which execution is possible, but other tasks occupy the CPU 140 due to the priority order or the like, and thus the task is waiting for the task to become free. In the task in this state, the TCB 750 is linked to the execution waiting queue 770.

【0036】中断状態905はI/O割込処理400な
どからのイベント待ちの状態であり、この状態の間では
CPU140が空いても実行されることはない。この状
態のタスクではTCB750が中断キュー790にリン
クされている。
The suspended state 905 is a state of waiting for an event from the I / O interrupt processing 400 or the like. During this state, the processing is not executed even if the CPU 140 is idle. In the task in this state, the TCB 750 is linked to the suspend queue 790.

【0037】ラウンドロビン待状態904は共有資源2
00にアクセスするタスク群だけが遷移可能な状態であ
り、共有資源200をアクセスするタスクがすでに実行
待状態903または実行状態901に1つ存在する場
合、このタスクが中断状態905に遷移するのを待って
いる状態である。この状態のタスクではTCB750が
ラウンドロビンキュー840にリンクされている。
The round robin wait state 904 indicates the shared resource 2
When only the task group accessing the shared resource 200 is in a state capable of transition, and there is already one task accessing the shared resource 200 in the execution waiting state 903 or the execution state 901, it is determined that this task transitions to the suspended state 905. You are waiting. In the task in this state, the TCB 750 is linked to the round robin queue 840.

【0038】図6は初期化データの構成を示す図であ
る。同図を参照すると、初期化データ500は全タスク
数510および全タスク情報520を含んで格納されて
いる。全タスク情報520は各タスク毎にタスクの実行
アドレス(PC)、優先順位、共有資源アクセスフラグ
521〜531を含んで格納されている。共有資源アク
セスフラグ521〜531には、共有資源にアクセスす
るタスク521〜525では値1がセットされ、アクセ
スしないタスク526〜531では値0がセットされ
る。
FIG. 6 shows the structure of the initialization data. Referring to FIG. 7, the initialization data 500 includes the total number of tasks 510 and all task information 520. All task information 520 is stored for each task including the task execution address (PC), priority, and shared resource access flags 521-531. In the shared resource access flags 521 to 531, the value 1 is set for the tasks 521 to 525 that access the shared resource, and the value 0 is set for the tasks 526 to 531 that do not access the shared resource.

【0039】図7は共有資源管理テーブルを示す図であ
る。同図を参照すると、共有資源管理テーブル680
は、実行待キュー770にリンクされている共有資源を
アクセスするタスクの数を表す実行待共有資源アクセス
タスク数682、およびラウンドロビンキュー840に
リンクされているタスクの数を表すラウンドロビン待タ
スク数681を含んで格納されている。
FIG. 7 shows a shared resource management table. Referring to the figure, the shared resource management table 680
Are the number of tasks waiting to execute shared resources 682 indicating the number of tasks accessing the shared resources linked to the waiting queue 770, and the number of tasks waiting to be round robin indicating the number of tasks linked to the round robin queue 840. 681 are stored.

【0040】図8はタスクコントロールブロックの構成
を示す図である。同図を参照すると、TCB(タスクコ
ントロールブロック)750はタスクID752、タス
クアドレス(PC)753、タスクスタックアドレス
(SP)754、優先順位755、タスク状態756、
リンクポインタ757、共有資源アクセスフラグ75
8、その他の付加情報759を含んで格納されている。
FIG. 8 is a diagram showing a configuration of the task control block. Referring to the figure, a TCB (task control block) 750 includes a task ID 752, a task address (PC) 753, a task stack address (SP) 754, a priority 755, a task state 756,
Link pointer 757, shared resource access flag 75
8, and other additional information 759.

【0041】TCB750は各タスク毎にデータを保持
し(TCB[0]751、TCB[1]760、TCB
[2]761…)、プリエンプトスケジューリング機構
700のデータとして保持されている。タスク状態75
6の取り得る値は初期状態902、実行待状態903、
実行状態901、中断状態905、ラウンドロビン待状
態904である。これらの状態遷移およびその発生要因
は図5に示した通りである。
The TCB 750 holds data for each task (TCB [0] 751, TCB [1] 760, TCB
[2] 761...), Which is held as data of the preempt scheduling mechanism 700. Task state 75
The possible values of 6 are initial state 902, execution waiting state 903,
An execution state 901, an interruption state 905, and a round robin waiting state 904 are set. These state transitions and the causes thereof are as shown in FIG.

【0042】つぎに、スケジューリング調整機構600
の初期化処理610について説明する。図9は初期化処
理610の手順を示すフローチャートである。この初期
化処理610はCPUリセット後の最初の処理としてC
PU140によって実行される。
Next, the scheduling adjustment mechanism 600
Will be described. FIG. 9 is a flowchart showing the procedure of the initialization process 610. This initialization processing 610 is C processing as the first processing after CPU reset.
This is executed by the PU 140.

【0043】まず、ハードウェア割込みを禁止する。
(ステップS611)。ROM110からRAM100
にコードおよび初期化データ500をコピーする(ステ
ップS612)。プリエンプトスケジューリング機構7
00の初期化処理720をコールする(ステップS61
3)。ラウンドロビンスケジューリング機構800の初
期化処理810をコールする(ステップS614)。
First, hardware interrupts are prohibited.
(Step S611). ROM 110 to RAM 100
Then, the code and the initialization data 500 are copied (step S612). Preemption scheduling mechanism 7
Call the initialization processing 720 of step S00 (step S61).
3). The initialization processing 810 of the round robin scheduling mechanism 800 is called (step S614).

【0044】ハードウェア割込みを許可する(ステップ
S615)。プリエンプトスケジューリング機構700
のスケジューリング処理730を起動し(ステップS6
16)、スケジューリング調整機構の初期化処理610
を終了する。
The hardware interrupt is permitted (step S615). Preempt scheduling mechanism 700
The scheduling process 730 is started (step S6).
16), initialization processing 610 of the scheduling adjustment mechanism
To end.

【0045】スケジューリング処理730はリターンせ
ず、実行待キュー770の中で最も優先順位の高く、最
も待ち行列の先頭のタスクにCPU140の占有を与え
て実行を開始する。
The scheduling process 730 does not return, but starts execution by giving the occupation of the CPU 140 to the task having the highest priority in the execution queue 770 and the head of the queue.

【0046】その後、タスクスケジューリングが発生す
るタイミングは、タスクから中断処理620または中断
解除処理640が起動された場合、I/O割込み処理4
00から中断解除処理640が起動された場合、タイマ
割込み410からタイマ割込み処理660が起動された
場合である。
Thereafter, the timing at which task scheduling occurs is as follows: when the interrupt processing 620 or the interrupt release processing 640 is started from the task, the I / O interrupt processing 4
This is a case where the interruption release processing 640 is started from 00, and a case where the timer interrupt processing 660 is started from the timer interrupt 410.

【0047】図10はプリエンプトスケジューリング機
構700の初期化処理720の手順を示すフローチャー
トである。この処理はスケジューリング調整機構600
の初期化処理610から1度だけコールされる。
FIG. 10 is a flowchart showing the procedure of the initialization process 720 of the preemption scheduling mechanism 700. This processing is performed by the scheduling adjustment mechanism 600.
Is called only once from the initialization process 610.

【0048】まず、初期化データ500の情報を基に各
タスクのTCB750の初期化(TCB[0]−TCB
[10](タスク1−6,A−E))を行う(ステップ
S721)。
First, the TCB 750 of each task is initialized (TCB [0] -TCB) based on the information of the initialization data 500.
[10] (Tasks 1-6, AE) are performed (step S721).

【0049】このステップS721の処理では、初期化
データ500の全タスク数510を基に全TCBの領域
をRAM100に確保する(721a)。初期化データ
500の全タスク情報520を基にTCB750内のタ
スクアドレス(PC)753/優先順位755/共有資
源アクセスフラグ758の値をセットする(721
b)。タスクID752を割り振り、タスクスタックの
領域をRAM100に確保し、スタックポインタをタス
クスタックアドレス(SP)754にセットする(72
1c)。全TCBのタスク状態756を実行待状態90
3にセットする(721d)。その他の付加情報759
があれば初期化する(721e)。
In the process of step S721, an area of all TCBs is secured in the RAM 100 based on the total number of tasks 510 of the initialization data 500 (721a). Based on all task information 520 of the initialization data 500, the values of the task address (PC) 753 / priority 755 / shared resource access flag 758 in the TCB 750 are set (721).
b). A task ID 752 is allocated, a task stack area is secured in the RAM 100, and a stack pointer is set to a task stack address (SP) 754 (72).
1c). Waiting state 90 for task state 756 of all TCBs
It is set to 3 (721d). Other additional information 759
If there is, it is initialized (721e).

【0050】つづいて、TCB[0]からTCB[(全
タスク数510)−1]まで以下の処理を繰り返す(ス
テップS722)。TCB750の共有資源アクセスフ
ラグ758が値0である共有資源にアクセスしないタス
クのTCB(タスク1,2,3,4,5,6)アドレス
を優先順位755に対応する実行待キュー770の後尾
に追加する。
Subsequently, the following processing is repeated from TCB [0] to TCB [(total number of tasks 510) -1] (step S722). The TCB (task 1, 2, 3, 4, 5, 6) address of a task that does not access the shared resource whose shared resource access flag 758 of the TCB 750 is 0 is added to the end of the execution wait queue 770 corresponding to the priority 755. I do.

【0051】現実行タスク703をアイドルタスクとす
る(ステップS723)。I/Oインターフェーおよび
タイマを初期化し、同じ優先順位のタイムスライススケ
ジューリングを必要とする場合、タイマ割込みベクタに
タイマ割込み処理660を登録する(ステップS72
4)。そして、呼び出し元にリターンする。
The currently executed task 703 is set as an idle task (step S723). When the I / O interface and the timer are initialized and time slice scheduling of the same priority is required, the timer interrupt processing 660 is registered in the timer interrupt vector (step S72).
4). Then, the process returns to the calling source.

【0052】図11はラウンドロビンスケジューリング
機構800の初期化処理810の手順を示すフローチャ
ートである。この処理はスケジューリング調整機構60
0の初期化処理610から1度だけコールされる。ま
ず、ループカウンタCountを初期化する(ステップ
S811)。ラウンドロビン待タスク数681を値0に
初期化する(ステップS812)。
FIG. 11 is a flowchart showing the procedure of the initialization process 810 of the round robin scheduling mechanism 800. This processing is performed by the scheduling adjustment mechanism 60.
Called only once from the initialization process 610 of 0. First, the loop counter Count is initialized (step S811). The number 681 of round-robin waiting tasks is initialized to a value 0 (step S812).

【0053】TCB[0]からTCB[(全タスク数5
10)−1]まで以下の処理を繰り返す(ステップ81
3)。つまり、TCB[Count]の共有資源アクセ
スフラグ758が値1である(共有資源にアクセスする
タスク)か否かを判別する(ステップ814)。値1で
ある場合、ループを終了し、ステップS816の処理に
移行する。一方、TCB[Count]の共有資源アク
セスフラグ758が値1でなければ、Countをイン
クリメントする(ステップS815)。
From TCB [0] to TCB [(total number of tasks 5
The following processing is repeated until 10) -1] (step 81)
3). That is, it is determined whether or not the shared resource access flag 758 of TCB [Count] has a value of 1 (task for accessing the shared resource) (step 814). If the value is 1, the loop ends, and the process proceeds to step S816. On the other hand, if the shared resource access flag 758 of TCB [Count] is not the value 1, Count is incremented (step S815).

【0054】最初に見つかった共有資源をアクセスする
タスクを示すTCB[Count]を優先順位755に
対応する実行待キュー770の後尾に追加する(ステッ
プS816)。ループカウンタCountをインクリメ
ントする(ステップS817)。実行待共有資源アクセ
スタスク数682に値1をセットする(ステップS81
8)。
The TCB [Count] indicating the task that accesses the first found shared resource is added to the end of the execution queue 770 corresponding to the priority 755 (step S816). The loop counter Count is incremented (step S817). The value 1 is set to the number 682 of tasks waiting to be executed shared resource access (step S81)
8).

【0055】ラウンドロビンキュー840に残りの共有
資源をアクセスするタスク群を追加するため、TCB
[Count]からTCB[(全タスク数510)−
1)]間で以下の処理を繰り返す(ステップS81
9)。TCB[Count]の共有資源アクセスフラグ
758が値1である(共有資源にアクセスするタスク)
か否かを判別する(ステップS820)。値1である場
合、TCB[Count]のタスク状態756をラウン
ドロビン待904とし、ラウンドロビンキュー840の
後尾に追加し(ステップS821)、ラウンドロビン待
タスク数681をインクリメントし(ステップS82
2)、ループカウンタCountをインクリメントする
(ステップS823)。一方、ステップS820でTC
B[Count]の共有資源アクセスフラグ758が値
1でなければ、Countをインクリメントする(ステ
ップS823)。また、ステップS813あるいはステ
ップS819で全て繰り返した場合、呼び出し元にリタ
ーンする。
To add a task group for accessing the remaining shared resources to the round robin queue 840, the TCB
From [Count] to TCB [(total number of tasks 510)-
1)] is repeated (step S81)
9). The value of the shared resource access flag 758 of TCB [Count] is 1 (task for accessing the shared resource).
It is determined whether or not this is the case (step S820). If the value is 1, the task state 756 of the TCB [Count] is set to the round robin wait 904, added to the end of the round robin queue 840 (step S821), and the round robin wait task number 681 is incremented (step S82).
2) The loop counter Count is incremented (step S823). On the other hand, in step S820, TC
If the shared resource access flag 758 of B [Count] is not the value 1, Count is incremented (step S823). In addition, if all of the steps are repeated in step S813 or step S819, the process returns to the calling source.

【0056】図12はプリエンプトスケジューリング機
構700のスケジューリング処理730の手順を示すフ
ローチャートである。この処理は、スケジューリング調
整機構600の初期化処理610、中断処理620、中
断解除処理640、タイマ割込み処理660から起動さ
れる。
FIG. 12 is a flowchart showing the procedure of the scheduling process 730 of the preemption scheduling mechanism 700. This process is started from the initialization process 610, the suspension process 620, the suspension release process 640, and the timer interrupt process 660 of the scheduling adjustment mechanism 600.

【0057】実行待キュー770に基づきタスクスケジ
ューリングを実現する。まず、現実行タスク703が最
高優先順位の実行待キュー770の先頭タスクと等しい
か否かを判別する(ステップS731)。等しければリ
ターンする。等しくなければ、タスクスイッチを行うた
めに現実行タスク703のTCB750(タスクアドレ
ス753、タスクスタックアドレス754)にCPU1
40内のPC(プログラムカウンタ)とSP(スタック
ポインタ)を保存し、タスク状態756を実行待状態9
03にする(ステップS732)。
Task scheduling is realized based on the execution queue 770. First, it is determined whether or not the currently executed task 703 is equal to the first task in the execution queue 770 having the highest priority (step S731). Return if equal. If they are not equal, the CPU 1 sets the TCB 750 (task address 753, task stack address 754) of the currently executed task 703 to perform a task switch.
Save PC (program counter) and SP (stack pointer) in 40 and change task state 756 to execution waiting state 9
03 (step S732).

【0058】最高優先順位の実行待キュー770の先頭
タスクのTCB750(タスクアドレス753、タスク
スタックアドレス754)から、CPU140内のPC
(プログラムカウンタ)とSP(スタックポインタ)を
セットし、タスク状態756を実行状態901にする
(ステップS733)。
From the TCB 750 (task address 753, task stack address 754) of the first task in the execution waiting queue 770 having the highest priority, the PC in the CPU 140
(Program counter) and SP (stack pointer) are set, and the task state 756 is changed to the execution state 901 (step S733).

【0059】現実行タスク703を最高優先順位の実行
待キュー770の先頭タスクとする(ステップS73
4)。そして、タスクをスタートさせる(ステップS7
35)。
The currently executed task 703 is set as the first task in the execution waiting queue 770 having the highest priority (step S73).
4). Then, the task is started (step S7)
35).

【0060】図13はスケジューリング調整機構600
の中断処理620の手順を示すフローチャートである。
この処理はタスクから任意に起動され、指定タスクを中
断状態905に遷移させる処理である。
FIG. 13 shows a scheduling adjustment mechanism 600.
Is a flowchart showing the procedure of the interruption process 620 of FIG.
This process is started arbitrarily from a task, and is a process for transitioning a designated task to a suspended state 905.

【0061】まず、指定した中断タスクのTCB750
内の共有資源アクセスフラグ758が値1と等しいか否
かを判別する(ステップS621)。等しくなければ、
中断すべきタスクは共有資源にアクセスしないタスクで
あるので、中断タスクのTCB750を実行待キュー7
70から取り出し(ステップS622)、中断キュー7
90の後尾に追加し、タスク状態756を中断状態90
5にし(ステップS623)、スケジューリング処理7
30を起動する(ステップS623A)。
First, the TCB 750 of the specified suspended task
It is determined whether the shared resource access flag 758 is equal to the value 1 (step S621). If not equal,
Since the task to be interrupted is a task that does not access the shared resource, the TCB 750 of the interrupted task is set to the execution queue 7.
70 (step S622), the interrupt queue 7
90, and the task state 756 is suspended.
5 (step S623), and the scheduling process 7
30 is started (step S623A).

【0062】指定した中断タスクのTCB750内の共
有資源アクセスフラグ758が値1と等しければ、中断
すべきタスクは共有資源にアクセスするタスクであるの
で、中断タスクのTCBを実行待キュー770から取り
出し(ステップS624)、実行待共有資源アクセスタ
スク数(682)に値0をセットし(ステップS62
5)、ステップS624で取り出したTCBを中断キュ
ー790の後尾に追加し、タスク状態756を中断状態
905にする(ステップS626)。
If the value of the shared resource access flag 758 in the TCB 750 of the specified suspended task is equal to the value 1, the task to be suspended is a task to access the shared resource, and the TCB of the suspended task is taken out from the execution waiting queue 770 ( In step S624), a value 0 is set to the number of tasks waiting to be executed shared resource access (682) (step S62).
5), the TCB extracted in step S624 is added to the end of the suspension queue 790, and the task state 756 is changed to the suspension state 905 (step S626).

【0063】ラウンドロビン待タスク数681が値0に
等しいか否かを判別する(ステップS627)。値0に
等しければ、特にラウンドロビン待状態904のタスク
は存在しないので、スケジューリング処理730を起動
する(ステップS632)。
It is determined whether or not the number of round robin waiting tasks 681 is equal to the value 0 (step S627). If the value is equal to 0, the task in the round robin waiting state 904 does not exist, and the scheduling process 730 is started (step S632).

【0064】値0に等しくなければ、指定した共有資源
をアクセスするタスクが実行待状態903から中断状態
905に遷移したため、新たにラウンドロビン待状態9
04の共有資源をアクセスするタスク群のうちから1タ
スクを実行待状態903に遷移させる。まず、ラウンド
ロビンキュー840の先頭タスクのTCB750を取り
出し(ステップS628)、ラウンドロビン待タスク数
681をデクリメントし(ステップS629)、ステッ
プ628で取り出したTCBを該当する優先順位755
の実行待キュー770の後尾へ追加し、タスク状態75
6を実行待状態903にする(ステップS630)。
If the value is not equal to 0, the task accessing the specified shared resource has transitioned from the execution wait state 903 to the suspended state 905, and the round robin wait state 9 is newly added.
In the group of tasks accessing the shared resource No. 04, one task is shifted to the execution waiting state 903. First, the TCB 750 of the first task in the round robin queue 840 is taken out (step S628), the number of round robin waiting tasks 681 is decremented (step S629), and the TCB taken out in the step 628 is assigned a corresponding priority 755.
Is added to the end of the execution wait queue 770, and the task state 75
6 is set to the execution waiting state 903 (step S630).

【0065】実行待共有資源アクセスタスク数(68
2)に値1をセットする(ステップ631)。スケジュ
ーリング処理730を起動する(ステップ632)。
The number of shared resource access tasks waiting to be executed (68
The value 1 is set in 2) (step 631). The scheduling process 730 is started (Step 632).

【0066】図14はスケジューリング調整機構600
の中断解除処理640の手順を示すフローチャートであ
る。この処理はタスクまたはI/O割込み処理から任意
に起動される。指定タスクを中断状態905から実行待
状態903またはラウンドロビン待状態904に遷移さ
せる処理である。
FIG. 14 shows a scheduling adjustment mechanism 600.
9 is a flowchart showing the procedure of the interruption release processing 640 of FIG. This process is arbitrarily started from a task or I / O interrupt process. This is a process of transitioning the designated task from the suspended state 905 to the execution waiting state 903 or the round robin waiting state 904.

【0067】まず、指定した中断状態を解除したいタス
クのTCB750内の共有資源アクセスフラグ758が
値1に等しいか否かを判別する(ステップS641)。
等しくなければ、中断状態を解除すべきタスクは共有資
源にアクセスしないタスクであるので、中断タスクのT
CB750を中断キュー790から取り出し(ステップ
S642)、該当する優先順位755の実行待キュー7
70の後尾へ追加し、タスク状態756を実行待状態9
03にし(ステップS643)、スケジューリング処理
730を起動する(ステップS643A)。
First, it is determined whether or not the shared resource access flag 758 in the TCB 750 of the task for which the specified suspended state is to be released is equal to the value 1 (step S641).
If they are not equal, the task to be released from the suspended state is a task that does not access the shared resource.
The CB 750 is taken out of the suspension queue 790 (step S642), and the execution waiting queue 7 of the corresponding priority 755 is taken.
70 is added to the end, and the task state 756 is in the execution waiting state 9
03 (step S643), and activates the scheduling process 730 (step S643A).

【0068】指定した中断状態を解除したいタスクのT
CB750内の共有資源アクセスフラグ758が値1に
等しければ、中断すべきタスクは共有資源にアクセスす
るタスクであるので、中断タスクのTCB750を中断
キュー790から取り出す(ステップS644)。
The T of the task to be released from the specified suspended state
If the shared resource access flag 758 in the CB 750 is equal to the value 1, the task to be interrupted is a task to access the shared resource, so the TCB 750 of the interrupted task is taken out from the interrupt queue 790 (step S644).

【0069】ラウンドロビン待タスク数681が値0に
等しいか否かを判別する(ステップS645)。値0に
等しくなければ、ラウンドロビン待状態904のタスク
が既に存在するので、ステップS644で取り出したT
CBをラウンドロビンキュー840の後尾へ追加し、タ
スク状態756をラウンドロビン待状態904にし(ス
テップS647)、ラウンドロビン待タスク数681を
インクリメントし(ステップS648)、リターンす
る。
It is determined whether or not the number 681 of round-robin waiting tasks is equal to the value 0 (step S645). If the value is not equal to 0, the task in the round robin waiting state 904 already exists, and thus the T extracted in step S644
The CB is added to the end of the round robin queue 840, the task state 756 is set to the round robin waiting state 904 (step S647), the round robin waiting task number 681 is incremented (step S648), and the process returns.

【0070】ステップS645で値0に等しければ、ラ
ウンドロビン待状態904のタスクは存在しないので、
実行待共有資源アクセスタスク数(682)が値0に等
しいか否かを判別する(ステップS646)。値0に等
しくなければ、既に共有資源をアクセスするタスク群の
うちから1タスクが実行待状態903であるため、ステ
ップS644で取り出したTCBをラウンドロビンキュ
ー840の後尾へ追加し、タスク状態756をラウンド
ロビン待状態904にし(ステップS647)、ラウン
ドロビン待タスク数681をインクリメントし(ステッ
プS648)、リターンする。
If the value is equal to 0 in step S645, there is no task in the round-robin waiting state 904, so that
It is determined whether or not the number of tasks waiting for execution of shared resource access (682) is equal to the value 0 (step S646). If the value is not equal to 0, one of the tasks that already access the shared resource is in the waiting state 903, so the TCB extracted in step S644 is added to the end of the round robin queue 840, and the task state 756 is changed. The state is set to the round robin waiting state 904 (step S647), the round robin waiting task number 681 is incremented (step S648), and the process returns.

【0071】ステップS646で値0に等しければ、共
有資源をアクセスするタスク群のうち、実行待状態90
3のタスクは存在しないので、ステップS644で取り
出したTCBを該当する優先順位755の実行待キュー
770の後尾へ追加し、タスク状態756を実行待状態
903にする(ステップS649)。実行待共有資源ア
クセスタスク数(682)に値1をセットする(ステッ
プS650)。スケジューリング処理730を起動する
(ステップS651)。
If the value is equal to 0 in step S646, the execution waiting state 90 of the task group accessing the shared resource
Since the task No. 3 does not exist, the TCB extracted in step S644 is added to the tail of the execution waiting queue 770 of the corresponding priority 755, and the task state 756 is changed to the execution waiting state 903 (step S649). The value 1 is set to the number of tasks waiting to be executed shared resource access (682) (step S650). The scheduling process 730 is started (step S651).

【0072】図15はスケジューリング調整機構600
のタイマ割込み処理660の手順を示すフローチャート
である。この処理は、タイマ割込み発生時、タイマ割込
み処理410から起動される。最高優先順位の実行待キ
ュー770内にリンクされているタスクをタイムスライ
ス(時分割)スケジューリングさせる処理である。タイ
ムスライスを実行したくなければ起動しなくてもよい。
FIG. 15 shows a scheduling adjustment mechanism 600.
6 is a flowchart showing a procedure of a timer interrupt process 660 of FIG. This process is started from the timer interrupt process 410 when a timer interrupt occurs. This is a process for performing time slice (time division) scheduling of the tasks linked in the execution waiting queue 770 having the highest priority. If you do not want to execute the time slice, you do not need to start.

【0073】まず、最高優先順位の実行待キュー770
から先頭タスクを取り出し(ステップS661)、同じ
優先順位の実行待キュー770の後尾へ追加する(ステ
ップS662)。スケジューリング処理730を起動す
る(ステップS663)。
First, the highest priority execution wait queue 770
The task is taken out of the queue (step S661) and added to the end of the execution waiting queue 770 having the same priority (step S662). The scheduling process 730 is started (step S663).

【0074】[第2の実施形態]第2の実施形態では、
前述した問題点1〜問題点5を解決するタスクスケジュ
ーリング装置について説明する。図16は第2の実施形
態におけるタスクスケジューリング装置が適用されたシ
ステムの構成を示す図である。第2の実施形態では、前
記第1の実施形態と異なり、共有資源が複数存在する。
共有資源1(200)にはタスクA(300)およびタ
スクB(310)がアクセスし、共有資源2(210)
にはタスクX(340)およびタスクY(350)がア
クセスする。
[Second Embodiment] In the second embodiment,
A task scheduling device that solves the above problems 1 to 5 will be described. FIG. 16 is a diagram illustrating a configuration of a system to which the task scheduling device according to the second embodiment is applied. In the second embodiment, different from the first embodiment, there are a plurality of shared resources.
Task A (300) and task B (310) access shared resource 1 (200), and shared resource 2 (210).
Is accessed by task X (340) and task Y (350).

【0075】図17〜図24は第2の実施形態において
前記第1の実施形態と異なる処理およびデータ構造を持
つ部分だけを示す。図2、図3、図5、図9、図12、
図15は前記第1の実施形態と同様の処理およびデータ
構造である。以降の説明では、図16〜図24、図2、
図3、図5、図9、図12、図15に示したものを使用
し、前記第1の実施形態と同一の構成要素には同一の符
号を使用する。
FIGS. 17 to 24 show only parts having processing and data structures different from those of the first embodiment in the second embodiment. 2, 3, 5, 9, 12,
FIG. 15 shows the same processing and data structure as in the first embodiment. In the following description, FIGS. 16 to 24, FIG.
The components shown in FIGS. 3, 5, 9, 12, and 15 are used, and the same reference numerals are used for the same components as those in the first embodiment.

【0076】図16に示すROM110には、RAM1
00に示される全てのコードおよび初期化データが格納
されている。CPU140にリセットがかかると、シス
テムは立ち上がり時、これらを全てRAM100にコピ
ーし、スケジューリング調整機構600の初期化処理6
10に起動をかける。
The ROM 110 shown in FIG.
All codes and initialization data indicated by 00 are stored. When the CPU 140 is reset, the system copies all of them to the RAM 100 when the system starts up, and initializes the scheduling adjustment mechanism 600 in the initialization processing 6.
Start 10

【0077】初期化処理610では、I/Oインターフ
ェース130およびタイマ150のハードウェアの初期
化を行うことで、I/O割込み処理400およびタイマ
割込み処理410を有効にし、プリエンプトスケジュー
リング機構700の初期化処理720、ラウンドロビン
スケジューリング機構800の初期化処理810によ
り、初期化データ500を基にマルチタスク環境を立ち
上げる。
In the initialization processing 610, the hardware of the I / O interface 130 and the timer 150 is initialized, thereby enabling the I / O interruption processing 400 and the timer interruption processing 410, and initializing the preempt scheduling mechanism 700. In a process 720, an initialization process 810 of the round robin scheduling mechanism 800 starts up a multitask environment based on the initialization data 500.

【0078】この時点で、全共有資源にアクセスしない
タスク群(タスク1(320)、タスク2(330)、
……)および共有資源1(200)にアクセスするタス
ク群(タスクA(300)、タスクB(310)、…
…)のうち1つだけ(タスクA(300))および共有
資源2(210)にアクセスするタスク群(タスクX
(340)、タスクY(350)、……)のうち1つだ
け(タスクX(340))がプリエンプトスケジューリ
ング機構700に登録され、それ以外のタスク群(タス
クB(310)、……およびタスクY(350)、…
…)はラウンドロビンスケジューリング機構800に共
有資源毎にラウンドロビングループを作って登録され
る。
At this point, the task group (task 1 (320), task 2 (330),
..) And a group of tasks accessing the shared resource 1 (200) (task A (300), task B (310),.
..) And a group of tasks (task X) accessing the shared resource 2 (210)
(340), only one of tasks Y (350),...) (Task X (340)) is registered in the preemptive scheduling mechanism 700, and the other tasks (task B (310),. Y (350), ...
..) Are registered in the round robin scheduling mechanism 800 by creating a round robin group for each shared resource.

【0079】プリエンプトスケジューリング機構700
に登録されたタスク群(タスク1(320)、タスク2
(330)……、タスクA(300)、タスクX(34
0))のうち、スケジューリング処理730により実行
待キュー770内で優先順位が最も高く、待ち行列の最
も先頭のタスク1つだけがCPU140を占有して実行
される。
Preemption scheduling mechanism 700
Task group (task 1 (320), task 2
(330)..., Task A (300), task X (34)
Of the tasks 0)), only one task at the top of the queue in the execution queue 770 by the scheduling process 730 occupies the CPU 140 and is executed.

【0080】プリエンプトスケジューリング機構700
に登録されたタスクAが中断状態905に遷移したと
き、ラウンドロビンスケジューリング機構800のラウ
ンドロビングループ[1]841に登録されたタスク群
(タスクB(842)、タスクC(843)……)のう
ち、ラウンドロビングループ[1]841のキューの先
頭のタスク(タスクB842]1つだけを取り出し、プ
リエンプトスケジューリング機構700に追加登録す
る。タスクA(300)は中断状態905が解除された
タイミングで、プリエンプトスケジューリング機構70
0から削除され、タスクB(842)の代わりにラウン
ドロビンスケジューリング機構800のラウンドロビン
グループ[1]841に登録される。
Preempt scheduling mechanism 700
When the task A registered in the task group A transitions to the suspended state 905, the task group (task B (842), task C (843)...) Registered in the round robin group [1] 841 of the round robin scheduling mechanism 800 Of these, only one task (task B842) at the head of the queue of the round robin group [1] 841 is taken out and additionally registered in the preemption scheduling mechanism 700. The task A (300) is released when the suspended state 905 is released. Preempt scheduling mechanism 70
0, and is registered in the round robin group [1] 841 of the round robin scheduling mechanism 800 instead of the task B (842).

【0081】同様にプリエンプトスケジューリング機構
700に登録されたタスクXが中断状態905に遷移し
たとき、ラウンドロビンスケジューリング機構800に
ラウンドロビングループ[2]846に登録されたタス
ク群(タスクY(847)、タスクZ(848)……)
のうち、ラウンドロビングループ(2)846のキュー
の先頭のタスク(タスクY847)1つだけを取り出
し、プリエンプトスケジューリング機構700に追加登
録する。タスクX(340)は中断状態905が解除さ
れたタイミングで、プリエンプトスケジューリング機構
700から削除され、タスクY(847)の代わりにラ
ウンドロビンスケジューリング機構800のラウンドロ
ビングループ[2]846に登録される。
Similarly, when the task X registered in the preemption scheduling mechanism 700 transitions to the suspended state 905, the task group registered in the round robin group [2] 846 (task Y (847), Task Z (848) ...)
Among them, only one task (task Y847) at the head of the queue of the round robin group (2) 846 is extracted and additionally registered in the preemption scheduling mechanism 700. The task X (340) is deleted from the preemption scheduling mechanism 700 at the timing when the suspended state 905 is released, and is registered in the round robin group [2] 846 of the round robin scheduling mechanism 800 instead of the task Y (847).

【0082】このように、共有資源1(200)をアク
セスするタスク群(タスクA(300)、タスクB(3
10)、……)においてはラウンドロビングループ
[1]841でラウンドロビンスケジューリングを用
い、共有資源2(210)をアクセスするタスク群(タ
スクX(340)、タスクY(350)、……)におい
てはラウンドロビングループ[2]846でラウンドロ
ビンスケジューリングを用い、共有資源と無関係なタス
ク群(タスク1(320)、タスク2(330)、…
…)においてはプリエンプト(横取り)スケジューリン
グを用い、これら3者のタスク群の間ではプリエンプト
(横取り)スケジューリングを行う。
As described above, the task group (task A (300), task B (3) accessing the shared resource 1 (200)
10),...) Use round-robin scheduling in the round-robin group [1] 841 to execute a task group (task X (340), task Y (350),...) Accessing the shared resource 2 (210). Use round-robin scheduling in a round-robin group [2] 846, and use a task group (task 1 (320), task 2 (330),.
..) Uses preemptive scheduling, and preemptive scheduling is performed between these three task groups.

【0083】以下に、第2の実施形態のタスクスケジュ
ーリング装置の構成および動作を、図面に基づいて詳細
に説明するが、前記第1の実施形態と異なる箇所につい
て詳細に説明する。
Hereinafter, the configuration and operation of the task scheduling apparatus according to the second embodiment will be described in detail with reference to the drawings, but different points from the first embodiment will be described in detail.

【0084】図17はラウンドロビンスケジューリング
機構800の構成を示す図である。ラウンドロビンスケ
ジューリング機構800が装備する処理801は、初期
化処理810、指定ラウンドロビンキュー後尾へ追加処
理832、指定ラウンドロビンキューからの取得処理8
33である。また、タスクスケジューリングを実現する
ためにラウンドロビンキュー840を保持している。
FIG. 17 is a diagram showing the configuration of the round robin scheduling mechanism 800. The processing 801 provided in the round robin scheduling mechanism 800 includes an initialization processing 810, an addition processing 832 to the tail of the designated round robin queue, and an acquisition processing 8 from the designated round robin queue.
33. Further, a round robin queue 840 is held to implement task scheduling.

【0085】ラウンドロビンキュー840は、ラウンド
ロビン待状態904のタスクのTCB750を共有資源
毎にリストに保持し、その並び順をラウンドロビングル
ープ毎(ラウンドロビングループ[1]841、ラウン
ドロビングループ[2]846、ラウンドロビングルー
プ[3]851)に待ち行列としてFIFOのキューと
して管理する。
The round robin queue 840 holds the TCBs 750 of the tasks in the round robin waiting state 904 in a list for each shared resource, and arranges the arrangement order for each round robin group (round robin group [1] 841, round robin group [2]). ] 846, the queue is managed as a queue in the round robin group [3] 851) as a FIFO queue.

【0086】図18は初期化データの構成を示す図であ
る。初期化データ500は全タスク数510、全共有資
源グループ数511および全タスク情報540を含んで
格納されている。全タスク情報540は、各タスク毎に
タスクの実行アドレス(PC)、優先順位、共有資源ア
クセスグループ(541−551)を含んで格納されて
いる。共有資源アクセスグループ(541−551)に
は共有資源毎にグループ番号が割り振られ、タスクA−
C(541−543)には値1、タスクX−Z(544
−546)には値2、タスクI−K(547−549)
には値3、アクセスしないタスク1−2(550−55
1)には値0をセットする。
FIG. 18 shows the structure of the initialization data. The initialization data 500 includes a total number of tasks 510, a total number of shared resource groups 511, and all task information 540. The all task information 540 is stored for each task including the task execution address (PC), priority, and shared resource access group (541-551). A group number is assigned to the shared resource access group (541-551) for each shared resource.
C (541-543) has the value 1, task XZ (544)
-546) has the value 2, task IK (547-549)
Has a value of 3, and the task 1-2 not to access (550-55)
The value 0 is set in 1).

【0087】図19は共有資源管理テーブルを示す図で
ある。共有資源管理テーブル680は、共有資源毎(グ
ループ[1]691、グループ[2]694、グループ
[3]697)にグループ分けされた形で、実行待キュ
ー770にリンクされている共有資源をアクセスするタ
スクの数を表す実行待共有資源アクセスタスク数69
2,695,698およびラウンドロビングループ(共
有資源)毎にラウンドロビンキュー840にリンクされ
ているタスクの数を表すラウンドロビン待タスク数69
3,696,699を含んで格納されている。
FIG. 19 shows a shared resource management table. The shared resource management table 680 accesses the shared resources linked to the execution waiting queue 770 in the form of grouping by shared resources (group [1] 691, group [2] 694, group [3] 697). Number of tasks waiting to execute shared resources 69 representing the number of tasks to be executed
2, 695, 698 and the number of tasks waiting for round robin 69 representing the number of tasks linked to the round robin queue 840 for each round robin group (shared resource)
3,696,699.

【0088】図20はタスクコントロールブロックの構
成を示す図である。TCB(タスクコントロールブロッ
ク)750は、タスクID752、タスクアドレス(P
C)753、タスクスタックアドレス(SP)754、
優先順位755、タスク状態756、リンクポインタ7
57、共有資源アクセスグループ765、その他の付加
情報759を含んで格納されている。
FIG. 20 is a diagram showing the configuration of the task control block. The TCB (task control block) 750 includes a task ID 752, a task address (P
C) 753, task stack address (SP) 754,
Priority 755, task status 756, link pointer 7
57, a shared resource access group 765, and other additional information 759.

【0089】TCB750は各タスク毎にデータを保持
し、TCB[0]751、TCB[1]760、TCB
[2]761およびプリエンプトスケジューリング機構
700のデータとして保持されている。
The TCB 750 holds data for each task, and includes TCB [0] 751, TCB [1] 760, TCB
[2] It is held as data of 761 and the preemption scheduling mechanism 700.

【0090】タスク状態756の取り得る値は初期状態
902、実行待状態903、実行状態901、中断状態
905、ラウンドロビン待状態904である。状態遷移
およびその発生要因は図5に示す通りである。
The possible values of the task state 756 are an initial state 902, an execution wait state 903, an execution state 901, an interruption state 905, and a round robin wait state 904. The state transition and the cause of occurrence are as shown in FIG.

【0091】図21はプリエンプトスケジューリング機
構700の初期化処理720の手順を示すフローチャー
トである。この処理はスケジューリング調整機構600
の初期化処理610から1度だけコールされる。
FIG. 21 is a flowchart showing the procedure of the initialization process 720 of the preemption scheduling mechanism 700. This processing is performed by the scheduling adjustment mechanism 600.
Is called only once from the initialization process 610.

【0092】まず、初期化データ500の情報を基に各
タスクのTCB750の初期化(TCB[0]−TCB
[10](タスク1−3,A−C,X−Z,I−J))
を行う(ステップS721A)。このステップS721
Aの処理では、初期化データ500の全タスク数510
を基に全TCBの領域をRAM100に確保する(72
1a)。初期化データ500の全タスク情報520を基
にTCB750内のタスクアドレス(PC)753/優
先順位755/共有資源アクセスグループ765の値を
セットする(721b)。
First, the TCB 750 of each task is initialized (TCB [0] -TCB) based on the information of the initialization data 500.
[10] (Task 1-3, AC, XZ, IJ))
Is performed (step S721A). This step S721
In the process A, the total number of tasks 510
All TCB areas are secured in the RAM 100 based on
1a). Based on all task information 520 of the initialization data 500, the values of the task address (PC) 753 / priority 755 / shared resource access group 765 in the TCB 750 are set (721b).

【0093】タスクID752を割り振り、タスクスタ
ックの領域をRAM100に確保し、スタックポインタ
をタスクスタックアドレス(SP)754にセットする
(721c)。全TCBのタスク状態756を実行待状
態903にセットする(721d)。その他の付加情報
759があれば初期化する(721e)。
A task ID 752 is allocated, a task stack area is secured in the RAM 100, and a stack pointer is set to a task stack address (SP) 754 (721c). The task state 756 of all TCBs is set to the execution waiting state 903 (721d). If there is other additional information 759, it is initialized (721e).

【0094】TCB[0]からTCB[全タスク数(5
10)−1]まで以下の処理を繰り返す(ステップS7
22A)。TCB750の共有資源アクセスグループ7
65が値0である共有資源にアクセスしないタスクのT
CB(タスク1,2,3)アドレスを優先順位755に
対応する実行待キュー770の後尾に追加する。
From TCB [0] to TCB [total number of tasks (5
The following processing is repeated until 10) -1] (Step S7)
22A). TCB750 Shared Resource Access Group 7
T of a task that does not access a shared resource whose value 65 is 0
The CB (task 1, 2, 3) address is added to the tail of the execution wait queue 770 corresponding to the priority 755.

【0095】現実行タスク703をアイドルタスクとす
る(ステップS723)。I/Oインタフェースおよび
タイマを初期化し、同じ優先順位のタイムスライススケ
ジューリングを必要とする場合、タイマ割込みベクタに
タイマ割込み処理660を登録する(ステップS72
4)。この後、呼び出し元にリターンする。
The currently executed task 703 is set as an idle task (step S723). When the I / O interface and the timer are initialized and time slice scheduling of the same priority is required, the timer interrupt processing 660 is registered in the timer interrupt vector (step S72).
4). Thereafter, the process returns to the caller.

【0096】図22はラウンドロビンスケジューリング
機構800の初期化処理810の手順を示すフローチャ
ートである。この処理はスケジューリング調整機構60
0の初期化処理610から1度だけコールされる。ま
ず、以降の処理全てをループカウンタCount2=1
からCount2=全共有資源グループ数511まで繰
り返したか否かを判別する(ステップS810A)。繰
り返した場合、そのままリターンし、繰り返していない
場合、ループカウンタCountを値0に初期化する
(ステップS811)。グループ[Count2]のラ
ウンドロビン待タスク数(693、696あるいは69
9)を値0に初期化する(ステップS812)。
FIG. 22 is a flowchart showing the procedure of the initialization process 810 of the round robin scheduling mechanism 800. This processing is performed by the scheduling adjustment mechanism 60.
Called only once from the initialization process 610 of 0. First, all the subsequent processing is performed with the loop counter Count2 = 1.
It is determined whether or not the process has been repeated up to Count2 = the total number of shared resource groups 511 (step S810A). If the process has been repeated, the process returns as it is. If the process has not been repeated, the loop counter Count is initialized to 0 (step S811). Number of round robin waiting tasks (693, 696, or 69) in group [Count2]
9) is initialized to a value 0 (step S812).

【0097】TCB[0]からTCB[全タスク数(5
10)−1]まで以下の処理を繰り返す(ステップS8
13)。TCB[Count]の共有資源アクセスグル
ープ765が値0でない(共有資源にアクセスするタス
ク)か否かを判別する(ステップS814)。値0であ
る場合、ループを終了し、ステップS816に移行す
る。TCB[Count]の共有資源アクセスグループ
765が値0でない場合、Countをインクリメント
する(ステップS815)。
From TCB [0] to TCB [total number of tasks (5
The following processing is repeated until 10) -1] (Step S8)
13). It is determined whether the value of the shared resource access group 765 of TCB [Count] is not 0 (task for accessing the shared resource) (step S814). If the value is 0, the loop ends and the process moves to step S816. If the value of the shared resource access group 765 of TCB [Count] is not 0, Count is incremented (step S815).

【0098】最初に見つかった共有資源をアクセスする
タスクを示すTCB[Count]を優先順位755に
対応する実行待キュー770の後尾に追加する(ステッ
プS816)。ループカウンタCountをインクリメ
ントする(ステップS817)。グループ[Count
2]の実行待共有資源アクセスタスク数(692、69
5あるいは698)に値1をセットする(ステップS8
18)。
The TCB [Count] indicating the task that accesses the shared resource found first is added to the end of the execution wait queue 770 corresponding to the priority 755 (step S816). The loop counter Count is incremented (step S817). Group [Count
2] waiting shared resource access task number (692, 69
5 or 698) is set to the value 1 (step S8).
18).

【0099】ラウンドロビンキュー840に残りの共有
資源をアクセスするタスク群を追加するため、TCB
[Count]からTCB[(全タスク数510)−
1]まで以下の処理を繰り返す(ステップS819)。
TCB[Count]の共有資源アクセスグループ76
5が値0でない(共有資源にアクセスするタスク)か否
かを判別する(ステップS820)。
To add a task group for accessing the remaining shared resources to the round robin queue 840, the TCB
From [Count] to TCB [(total number of tasks 510)-
1] is repeated (step S819).
TCB [Count] shared resource access group 76
It is determined whether 5 is not the value 0 (task for accessing the shared resource) (step S820).

【0100】値0でない場合、TCB[Count]の
タスク状態756をラウンドロビン待904とし、ラウ
ンドロビングループ[Count2]のラウンドロビン
キュー(841、846あるいは851)の後尾へ追加
し(ステップS821)、グループ[Count2]の
ラウンドロビン待タスク数(693、696あるいは6
99)をインクリメントし(ステップS822)、ルー
プカウンタCountをインクリメントする(ステップ
S823)。TCB[Count]の共有資源アクセス
グループ765が値0ならば、Countをインクリメ
ントする(ステップS823)。そして、ステップS8
10AでCount2=全共有資源グループ数511ま
で繰り返した場合、呼び出し元にリターンする。
If the value is not 0, the task state 756 of the TCB [Count] is set to the round robin wait 904 and added to the end of the round robin queue (841, 846 or 851) of the round robin group [Count2] (step S821). Number of round-robin waiting tasks in group [Count2] (693, 696 or 6
99) is incremented (step S822), and the loop counter Count is incremented (step S823). If the value of the shared resource access group 765 of TCB [Count] is 0, Count is incremented (step S823). Then, step S8
When the processing is repeated up to Count2 = the total number of shared resource groups 511 at 10A, the process returns to the caller.

【0101】図23はスケジューリング調整機構600
の中断処理620の手順を示すフローチャートである。
この処理はタスクから任意に起動される。指定タスクを
中断状態905に遷移させる処理である。まず、指定し
た中断タスクのTCB750内の共有資源アクセスグル
ープ765が値0に等しくないか否かを判別する(ステ
ップS621)。値0に等しければ、中断すべきタスク
は共有資源にアクセスしないタスクなので、中断タスク
のTCB750を実行待キュー770から取り出し(ス
テップS622)、中断キュー790の後尾に追加し、
タスク状態756を中断状態905にし(ステップS6
23)、スケジューリング処理730を起動する(ステ
ップ623A)。
FIG. 23 shows the scheduling adjustment mechanism 600.
Is a flowchart showing the procedure of the interruption process 620 of FIG.
This process is arbitrarily started from a task. This is a process of transitioning the designated task to the suspended state 905. First, it is determined whether or not the value of the shared resource access group 765 in the TCB 750 of the specified suspended task is not equal to 0 (step S621). If the value is equal to 0, the task to be interrupted is a task that does not access the shared resource. Therefore, the TCB 750 of the interrupted task is removed from the execution queue 770 (step S622), and added to the end of the interrupt queue 790,
The task state 756 is changed to the suspended state 905 (step S6
23), start the scheduling process 730 (step 623A).

【0102】指定した中断タスクのTCB750内の共
有資源アクセスフラグ758が値0に等しくなければ、
中断すべきタスクは共有資源にアクセスするタスクであ
るので、中断タスクのTCBを実行待キュー770から
取り出し(ステップS624)、グループ[共有資源グ
ループ765]の実行待共有資源アクセスタスク数(6
92、695あるいは698)に値0をセットし(ステ
ップS625)、ステップS624で取り出したTCB
を中断キュー790の後尾に追加し、タスク状態756
を中断状態905にする(ステップS626)。
If the shared resource access flag 758 in the TCB 750 of the specified suspended task is not equal to the value 0,
Since the task to be interrupted is a task that accesses a shared resource, the TCB of the interrupted task is taken out of the queue for execution 770 (step S624), and the number of shared resource access tasks waiting for execution of the group [shared resource group 765] (6
92, 695 or 698) to 0 (step S625), and the TCB extracted in step S624.
Is added to the end of the suspend queue 790, and the task state 756 is added.
To the suspended state 905 (step S626).

【0103】グループ[共有資源グループ765]のラ
ウンドロビン待タスク数(693、696あるいは69
9)が値0に等しいか否かを判別する(ステップS62
7)。値0に等しければ、特にラウンドロビン待状態9
04のタスクは存在しないので、スケジューリング処理
730を起動する(ステップS632)。 一方、ステ
ップS627で値0に等しくなければ、指定した共有資
源をアクセスするタスクが実行待状態903から中断状
態905に遷移したために、新たにラウンドロビン待状
態904の共有資源をアクセスするタスク群のうちから
1タスクを実行待状態903に遷移させる。まず、ラウ
ンドロビングループ[共有資源グループ765]のラウ
ンドロビンキュー(841、846あるいは851)の
先頭タスク(842、847あるいは852)のTCB
750を取り出し(ステップS628)、グループ[共
有資源グループ765]のラウンドロビン待タスク数
(693、696あるいは699)をデクリメントし
(ステップS629)、ステップS628で取り出した
TCBを該当する優先順位755の実行待キュー770
の後尾へ追加し、タスク状態756を実行待状態903
にする(ステップS630)。
The number of round-robin waiting tasks (693, 696 or 69) in the group [shared resource group 765]
It is determined whether or not (9) is equal to the value 0 (step S62).
7). If the value is equal to 0, in particular, the round robin wait state 9
Since the task 04 does not exist, the scheduling process 730 is started (step S632). On the other hand, if the value is not equal to 0 in step S627, the task that accesses the specified shared resource has transitioned from the execution wait state 903 to the suspended state 905, and the task group that newly accesses the shared resource in the round robin wait state 904 One of the tasks is shifted to the execution waiting state 903. First, the TCB of the first task (842, 847 or 852) of the round robin queue (841, 846 or 851) of the round robin group [shared resource group 765].
750 is extracted (step S628), the number of round-robin waiting tasks (693, 696 or 699) of the group [shared resource group 765] is decremented (step S629), and the TCB extracted in step S628 is executed with the corresponding priority 755. Wait queue 770
And the task state 756 is placed in the execution waiting state 903.
(Step S630).

【0104】グループ[共有資源グループ765]の実
行待共有資源アクセスタスク数(692、695あるい
は698)に値1をセットする(ステップS631)。
スケジューリング処理730を起動する(ステップS6
32)。
The value 1 is set to the number of tasks (692, 695 or 698) waiting for execution of the shared resource of the group [shared resource group 765] (step S631).
Activate the scheduling process 730 (step S6)
32).

【0105】図24はスケジューリング調整機構600
の中断解除処理640の手順を示すフローチャートであ
る。この処理はタスクまたはI/O割込み処理から任意
に起動される。指定タスクを中断状態905から実行待
状態903またはラウンドロビン待状態904に遷移さ
せる処理である。
FIG. 24 shows a scheduling adjustment mechanism 600.
9 is a flowchart showing the procedure of the interruption release processing 640 of FIG. This process is arbitrarily started from a task or I / O interrupt process. This is a process of transitioning the designated task from the suspended state 905 to the execution waiting state 903 or the round robin waiting state 904.

【0106】まず、指定した中断状態を解除したいタス
クのTCB750内の共有資源グループ765が値0に
等しくないか否かを判別する(ステップS641)。値
0に等しければ、中断状態を解除すべきタスクは共有資
源にアクセスしないタスクであるので、中断タスクのT
CB750を中断キュー790から取り出し(ステップ
S642)、該当する優先順位755の実行待キュー7
70の後尾へ追加し、タスク状態756を実行待状態9
03にし(ステップS643)、スケジューリング処理
730を起動する(ステップS643A)。
First, it is determined whether or not the value of the shared resource group 765 in the TCB 750 of the task to be released from the specified suspended state is not equal to 0 (step S641). If the value is equal to 0, the task whose suspension state should be released is a task that does not access the shared resource,
The CB 750 is taken out of the suspension queue 790 (step S642), and the execution waiting queue 7 of the corresponding priority 755 is taken.
70 is added to the end, and the task state 756 is in the execution waiting state 9
03 (step S643), and activates the scheduling process 730 (step S643A).

【0107】指定した中断状態を解除したいタスクのT
CB750内の共有資源アクセスグループ765が値0
に等しくなければ、中断すべきタスクは共有資源にアク
セスするタスクであるので、中断タスクのTCB750
を中断キュー790から取り出す(ステップS64
4)。グループ[共有資源グループ765]のラウンド
ロビン待タスク数(693、696あるいは699)が
値0に等しいか否かを判別する(ステップS645)。
値0に等しくなければ、ラウンドロビン待状態904の
タスクが既に存在するので、ステップS644で取り出
したTCBをラウンドロビングループ[Count2]
のラウンドロビンキュー(841、846あるいは85
1)の後尾へ追加し、タスク状態756をラウンドロビ
ン待状態904にし(ステップS647)、グループ
[共有資源グループ765]のラウンドロビン待タスク
数(693、696あるいは699)をインクリメント
(ステップS648)、リターンする。
[0107] The T of the task for which the specified suspended state is to be released
Shared resource access group 765 in CB 750 has value 0
If not, the task to be interrupted is the task that accesses the shared resource, so the interrupted task TCB 750
From the suspend queue 790 (step S64)
4). It is determined whether or not the number of round robin waiting tasks (693, 696, or 699) of the group [shared resource group 765] is equal to the value 0 (step S645).
If the value is not equal to 0, a task in the round robin waiting state 904 already exists, and the TCB extracted in step S644 is stored in the round robin group [Count2].
Round robin queue (841, 846 or 85
1) The task state 756 is added to the tail, the task state 756 is set to the round robin waiting state 904 (step S647), and the number of round robin waiting tasks (693, 696 or 699) of the group [shared resource group 765] is incremented (step S648). To return.

【0108】ステップS645で値0に等しければ、ラ
ウンドロビン待状態904のタスクは存在しないので、
グループ[共有資源グループ765]の実行待共有資源
アクセスタスク数(692、695あるいは698)が
値0に等しいか否かを判別する(ステップS646)。
If the value is equal to 0 in step S645, there is no task in the round-robin waiting state 904, so that
It is determined whether or not the number of tasks (692, 695 or 698) waiting for execution of the shared resource of the group [shared resource group 765] is equal to the value 0 (step S646).

【0109】値0に等しくなければ、既に共有資源グル
ープ765のタスク群のうちから1タスクが実行待状態
903であるため、ステップS644で取り出したTC
Bをラウンドロビングループ[Count2]のラウン
ドロビンキュー(841、846あるいは851)の後
尾へ追加し、タスク状態756をラウンドロビン待状態
904にし(ステップS647)、グループ[共有資源
グループ765]のラウンドロビン待タスク数(69
3、696あるいは699)をインクリメントし(ステ
ップS648)、リターンする。
If the value is not equal to 0, one of the tasks in the shared resource group 765 is already in the execution waiting state 903, and the TC extracted in step S644
B is added to the end of the round robin queue (841, 846 or 851) of the round robin group [Count2], the task state 756 is set to the round robin waiting state 904 (step S647), and the round robin of the group [shared resource group 765] is set. Number of waiting tasks (69
3, 696 or 699) (step S648), and the process returns.

【0110】ステップS646で値0に等しければ、共
有資源グループ765のタスク群のうち、実行待状態9
03のタスクは存在しないので、ステップS644で取
り出したTCBを該当する優先順位755の実行待キュ
ー770の後尾へ追加し、タスク状態756を実行待状
態903にする(ステップS649)。グループ[共有
資源グループ765]の実行待共有資源アクセスタスク
数(692、695あるいは698)に値1をセットす
る(ステップS650)。スケジューリング処理730
を起動する(ステップS651)。
If it is determined in step S646 that the value is equal to 0, of the tasks in the shared resource group 765, the execution waiting state 9
Since the task 03 does not exist, the TCB extracted in step S644 is added to the tail of the execution waiting queue 770 of the corresponding priority 755, and the task state 756 is changed to the execution waiting state 903 (step S649). The value 1 is set to the number of tasks (692, 695 or 698) waiting for execution of the shared resource of the group [shared resource group 765] (step S650). Scheduling process 730
Is started (step S651).

【0111】[第3の実施形態]第3の実施形態では、
前述した問題点1〜問題点4を解決するタスクスケジュ
ーリング装置について説明する。これは、前記第2の実
施形態における図16の共有資源にアクセスしないタス
ク(タスク1(320)、タスク2(330))を除い
たケースに相当する。したがって、図18の初期化デー
タ500において、タスク1とタスク2に関するタスク
情報(550および551)を削除してやれば、その他
は第2の実施形態と同等の処理で実現することができ
る。
[Third Embodiment] In the third embodiment,
A task scheduling device that solves the above-described problems 1 to 4 will be described. This corresponds to the case of FIG. 16 excluding the tasks (task 1 (320) and task 2 (330)) that do not access the shared resources in the second embodiment. Therefore, if the task information (550 and 551) relating to task 1 and task 2 is deleted from the initialization data 500 in FIG. 18, the other operations can be realized by the same processing as in the second embodiment.

【0112】尚、立ち上げ時のコードおよび初期化デー
タ500の格納場所をROM110ではなく、フロッピ
ーディスクやハードディスクなどの記録媒体に置き換え
てもよい。
The storage location of the startup code and initialization data 500 may be replaced with a recording medium such as a floppy disk or hard disk instead of the ROM 110.

【0113】また、共有資源としては、変数データだけ
でなく、ハードディスクやCD−ROMドライブ、RS
−232C、PIOなどの通信ポートに応用すること
で、容易にシステムの信頼性および性能を最大限に高め
て複数のタスクから資源を共有することが可能になる。
The shared resources include not only variable data but also a hard disk, CD-ROM drive, RS
Application to communication ports such as -232C and PIO makes it possible to easily share resources from a plurality of tasks while maximizing the reliability and performance of the system.

【0114】さらに、共有資源としては、オブジェクト
指向言語の「クラス」に対応させることが容易であり、
オブジェクト指向言語で記述したシステムの信頼性およ
び性能を最大限に高めてマルチタスクシステムとして実
装することが可能になる。
Further, as a shared resource, it is easy to correspond to a "class" of an object-oriented language.
The reliability and performance of a system described in an object-oriented language can be maximized and implemented as a multitask system.

【0115】[0115]

【発明の効果】本発明の請求項1に記載のタスクスケジ
ューリング装置によれば、前述した問題点1〜問題点4
を解決することができる。
According to the task scheduling apparatus of the first aspect of the present invention, the above-mentioned problems 1 to 4
Can be solved.

【0116】即ち、スケジューリング調整機構によっ
て、共有資源と無関係な全てのタスクおよび共有資源に
アクセスするタスクのうちから1つをプリエンプトスケ
ジューリング機構に登録し、残った共有資源にアクセス
するタスク全てをラウンドロビンスケジューリング機構
に順序付けて登録し、プリエンプトスケジューリング機
構によるスケジューリングで共有資源にアクセスするタ
スクが実行権を放棄(中断状態に遷移)した時、ラウン
ドロビンスケジューリング機構に順序付けて登録された
共有資源にアクセスするタスクのうち先頭のものと入れ
替え、この際、中断状態に遷移したタスクを中断要因が
解除された時にラウンドロビンスケジューリング機構の
順序付けの最後尾に登録することが可能になる。したが
って、共有資源をアクセスしているタスクがCPUを占
有して実行し続けても、共有資源と無関係なタスクはプ
リエンプト(横取り)可能であるので、共有資源をアク
セスしているタスクより優先順位が高かったり、同じ優
先順位でもタイムスライスによりタスクスイッチが生
じ、CPU占有権を得て実行され、システム全体に影響
を及ぼさないようにすることができ、前述した問題点4
を解決できる。
That is, the scheduling coordinating mechanism registers one of all tasks irrelevant to the shared resource and the task accessing the shared resource in the preemption scheduling mechanism, and all the tasks accessing the remaining shared resources are round-robin. A task that accesses the shared resources registered in order in the round-robin scheduling mechanism when the task that accesses the shared resources by scheduling by the preemption scheduling mechanism relinquishes the execution right (transition to the suspended state). In this case, the task that has transitioned to the suspended state can be registered at the end of the ordering of the round-robin scheduling mechanism when the cause of suspension is released. Therefore, even if the task accessing the shared resource occupies the CPU and continues to execute the task, the task unrelated to the shared resource can be preempted (preempted), and therefore has a higher priority than the task accessing the shared resource. Even if the priority is high or the priority is the same, a task switch occurs due to the time slice, the CPU is executed with the exclusive right of the CPU, and it is possible to prevent the whole system from being affected.
Can be solved.

【0117】また、共有資源にアクセスするタスク群で
は、ラウンドロビンスケジューリングを用いることで、
セマフォによる排他制御を不要とし、その際のオーバー
ヘッドをなくすことができ、前述した問題点1を解決で
きる。
In the task group accessing the shared resource, the round robin scheduling is used to
Exclusion control by the semaphore is not required, overhead at that time can be eliminated, and the aforementioned problem 1 can be solved.

【0118】さらに、複雑なデータ構造もデータ構造全
体を1つの共有資源とし、共有資源とタスクとの関係を
1対多の関係で定義することを可能にしたことで、細か
い共有資源の切り出しを不要にでき、前述した問題点2
を解決できる。
Further, even for a complicated data structure, the entire data structure is regarded as one shared resource, and the relationship between the shared resource and the task can be defined in a one-to-many relationship. Problem 2 mentioned above
Can be solved.

【0119】また、連続したデータアクセスが必要な場
合もそれらを1つの共有資源として扱うことができ、デ
ッドロックの危険性をなくすことができ、前述した問題
点3を解決できる。
Also, when continuous data access is required, they can be handled as one shared resource, the danger of deadlock can be eliminated, and problem 3 described above can be solved.

【0120】尚、請求項4に記載のタスクスケジューリ
ング方法においても同様の効果を得ることがてきる。
The same effect can be obtained in the task scheduling method according to the fourth aspect.

【0121】請求項2に記載のタスクスケジューリング
装置によれば、前述した問題点1〜問題点3および問題
点5を解決できる。
According to the task scheduling apparatus of the second aspect, the above problems 1 to 3 and 5 can be solved.

【0122】即ち、スケジューリング調整機構によっ
て、共有資源毎にアクセスするタスク群をタスクグルー
プとして切り分けて管理し、各タスクグループのうちか
ら1タスクずつプリエンプトスケジューリング機構に登
録し、残った共有資源にアクセスするタスク全てをタス
クグループ毎にラウンドロビンスケジューリング機構に
順序付けて登録し、プリエンプトスケジューリング機構
によるスケジューリングで、あるタスクグループ(該当
タスクグループ)に属するタスクが実行権を放棄(中断
状態に遷移)した時、ラウンドロビンスケジューリング
機構にタスクグループ毎に順序付けて登録されたタスク
のうち、該当タスクグループ内の順序付けの先頭のもの
と入れ替え、この際、中断状態に遷移したタスクを中断
要因が解除された時にラウンドロビンスケジューリング
機構のうち、該当タスクグループ内の順序付けの最後尾
に登録することが可能になる。したがって、複数の共有
資源がある場合、タイムスライスによるプリエンプト
(横取り)スケジューリングによって、それぞれの共有
資源毎の累積アクセス時間を均等に割り振ることがで
き、前述した問題点5を解決できる。
That is, a task group to be accessed for each shared resource is divided and managed by the scheduling adjustment mechanism as a task group, and one task from each task group is registered in the preemption scheduling mechanism, and the remaining shared resources are accessed. All the tasks are registered in order in the round robin scheduling mechanism for each task group, and when a task belonging to a certain task group (applicable task group) relinquishes its execution right (transition to a suspended state) by scheduling by the preemption scheduling mechanism, a round is performed. Replaces the tasks registered in the Robin Scheduling Order with the order of each task group with the first in the order in the corresponding task group. Of round-robin scheduling mechanism, it is possible to register at the end of the ordering in the corresponding task group. Therefore, when there are a plurality of shared resources, the accumulated access time for each of the shared resources can be evenly allocated by preemption (preemption) scheduling by time slice, and the above-mentioned problem 5 can be solved.

【0123】また、共有資源にアクセスするタスク群で
はラウンドロビンスケジューリングを用いることで、セ
マフォによる排他制御を不要とし、その際のオーバーヘ
ッドをなくすことができ、前述した問題点1を解決でき
る。
Further, by using round-robin scheduling in a task group accessing a shared resource, semaphore exclusion control is not required, overhead at that time can be eliminated, and Problem 1 described above can be solved.

【0124】さらに、複雑なデータ構造もデータ構造全
体を1つの共有資源とし、共有資源とタスクとの関係を
1対多の関係で定義することを可能にしたことで、細か
い共有資源の切り出しを不要にでき、前述した問題点2
を解決できる。
Further, even for a complicated data structure, the entire data structure is used as one shared resource, and the relationship between the shared resource and the task can be defined in a one-to-many relationship. Problem 2 mentioned above
Can be solved.

【0125】また、連続したデータアクセスが必要な場
合もそれらを1つの共有資源として扱うことができ、デ
ッドロックの危険性をなくすことができ、前述した問題
点3を解決できる。
Also, when continuous data access is required, they can be handled as one shared resource, the risk of deadlock can be eliminated, and problem 3 described above can be solved.

【0126】尚、請求項5に記載のタスクスケジューリ
ング方法においても、同様の効果を得ることができる。
The same effect can be obtained in the task scheduling method according to the fifth aspect.

【0127】請求項3に記載のタスクスケジューリング
装置によれば、前述した問題点1〜問題点5を解決する
ことがてきる。
According to the task scheduling device of the third aspect, the above problems 1 to 5 can be solved.

【0128】即ち、スケジューリング調整機構によっ
て、共有資源毎にアクセスするタスク群をタスクグルー
プとして切り分けて管理し、各タスクグループのうちか
ら1タスクずつプリエンプトスケジューリング機構に登
録し、残った共有資源にアクセスするタスク全てをタス
クグループ毎にラウンドロビンスケジューリング機構に
順序付けて登録し、プリエンプトスケジューリング機構
によるスケジューリングで、あるタスクグループ(該当
タスクグループ)に属するタスクが実行権を放棄(中断
状態に遷移)した時、ラウンドロビンスケジューリング
機構にタスクグループ毎に順序付けて登録されたタスク
のうち、該当タスクグループ内の順序付けの先頭のもの
と入れ替え、この際、中断状態に遷移したタスクを中断
要因が解除された時にラウンドロビンスケジューリング
機構のうち、該当タスクグループ内の順序付けの最後尾
に登録することが可能になる。したがって、複数の共有
資源がある場合、タイムスライスによるプリエンプト
(横取り)スケジューリングによって、それぞれの共有
資源毎の累積アクセス時間を均等に割り振ることがで
き、前述した問題点5を解決できる。
That is, the task group to be accessed for each shared resource is divided and managed by the scheduling adjustment mechanism as a task group, and one task from each task group is registered in the preemption scheduling mechanism, and the remaining shared resources are accessed. All the tasks are registered in order in the round robin scheduling mechanism for each task group, and when a task belonging to a certain task group (applicable task group) relinquishes its execution right (transition to a suspended state) by scheduling by the preemption scheduling mechanism, a round is performed. Replaces the tasks registered in the Robin Scheduling Order with the order of each task group with the first in the order in the corresponding task group. Of round-robin scheduling mechanism, it is possible to register at the end of the ordering in the corresponding task group. Therefore, when there are a plurality of shared resources, the accumulated access time for each of the shared resources can be evenly allocated by preemption (preemption) scheduling by time slice, and the above-mentioned problem 5 can be solved.

【0129】また、共有資源をアクセスしているタスク
がCPUを占有して実行し続けても、共有資源と無関係
なタスクはプリエンプト(横取り)可能であるので、共
有資源をアクセスしているタスクより優先順位が高かっ
たり、同じ優先順位でもタイムスライスによりタスクス
イッチが生じ、CPU占有権を得て実行され、システム
全体に影響を及ぼさないようにすることができ、前述し
た問題点4を解決できる。
Further, even if the task accessing the shared resource occupies the CPU and keeps executing, the task unrelated to the shared resource can be preempted (preempted). Even if the priority is high or the same priority is given, a task switch occurs due to time slicing, the CPU is executed with the exclusive right of the CPU, so that the entire system can be prevented from being affected, and the problem 4 described above can be solved.

【0130】さらに、共有資源にアクセスするタスク群
では、ラウンドロビンスケジューリングを用いること
で、セマフォによる排他制御を不要とし、その際のオー
バーヘッドをなくすことができ、前述した問題点1を解
決できる。
Furthermore, in the task group accessing the shared resource, the use of round-robin scheduling eliminates the need for semaphore exclusive control and eliminates the overhead in that case, and can solve the above-described problem 1.

【0131】また、複雑なデータ構造もデータ構造全体
を1つの共有資源とし、共有資源とタスクとの関係を1
対多の関係で定義することを可能にしたことで、細かい
共有資源の切り出しを不要にでき、前述した問題点2を
解決できる。
Further, even for a complicated data structure, the entire data structure is used as one shared resource, and the relationship between the shared resource and the task is defined as one.
By making it possible to define the relationship in a many-to-many relationship, it is not necessary to cut out a fine shared resource, and the problem 2 described above can be solved.

【0132】さらに、連続したデータアクセスが必要な
場合もそれらを1つの共有資源として扱うことができ、
デッドロックの危険性をなくすことができ、前述した問
題点3を解決できる。
Further, even when continuous data access is required, they can be handled as one shared resource.
The risk of deadlock can be eliminated, and the aforementioned problem 3 can be solved.

【0133】尚、請求項6に記載のタスクスケジューリ
ング方法においても、同様の効果を得ることができる。
The same effect can be obtained in the task scheduling method according to the sixth aspect.

【0134】このように、共有資源をアクセスしている
タスクがCPUを占有して実行し続けても、共有資源と
無関係なタスクはプリエンプト(横取り)可能であるた
め、共有資源をアクセスしているタスクより優先順位が
高かったり、同じ優先順位てもタイムスライスによりタ
スクスイッチが生じ、CPU占有権を得て実行され、シ
ステム全体に影響を及ぼさないようにすることができ、
システムの信頼性を高めることが可能である。
As described above, even if the task accessing the shared resource occupies the CPU and continues to execute the task, the task unrelated to the shared resource can be preempted (preempted), so the shared resource is accessed. A task switch occurs due to a time slice having a higher priority than a task or the same priority, and is executed with CPU exclusive right, so that it does not affect the entire system,
It is possible to increase the reliability of the system.

【0135】また、複数の共有資源がある場合、タイム
スライスによるプリエンプト(横取り)スケジューリン
グによってそれぞれの共有資源毎の累積アクセス時間を
均等に割り振ることができ、タスクの数が変化しても安
定したスループットを保証するシステムを構築すること
が可能である。
When there are a plurality of shared resources, the accumulated access time for each of the shared resources can be evenly allocated by preemption (preemption) scheduling by time slice, and a stable throughput can be obtained even if the number of tasks changes. Can be constructed.

【0136】さらに、共有資源にアクセスするタスク群
ではラウンドロビンスケジューリングを用いることによ
り、セマフォによる排他制御を不要とし、その際のオー
バヘッドをなくすことができ、システムの性能を向上さ
せることが可能になる。
Furthermore, the use of round-robin scheduling in the task group accessing the shared resource eliminates the need for semaphore exclusion control, eliminates overhead in that case, and improves system performance. .

【0137】また、複雑なデータ構造もデータ構造全体
を1つの共有資源とし、共有資源とタスクとの関係を1
対多の関係で定義することを可能にしたことで、細かい
共有資源の切り出しを不要にすることができ、システム
設計を容易に行うことができ、生産性を向上させること
が可能である。
In addition, even for a complicated data structure, the entire data structure is used as one shared resource, and the relationship between the shared resource and the task is defined as one.
By making it possible to define the relationship in a many-to-many relationship, it is not necessary to cut out the shared resources in detail, so that the system can be easily designed and the productivity can be improved.

【0138】さらに、連続したデータアクセスが必要な
場合もそれらを1つの共有資源として扱うことを可能と
したことで、デッドロックの危険性をなくすことがで
き、システムの信頼性を高めることができる。
Further, even when continuous data accesses are required, they can be handled as one shared resource, so that the danger of deadlock can be eliminated and the reliability of the system can be improved. .

【0139】また、共有資源としては、変数データだけ
でなく、ハードディスクやCD−ROMドライブ、RS
−232C、PIOなどの通信ポートに応用すること
で、容易にシステムの信頼性および性能を最大限に高め
て複数のタスクから資源を共有することが可能になる。
The shared resources include not only variable data but also a hard disk, CD-ROM drive, RS
Application to communication ports such as -232C and PIO makes it possible to easily share resources from a plurality of tasks while maximizing the reliability and performance of the system.

【0140】さらに、共有資源としては、オブジェクト
指向言語の「クラス」に対応させることが容易であり、
オブジェクト指向言語で記述したシステムの信頼性およ
び性能を最大限に高めてマルチタスクシステムとして実
装することが可能になる。
Further, as a shared resource, it is easy to correspond to a “class” of an object-oriented language.
The reliability and performance of a system described in an object-oriented language can be maximized and implemented as a multitask system.

【0141】また、専用のハードウェアを新規に開発す
る必要がなく、固定優先順位のプリエンプトスケジュー
ル機能を持ったリアルタイムOSに簡単に組み込むこと
が可能であるので、既存システムであっても低コストで
信頼性および性能を向上させることができる。
Further, there is no need to newly develop dedicated hardware, and it is possible to easily incorporate the hardware into a real-time OS having a fixed-priority preemption schedule function. Reliability and performance can be improved.

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

【図1】第1の実施形態におけるタスクスケジューリン
グ装置が適用されたシステムの構成を示すブロック図で
ある。
FIG. 1 is a block diagram illustrating a configuration of a system to which a task scheduling device according to a first embodiment is applied.

【図2】スケジューリング調整機構600の構成を示す
図である。
FIG. 2 is a diagram showing a configuration of a scheduling adjustment mechanism 600.

【図3】プリエンプトスケジューリング機構700の構
成を示す図である。
FIG. 3 is a diagram showing a configuration of a preemption scheduling mechanism 700.

【図4】ラウンドロビンスケジューリング機構800の
構成を示す図である。
FIG. 4 is a diagram showing a configuration of a round robin scheduling mechanism 800.

【図5】タスクの状態遷移を示す図である。FIG. 5 is a diagram showing a state transition of a task.

【図6】初期化データの構成を示す図である。FIG. 6 is a diagram showing a configuration of initialization data.

【図7】共有資源管理テーブルを示す図である。FIG. 7 is a diagram showing a shared resource management table.

【図8】タスクコントロールブロックの構成を示す図で
ある。
FIG. 8 is a diagram showing a configuration of a task control block.

【図9】初期化処理610の手順を示すフローチャート
である。
FIG. 9 is a flowchart illustrating a procedure of an initialization process 610.

【図10】プリエンプトスケジューリング機構700の
初期化処理720の手順を示すフローチャートである。
FIG. 10 is a flowchart showing a procedure of an initialization process 720 of the preemption scheduling mechanism 700.

【図11】ラウンドロビンスケジューリング機構800
の初期化処理810の手順を示すフローチャートであ
る。
FIG. 11 is a round-robin scheduling mechanism 800
9 is a flowchart showing a procedure of an initialization process 810 of FIG.

【図12】プリエンプトスケジューリング機構700の
スケジューリング処理730の手順を示すフローチャー
トである。
FIG. 12 is a flowchart showing a procedure of a scheduling process 730 of the preempt scheduling mechanism 700.

【図13】スケジューリング調整機構600の中断処理
620の手順を示すフローチャートである。
FIG. 13 is a flowchart showing a procedure of an interruption process 620 of the scheduling adjustment mechanism 600.

【図14】スケジューリング調整機構600の中断解除
処理640の手順を示すフローチャートである。
FIG. 14 is a flowchart illustrating a procedure of an interruption release process 640 of the scheduling adjustment mechanism 600.

【図15】スケジューリング調整機構600のタイマ割
込み処理660の手順を示すフローチャートである。
FIG. 15 is a flowchart showing a procedure of a timer interrupt process 660 of the scheduling adjustment mechanism 600.

【図16】第2の実施形態におけるタスクスケジューリ
ング装置が適用されたシステムの構成を示す図である。
FIG. 16 is a diagram illustrating a configuration of a system to which the task scheduling device according to the second embodiment is applied.

【図17】ラウンドロビンスケジューリング機構800
の構成を示す図である。
FIG. 17 is a round robin scheduling mechanism 800.
FIG. 3 is a diagram showing the configuration of FIG.

【図18】初期化データの構成を示す図である。FIG. 18 is a diagram showing a configuration of initialization data.

【図19】共有資源管理テーブルを示す図である。FIG. 19 illustrates a shared resource management table.

【図20】タスクコントロールブロックの構成を示す図
である。
FIG. 20 is a diagram showing a configuration of a task control block.

【図21】プリエンプトスケジューリング機構700の
初期化処理720の手順を示すフローチャートである。
FIG. 21 is a flowchart showing a procedure of an initialization process 720 of the preemption scheduling mechanism 700.

【図22】ラウンドロビンスケジューリング機構800
の初期化処理810の手順を示すフローチャートであ
る。
FIG. 22 shows a round robin scheduling mechanism 800
9 is a flowchart showing a procedure of an initialization process 810 of FIG.

【図23】スケジューリング調整機構600の中断処理
620の手順を示すフローチャートである。
FIG. 23 is a flowchart showing a procedure of an interruption process 620 of the scheduling adjustment mechanism 600.

【図24】スケジューリング調整機構600の中断解除
処理640の手順を示すフローチャートである。
FIG. 24 is a flowchart showing a procedure of an interruption release process 640 of the scheduling adjustment mechanism 600.

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

100 RAM 110 ROM 140 CPU 200 共有資源 300、310、320、330 タスク 600 スケジューリング機構 700 プリエンプトスケジューリング機構 800 ラウンドロビンスケジューリング機構 Reference Signs List 100 RAM 110 ROM 140 CPU 200 Shared resources 300, 310, 320, 330 Task 600 Scheduling mechanism 700 Preempt scheduling mechanism 800 Round robin scheduling mechanism

───────────────────────────────────────────────────── フロントページの続き (72)発明者 別所 正隆 東京都大田区下丸子3丁目30番2号 キヤ ノン株式会社内 ────────────────────────────────────────────────── ─── Continuing on the front page (72) Inventor Masataka Bessho 3-30-2 Shimomaruko, Ota-ku, Tokyo Inside Canon Inc.

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング装置において、 スケジューリング調整機構と、プリエンプトスケジュー
リング機構と、ラウンドロビンスケジューリング機構と
を備え、 共有資源をアクセスするタスク群ではラウンドロビンス
ケジューリングを用い、 前記共有資源と無関係なタスク群ではプリエンプトスケ
ジューリングを用い、両タスク群の間ではプリエンプト
スケジューリングを実現する処理を行うことを特徴とす
るタスクスケジューリング装置。
1. A task scheduling apparatus for scheduling a multitask program, comprising: a scheduling adjustment mechanism, a preemption scheduling mechanism, and a round-robin scheduling mechanism, wherein a group of tasks accessing a shared resource uses round-robin scheduling. A task scheduling device, wherein preempt scheduling is used for a task group irrelevant to a shared resource, and processing for realizing preempt scheduling is performed between both task groups.
【請求項2】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング装置において、 スケジューリング調整機構と、プリエンプトスケジュー
リング機構と、ラウンドロビンスケジューリング機構と
を備え、 共有資源毎にアクセスするタスク群をタスクグループと
して切り出し、 各タスクグループ内で独立してラウンドロビンスケジュ
ーリングを用い、 前記タスクグループの間ではプリエンプトスケジューリ
ングを実現する処理を行うことを特徴とするタスクスケ
ジューリング装置。
2. A task scheduling apparatus for scheduling a multitask program, comprising: a scheduling adjustment mechanism, a preemption scheduling mechanism, and a round-robin scheduling mechanism, wherein a task group to be accessed for each shared resource is cut out as a task group. A task scheduling apparatus, wherein round robin scheduling is used independently within a task group, and processing for realizing preemption scheduling is performed between the task groups.
【請求項3】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング装置において、 スケジューリング調整機構と、プリエンプトスケジュー
リング機構と、ラウンドロビンスケジューリング機構と
を備え、 共有資源毎にアクセスするタスク群をタスクグループと
して切り出し、 各タスクグループ内で独立してラウンドロビンスケジュ
ーリングを用い、 前記共有資源と無関係なタスク群ではプリエンプトスケ
ジューリングを用い、 前記タスクグループの間および前記タスクグループと前
記共有資源とは無関係なタスク群の間ではプリエンプト
スケジューリングを実現する処理を行うことを特徴とす
るタスクスケジューリング装置。
3. A task scheduling apparatus for scheduling a multitask program, comprising: a scheduling adjustment mechanism, a preemption scheduling mechanism, and a round-robin scheduling mechanism, wherein a task group to be accessed for each shared resource is cut out as a task group. Round robin scheduling is used independently within a task group, preemption scheduling is used for a task group unrelated to the shared resource, and preemption is performed between the task groups and between task groups unrelated to the shared resource. A task scheduling device for performing a process for realizing scheduling.
【請求項4】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング方法において、 共有資源をアクセスするタスク群ではラウンドロビンス
ケジューリングを用い、 前記共有資源と無関係なタスク群ではプリエンプトスケ
ジューリングを用い、 両タスク群の間ではプリエンプトスケジューリングを実
現する処理を行うことを特徴とするタスクスケジューリ
ング方法。
4. A task scheduling method for scheduling a multi-task program, wherein a round robin scheduling is used for a task group accessing a shared resource, a preempt scheduling is used for a task group irrelevant to the shared resource, and between the two task groups. In the task scheduling method, a process for realizing preemption scheduling is performed.
【請求項5】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング方法において、 共有資源毎にアクセスするタスク群をタスクグループと
して切り出し、 各タスクグループ内で独立してラウンドロビンスケジュ
ーリングを用い、 前記タスクグループの間ではプリエンプトスケジューリ
ングを実現する処理を行うことを特徴とするタスクスケ
ジューリング方法。
5. A task scheduling method for scheduling a multi-task program, wherein a task group to be accessed for each shared resource is cut out as a task group, and round robin scheduling is used independently in each task group. In the task scheduling method, a process for realizing preemption scheduling is performed.
【請求項6】 マルチタスクプログラムのスケジューリ
ングを行うタスクスケジューリング方法において、 共有資源毎にアクセスするタスク群をタスクグループと
して切り出し、 各タスクグループ内で独立してラウンドロビンスケジュ
ーリングを用い、 前記共有資源と無関係なタスク群ではプリエンプトスケ
ジューリングを用い、 前記タスクグループの間および前記タスクグループと前
記共有資源とは無関係なタスク群の間ではプリエンプト
スケジューリングを実現する処理を行うことを特徴とす
るタスクスケジューリング方法。
6. A task scheduling method for scheduling a multitask program, wherein a task group to be accessed for each shared resource is cut out as a task group, and round robin scheduling is used independently in each task group, and is independent of the shared resource. A task scheduling method, characterized in that preempt scheduling is used for a task group, and processing for realizing preempt scheduling is performed between the task groups and between task groups irrelevant to the shared resource.
JP9193389A 1997-07-04 1997-07-04 Device and method for scheduling task Pending JPH1124946A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9193389A JPH1124946A (en) 1997-07-04 1997-07-04 Device and method for scheduling task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9193389A JPH1124946A (en) 1997-07-04 1997-07-04 Device and method for scheduling task

Publications (1)

Publication Number Publication Date
JPH1124946A true JPH1124946A (en) 1999-01-29

Family

ID=16307131

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9193389A Pending JPH1124946A (en) 1997-07-04 1997-07-04 Device and method for scheduling task

Country Status (1)

Country Link
JP (1) JPH1124946A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007316721A (en) * 2006-05-23 2007-12-06 Toshiba Corp Mobile terminal
US7472214B2 (en) 2005-08-05 2008-12-30 Mitsubishi Denki Kabushiki Kaisha Real-time embedded simple monitor method and computer product
JP2009211386A (en) * 2008-03-04 2009-09-17 Nec Corp Process control apparatus, method, and program
JP2017021488A (en) * 2015-07-08 2017-01-26 富士通株式会社 Control apparatus, control method, and program
CN109799805A (en) * 2019-01-17 2019-05-24 湖南大学 A kind of high-performing car electronic schedule algorithm of reliability perception

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7472214B2 (en) 2005-08-05 2008-12-30 Mitsubishi Denki Kabushiki Kaisha Real-time embedded simple monitor method and computer product
JP2007316721A (en) * 2006-05-23 2007-12-06 Toshiba Corp Mobile terminal
JP2009211386A (en) * 2008-03-04 2009-09-17 Nec Corp Process control apparatus, method, and program
JP2017021488A (en) * 2015-07-08 2017-01-26 富士通株式会社 Control apparatus, control method, and program
CN109799805A (en) * 2019-01-17 2019-05-24 湖南大学 A kind of high-performing car electronic schedule algorithm of reliability perception
CN109799805B (en) * 2019-01-17 2020-09-29 湖南大学 Reliability-aware high-performance automobile electronic scheduling algorithm

Similar Documents

Publication Publication Date Title
US5390329A (en) Responding to service requests using minimal system-side context in a multiprocessor environment
AU2014202257B2 (en) Dynamic virtual machine sizing
US10452572B2 (en) Automatic system service resource management for virtualizing low-latency workloads that are input/output intensive
KR20070083460A (en) Method and system for concurrent execution of multiple kernels
EP0942365A2 (en) Context controller having instruction-based time slice task switching capability and processor employing the same
CN111897637B (en) Job scheduling method, device, host and storage medium
JPH1124946A (en) Device and method for scheduling task
EP0942368A2 (en) Context controller having automatic entry to power saving mode and processor employing the same
JP3644042B2 (en) Multitask processing device
Ahn et al. Accelerating critical OS services in virtualized systems with flexible micro-sliced cores
JP4292705B2 (en) Task scheduling device
US11934890B2 (en) Opportunistic exclusive affinity for threads in a virtualized computing system
EP0942366A2 (en) Event-driven and cyclic context controller and processor employing the same
JP2693916B2 (en) Task scheduling method
Saranya et al. An implementation of partitioned scheduling scheme for hard real-time tasks in multicore linux with fair share for linux tasks
CN110851239A (en) TYPE-I TYPE hard real-time high-reliability full virtualization method
JPS6126095B2 (en)
Cherepov et al. Hard Real-time with {RTX} on Windows {NT}
KR102115738B1 (en) Apparatus and method for accelerating critical service in virtualized system
WO1992003783A1 (en) Method of implementing kernel functions
JPS5958553A (en) Dispatch control system of integrated type virtual computer
JPH03248231A (en) Multitask exclusive control method
Haydt et al. Mach scheduling framework
EP0942364A2 (en) Context controller having status-based background task resource allocation capability and processor employing the same
SODIYA A LECTURE NOTE ON

Legal Events

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

Free format text: PAYMENT UNTIL: 20081031

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20081031

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20091031

Year of fee payment: 12

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091031

Year of fee payment: 12