JPH08328879A - Task management system - Google Patents

Task management system

Info

Publication number
JPH08328879A
JPH08328879A JP13369495A JP13369495A JPH08328879A JP H08328879 A JPH08328879 A JP H08328879A JP 13369495 A JP13369495 A JP 13369495A JP 13369495 A JP13369495 A JP 13369495A JP H08328879 A JPH08328879 A JP H08328879A
Authority
JP
Japan
Prior art keywords
queue
task
address
tasks
insertion position
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP13369495A
Other languages
Japanese (ja)
Other versions
JP2740469B2 (en
Inventor
Takahito Kawamura
貴仁 川村
Yoshinobu Yamada
義信 山田
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.)
NEC IC Microcomputer Systems Co Ltd
Original Assignee
NEC IC Microcomputer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC IC Microcomputer Systems Co Ltd filed Critical NEC IC Microcomputer Systems Co Ltd
Priority to JP13369495A priority Critical patent/JP2740469B2/en
Publication of JPH08328879A publication Critical patent/JPH08328879A/en
Application granted granted Critical
Publication of JP2740469B2 publication Critical patent/JP2740469B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE: To provide a task management system of real-time OS which is used for a built-in microcomputer and can improve the task insertion processing speed without increasing the memory capacity. CONSTITUTION: This system consists of an inserting position retrieval means 101 which retrieves a task inserting position, an insertion method decision means 103 which decides a pattern based on the absolute address information 102 showing the head address, the idle area address and the task insertion address and then decides a task insertion method, and a task insertion means 104 which inserts a task based on the insertion method decided by the means 103. Then the means 103 includes a present task number calculation means 105 which calculates the number of present tasks stored in a queue, a queue state analysis means 106 which decides 3 patterns based on the state of the queue, and a direction decision means 108 which decides the task shift direction in the queue based on the information 102 and the half value 107 of the present task number calculated by the means 105.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はタスク管理方式に関し、
特にメモリ容量または処理速度等に対する要求条件の厳
しいリ分野において使用されるリアルタイムOSに適用
されるタスク管理方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a task management system,
In particular, the present invention relates to a task management method applied to a real-time OS used in a field in which requirements such as memory capacity or processing speed are severe.

【0002】[0002]

【従来の技術】従来、組込みマイクロコンピュータの応
用製品においては、ハードウェア構成が比較的単純であ
り、且つ制御対象のプログラムの規模が小さい場合に
は、応用製品のソフトウェアにリアルタイムOSを導入
する必要姓が低いものとされている。しかしながら、組
込みマイクロコンピュータの応用製品の多様化に伴い、
従来はマルチチップの世界でしか使用されなかったリア
ルタイムOSの必要性が生じてきている。プログラムの
開発期間の短縮とプログラムの作成、ならびにプログラ
ムの検証コストの低減が強く要求されており、従って、
作り易く、しかも保守点検が容易な構造を採用すること
が推奨されている。このために、プログラムの部品化等
の方法が採用されつつある。しかしながら、組込みマイ
クロコンピュータにおいては、使用することのできるR
OM/RAM容量などの資源には未だに限りがあり、ま
た制御用の多いというプログラムの特徴からOSが占有
する処理時間も大きく制限されるものとなっている。
2. Description of the Related Art Conventionally, in a product to which an embedded microcomputer is applied, it is necessary to introduce a real-time OS into the software of the application product when the hardware configuration is relatively simple and the scale of the program to be controlled is small. It is said that the family name is low. However, with the diversification of embedded microcomputer application products,
There is a need for a real-time OS that has been conventionally used only in the multi-chip world. There is a strong demand for shortening the program development period, creating the program, and reducing the verification cost of the program.
It is recommended to use a structure that is easy to make and easy to inspect and maintain. For this reason, methods such as program componentization are being adopted. However, in an embedded microcomputer, R which can be used
The resources such as the OM / RAM capacity are still limited, and the processing time occupied by the OS is greatly limited due to the characteristics of the programs that are often used for control.

【0003】このような現状に対応して、組込みマイク
ロコンピュータにおいて使用されるリアルタイムOSと
しては、ROM/RAMを消費することなしに処理速度
の速いものが要求され、機能のコンパクト化と資源の節
減に対する努力工夫が強く求められている。
In response to such a situation, a real-time OS used in an embedded microcomputer is required to have a high processing speed without consuming ROM / RAM, which makes the function compact and saves resources. There is a strong demand for efforts and efforts.

【0004】まず、現在使用されている一般的なリアル
タイムOSのタスク管理方法について説明する。一般的
なリアルタイムOSにおいては、処理の実行単位である
タスクを切替えながらプログラム実行の管理が行われて
いる。このタスク管理には、実行を待つタスクの待ち行
列が用いられている。例えば、特開平5−274163
号公報において取り上げられている従来例1において
は、図6に示されるように、待ち状態のタスクの情報
を、リストとして順次つなげてゆく構造が用いられてい
る。図6に示されるように、待ち行列の先頭であるタス
ク1の情報が格納されているアドレスを示すリストの先
頭アドレス601、タスク2のアドレスを示す次のリス
トのポインタ602、タスク3のアドレスを示す次のリ
ストのポインタ603、……………、次のリストのポイ
ンタ604という具合に、逐次に次のリストのポインタ
へとつながれている。また特開平2−17542号公報
においては、このタスク情報に含まれている時間カウン
タにより、この待ち行列が値の小さい順に整列されてい
る場合もある。
First, a general real-time OS task management method currently used will be described. In a general real-time OS, program execution is managed while switching tasks, which are execution units of processing. A queue of tasks waiting for execution is used for this task management. For example, JP-A-5-274163
In Conventional Example 1 taken up in the publication, as shown in FIG. 6, a structure is used in which information on tasks in a waiting state is sequentially linked as a list. As shown in FIG. 6, the head address 601 of the list indicating the address where the information of the task 1 at the head of the queue is stored, the pointer 602 of the next list indicating the address of task 2, and the address of task 3 are set. The next list pointer 603, ..., And the next list pointer 604 are sequentially connected to the next list pointer. Further, in Japanese Patent Application Laid-Open No. 2-17542, there are cases where the queues are arranged in ascending order of the value by the time counter included in the task information.

【0005】これらの待ち行列から必要なタスクを取り
出す手順については、特開平4−219830号公報に
1つの従来例が示されている。この手順は、図7に示さ
れるように、まず検索手段701において待ち行列の先
頭から目的のタスクが検索され、次いで選択手段702
においては検索手段701による検索の結果見付けられ
たタスクが削除されて、並び替え手段703において、
削除後の待ち行列のチェ−ン構造のつなぎ替えが行われ
る。この場合に、新たにタスク情報を追加する場合も同
様の手順により行われており、検索手段701において
挿入すべき位置が検索され、選択手段702において新
しいタスクが挿入されて、並び替え手段703において
挿入後の待ち行列のチェ−ン構造がつなぎ直される。
As a procedure for extracting a required task from these queues, Japanese Patent Laid-Open No. 4-219830 discloses one conventional example. In this procedure, as shown in FIG. 7, first, the searching means 701 searches for the target task from the head of the queue, and then the selecting means 702.
, The task found as a result of the search by the search means 701 is deleted, and the rearrangement means 703
The chain structure of the queue after the deletion is reconnected. In this case, when adding new task information, the same procedure is performed, the search means 701 searches for a position to be inserted, the selecting means 702 inserts a new task, and the rearranging means 703. The chain structure of the queue after the insertion is reconnected.

【0006】次に、この従来例1が、組込みマイクロコ
ンピュータ用のリアルタイムOSにより、どのようにし
て実現されるかについて説明する。一般的なリアルタイ
ムOSにおいては、前述のように、待ち行列はポインタ
を用いたチェ−ン構造により形成されている。これは、
要素となるタスク情報を待ち行列に挿入/削除すること
が容易にできるという利点があるからである。一方、前
述のように、組込みマイクロコンピュータ用のリアルタ
イムOSにおいては、資源の使用を如何に抑制するかが
重要となるために、扱う待ち行列の数も小さくなり(た
かだか6〜8個程度)、格納される情報量も少なくな
る。一般的に待ち行列の構造としては、或る程度以上の
大きなデータを扱う場合には、ポインタのために必要と
なるメモリ容量は問題にはならないが、扱うデータが小
さい場合には、ポインタに使用される領域が全体のメモ
リ容量に対して大きく影響するようになる(参考文献:
“Cプログラマのためのアルゴリズムとデータ構造”
p.53)。
Next, how the conventional example 1 is realized by a real-time OS for an embedded microcomputer will be described. In a general real-time OS, the queue is formed by a chain structure using pointers as described above. this is,
This is because there is an advantage that task information as an element can be easily inserted / deleted in the queue. On the other hand, as described above, in a real-time OS for embedded microcomputers, how to suppress the use of resources is important, so the number of queues to be handled becomes small (about 6 to 8 at most), The amount of information stored is also small. Generally, as the structure of the queue, the memory capacity required for the pointer does not matter when handling a certain amount of large data, but it is used for the pointer when the handling data is small. Area becomes a big influence on the total memory capacity (references:
"Algorithms and data structures for C programmers"
p. 53).

【0007】従って、扱うデータ量が小さい場合、また
は限られている場合には、待ち行列内にポインタを持つ
チェ−ン構造にするよりも、配列で各タスク情報を並べ
た方がRAMの容量削減に効果がある。またチェ−ン構
造においては、必要な時に必要なメモリ資源を確保する
という方法が採られているが、組込みマイクロコンピュ
ータOSにおいては、前述の資源の制約により必要な領
域を予め割当てておくという方法が採られている。この
点においても、扱うデータ量が小さい場合、または限ら
れている場合には、配列を用いた待ち行列の方がRAM
効率がよいということができる。以下、この配列を用い
たものを従来例1と云う。
Therefore, when the amount of data to be handled is small or limited, it is better to arrange each task information in an array rather than to form a chain structure having pointers in the queue. Effective for reduction. Further, in the chain structure, a method of securing a necessary memory resource at a necessary time is adopted, but in the embedded microcomputer OS, a method of allocating a necessary area in advance due to the resource limitation described above. Is taken. Also in this respect, when the amount of data to be handled is small or limited, the queue using the array is more RAM.
It can be said that it is efficient. Hereinafter, the one using this arrangement is referred to as Conventional Example 1.

【0008】このように配列を用いた待ち行例につい
て、図8(a)、(b)、(c)および(d)を参照し
て、前記従来例1のタスク管理方式におけるタスク挿入
の手順を説明する。図8(a)、(b)、(c)および
(d)は、タスク挿入手順における待ち行列の経過状態
を示している。まず、図8(a)においては、待ち行列
801の先頭アドレス802から順次「task1」の
挿入位置が検索される。なお、この例においては、待ち
行列801には空き領域アドレス803が存在するもの
とする。図8(b)においては、検索の結果、挿入アド
レス804がタスクt1 とタスクt2 の間にあることが
分かったものとすると、図8(c)において、挿入アド
レス804以降のタスクt2 、t3 、t4 およびt5
待ち行列801の後方にシフトされ、図8(d)におい
て、当該“task1”は、タスクt1 とタスクt2
の間に挿入される。
Regarding the example of waiting using the array as described above, referring to FIGS. 8 (a), (b), (c) and (d), the procedure of task insertion in the task management system of the prior art 1 described above. Will be explained. 8 (a), (b), (c) and (d) show the progress of the queue in the task insertion procedure. First, in FIG. 8A, the insertion position of “task1” is sequentially searched from the head address 802 of the queue 801. In this example, it is assumed that the queue 801 has a free area address 803. In FIG. 8B, it is assumed that the insertion address 804 is found to be between the task t 1 and the task t 2 as a result of the search, and in FIG. 8C, the task t 2 after the insertion address 804. , T 3 , t 4 and t 5 are shifted to the rear of the queue 801, and the “task1” is inserted between the task t 1 and the task t 2 in FIG. 8D.

【0009】この従来例1の場合には、タスクの挿入位
置には関係なく後方に対するシフトが行われるために、
待ち行列にn個のタスクが存在する場合には、最大n回
のシフト動作が必要となるという問題がある。この問題
の解決に対応した他の従来例2のタスク挿入手順におけ
る待ち行列の経過状態が、図9(a)、(b)、(c)
および(d)に示されている。まず、図9(a)におい
ては、待ち行列901の先頭アドレス902から順次
“task1”の挿入位置が検索され、この検索の過程
において通過したタスク数が計数されて、所定のカウン
タ(図示されない)に格納される。図9(b)において
は、検索の結果、挿入アドレス904がタスクt2 とタ
スクt3 の間にあることが分かったものとすると、前記
カウンタに格納される通過タスク数は2となる。次に、
現時点において待ち行列901に格納されているタスク
の数が数えられ、その数の半分の数と前記カウンタに格
納されている通過したタスクの数とが比較されて、図9
(c)においては、その数の少ない方、即ち後方ではな
く前方に対してシフトが行われる。そして、図9(d)
において、前述の従来例1の場合と同様に、当該“ta
sk1”は、タスクt2 とタスクt3 との間に挿入され
る。なお、この従来例2の場合においては、シフトの回
数を平均してn/2回程度に抑制することができる(参
考文献:“Cプログラマのためのアルゴリズムとデータ
構造”p.53)。
In the case of the prior art example 1, since the shift is performed backward regardless of the insertion position of the task,
If there are n tasks in the queue, there is a problem that a maximum of n shift operations are required. 9 (a), 9 (b), and 9 (c) show the progress states of the queue in the task insertion procedure of another conventional example 2 corresponding to the solution of this problem.
And (d). First, in FIG. 9A, the insertion position of "task1" is sequentially searched from the start address 902 of the queue 901, the number of tasks passed in the process of this search is counted, and a predetermined counter (not shown) Stored in. In FIG. 9B, if it is found as a result of the search that the insertion address 904 is between the task t 2 and the task t 3 , the number of passing tasks stored in the counter is 2. next,
The number of tasks currently stored in the queue 901 is counted, and the number of half the number is compared with the number of passed tasks stored in the counter.
In (c), the shift is performed to the smaller one, that is, to the front rather than the rear. And FIG. 9 (d)
In the same manner as in the case of the conventional example 1 described above, the "ta
sk1 ″ is inserted between the task t 2 and the task t 3. In the case of the conventional example 2, the number of shifts can be suppressed to n / 2 times on average (reference). Reference: "Algorithms and data structures for C programmers" p.53).

【0010】上記の従来例2の構成の概要が図10
(a)に示される。図10(a)において、当該従来例
2は、タスクの挿入位置を検索する挿入位置検索手段1
001と、検索時に通過したタスク数を受けてカウント
する通過タスク数カウント手段1002と、通過タスク
数カウント手段1002によりカウントされた通過タス
ク数1003を受けて、当該通過タスク数1003を用
いてタスクの挿入方法を決定する挿入方法決定手段10
04と、挿入方法決定手段1004によるタスクの挿入
方法を受けて、当該挿入方法により決められた方向にシ
フトを行い、所定のタスクを挿入するタスク挿入手段1
005とを備えて構成されている。そして、更に、挿入
方法決定手段1004は、図10(b)に示されるよう
に、現在待ち行列に格納されているタスク数を計算する
現タスク数計算手段1006と、当該現タスク数計算手
段1006により計算された現タスク数の半分の値10
07を受けて、当該通過タスク数1003を用いて、前
方に対してシフトするか、または後方に対してシフトす
るかのシフト方向を決定する方向決定手段1008とを
備えて構成される。
The outline of the configuration of the above-mentioned conventional example 2 is shown in FIG.
It is shown in (a). In FIG. 10A, the conventional example 2 is an insertion position search means 1 for searching the insertion position of a task.
001, the passing task number counting means 1002 for receiving and counting the number of passing tasks at the time of retrieval, and the passing task number 1003 counted by the passing task number counting means 1002, and using the passing task number 1003 Insertion method determining means 10 for determining the insertion method
04 and the insertion method of the task by the insertion method determination unit 1004, the task insertion unit 1 shifts in the direction determined by the insertion method and inserts a predetermined task.
And 005. Then, as shown in FIG. 10B, the insertion method determining means 1004 further calculates the current task number calculating means 1006 for calculating the number of tasks currently stored in the queue and the current task number calculating means 1006. Half the number of current tasks calculated by
When the number of passing tasks 1003 is received, the direction determining means 1008 is configured to determine the shift direction of shifting to the front or shifting to the rear.

【0011】次に、図11に示されるフローチャートを
参照して従来例2の処理手順について説明する。ステッ
プ1102においては、挿入位置検索手段1001によ
りタスクの挿入位置の検索を行いながら、当該検索が未
発見である場合には、ステップ1101において、通過
タスク数カウント手段1002により、検索ループの中
において通過したタスク数のカウントが行われる。ステ
ップ1102における挿入位置検索により、タスクの挿
入位置が発見された場合には、ステップ1103におい
て、現在待ち行列に格納されているタスクの数が、現タ
スク数計算手段1005により求められ、次いでステッ
プ1104においては、方向決定手段1008により、
ステップ1101における通過タスク数のカウント数1
003と、ステップ1103において求められた待ち行
列に格納されているタスクの数の半分の値1007とが
比較されて、当該比較結果において、通過タスク数10
03の方が現タスク数の半分の値1007よりも大きい
場合には、ステップ1106において、後方にシフト方
向が決定され、また、通過タスク数1003の方が現タ
スク数の半分の値1007よりも小さい場合には、ステ
ップ1105において、前方にシフト方向が決定され
る。ステップ1107においては、ステップ1105ま
たはステップ1106において決定された方向に対して
タスクシフトが行われ、タスク挿入手段1005により
所望のタスクが挿入される。
Next, the processing procedure of the second conventional example will be described with reference to the flowchart shown in FIG. In step 1102, while the insertion position searching means 1001 searches for the insertion position of the task, if the search is not found yet, in step 1101, the passing task number counting means 1002 passes through the search loop. The number of tasks performed is counted. When the insertion position of the task is found by the insertion position search in step 1102, the number of tasks currently stored in the queue is calculated by the current task number calculation means 1005 in step 1103, and then step 1104 is executed. In, the direction determining means 1008
Count number 1 of the number of passing tasks in step 1101
003 is compared with a value 1007 which is half the number of tasks stored in the queue obtained in step 1103, and in the comparison result, the number of passing tasks is 10
If 03 is larger than the half value 1007 of the current task number, the shift direction is determined backward in step 1106, and the passing task number 1003 is smaller than the half value 1007 of the current task number. If it is smaller, in step 1105 the forward shift direction is determined. In step 1107, task shifting is performed in the direction determined in step 1105 or step 1106, and the desired task is inserted by the task inserting means 1005.

【0012】[0012]

【発明が解決しようとする課題】上述した従来のタスク
管理方式においては、一般に、組込みマイクロコンピュ
ータのリアルタイムOSとしては、RAMなどの資源を
消費することなく処理速度の速いものが要求されてお
り、機能のコンパクト化とOSにより使用される資源の
節約が必要条件となっている。
In the conventional task management system described above, a real-time OS of an embedded microcomputer is generally required to have a high processing speed without consuming resources such as RAM. It is necessary to make the functions compact and to save the resources used by the OS.

【0013】前記従来例2の場合においては、従来例1
において問題となっているシフト動作回数を低減するこ
とができるという利点があるものの、図11のステップ
1101の通過タスク数をカウントする処理手順が、挿
入位置を検索するステップ1102のループ内に含まれ
ており、従って、挿入位置検索の回数が増えるに伴ない
当該処理時間が増大してゆくという欠点がある。
In the case of the conventional example 2, the conventional example 1
However, the processing procedure for counting the number of passing tasks in step 1101 of FIG. 11 is included in the loop of step 1102 for searching for the insertion position, although it has the advantage of reducing the number of shift operations which is a problem in the above. Therefore, there is a disadvantage in that the processing time increases as the number of insertion position searches increases.

【0014】また通過タスク数をカウントするために
は、新たにRAMをも付加することが必要になるという
欠点がある。
Further, there is a drawback that a RAM must be newly added to count the number of passing tasks.

【0015】本発明の目的は、上記の従来例2における
欠点を解消し、通過タスク数をカウントする処理手順を
短縮し、且つRAMの使用を不要とするリアルタイムO
S用のタスク管理方式を実現することにある。
The object of the present invention is to solve the drawbacks of the conventional example 2 described above, shorten the processing procedure for counting the number of passing tasks, and eliminate the need for using RAM.
It is to realize a task management system for S.

【0016】[0016]

【課題を解決するための手段】本発明のタスク管理方式
は、複数のタスクの実行を管理するとともに、所定の待
ち行列と空き領域により構成される有限の配列を用いて
実行待ちタスクの管理を行うリアルタイムOSのタスク
管理方式において、前記待ち行列の中に所定タスクを挿
入する際に、当該所定タスクを前記待ち行列内に挿入す
るための当該行列内の位置を検索する挿入位置検索手段
と、前記待ち行列の先頭アドレスと前記空き領域の先頭
アドレスとを用い、所定の解析処理を介して、前記挿入
位置検索手段により求められたタスク挿入位置に前記所
定タスクを挿入する方法を決定する挿入方法決定手段
と、前記挿入方法決定手段により決定された挿入方法に
より、前記待ち行列に前記所定タスクを挿入するタスク
挿入手段と、を備えることを特徴としている。
The task management system of the present invention manages the execution of a plurality of tasks and manages the execution waiting tasks by using a finite array composed of a predetermined queue and an empty area. In the task management method of the real-time OS for performing, when inserting a predetermined task into the queue, an insertion position searching means for searching a position in the queue for inserting the predetermined task into the queue, An insertion method for determining a method for inserting the predetermined task at the task insertion position obtained by the insertion position search means through a predetermined analysis process using the start address of the queue and the start address of the empty area. And a task inserting means for inserting the predetermined task into the queue by the inserting method determined by the inserting method determining means. It is characterized in that.

【0017】なお、前記挿入方法決定手段は、前記待ち
行列の現時点における先頭アドレスと、当該待ち行列の
前記空き領域の先頭アドレスと、前記位置検索手段によ
る挿入位置検索を介して得られるタスク挿入位置のアド
レスとを用いて、当該待ち行列に格納されている現時点
におけるタスクの個数を計算して出力する現タスク数計
算手段と、前記現タスク数計算手段により得られる現時
点における前記タスク個数を参照し、前記待ち行列の現
時点における状態を解析して、当該待ち行列のパターン
を識別する待ち行列状態解析手段と、前記待ち行列状態
解析手段により得られる前記パターンの識別情報と、前
記現タスク数計算手段より計算出力される前記タスクの
個数の半分に相当する数値とを用いて、前記待ち行列に
対するタスク挿入のシフト方向を決定する方向決定手段
と、を備えて構成してもよい。
It should be noted that the inserting method determining means determines the start address of the queue at the present time, the start address of the empty area of the queue, and the task insertion position obtained through the insertion position search by the position searching means. Address of the current task number calculation means for calculating and outputting the number of tasks at the current time stored in the queue, and the current number of tasks obtained by the current task number calculation means. A queue state analysis means for analyzing the current state of the queue to identify a pattern of the queue, identification information of the pattern obtained by the queue state analysis means, and the current task number calculation means Inserting a task into the queue by using a numerical value corresponding to half the number of the tasks calculated by And direction determining means for determining a shift direction may be configured with.

【0018】また、前記挿入方法決定手段は、前記待ち
行列の現時点における先頭アドレスと、当該待ち行列の
前記空き領域の先頭アドレスと、前記位置検索手段によ
る挿入位置検索を介して得られるタスク挿入位置のアド
レスとを参照し、前記待ち行列の現時点における状態を
解析して、当該待ち行列のパターンを識別する待ち行列
状態解析手段と、前記待ち行列の現時点における先頭ア
ドレスと、当該待ち行列の前記空き領域の先頭アドレス
と、前記位置検索手段による挿入位置検索を介して得ら
れるタスク挿入位置のアドレスと、前記待ち行列状態解
析手段により得られる前記パターンの識別情報と、予め
規定される前記待ち行列の最大値の半分に相当する数値
とを用いて、前記待ち行列に対するタスク挿入のシフト
方向を決定する方向決定手段と、を備えて構成してもよ
い。
The inserting method determining means may further include a start address of the queue at the present time, a start address of the empty area of the queue, and a task insertion position obtained through the insertion position search by the position searching means. Address of the queue, the queue state analysis means for analyzing the state of the queue at the present time to identify the pattern of the queue, the start address of the queue at the present time, and the free space of the queue. The start address of the area, the address of the task insertion position obtained through the insertion position search by the position search means, the identification information of the pattern obtained by the queue state analysis means, and the predefined queue A method for determining the shift direction of task insertion with respect to the above-mentioned queue by using the value corresponding to half the maximum value and A determination unit may be configured with.

【0019】[0019]

【実施例】次に、本発明について図面を参照して説明す
る。なお、本発明の実施例の説明に入る前に、予備的
に、待ち行列の状態について説明する。
Next, the present invention will be described with reference to the drawings. Before the description of the embodiments of the present invention, the state of the queue will be described as a preliminary.

【0020】一般に、待ち行列においては、タスクの挿
入/削除により、当該待ち行列の先頭アドレスと空き領
域の先頭アドレスを示す絶対番地が変化する。この絶対
番地の位置関係により、図4(a)、(b)および
(c)に示されるように、待ち行列401には3つのパ
ターンが存在する。図4(a)は、待ち行列401内に
タスクが格納されている領域の先頭アドレスA(Aは絶
対番地)402より、空き領域アドレスB(Bは絶対番
地)403の方が大きい場合のパターン(以下、パター
ン1と云う)であり、図4(b)は、先頭アドレスA4
02が、空き領域アドレスB403よりも大きく、更
に、タスクを挿入する挿入アドレスC(Cは絶対番地)
404よりも、先頭アドレス402の方が大きい場合の
パターン(以下、パターン2と云う)である。また、図
4(c)は、先頭アドレスA402が、空き領域アドレ
スB403よりも大きく、更に、タスクを挿入する挿入
アドレスC404が、先頭アドレス402よりも大きい
場合のパターン(以下、パターン3と云う)である。
Generally, in the queue, the absolute address indicating the start address of the queue and the start address of the empty area changes due to the insertion / deletion of the task. Due to the positional relationship of the absolute addresses, there are three patterns in the queue 401 as shown in FIGS. 4 (a), (b) and (c). FIG. 4A shows a pattern in which the free area address B (B is an absolute address) 403 is larger than the start address A (A is an absolute address) 402 of the area in which tasks are stored in the queue 401. (Hereinafter, referred to as pattern 1), and FIG.
02 is larger than the free area address B403, and the insertion address C for inserting a task (C is an absolute address)
This is a pattern in which the start address 402 is larger than 404 (hereinafter referred to as pattern 2). Further, in FIG. 4C, a pattern in which the start address A402 is larger than the free area address B403 and the insertion address C404 for inserting the task is larger than the start address 402 (hereinafter, referred to as pattern 3). Is.

【0021】以下の本発明の実施例の説明においては、
上記の3つのパターンに着目して、タスクの挿入位置の
検索時に、カウンタによる通過タスク数のカウントを行
うことなく、タスク挿入位置によるシフト方向の決定を
行うことのできる本発明のタスク管理方式の実施例につ
いて説明するものとする。
In the following description of the embodiments of the present invention,
Focusing on the above three patterns, in the task management system of the present invention, the shift direction can be determined by the task insertion position without counting the number of passing tasks by the counter when searching the task insertion position. An example shall be described.

【0022】図1(a)は、本発明の1実施例の基本構
成を示す図である。図1に示されるように、本実施例
は、タスクを挿入する位置を、待ち行列の中から検索す
る挿入位置検索手段101と、絶対番地のアドレス情報
により、前述の3つのパターンを判定するための先頭ア
ドレス、空き領域アドレスおよびタスク挿入アドレスを
示す絶対アドレス情報102を用いて、挿入方法を決定
する挿入方法決定手段103と、当該挿入方法決定手段
103により決定された方法に従って、タスクを挿入す
るタスク挿入手段104とを備えて構成される。また、
図1(b)は、本発明の第1の実施例における挿入方法
決定手段103の内部構成を示す図であり、現在待ち行
列に格納されているタスク数を計算する現タスク数計算
手段105と、待ち行列の状態から前述の3パターンを
判別する待ち行列状態解析手段106と、絶対アドレス
情報102と現タスク数計算手段105により算出され
る現タスク数の半分の値107を用いて、待ち行列の中
のタスクをシフトする方向を決定する方向決定手段10
8とを備えて構成される。
FIG. 1A is a diagram showing the basic configuration of one embodiment of the present invention. As shown in FIG. 1, in the present embodiment, the above-mentioned three patterns are determined based on the insertion position search means 101 that searches the queue for the position to insert a task and the address information of the absolute address. The task is inserted according to the insertion method determining means 103 for determining the insertion method and the method determined by the insertion method determining means 103 by using the absolute address information 102 indicating the start address, the free area address and the task insertion address of And a task insertion means 104. Also,
FIG. 1B is a diagram showing an internal configuration of the insertion method determination means 103 in the first embodiment of the present invention, and a current task number calculation means 105 for calculating the number of tasks currently stored in the queue. The queue state analysis means 106 for discriminating the above-mentioned three patterns from the state of the queue, the absolute address information 102, and the value 107 which is half the current task number calculated by the current task number calculation means 105 are used. Direction determining means 10 for determining the direction in which to shift the tasks in the
8 is provided.

【0023】以下においては、図2のフローチャートを
参照して、第1の実施例の動作について説明する。ま
ず、ステップ201において、挿入位置検索手段101
により、待ち行列401に対してタスクを挿入する位置
の検索が行われる。この検索の結果挿入位置が未発見で
ある場合には、再度ステップ201に戻り挿入位置の検
索が行われる。ステップ201において挿入位置が発見
されると、ステップ202において、現タスク数計算手
段105により、現在待ち行列401に格納されている
タスク数が計算される。次いで、待ち行列状態解析手段
106により、対応する待ち行列401が、図4に示さ
れる3つのパターンの内の何れのパターに属するかを判
定するために、それぞれの絶対アドレスが比較照合され
るが、まずステップ203の状態解析1においては、待
ち行列401の先頭アドレスA402と空き領域アドレ
スB403とが比較される。ステップ203において、
空き領域アドレスB403が待ち行列の先頭アドレスA
402よりも大きい場合には、待ち行列401がパター
ン1であるものと確定し、また待ち行列401の先頭ア
ドレスA402が空き領域アドレスB403よりも大き
い場合には、待ち行列401がパターン2またはパター
ン3の何れかであることが分かる。この場合には、更に
ステップ204の状態解析2において、待ち行列401
の先頭アドレスA402とタスクを挿入しようとしてい
る領域の挿入アドレスC404とが比較される。このス
テップ204において、待ち行列401の先頭アドレス
A402が挿入アドレスC404よりも大きい場合に
は、当該待ち行列401がパターン2であることが確定
し、また、挿入アドレスC404が、待ち行列401の
先頭アドレスA402以下である場合には、待ち行列4
01がパターン3であることが確定する。なお、待ち行
列401が空である場合(A=B)の処理については、
タスクの挿入処理以前において判断されて処理される対
象であるため、その説明は省略するものとする。
The operation of the first embodiment will be described below with reference to the flowchart of FIG. First, in step 201, the insertion position search means 101
As a result, the position of inserting the task in the queue 401 is searched. If the insertion position is not found as a result of this search, the process returns to step 201 and the insertion position is searched again. When the insertion position is found in step 201, the current task number calculating means 105 calculates the number of tasks currently stored in the queue 401 in step 202. Then, the queue state analysis unit 106 compares and compares the absolute addresses of the corresponding queues 401 in order to determine which pattern of the three patterns shown in FIG. 4 belongs to. First, in the state analysis 1 of step 203, the head address A402 of the queue 401 and the free area address B403 are compared. In step 203,
Free area address B403 is the start address A of the queue
If it is larger than 402, it is determined that the queue 401 is the pattern 1, and if the head address A402 of the queue 401 is larger than the free space address B403, the queue 401 is the pattern 2 or pattern 3. It turns out that it is either. In this case, in the state analysis 2 of step 204, the queue 401
The leading address A402 of the above is compared with the insertion address C404 of the area in which the task is to be inserted. In this step 204, if the start address A402 of the queue 401 is larger than the insertion address C404, it is determined that the queue 401 is pattern 2, and the insertion address C404 is the start address of the queue 401. Queue 4 if less than A402
It is determined that 01 is pattern 3. For the processing when the queue 401 is empty (A = B),
Since it is a target to be determined and processed before the task insertion process, the description thereof will be omitted.

【0024】前記ステップ203において、待ち行列が
パターン1であると判定される場合には、ステップ20
5の方向決定1において、挿入しようとしている挿入ア
ドレスC404と先頭アドレスA402の差(C−A)
と、待ち行列401に格納されている現タスク数の半分
の値(以下、Dと云う)とが比較され、前記(C−A)
が前記D以上である場合には、ステップ209において
シフト方向が後方向であると決定され、また(C−A)
が前記Dよりも小さい場合には、ステップ208におい
てシフト方向が前方向であるものと決定される。また、
ステップ204において、待ち行列401がパターン2
であると判定される場合には、ステップ206の方向決
定2において、挿入しようとしている挿入アドレスC4
04と空き領域アドレスB403の差(C−B)と、待
ち行列401に格納されている現タスク数の半分の値D
とが比較され、前記(C−B)が前記Dよりも大きい場
合には、ステップ208においてシフト方向が前方向で
あると決定され、また(C−B)が前記D以下である場
合には、ステップ209においてシフト方向が後方向で
あるものと決定される。更にまた、ステップ204にお
いて、待ち行列401がパターン3であると判定される
場合には、ステップ207の方向決定3において、挿入
しようとしている挿入アドレスC404と先頭アドレス
A402の差(C−A)と、待ち行列401に格納され
ている現タスク数の半分の値Dとが比較され、前記(C
−A)が前記Dよりも小さい場合には、ステップ208
においてシフト方向が前方向であると決定され、また
(C−A)が前記D以上である場合には、ステップ20
9においてシフト方向が後方向であるものと決定され
る。但し、相互の比較対象が等しい場合には、シフト方
向としては、前後何れの方向に決定してもよく、通常
は、前方に対してシフトが行われる。そして、ステップ
208およひステップ209に続いて、ステップ210
においては、前方または後方の何れかに決定されたシフ
ト方向に従ってタスクがシフトされ、挿入対象のタスク
が挿入されて処理は終了する。
If it is determined in step 203 that the queue is pattern 1, step 20
In the direction determination 1 of 5, the difference between the insertion address C404 to be inserted and the start address A402 (CA)
Is compared with a value (hereinafter, referred to as D) which is half the number of current tasks stored in the queue 401, and (CA)
Is greater than or equal to D, it is determined in step 209 that the shift direction is backward, and (C-A)
Is smaller than D, it is determined in step 208 that the shift direction is the forward direction. Also,
In step 204, queue 401 has pattern 2
If it is determined that the insertion address C4 to be inserted is determined in the direction determination 2 of step 206.
04 and the free area address B403 (CB), and a value D which is half the number of current tasks stored in the queue 401.
And (CB) is greater than D, it is determined in step 208 that the shift direction is the forward direction, and (CB) is less than or equal to D, In step 209, the shift direction is determined to be backward. Furthermore, when it is determined that the queue 401 has the pattern 3 in step 204, in the direction determination 3 of step 207, the difference (CA) between the insertion address C404 to be inserted and the head address A402 is determined. , The value D, which is half the current number of tasks stored in the queue 401, is compared, and (C
-A) is smaller than D, step 208
In the case where the shift direction is determined to be the forward direction in (1) and (C-A) is D or more, the step 20
In 9, it is determined that the shift direction is backward. However, when the objects to be compared with each other are the same, the shift direction may be determined in any of the front and rear directions, and the shift is normally performed forward. Then, following step 208 and step 209, step 210
In, the task is shifted according to the shift direction determined to be either forward or backward, the task to be inserted is inserted, and the process ends.

【0025】前述の従来例2においては、ステップ11
01の通過タスク数のカウント処理が、検索ループ内に
含まれているために、検索回数が増えるに伴ない処理時
間が増大するという欠点があったが、これに対比して、
この第1の実施例においては検索回数に関係なく、ステ
ップ203の状態解析1、またはステップ203の状態
解析1およびステップ204の状態解析2による処理に
より対応が可能となり、全体の処理に要する時間の短縮
と平均化を行うことが可能になるとともに、通過タスク
数のカウントを行う必要がないために、従来例2におけ
る通過タスク数のカウント処理と、このために必要とさ
れる通過タスク数のRAM領域が削減される。
In the above-mentioned conventional example 2, step 11
Since the count processing of the number of passing tasks of 01 is included in the search loop, there is a drawback that the processing time increases as the number of searches increases, but in contrast to this,
In the first embodiment, regardless of the number of searches, the state analysis 1 of step 203, or the state analysis 1 of step 203 and the state analysis 2 of step 204 can be used to deal with this, and the time required for the entire process can be reduced. Since it is possible to perform shortening and averaging, and since it is not necessary to count the number of passing tasks, the processing of counting the number of passing tasks in the conventional example 2 and the RAM of the number of passing tasks required for this Area is reduced.

【0026】次に、本発明の第2の実施例について説明
する。本実施例の第1の実施例との差異は、図1の構成
における挿入方法設定手段103の構成内容の違いにあ
る。本実施例の挿入方法決定手段103は、図1(c)
に示されるとうりであり、待ち行列の状態から前述の3
パターンを判別する待ち行列状態解析手段106と、後
述するように、予め定数として定義される待ち行列の最
大値の半分の値109と絶対アドレス情報102を用い
て、待ち行列の中のタスクのシフト方向を決定する方向
決定手段110とを備えて構成される。本実施例におい
ては、図1(b)と図1(c)との対比により明らかな
ように、第1の実施例における現タスク数計算手段10
5が削除されている。ここでは、組込みマイクロコンピ
ュータ用リアルタイムOSが、使用する待ち行列の大き
さが比較的に小さいものであること、配列を用いて予め
決められている領域が確保されていることに着目し、現
在格納されているタスク数の代わりに、もともと確保さ
れている待ち行列の大きさの半分の値(以下、Eと云
う)を予め定数として定義しておき使用するものであ
る。
Next, a second embodiment of the present invention will be described. The difference between this embodiment and the first embodiment is the difference in the configuration contents of the insertion method setting means 103 in the configuration of FIG. The insertion method determining means 103 of this embodiment is shown in FIG.
As shown in the above, from the state of the queue,
Queue state analysis means 106 for discriminating a pattern, and a half of the maximum value of the queue defined in advance as a constant 109 and absolute address information 102 are used to shift the tasks in the queue, as will be described later. And a direction determining means 110 for determining a direction. In this embodiment, as is clear from comparison between FIG. 1B and FIG. 1C, the current task number calculating means 10 in the first embodiment is shown.
5 has been deleted. Here, the real-time OS for embedded microcomputers uses a relatively small queue size, and pays attention to the fact that a predetermined area is secured by using an array. Instead of the number of tasks that have been assigned, a value that is half the size of the queue that was originally secured (hereinafter referred to as E) is defined in advance as a constant and used.

【0027】以下においては、図3のフローチャートを
参照して、本実施例の動作について説明する。まず、ス
テップ301において、挿入位置検索手段101によ
り、待ち行列401に対してタスクを挿入する位置の検
索が行われる。この検索の結果挿入位置が未発見である
場合には、再度ステップ301に戻り挿入位置の検索が
行われる。ステップ301において挿入位置が発見され
ると、待ち行列状態解析手段106により、対応する待
ち行列401が、図4に示される3つのパターンの内の
何れのパターンに属するかを判定するために、それぞれ
の絶対アドレスが比較照合される。まずステップ302
の状態解析1においては、待ち行列401の先頭アドレ
スA402と空き領域アドレスB403とが比較され
る。ステップ302において、空き領域アドレスB40
3が待ち行列401の先頭アドレスA402よりも大き
い場合には、待ち行列401がパターン1であるものと
確定され、また待ち行列401の先頭アドレスA402
が空き領域アドレスB403よりも大きい場合には、待
ち行列401がパターン2またはパターン3の何れかで
あるものと判定される。この場合には、更にステップ3
04の状態解析2において、待ち行列401の先頭アド
レスA402とタスクを挿入しようとしている領域の挿
入アドレスC404とが比較される。このステップ30
4において、待ち行列401の先頭アドレスA402が
挿入アドレスC404よりも大きい場合には、当該待ち
行列401がパターン2であるものと確定され、また、
挿入アドレスC404が待ち行列401の先頭アドレス
A402以下である場合には、待ち行列401がパター
ン3であるものと確定される。
The operation of this embodiment will be described below with reference to the flowchart of FIG. First, in step 301, the insertion position search means 101 searches the queue 401 for a position to insert a task. If the insertion position is not found as a result of this search, the process returns to step 301 again and the insertion position is searched. When the insertion position is found in step 301, the queue state analysis means 106 determines the pattern to which the corresponding queue 401 belongs, out of the three patterns shown in FIG. 4, respectively. The absolute addresses of are compared and matched. First, step 302
In the state analysis 1 of 1, the start address A402 of the queue 401 and the free area address B403 are compared. In step 302, the free area address B40
3 is larger than the start address A402 of the queue 401, the queue 401 is determined to be pattern 1, and the start address A402 of the queue 401 is determined.
Is larger than the free area address B403, the queue 401 is determined to be either pattern 2 or pattern 3. In this case, step 3
In the state analysis 2 of 04, the start address A402 of the queue 401 is compared with the insertion address C404 of the area in which the task is to be inserted. This step 30
4, when the start address A402 of the queue 401 is larger than the insertion address C404, it is determined that the queue 401 is pattern 2, and
When the insertion address C404 is equal to or lower than the head address A402 of the queue 401, the queue 401 is determined to be pattern 3.

【0028】前記ステップ302において、待ち行列4
01がパターン1であると判定される場合には、ステッ
プ303の方向決定1において、挿入しようとしている
挿入アドレスC404と先頭アドレスA402の差(C
−A)と、待ち行列401の最大値の半分の値(以下、
Eと云う)とが比較され、前記(C−A)が前記E以上
である場合には、ステップ308においてシフト方向が
後方向であると決定され、また(C−A)が前記Eより
も小さい場合には、ステップ307においてシフト方向
が前方向であるものと決定される。また、ステップ30
4において、待ち行列401がパターン2であると判定
される場合には、ステップ305の方向決定2におい
て、挿入しようとしている挿入アドレスC404と空き
領域アドレスB403の差(C−B)と、待ち行列40
1の最大値の半分の値Eとが比較され、前記(C−B)
が前記Eよりも大きい場合には、ステップ307におい
てシフト方向が前方向であると決定され、また(C−
B)が前記E以下である場合には、ステップ308にお
いてシフト方向が後方向であるものと決定される。更に
また、ステップ304において、待ち行列401がパタ
ーン3であると判定される場合には、ステップ306の
方向決定3において、挿入しようとしている挿入アドレ
スC404と先頭アドレスA402の差(C−A)と、
待ち行列401の最大値の半分の値Eとが比較され、前
記(C−A)が前記Eよりも小さい場合には、ステップ
307においてシフト方向が前方向であると決定され、
また(C−A)が前記E以上である場合には、ステップ
308においてシフト方向が後方向であるものと決定さ
れる。なお、相互の比較対象が等しい場合には、シフト
方向としては、前後何れの方向に決定してもよく、通常
は、前方に対してシフトが行われる。そして、ステップ
307およひステップ308に続いて、ステップ309
においては、前方または後方の何れかに決定されたシフ
ト方向に従ってタスクがシフトされ、挿入対象のタスク
が挿入されて処理は終了する。
In step 302, the queue 4
If 01 is determined to be the pattern 1, in the direction determination 1 at step 303, the difference (C
-A) and half the maximum value of the queue 401 (hereinafter,
E) is compared, and if (C-A) is greater than or equal to E, it is determined in step 308 that the shift direction is backward, and (C-A) is greater than E. If it is smaller, it is determined in step 307 that the shift direction is the forward direction. Also, step 30
4 determines that the queue 401 has the pattern 2, in the direction determination 2 of step 305, the difference (CB) between the insertion address C404 and the free area address B403 to be inserted, and the queue 40
The value E, which is half the maximum value of 1, is compared, and the above (CB)
Is larger than E, it is determined in step 307 that the shift direction is the forward direction, and (C-
If B) is equal to or less than E, it is determined in step 308 that the shift direction is backward. Furthermore, when it is determined that the queue 401 has the pattern 3 in step 304, in the direction determination 3 of step 306, the difference (CA) between the insertion address C404 to be inserted and the head address A402 is determined. ,
The value E, which is half the maximum value of the queue 401, is compared, and if (C−A) is smaller than E, it is determined in step 307 that the shift direction is the forward direction.
If (CA) is equal to or larger than E, it is determined in step 308 that the shift direction is the backward direction. When the comparison targets are equal to each other, the shift direction may be determined in any of the front and rear directions, and normally, the shift is performed forward. Then, following step 307 and step 308, step 309
In, the task is shifted according to the shift direction determined to be either forward or backward, the task to be inserted is inserted, and the process ends.

【0029】次に、第2の実施例における方向決定の具
体例として、待ち行列の最大値を8として、図4
(a)、(b)および(c)に示される待ち行列の場合
について説明する。図4(a)に示されるパターン1の
場合には(C−A)の値は2となり、Eの値の4よりも
小さいので、シフト方向は前方となる。図4(b)に示
されるパターン2の場合には(C−B)の値は2とな
り、Eの値の4よりも小さいので、シフト方向は後方と
なる。そして、図4(c)に示されるパターン3の場合
には(C−A)の値は2となり、Eの値の4よりも小さ
いので、シフト方向は前方となる。
Next, as a concrete example of the direction determination in the second embodiment, the maximum value of the queue is set to 8 and FIG.
The case of the queues shown in (a), (b) and (c) will be described. In the case of the pattern 1 shown in FIG. 4A, the value of (C-A) is 2, which is smaller than the value E of 4, so the shift direction is forward. In the case of the pattern 2 shown in FIG. 4B, the value of (C-B) is 2, which is smaller than the value of 4 of E, so the shift direction is backward. Then, in the case of the pattern 3 shown in FIG. 4C, the value of (C-A) is 2, which is smaller than the value of E, 4, so the shift direction is forward.

【0030】この第2の実施例の採用により、従来例2
において行われている、現在格納されているタスク数の
計算処理(図11のステップ1103)が不要となり、
処理時間の短縮化を図ることができる。但し、この第2
の実施例においては、実際に格納されているタスクの数
ではなく、予め確保されている待ち行列全体の大きさを
用いているために、格納されているタスクの数が少ない
時には、第1の実施例の場合に比較してシフトするタス
クの数が増える場合があり得る。上述の例のように、待
ち行列に格納することのできる最大のタスク数が8個の
時に、挿入位置によってシフトするタスクの数が増える
場合の例が図5の表に示される。
By adopting this second embodiment, the conventional example 2
The calculation process of the number of tasks currently stored (step 1103 in FIG. 11), which is performed in
The processing time can be shortened. However, this second
In this embodiment, since the size of the entire queue that is reserved in advance is used instead of the number of tasks actually stored, when the number of stored tasks is small, the first The number of tasks to be shifted may increase as compared with the case of the embodiment. As in the above example, when the maximum number of tasks that can be stored in the queue is eight, an example in which the number of tasks to be shifted increases depending on the insertion position is shown in the table of FIG.

【0031】図5の表においては、上段は、第2の実施
例におけるシフトの方向と(P欄)、シフトされるタス
クの数とを示し(Q欄)、下段は、第1の実施例におけ
るシフトの方向と(R欄)、シフトされるタスクの数と
を示している(S欄)。また、表中の網掛けの部分は、
第1および第2の実施例において、シフトの回数が相互
に異なる場合を示している。例えば、待ち行列に3個の
タスクが格納されており、当該待ち行列の2番目と3番
目の間にタスクを挿入する場合には、第1の実施例にお
いては後方に1つだけタスクをシフトするのに対して、
第2の実施例においては前方に2つタスクをシフトする
方が選択される。また、待ち行列に4個のタスクが格納
されており、当該待ち行列の3番目と4番目の間にタス
クを挿入する場合、および待ち行列に5個のタスクが格
納されており、当該待ち行列の3番目と4番目の間にタ
スクを挿入する場合においても同様である。このケース
は、待ち行列に格納することのできる最大タスク数が増
える程多くなるが、前述のように、6〜8個程度の比較
的小さい待ち行列を使用する組込みマイクロコンピュー
タ用リアルタイムOSにおいては、上記のケースが発生
しても、全ての場合のシフト回数の最大値(図5の表に
おいては、7個のタスクが格納されている場合に、4番
目と5番目の間にタスクを挿入する時の回数など)であ
る3回を上回ることがないので、処理時間の最大時間が
長くなることはなく、タスク数の計算処理削減の効果が
得られる。
In the table of FIG. 5, the upper part shows the shift direction and the number of tasks to be shifted (column P) in the second embodiment (column Q), and the lower part shows the first embodiment. It shows the shift direction and the number of tasks to be shifted (column R) (column S). The shaded area in the table is
The first and second embodiments show the case where the number of shifts is different from each other. For example, if three tasks are stored in the queue and the tasks are inserted between the second and third tasks in the queue, only one task is shifted backward in the first embodiment. While doing
In the second embodiment, the one that shifts two tasks forward is selected. In addition, when four tasks are stored in the queue, and when tasks are inserted between the third and fourth queues, and when five tasks are stored in the queue, The same applies when a task is inserted between the third and fourth positions. This case increases as the maximum number of tasks that can be stored in the queue increases, but as described above, in a real-time OS for embedded microcomputers that uses a relatively small queue of about 6 to 8, Even if the above case occurs, the maximum value of the number of shifts in all cases (in the table of FIG. 5, when seven tasks are stored, the task is inserted between the fourth task and the fifth task). Since the maximum number of processing times does not become longer, the effect of reducing the calculation processing of the number of tasks can be obtained.

【0032】なお本発明の適用例として、78K/4シ
リーズを用いた処理時間の計測例においては、最大タス
ク格納数が8個の待ち行列に7個のタスクが格納されて
いる状態において、6番目と7番目のタスクの間にタス
クを挿入する場合に、従来例においては処理時間が35
μsec であったのに対して、前記第2の実施例適用時に
は、当該処理時間を25μsec に短縮することができて
いる。
As an application example of the present invention, in the processing time measurement example using the 78K / 4 series, when the maximum number of stored tasks is 8 and 7 tasks are stored in the queue, When a task is inserted between the seventh task and the seventh task, the processing time is 35 in the conventional example.
While it was μsec, the processing time can be shortened to 25 μsec when the second embodiment is applied.

【0033】[0033]

【発明の効果】以上説明したように、本発明は、待ち行
列に対するタスク挿入位置検索時に、当該待ち行列の状
態解析を介してパターン判別を行うことにより、前記検
索回数に応じて増大してゆくタスク管理に要する処理時
間を短縮することができるという効果がある。
As described above, according to the present invention, when a task insertion position is searched for a queue, pattern determination is performed through state analysis of the queue, so that the number of searches increases. The effect is that the processing time required for task management can be shortened.

【0034】また、従来、タスク挿入位置検索時に用い
られている通過タスク数のカウント機能が排除されて、
当該カウント機能に必要とされているRAM領域の付加
が全く不要になるという効果がある。
Further, the counting function of the number of passing tasks which has been conventionally used at the time of searching the task insertion position is eliminated,
There is an effect that the addition of the RAM area required for the counting function is completely unnecessary.

【0035】従って、資源に制約のある組込みマイクロ
コンピュータに対応して、リアルタイムOSに用いられ
るRAM領域の削減、ならびにリアルタイムOS処理の
要する処理時間の短縮が可能となり、当該マイクロコン
ピュータに対して、実用的なリアルタイムOSを提供す
ることができるという効果がある。
Therefore, it is possible to reduce the RAM area used for the real-time OS and to shorten the processing time required for the real-time OS processing corresponding to the embedded microcomputer with limited resources. There is an effect that a general real-time OS can be provided.

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

【図1】本発明の基本構成と、本発明の第1および第2
の実施例における挿入方法決定手段の構成を示す図であ
る。
FIG. 1 is a basic configuration of the present invention and first and second aspects of the present invention.
It is a figure which shows the structure of the insertion method determination means in the Example of this.

【図2】本発明の第1の実施例における処理手順のフロ
ーチャートを示す図である。
FIG. 2 is a diagram showing a flowchart of a processing procedure in the first embodiment of the present invention.

【図3】本発明の第2の実施例における処理手順のフロ
ーチャートを示す図である。
FIG. 3 is a diagram showing a flowchart of a processing procedure in the second embodiment of the present invention.

【図4】待ち行列のパターンを示す図である。FIG. 4 is a diagram showing a queue pattern.

【図5】本発明の第1および第2の実施例におけるタス
クのシフト数比較表を示す図である。
FIG. 5 is a diagram showing a task shift number comparison table in the first and second embodiments of the present invention.

【図6】一般的なリアルタイムOSの待ち行列を示す図
である。
FIG. 6 is a diagram showing a queue of a general real-time OS.

【図7】一般的なリアルタイムOSのタスク管理の構成
を示す図である。
FIG. 7 is a diagram showing a configuration of task management of a general real-time OS.

【図8】従来例1の待ち行列への挿入動作を示す図であ
る。
FIG. 8 is a diagram showing an inserting operation to a queue in Conventional Example 1.

【図9】従来例2の待ち行列への挿入動作を示す図であ
る。
FIG. 9 is a diagram showing an inserting operation to a queue in Conventional Example 2.

【図10】従来例2の基本構成と、従来例2における挿
入方法決定手段の構成を示す図である。
10 is a diagram showing a basic configuration of Conventional Example 2 and a configuration of an insertion method determining unit in Conventional Example 2. FIG.

【図11】従来例2における処理手順のフローチャート
を示す図である。
11 is a diagram showing a flowchart of a processing procedure in Conventional Example 2. FIG.

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

101、1001 挿入位置検索手段 102 絶対アドレス情報 103、1004 挿入方法決定手段 104、1005 タスク挿入手段 105、1006 現タスク数計算手段 106 待ち行列状態解析手段 107、1007 現タスク数の半分の値 108、110、1008 方向決定手段 109 待ち行列の最大値の半分の値 201、301、1102 挿入位置検索 202、1103 現タスク数計算 203、302 状態解析1 204、304 状態解析2 205、303 方向決定1 206、305 方向決定2 207、306 方向決定3 208、307、1005 前方 209、308、1106 後方 210、309、1107 タスク挿入 401、801、901 待ち行列 402 先頭アドレスA 403 空き領域アドレスB 404 挿入アドレスC 601 リストの先頭アドレス 602 次のリストのポインタ(タスク1の情報) 603 次のリストのポインタ(タスク2の情報) 604 次のリストのポインタ(タスクnの情報) 701 検索手段 702 選択手段 703 並び替え手段 802、902 先頭アドレス 803、903 空き領域アドレス 804、904 挿入アドレス 1002 通過タスク数カウント手段 1003 通過タスク数 1101 通過タスク数カウント 1104 方向決定 101, 1001 Insertion position search means 102 Absolute address information 103, 1004 Insertion method determination means 104, 1005 Task insertion means 105, 1006 Current task number calculation means 106 Queue state analysis means 107, 1007 Half value of current task number 108, 110, 1008 Direction determining means 109 Half value of maximum value of queue 201, 301, 1102 Insertion position search 202, 1103 Current task number calculation 203, 302 State analysis 1 204, 304 State analysis 2 205, 303 Direction determination 1 206 , 305 Direction determination 2 207, 306 Direction determination 3 208, 307, 1005 Front 209, 308, 1106 Rear 210, 309, 1107 Task insertion 401, 801, 901 Queue 402 402 Start address A 403 Free area address B 404 Input address C 601 List start address 602 Next list pointer (task 1 information) 603 Next list pointer (task 2 information) 604 Next list pointer (task n information) 701 Search means 702 Selection means 703 Sorting means 802, 902 Start address 803, 903 Free area address 804, 904 Insert address 1002 Passing task number counting means 1003 Passing task number 1101 Passing task number counting 1104 Direction determination

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 複数のタスクの実行を管理するととも
に、所定の待ち行列と空き領域により構成される有限の
配列を用いて実行待ちタスクの管理を行うリアルタイム
OSのタスク管理方式において、 前記待ち行列の中に所定タスクを挿入する際に、当該所
定タスクを前記待ち行列内に挿入するための当該行列内
の位置を検索する挿入位置検索手段と、 前記待ち行列の先頭アドレスと前記空き領域の先頭アド
レスとを用い、所定の解析処理を介して、前記挿入位置
検索手段により求められたタスク挿入位置に前記所定タ
スクを挿入する方法を決定する挿入方法決定手段と、 前記挿入方法決定手段により決定された挿入方法によ
り、前記待ち行列に前記所定タスクを挿入するタスク挿
入手段と、 を備えることを特徴とするタスク管理方式。
1. A task management system for a real-time OS, which manages execution of a plurality of tasks, and manages tasks waiting to be executed using a finite array composed of a predetermined queue and an empty area. Insertion position searching means for searching a position in the queue for inserting the predetermined task into the queue when inserting the predetermined task into the queue, a start address of the queue and a head of the empty area An insertion method determining unit that determines a method of inserting the predetermined task at the task insertion position obtained by the insertion position searching unit using a predetermined analysis process using an address, and is determined by the insertion method determining unit. And a task inserting unit that inserts the predetermined task into the queue by the insertion method.
【請求項2】 前記挿入方法決定手段が、前記待ち行列
の現時点における先頭アドレスと、当該待ち行列の前記
空き領域の先頭アドレスと、前記位置検索手段による挿
入位置検索を介して得られるタスク挿入位置のアドレス
とを用いて、当該待ち行列に格納されている現時点にお
けるタスクの個数を計算して出力する現タスク数計算手
段と、 前記現タスク数計算手段により得られる現時点における
前記タスク個数を参照し、前記待ち行列の現時点におけ
る状態を解析して、当該待ち行列のパターンを識別する
待ち行列状態解析手段と、 前記待ち行列状態解析手段により得られる前記パターン
の識別情報と、前記現タスク数計算手段より計算出力さ
れる前記タスクの個数の半分に相当する数値とを用い
て、前記待ち行列に対するタスク挿入のシフト方向を決
定する方向決定手段と、 を備えることを特徴とする請求項1記載のタスク管理方
式。
2. A task insertion position obtained by the insertion method determining means through the insertion position search by the position search means, the start address of the queue at the current time point, the start address of the empty area of the queue, And the current task number calculation means for calculating and outputting the number of tasks at the current time stored in the queue, and the current number of tasks obtained by the current task number calculation means. A queue state analysis unit that analyzes the current state of the queue to identify the pattern of the queue, identification information of the pattern obtained by the queue state analysis unit, and the current task number calculation unit And a numerical value corresponding to half of the number of tasks calculated and output, Task management method according to claim 1, characterized in that it comprises a direction determining means for determining the winding direction, the.
【請求項3】 前記挿入方法決定手段が、前記待ち行列
の現時点における先頭アドレスと、当該待ち行列の前記
空き領域の先頭アドレスと、前記位置検索手段による挿
入位置検索を介して得られるタスク挿入位置のアドレス
とを参照し、前記待ち行列の現時点における状態を解析
して、当該待ち行列のパターンを識別する待ち行列状態
解析手段と、 前記待ち行列の現時点における先頭アドレスと、当該待
ち行列の前記空き領域の先頭アドレスと、前記位置検索
手段による挿入位置検索を介して得られるタスク挿入位
置のアドレスと、前記待ち行列状態解析手段により得ら
れる前記パターンの識別情報と、予め規定される前記待
ち行列の最大値の半分に相当する数値とを用いて、前記
待ち行列に対するタスク挿入のシフト方向を決定する方
向決定手段と、 を備えることを特徴とする請求項1記載のタスク管理方
式。
3. The task insertion position obtained by the insertion method determination means through the insertion address search by the position search means, the start address of the queue at the current time point, the start address of the empty area of the queue, Address of the queue, the queue state analysis means for analyzing the state of the queue at the present time to identify the pattern of the queue, the head address at the present time of the queue, and the free space of the queue. The start address of the area, the address of the task insertion position obtained through the insertion position search by the position search means, the identification information of the pattern obtained by the queue state analysis means, and the predefined queue And a numerical value corresponding to half of the maximum value are used to determine the direction of shifting the task insertion to the queue. Task management method according to claim 1, characterized in that it comprises a means.
JP13369495A 1995-05-31 1995-05-31 Task management method Expired - Fee Related JP2740469B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13369495A JP2740469B2 (en) 1995-05-31 1995-05-31 Task management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13369495A JP2740469B2 (en) 1995-05-31 1995-05-31 Task management method

Publications (2)

Publication Number Publication Date
JPH08328879A true JPH08328879A (en) 1996-12-13
JP2740469B2 JP2740469B2 (en) 1998-04-15

Family

ID=15110699

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13369495A Expired - Fee Related JP2740469B2 (en) 1995-05-31 1995-05-31 Task management method

Country Status (1)

Country Link
JP (1) JP2740469B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100383742C (en) * 2006-04-07 2008-04-23 浙江大学 Implementation method for real-time task establishment in Java operating system
CN100383743C (en) * 2006-04-07 2008-04-23 浙江大学 Real-time task scheduling method in Java operating system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100383742C (en) * 2006-04-07 2008-04-23 浙江大学 Implementation method for real-time task establishment in Java operating system
CN100383743C (en) * 2006-04-07 2008-04-23 浙江大学 Real-time task scheduling method in Java operating system

Also Published As

Publication number Publication date
JP2740469B2 (en) 1998-04-15

Similar Documents

Publication Publication Date Title
US5918033A (en) Method and apparatus for dynamic location and control of processor resources to increase resolution of data dependency stalls
CA1223371A (en) System for by-pass control in pipeline operation of computer
US5471626A (en) Variable stage entry/exit instruction pipeline
US5742805A (en) Method and apparatus for a single history register based branch predictor in a superscalar microprocessor
EP0118781A2 (en) Control flow parallel computer system
US7093105B2 (en) Method and apparatus for determining availability of a queue to which a program step is issued out of program order
EP0220682B1 (en) Data processing system
EP0093430B1 (en) Pipeline data processing system
US6209081B1 (en) Method and system for nonsequential instruction dispatch and execution in a superscalar processor system
US5276821A (en) Operation assignment method and apparatus therefor
US20030037227A1 (en) Processor enabling exception handling to be set by program
US20080215859A1 (en) Computer with high-speed context switching
JPH08328879A (en) Task management system
US7337304B2 (en) Processor for executing instruction control in accordance with dynamic pipeline scheduling and a method thereof
US6311266B1 (en) Instruction look-ahead system and hardware
US20090063808A1 (en) Microprocessor and method of processing data
JP2638314B2 (en) Automatic Change Method of External Storage Device for Swapping in Virtual Storage System
JPH08249018A (en) Multiprocessor arithmetic unit and programmable controller having the arithmetic unit
JPH06230963A (en) Memory access controller
JP3123946B2 (en) Microcomputer
JP2938072B1 (en) Operating system timer management
JPH03255530A (en) Parallel instruction fetching mechanism
JPH07230358A (en) Multiplexed volume device
KR20020004798A (en) Apparatus and method for data processing using multiply-accumulate instructions
JPS62138924A (en) Table search control system

Legal Events

Date Code Title Description
R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20080123

Year of fee payment: 10

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

Year of fee payment: 11

Free format text: PAYMENT UNTIL: 20090123

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

Year of fee payment: 12

Free format text: PAYMENT UNTIL: 20100123

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

Free format text: PAYMENT UNTIL: 20110123

Year of fee payment: 13

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

Free format text: PAYMENT UNTIL: 20110123

Year of fee payment: 13

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

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

Free format text: PAYMENT UNTIL: 20110123

Year of fee payment: 13

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20110123

Year of fee payment: 13

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

Free format text: PAYMENT UNTIL: 20120123

Year of fee payment: 14

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

Year of fee payment: 15

Free format text: PAYMENT UNTIL: 20130123

LAPS Cancellation because of no payment of annual fees