JP3071210B2 - Task management control method - Google Patents

Task management control method

Info

Publication number
JP3071210B2
JP3071210B2 JP2201505A JP20150590A JP3071210B2 JP 3071210 B2 JP3071210 B2 JP 3071210B2 JP 2201505 A JP2201505 A JP 2201505A JP 20150590 A JP20150590 A JP 20150590A JP 3071210 B2 JP3071210 B2 JP 3071210B2
Authority
JP
Japan
Prior art keywords
task
execution
priority level
level
priority
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.)
Expired - Fee Related
Application number
JP2201505A
Other languages
Japanese (ja)
Other versions
JPH0486923A (en
Inventor
哲仁 渡辺
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric 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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP2201505A priority Critical patent/JP3071210B2/en
Publication of JPH0486923A publication Critical patent/JPH0486923A/en
Application granted granted Critical
Publication of JP3071210B2 publication Critical patent/JP3071210B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔概要〕 複数の優先レベルを有する複数のタスクの実行を管理
するタスク管理制御方式に関し、 割込み要求に対応するタスクのスイッチを高速に行う
こと、さらにはPレベルのタスクのスイッチをも高速に
行えるようにすることを目的とし、 複数の優先レベルを有するタスクと前記各優先レベル
に1対1に対応して設けられた当該優先レベルのタスク
がキューイングされる複数の優先レベルキューとを有
し、最も高い優先レベルのキューにキューイングされて
いるタスクを優先的に実行させるタスク管理制御方式に
おいて、前記各優先レベルのタスクの実行を行うタスク
実行手段と、前記各優先レベル毎の優先レベルキューを
有し、割り込みもしくはプログラム起動により任意のタ
スクの実行要求がなされた場合、その実行要求のなされ
たタスクを、そのタスクの優先レベルに対応する優先レ
ベルキューにキューイングすると共に、そのキューイン
グされたタスクの優先レベルを示すキューイング優先レ
ベル情報を出力するタスク管理手段と、該タスク管理手
段から出力される前記優先レベル情報に基づいて設定さ
れる現在実行待ちとなっているタスクの全ての優先レベ
ルを記憶する第1の記憶手段と、前記タスク実行手段に
より現在実行されているタスクの優先レベルを記憶する
第2の記憶手段とを有し、タスク管理手段から前記キュ
ーイング優先レベル情報が出力されたとき、そのキュー
イング優先レベル情報の示す優先レベルを前記第1の記
憶手段に記憶すると共に、前記第1の記憶手段と前記第
2の記憶手段とに記憶されている情報に基づいて、前記
タスク実行手段により現在実行されているタスクの優先
レベルと現在実行待ちとなっているタスクの優先レベル
とを比較し、実行待ちとなっているタスクの方が優先レ
ベルが高い場合には、タスクのスイッチングを要求する
タスクスイッチ指令信号と上記実行待ちとなっているタ
スクの優先レベルのうち、最も高い優先レベルを示すス
イッチ優先レベル情報を出力し、一方、現在実行中のタ
スクの方が優先レベルが高ければ、上記タスクスイッチ
指令信号は出力しない実行タスク選択手段とを備え、前
記タスク管理手段は、前記タスク実行手段とは独立して
備えられ、前記実行タスク選択手段は、前記タスク実行
手段若しくは前記タスク管理手段のいずれからも独立し
て備えられ、前記タスク実行手段は、タスクの実行を開
始する際に、そのタスクの優先レベルを示す情報を前記
実行タスク選択手段内の第2の記憶手段に設定すると共
に、前記実行タスク選択手段から前記タスクスイッチ指
令信号と前記スイッチ優先レベル情報とを入力すると、
現在実行中のタスクの実行を中断し、その上位レベルの
タスクの優先レベルに対応する優先レベルキューの先頭
にキューイングされているタスクを新たに実行し、タス
ク実行終了後には、それまで実行していたタスクと同じ
優先レベルに対応する優先レベルキューにタスクがキュ
ーイングされているか否か判別し、タスクがキューイン
グされていればそのタスクの実行を開始し、タスクがキ
ューイングされていなければ、上記タスクスイッチ指令
信号の入力により中断したタスクの実行を再開させると
共に、そのタスクの優先レベルを示す情報を前記実行タ
スク選択手段内の第2の記憶手段に書き込むように構成
する。
DETAILED DESCRIPTION OF THE INVENTION [Summary] The present invention relates to a task management control system for managing execution of a plurality of tasks having a plurality of priority levels, in which a task corresponding to an interrupt request is switched at a high speed, and a P-level task is performed. A task having a plurality of priority levels and a task of the priority level provided in one-to-one correspondence with each of the priority levels are queued. In a task management control method having a priority level queue and preferentially executing a task queued in the highest priority level queue, a task executing means for executing the task of each priority level; It has a priority level queue for each priority level, and when an arbitrary task execution request is made by interrupt or program startup, Task management means for queuing the task requested to be executed in a priority level queue corresponding to the priority level of the task, and outputting queuing priority level information indicating the priority level of the queued task; First storage means for storing all priority levels of tasks currently waiting to be set, which are set based on the priority level information output from the task management means; and Second storage means for storing the priority level of the task in question, wherein when the queuing priority level information is output from the task management means, the priority level indicated by the queuing priority level information is stored in the first storage. Means, and based on information stored in the first storage means and the second storage means, The priority level of the task currently being executed by the task execution means is compared with the priority level of the task currently waiting for execution, and if the task waiting for execution has a higher priority level, the task It outputs switch priority level information indicating the highest priority level among the task switch command signal requesting switching and the priority level of the task waiting to be executed, while the priority level of the currently executing task is higher. If it is higher, the task switch command signal is not output, and the execution task selection means is not provided.The task management means is provided independently of the task execution means, and the execution task selection means is the task execution means or the task execution means. The task execution means is provided independently of any of the task management means. The information indicating the priority level of a task and sets the second storage means in said execution task selection means, the task switch instruction signal from said execution task selection means and by entering the said switch priority level information,
Suspends the execution of the currently executing task, newly executes the task queued at the top of the priority level queue corresponding to the priority level of the higher-level task, and executes the task after completion of the task execution. Determines whether the task is queued in the priority queue corresponding to the same priority level as the task that was waiting, and if the task is queued, starts executing the task. If the task is not queued, The execution of the task interrupted by the input of the task switch command signal is resumed, and information indicating the priority level of the task is written to the second storage means in the execution task selection means.

〔産業上の利用分野〕[Industrial applications]

本発明は、複数の優先レベルを有する複数のタスクの
実行を管理するタスク管理制御方式に関する。
The present invention relates to a task management control method for managing execution of a plurality of tasks having a plurality of priority levels.

〔従来の技術〕[Conventional technology]

プログラマブルコントローラ等の情報処理装置のタス
クの起動要因としては一般に、 サイクリックタスク起動 インタバルタイマによる定周期割込みタスク起動 外部割込みタスク起動 プログラム割込みタスク起動(ソフトエンター等) の4種があり、またタスクの優先レベル例としては、サ
イクリックタスク起動によるPレベルタスク、定周期割
込み、外部割込み、並びにソフト割込みタスク起動によ
る1〜4レベルタスク、外部割込み並びにプログラム割
込みタスク起動による0レベルタスクがある。このタス
クの優先レベルの数は、各装置の仕様、規模で決定され
る。
Generally, there are four types of activation factors for tasks of information processing devices such as programmable controllers: cyclic task activation, fixed-cycle interrupt task activation by interval timer external interrupt task activation, program interrupt task activation (soft enter, etc.). Examples of priority levels include a P-level task by starting a cyclic task, a periodic interrupt, an external interrupt, a 1-4 level task by starting a soft interrupt task, and a 0-level task by starting an external interrupt and a program interrupt task. The number of priority levels of this task is determined by the specifications and scale of each device.

第6図(a)〜(f)は、プログラマブルコントロー
ラに設けられたタスクの優先レベル及び各優先レベルに
定義されたタスクのNo.の例を示す図である。同図
(a)〜(f)は、タスクNo.により、タスクの優先レ
ベルが決定される例であるが、1のタスクNo.に対し、
タスクの優先レベルを、自由に設定できる場合もある。
6 (a) to 6 (f) are diagrams showing examples of task priority levels provided in the programmable controller and task numbers defined in each priority level. FIGS. 7A to 7F are examples in which the priority level of a task is determined by the task number.
In some cases, the priority level of a task can be freely set.

タスクの優先レベルは、P<4<3<2<1<0に設
定されている。Pレベルタスクは、ディスパッチャ(di
spatcher)により、X‘00'→X‘01'→……→X‘3E'
→X‘3F'→X‘00'→X‘01'・・・というように、第
6図(a)に示すPレベルのタスクNo.格納テーブルの
格納順に、各タスクNo.を有するタスクがサイクリック
に実行される。また、「1」〜「4」のレベルタスク
は、例えば、ある一定時間間隔(例えば、100msec)毎
に起動される定周期起動、プラントの入力情報等による
外部割込み起動、又はプログラム処理からのエンター起
動により、実行される。0レベルタスクは主に、システ
ムのイニシャル処理、重故障処理等に利用され、前記の
プログラム処理起動又は外部割込み起動により実行され
る。
The task priority level is set to P <4 <3 <2 <1 <0. P-level tasks are dispatchers (di
X'00 '→ X'01' → …… → X'3E '
.. X′3F ′ → X′00 ′ → X′01 ′..., The tasks having the respective task numbers are stored in the P-level task number storage table shown in FIG. Performed cyclically. The level tasks of “1” to “4” include, for example, a fixed-cycle start that is started at a certain fixed time interval (for example, 100 msec), an external interrupt start based on plant input information, or an enter from program processing. It is executed by activation. The 0-level task is mainly used for system initial processing, serious failure processing, and the like, and is executed by activating the program processing or activating an external interrupt.

次に第7図を参照しながら、タスクの動作を説明す
る。第6図(a)に示すテーブルの格納順にX‘00'→
X‘01'→X‘02'とPレベルタスクが実行されて、X
‘02'のタスクが実行中に3レベルのX‘61'のタスクの
実行要求が発生すると、X‘02'のタスクの実行が中断
され、より高い3レベルのX‘61'のタスクに処理が移
る。そして、上記3レベルのX‘61'のタスクが実行中
に、1レベルのX‘70'のタスクの実行要求が発生する
と、3レベルのX‘61'のタスクが中断され、1レベル
のX‘70'のタスクに実行権が移行する。そして、この
1レベルのX‘70'のタスクが実行中に、2レベルのX
‘6F'のタスクの実行要求があっても、そのX‘6F'のタ
スクの実行は、X‘70'のタスクが実行するまで待たさ
れ、X‘70'のタスクの実行終了後に受け付けられて、
X‘70'のタスクからX‘6F'のタスクへと実行が移行す
る。以下同様にして、任意のタスクが実行中に、そのタ
スクよりも高いレベルのタスクからの実行要求が発生す
れば、上記任意のそのタスクの実行が中断され、より高
いレベルのタスクに実行権が移行し、その高いレベルの
タスクの処理終了後、再びより低いレベルの上記任意の
タスクが再び実行される。
Next, the operation of the task will be described with reference to FIG. X'00 'in the storage order of the table shown in FIG.
X'01 '→ X'02' and the P-level task are executed, and X
If a task execution request for a three-level X'61 'task is issued while the' 02 'task is being executed, the execution of the X'02' task is interrupted and processed to a higher three-level X'61 'task. Moves. Then, when the execution request of the task of the one-level X'70 'occurs while the task of the three-level X'61' is being executed, the task of the three-level X'61 'is interrupted and the one-level X'61' is interrupted. Execution right is transferred to task '70'. Then, while this one-level X'70 'task is being executed, the two-level X'70'
Even if there is a request to execute the task of '6F', the execution of the task of X'6F 'is waited until the task of X'70' is executed, and is accepted after the execution of the task of X'70 'is completed. ,
Execution shifts from the task X'70 'to the task X'6F'. Similarly, if an execution request is issued from a higher-level task during execution of any task, the execution of the above-mentioned arbitrary task is suspended, and the execution right is assigned to the higher-level task. After the transition and the processing of the higher-level task is completed, the lower-level arbitrary task is executed again.

また、第7図において、X‘51'のタスクからX‘02'
のタスク(継続実行)に実行権が移った後は、割込み要
求が発生していない為、X‘02'→X‘03'…→X‘3E'
→X‘3F'→X‘00'→X‘01'…の順に、Pレベルタス
クがサイクリックに実行される。
In FIG. 7, the task X'51 'is shifted to the task X'02'.
X'02 '→ X'03' ... → X'3E 'after the execution right has been transferred to the task (continuous execution)
The P-level tasks are cyclically executed in the order of → X′3F ′ → X′00 ′ → X′01 ′.

このようなタスク管理の従来における1つの方式とし
て、単一プロセッサでタスク実行とタスク管理の双方を
行う例があるが、この場合、タスクの実行処理、割込み
イベント管理処理、及びイベント発生時もしくは1タス
ク終了時に次に実行すべきタスクを決定する決定処理
(ディスパッチ:Dispatch)がシリアルに行われる為、P
Cのユーザプログラム(アプリケーションプログラム)
の実行において、上記のようなタスクスイッチに要する
オーバーヘッドが大きくなってしまうという問題があ
る。
As one conventional method of such task management, there is an example in which both task execution and task management are performed by a single processor. In this case, task execution processing, interrupt event management processing, and when an event occurs or when 1 At the end of the task, the decision process (dispatch) to determine the task to be executed next is performed serially.
C user program (application program)
However, there is a problem in that the overhead required for the task switch as described above increases.

また、従来のタスク管理の他の方式の一例として、上
記オーバーヘッドを減らす為に、タスク実行を行う実行
プロセッサと、割込みイベント管理とタスク管理を行う
上記実行プロセッサと並列処理可能なタスク管理プロセ
ッサとで構成されるシステムの一例を第8図に示す。
Further, as another example of the conventional task management method, in order to reduce the overhead, an execution processor that performs task execution and a task management processor that performs interrupt event management and task management and that can perform parallel processing with the execution processor are used. FIG. 8 shows an example of the system configured.

同図において、プログラムメモリ11は、マクロ命令か
ら成る複数のタスクから構成されるユーザプログラムが
格納されているROM(リード・オンリ・メモリ)もしく
はRAM(ランダム・アクセス・メモリ)等のメモリ、フ
ェッチ制御回路20は上記プログラムメモリ11からマクロ
命令をフェッチする為の回路であり、プログラムカウン
タ(PC)21と上記マクロ命令が格納される命令レジスタ
(iRG)22から構成される。MAP制御回路13は、後述する
マイクロプログラム制御方式でマクロ命令の解読・実行
を行う実行プロセッサ1に対し命令のインタプリト(解
読及び実行)起動を行うMAP制御回路である。データメ
モリ30は、前記プログラムメモリ11内に格納されている
全タスクの先頭番地を各タスク毎にそのタスクNo.に対
応させて管理しているアドレステーブルであるタスクN
o.エントリーテーブル31(以下TET31と称す)と、割込
み処理でタスクスイッチするときに今まで実行していた
タスクはプログラムカウンタ(以下、PCと記す)、スタ
ックポインタ等の各種情報を各割込みレベル毎(0〜4
レベル)に退避する領域である割込み制御ファイル32
(以下iRTCB32と称す)とから構成されている。
In FIG. 1, a program memory 11 is a memory such as a ROM (read only memory) or a RAM (random access memory) in which a user program composed of a plurality of tasks composed of macro instructions is stored, and a fetch control. The circuit 20 is a circuit for fetching a macro instruction from the program memory 11, and includes a program counter (PC) 21 and an instruction register (iRG) 22 in which the macro instruction is stored. The MAP control circuit 13 is a MAP control circuit for interpreting (decoding and executing) an instruction and for activating the execution processor 1 which decodes and executes a macro instruction by a microprogram control method described later. The data memory 30 is a task N which is an address table that manages the start addresses of all tasks stored in the program memory 11 in correspondence with the task numbers for each task.
o. Entry table 31 (hereinafter referred to as TET31), and the tasks that have been executed up to now when switching tasks in interrupt processing, include various information such as a program counter (hereinafter referred to as PC) and a stack pointer for each interrupt level. (0-4
Interrupt control file 32, which is the area saved to the level
(Hereinafter referred to as iRTCB32).

そして、前記実行プロセッサ14とデータメモリ30は内
部バス50を介して、互いに接続されており、内部バス50
は特に図示していない外部システムバス60に接続されて
いる。
The execution processor 14 and the data memory 30 are connected to each other via an internal bus 50.
Are connected to an external system bus 60 (not shown).

タスク管理プロセッサ40は、外部割込み、実行プロセ
ッサ14からのプログラム割込み、定周期タイマ(インタ
ーバル・タイマ)41からの定周期割込み等のイベントを
検出するイベント検出機構42、該イベント検出機構42で
検出したイベントを、0〜4レベルのうちの該当する割
込みレベルのキューファイルに対応するタスクNo.で登
録するファースト・イン・ファースト・アウト(FIFO)
構造の割込み要求キューファイル43、各実行レベルにお
けるタスク管理情報(割込みマスク情報等)が書き込ま
れている割込み制御ファイル45、各レベル毎の割込みマ
スクレジスタ44、及びPレベルのタスクのタスクNo.を
管理するタスクNo.管理ファイル46から構成されてい
る。
The task management processor 40 detects events such as an external interrupt, a program interrupt from the execution processor 14, and a fixed-cycle interrupt from a fixed-cycle timer (interval timer) 41, and the like. First-in-first-out (FIFO) for registering an event with a task number corresponding to the queue file of the corresponding interrupt level among the 0 to 4 levels
An interrupt request queue file 43 having a structure, an interrupt control file 45 in which task management information (interrupt mask information and the like) at each execution level is written, an interrupt mask register 44 for each level, and a task number of a P-level task. It consists of a task number management file 46 to be managed.

上述したように、実行プロセッサ14はマイクロプログ
ラム制御方式を採用しており、1つのタスク実行中は、
プログラムメモリ11からPC21の指すアドレスに格納され
ているマクロ命令をiRG22にフェッチし、MAP制御回路13
を介し、通常命令の場合は、マイクロインタプリタ処理
として各種演算及びデータ転送を行う。このMAP→演算
→MAP→演算…の繰り返しにより、タスクは1命令ずつ
実行されていく。この処理は第4図のEのに該当し、
マップ制御によりマクロ命令で記述されたユーザプログ
ラムは、マイクロ命令で記述されたそのマクロ命令に該
当するインタプリタ(命令の解読・実行)の先頭番地へ
マッピングすることにより、そのマクロ命令に該当する
あらかじめ決められた各種データ演算及びデータ転送処
理等を行う。これらの実行処理と並行してタスク管理プ
ロセッサ40は、以下の処理を行う。
As described above, the execution processor 14 employs a microprogram control method, and during execution of one task,
The macro instruction stored at the address pointed to by the PC 21 from the program memory 11 is fetched into the iRG 22 and the MAP control circuit 13
In the case of a normal instruction, various operations and data transfer are performed as micro-interpreter processing. The task is executed one instruction at a time by repeating this MAP → operation → MAP → operation... This processing corresponds to E in FIG.
The user program described by the macro instruction by the map control is mapped to the start address of the interpreter (decoding and execution of the instruction) corresponding to the macro instruction described by the micro instruction so that the predetermined program corresponding to the macro instruction is determined. And performs various data calculations and data transfer processing. In parallel with these execution processes, the task management processor 40 performs the following processes.

T 外部割込み、定周期タイマ41からの定周期割込
み、及び実行プロセッサ14からのプログラム割込みをイ
ベント検出機構42で検出する。
T The event detection mechanism 42 detects an external interrupt, a periodic interrupt from the periodic timer 41, and a program interrupt from the execution processor 14.

T 割込みイベント発生時は、割込み要求のあったタ
スクを、そのタスクの割込み要求レベルに対応する割込
み要求キューファイル43内にタスクNo.により格納して
いく。
T When an interrupt event occurs, the task that has issued the interrupt request is stored in the interrupt request queue file 43 corresponding to the interrupt request level of the task by the task number.

T 現在実行しているタスクのレベルに対応する割込
みレベルマスクレジスタ44の情報に基づき、マスクされ
ていない割込みレベルのタスクNo.が割込み要求キュー
ファイル43にキューイングされている場合は(ソフトウ
ェア手段で判定)、割込み制御ファイル45の現在実行中
のタスクの割込みレベルに対応する領域に、それまで実
行されていたタスクのタスク管理情報(レベルNo.、マ
スクレジスタ情報等)を退避し、新たに実行すべきタス
クのレベルに対応するマスク情報を割込レベルマスクレ
ジスタ44にセットし、さらにタスクスイッチ指令をMAP
制御回路13へ、又新たに割込み起動させるタスクのタス
クNo.並びにレベルを実行プロセッサ14へ通知する。
T If the task number of the unmasked interrupt level is queued in the interrupt request queue file 43 based on the information of the interrupt level mask register 44 corresponding to the level of the task currently being executed (by software means) Judgment), saves the task management information (level No., mask register information, etc.) of the task that has been executed up to the area corresponding to the interrupt level of the currently executing task in the interrupt control file 45, and newly executes the task. Mask information corresponding to the level of the task to be set is set in the interrupt level mask register 44, and a task switch command is set to MAP
It notifies the control circuit 13 and the task number and level of the task to be newly activated by the interrupt to the execution processor 14.

T 割込み要求キューファイル43から新たに起動させ
たタスクのタスクNo.を削除する。続いて、実行プロセ
ッサ14は、タスクスイッチ指令によるMAP処理により、
タスク起動割込み処理ルーチンにマッピングされ、上記
タスク起動割込み処理ルーチンの実行により、以下に示
すE〜Eの処理を行う。
T Delete the task number of the newly started task from the interrupt request queue file 43. Subsequently, the execution processor 14 performs the MAP processing by the task switch command,
The process is mapped to the task activation interrupt processing routine, and the following processes E to E are performed by executing the task activation interrupt processing routine.

E タスク管理プロセッサ40から通知された割込みに
より起動させるタスクのレベルに対応するデータメモリ
30内の割込み制御ファイル32に、今まで実行していたレ
ベルのタスクの種々のタスク情報(プログラムカウン
タ、スタックポインタ等)を退避する。
E Data memory corresponding to the task level activated by the interrupt notified from the task management processor 40
Various task information (program counter, stack pointer, etc.) of the task of the level executed so far is saved in the interrupt control file 32 in 30.

E タスク管理プロセッサ40から通知されたタスクN
o.を有するタスクの新たな割込みタスクのプログラムメ
モリ11内の格納先頭アドレスをTET31から求めて、PC21
にセットし、次に、その新たな割込みタスクの実行をMA
P→演算→MAP→…の繰り返しを行いながら実行させる。
E Task N notified from task management processor 40
The start address of the new interrupt task in the program memory 11 for the task having the task o.
And then execute the new interrupt task
Execute while repeating P → calculation → MAP → ...

E そして、タスク終了命令をフェッチした場合、タ
スク管理プロセッサ40に対しタスク終了割込みをかけ
る。このことにより、実行プロセッサ14は、タスク管理
プロセッサ40からのタスクスイッチ指令待ちとなる。
E When a task end instruction is fetched, a task end interrupt is issued to the task management processor 40. As a result, the execution processor 14 waits for a task switch command from the task management processor 40.

次に、タスク管理プロセッサ40は、実行プロセッサ14
からタスク終了割込みが加わると、以下に示すTの処
理を行う。
Next, the task management processor 40
When a task end interrupt is added from step (1), the processing of T shown below is performed.

T 割込み要求キューファイル43の現在実行中のタス
クのレベルに等しいレベル領域(現実行タスクレベル領
域)を検索し、要求タスクNo.があれば、前記処理T
と同様にして再び同レベルのタスクスイッチ指令をMAP
制御回路13に、割込み起動を行うタスクのタスクNo.並
びにタスクレベルを実行プロセッサ14に対し出力した
後、前記処理Tを行う。
T Search the interrupt request queue file 43 for a level area equal to the level of the currently executing task (currently executing task level area).
MAP the same level task switch command again
After outputting to the control circuit 13 the task number and task level of the task to be activated by the interrupt to the execution processor 14, the processing T is performed.

実行プロセッサ14は、タスクスイッチ指令によるマッ
ピング処理により、今度は前記処理Eを行わないで前
記処理Eを行う。
The execution processor 14 performs the process E without performing the process E by the mapping process based on the task switch command.

一方、タスク管理プロセッサ40は、前記処理Tにお
いて、前記現実行レベル領域に要求タスクNo.がない場
合は以下の処理Tを行う。
On the other hand, if there is no required task number in the current execution level area in the processing T, the task management processor 40 performs the following processing T.

T 割込み制御ファイル45から、退避させておいた前
実行レベルのタスクのタスク管理情報を復帰し、次に前
実行レベルのタスクのマスクレジスタ情報を割込みレベ
ルマスクレジスタ44へセットした後、前実行レベルのタ
スクへの切り換えを指示するタスクスイッチ指令をMAP
制御回路13へ通知する。
T The task management information of the task of the previous execution level saved from the interrupt control file 45 is restored, and the mask register information of the task of the previous execution level is set in the interrupt level mask register 44. MAP a task switch command to switch to another task
The control circuit 13 is notified.

実行プロセッサ14は、上記タスクスイッチ指定が加わ
ると、MAP処理により以下の処理Eを行う。
When the task switch designation is added, the execution processor 14 performs the following processing E by MAP processing.

E 割込み制御ファイル32の現在実行しているタスク
のレベルに等しいレベル領域から前回実行していたより
下位レベルのタスクの各種タスク情報(PC、スタックポ
インタ等)を読み出し、その読み出した各種タスク情報
を、当該レジスタ、フラグ等に再セットし、再び前回実
行していたタスクのMAP→演算→…の処理を再開する。
E Read various task information (PC, stack pointer, etc.) of the lower-level task that was previously executed from the level area equal to the level of the currently executed task in the interrupt control file 32, and The registers, flags, etc. are reset, and the MAP → operation →... Processing of the previously executed task is restarted again.

以上は、割込みタスクの動作であるが、Pレベルタス
クについても同様であり、タスク管理プロセッサ40は、
Pレベルタスクの終了割込みにより、以下に示すTの
処理を行う。
The above is the operation of the interrupt task, but the same applies to the P-level task.
The process of T shown below is performed by the end interrupt of the P-level task.

T PレベルタスクNo.管理ファイル46から、次に実
行するタスクNo.を求め(Pレベルタスクは、X‘00'→
X‘01'→…n(nは任意の正の16進値)→X‘00'→…
→n→X‘00'のようにサイクリックに実行すべきタス
クのタスクNo.が決定されていく)、前記処理Tと同
様にタスクスイッチ指令をMAP制御回路13へ、又起動す
べきタスクのタスクNo.とそのレベル(Pレベル)を実
行プロセッサ14に通知する。
The task number to be executed next is obtained from the TP level task number management file 46 (the P level task is X'00 '→
X'01 '→ ... n (n is any positive hexadecimal value) → X'00' → ...
The task number of the task to be cyclically executed is determined as follows: → n → X'00 '), and a task switch command is sent to the MAP control circuit 13 as in the process T, and the task to be started is The task number and its level (P level) are notified to the execution processor 14.

実行プロセッサ14は、タスクスイッチ指令によるマッ
ピング処理により、前記処理Eを行わずに前記処理E
と同様にプログラムメモリ11内のPレベルタスクの格
納領域の先頭アドレスをPC21にセットして、Pレベルタ
スクを実行させていく。そして、タスク終了命令をフェ
ッチした場合には、前記処理Eを行い、タスク管理プ
ロセッサ40は、再び前記処理Tを行う。
The execution processor 14 performs the processing E without performing the processing E by the mapping processing based on the task switch command.
Similarly to the above, the start address of the storage area of the P-level task in the program memory 11 is set in the PC 21, and the P-level task is executed. Then, when the task end instruction is fetched, the process E is performed, and the task management processor 40 performs the process T again.

上述したように、Pレベルタスクにおいても、割込み
タスクと同様にタスク管理プロセッサ40からのタスクス
イッチ指令と実行プロセッサ14からのタスク終了割込み
によりタスク管理プロセッサ40と実行プロセッサ14間で
ハンドシェークが行われながらタスクが実行される。
As described above, also in the P-level task, the handshake is performed between the task management processor 40 and the execution processor 14 by the task switch command from the task management processor 40 and the task end interrupt from the execution processor 14 similarly to the interrupt task. The task is performed.

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

上述した単一のプロセッサでタスク管理とタスクの実
行をシリアルに処理する方式では、ユーザプログラムの
実行におけるタスク管理処理のオーバーヘッドがかなり
大きくなってしまうという問題があった。
In the above-described system in which task management and task execution are serially processed by a single processor, there is a problem that the overhead of task management processing in executing a user program is considerably large.

また、上記オーバーヘッドを削減する為に、実行プロ
セッサ14に加え、タスク管理プロセッサ40を備えて、実
行プロセッサ14によるタスク実行と並行して、タスク管
理プロセッサ40によりタスク管理処理を行う方式では、
Pレベルタスクの実行管理においては、イベント検出、
割込みキューファイル43への登録/削除、割込み制御フ
ァイル45への退避/復帰処理は不要であり、タスクスイ
ッチ時に実行プロセッサ14とタスク管理プロセッサ40間
で、タスクスイッチ指令/タスク終了割込みという形の
ハンドシェーク処理は、オーバーヘッドとなってしま
う。また、割込みタスクの起動管理は、タスク管理プロ
セッサ40が、割込み要求発生時に、現実行タスクレベル
との優先判定をソフトウェアにより行い、さらに1つの
割込みタスク終了時においても、次に実行すべきタスク
のタスクNo.の決定を、実行プロセッサ14からタスク管
理プロセッサ40に対し割込みを通知し、その通知により
タスク管理プロセッサ40がソフトウェアにより判定する
ことにより行っている為、このこともタスクスイッチ時
のオーバーヘッドの一因となる。
In addition, in order to reduce the overhead, in addition to the execution processor 14, the task management processor 40 is provided, and in parallel with the execution of the task by the execution processor 14, the task management processor 40 performs a task management process,
Event management, P-level task execution management,
It is not necessary to register / delete in the interrupt queue file 43 and save / restore in the interrupt control file 45, and handshake in the form of a task switch command / task end interrupt between the execution processor 14 and the task management processor 40 at the time of task switching. The processing becomes overhead. In addition, the start management of the interrupt task is performed by the task management processor 40, when an interrupt request is generated, by performing software priority determination with respect to the currently executed task level, and even when one interrupt task ends, the task to be executed next is determined. The task number is determined by notifying an interrupt from the execution processor 14 to the task management processor 40, and the task management processor 40 determines the task by software based on the notification. Contributes.

本発明は、割込み要求に対応するタスクのスイッチを
高速に行うこと、さらにはPレベルのタスクのスイッチ
をも高速に行えるようにすることを目的とする。
An object of the present invention is to switch a task corresponding to an interrupt request at a high speed, and to switch a P-level task at a high speed.

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

第1図は、本発明の原理説明図である。 FIG. 1 is a diagram illustrating the principle of the present invention.

本発明は、複数の優先レベルを有するタスクと前記各
優先レベルに1対1に対応して設けられた当該優先レベ
ルのタスクがキューイングされる複数の優先レベルキュ
ーとを有し、再も高い優先レベルのキューにキューイン
グされているタスクを優先的に実行させるタスク管理制
御方式を前提とする。
The present invention includes a task having a plurality of priority levels and a plurality of priority level queues provided in one-to-one correspondence with the respective priority levels, in which the tasks of the priority level are queued, and the level is also high. It is assumed that a task management control method for executing tasks queued in a priority level queue preferentially is performed.

請求項1記載の第1の発明の手段は次の通りである。 The means of the first invention described in claim 1 is as follows.

タスク実行手段1は、例えばマイクロプロセッサ等か
ら成り、前記各優先レベルのタスクの実行を行う。
The task executing means 1 is composed of, for example, a microprocessor or the like, and executes the tasks of the respective priority levels.

タスク管理手段2は、例えばマイクロプロセッサ等か
ら成り、前記各優先レベル毎の優先レベルキュー2−0
〜2−Nを有し、割込みもしくはプログラム起動により
任意のタスクの実行要求がなされた場合、その実行要求
のなされたタスクをそのタスクの優先レベルに対応する
優先レベルキュー2−0〜2−Nにキューイングすると
共に、そのキューイングされたタスクの優先レベル信号
をオンにする。
The task management means 2 comprises, for example, a microprocessor or the like, and has a priority level queue 2-0 for each priority level.
When an execution request for an arbitrary task is made by an interrupt or a program activation, the requested task is placed in a priority level queue 2-0 to 2-N corresponding to the priority level of the task. And turns on the priority level signal of the queued task.

タスク選択手段3は、タスク管理手段2から出力され
る前記優先レベル信号に基づいて設定される現在実行待
ちとなっているタスクの全ての優先レベルを記憶する第
1の記憶手段3aと、前記タスク実行手段により現在実行
されているタスクの優先レベルを記憶する第2の記憶手
段3bとを有し、タスク管理手段2から前記キューイング
優先レベル情報が出力されたとき、そのキューイング優
先レベル情報の示す優先レベルを前記第1の記憶手段3a
に記憶すると共に、前記第1の記憶手段3aと前記第2の
記憶手段3bに記憶されている情報とに基づいて、前記タ
スク実行手段1により現在実行されているタスクの優先
レベルの現在実行待ちとなっているタスクの優先レベル
とを比較し、実行待ちとなっているタスクの方が優先レ
ベルが高い場合には、タスクのスイッチングを要求する
タスクスイッ指令信号と現在実行されているタスクより
も優先レベルの高い上記実行待ちとなっているタスクの
優先レベルのうち、最も高い優先レベルを示すスイッチ
優先レベル情報を出力し、一方現在実行中のタスクの方
が優先レベルが高ければ、上記タスクスイッチ指令信号
は出力しない。
The task selecting means 3 comprises: first storing means 3a for storing all priority levels of tasks currently waiting to be set which are set based on the priority level signal output from the task managing means 2; Second storage means 3b for storing the priority level of the task currently executed by the execution means, and when the queuing priority level information is output from the task management means 2, The priority level indicated by the first storage unit 3a.
, And based on the information stored in the first storage unit 3a and the second storage unit 3b, waiting for the current execution of the priority level of the task currently being executed by the task execution unit 1. Compares the priority level of the task with the task, and if the task waiting to be executed has a higher priority level, it has priority over the task switch command signal requesting task switching and the task currently being executed. Outputs switch priority level information indicating the highest priority level among the priority levels of the tasks waiting to be executed having a higher level. On the other hand, if the currently executing task has a higher priority level, the task switch command is output. No signal is output.

そして、タスク実行手段1は、タスクの実行を開始す
る際に、そのタスクの優先レベルを示す情報を前記実行
タスク選択手段3内の第2の記憶手段3bに設定すると共
に、前記実行タスク選択手段3から前記タスクスイッチ
指令信号と前記スイッチ優先レベル情報とを入力する
と、現在実行中のタスクの実行を中断し、その上位レベ
ルのタスクの優先レベルに対応する優先レベルキュー2
−0〜2−Nの先頭にキューイングされているタスクを
新たに実行し、タスク実行終了時には、それまで実行し
ていたタスクと同じ優先レベルに対応する優先レベルキ
ュー2−0〜2−Nにタスクがキューイングされている
か否かを前記実行タスク選択手段3の第1の記憶手段3a
により判別し、タスクがキューイングされていればその
タスクの実行を開始し、タスクがキューイングされてい
なければ、上記タスクスイッチ指令信号の入力により中
断したタスクの実行を再開させると共に、そのタスクの
優先レベルを示す情報を前記実行選択手段3の第2の記
憶手段3bに書き込む。
The task execution means 1 sets information indicating the priority level of the task in the second storage means 3b in the execution task selection means 3 when starting execution of the task, and executes the execution task selection means. 3, when the task switch command signal and the switch priority level information are input, the execution of the currently executing task is interrupted, and the priority level queue 2 corresponding to the priority level of the higher-level task is interrupted.
-0 to 2-N, the task queued at the head of the task is newly executed, and at the end of the task execution, the priority level queues 2-0 to 2-N corresponding to the same priority level as the task executed so far. The first storage means 3a of the execution task selecting means 3 determines whether or not the task is queued
If the task is queued, the execution of the task is started.If the task is not queued, the execution of the task interrupted by the input of the task switch command signal is resumed, and the execution of the task is resumed. The information indicating the priority level is written in the second storage unit 3b of the execution selection unit 3.

また、請求項2記載の第2の発明の手段は、次の通り
である。
The means of the second invention described in claim 2 is as follows.

まず、上記第1の発明と同様なタスク実行手段1、タ
スク管理手段2、及びタスク選択手段3とに加え、第3
の記憶手段4を有する。
First, in addition to the task execution means 1, the task management means 2, and the task selection means 3 which are the same as those of the first invention, the third
Storage means 4.

この第3の記憶手段4は、例えば、ROM(リード・オ
ンリ・メモリ)もしくはRAM(ランダム・アクセス・メ
モリ)等のメモリからなり、サイクリックに起動される
Pレベルの複数のタスクの実行・管理に係わる情報を記
憶し、タスク実行手段1が直接アクセス可能である。
The third storage means 4 is composed of, for example, a memory such as a ROM (Read Only Memory) or a RAM (Random Access Memory), and executes and manages a plurality of P-level tasks that are started cyclically. And the task execution means 1 can directly access the information.

上記複数のPレベルのタスクの実行・管理に係わる情
報は、例えばPレベルのタスクの実行順序並びに各Pレ
ベルのタスクのエントリポイント(entry point)を示
すポインタ等から成る。
The information related to the execution and management of the plurality of P-level tasks includes, for example, the execution order of the P-level tasks and pointers indicating the entry points of the respective P-level tasks.

そして、タスク実行手段1は、第3の記憶手段4に記
憶されている前記複数のPレベルのタスクの実行・管理
に係わる情報に基づいて、複数のPレベルのタスクを所
定の順序でサイクリックに実行する。
Then, the task execution unit 1 cyclically executes the plurality of P-level tasks in a predetermined order based on the information related to the execution and management of the plurality of P-level tasks stored in the third storage unit 4. To run.

〔作用〕[Action]

第1の発明の作用は、次の通りである。 The operation of the first invention is as follows.

タスク管理手段2は、外部割込み、タスク実行手段1
からのプログラム割込みによるタスク起動要求、または
インタバルタイマ(interval timer)等からの定周期割
込み等が加わる毎に、その割込みに対応するタスクを、
そのタスクの優先レベル「i」に対応する優先レベルキ
ュー2−iにキューイングすると共に、実行タスク選択
手段3に対し、上記キューイングされたタスクの優先レ
ベル「i」を示す優先レベル信号をオンにする。
The task management means 2 includes an external interrupt, a task execution means 1
Whenever a task start request due to a program interrupt from the server or a periodic interrupt from an interval timer is added, the task corresponding to the interrupt is
The task is queued in the priority level queue 2-i corresponding to the priority level "i" of the task, and the priority level signal indicating the priority level "i" of the queued task is turned on to the execution task selecting means 3. To

実行タスク選択手段3は、その優先レベル信号がオフ
からオンに変化したことを検出すると、第1の記憶手段
3aに優先レベル「i」にタスクがキューイングされた旨
を記憶した後、第1の記憶手段3aに記憶されている優先
レベルキュー2−1〜2−nの現在のタスクのキューイ
ング優先レベル情報と第2の記憶手段3bに記憶されてい
るタスク実行手段1が現在実行中のタスクの優先レベル
情報に基づいて、上記新たにキューイングされたタスク
が現在実行中のタスクよりも優先レベルが高いか否かを
判別し、上記新たにキューイングされたタスクが、現在
実行中のタスクよりも優先レベルが高い場合には、タス
クスイッチ指令信号と上記新たにキューイングされたタ
スクの優先レベルを示すスイッチ優先レベル情報をタス
ク実行手段1に出力する。
When detecting that the priority level signal has changed from off to on, the execution task selecting means 3 reads the first storage means.
After storing the fact that the task is queued at the priority level "i" in 3a, the queuing priority level of the current task in the priority level queues 2-1 to 2-n stored in the first storage means 3a Based on the information and the priority level information of the task currently being executed by the task executing means 1 stored in the second storage means 3b, the priority of the newly queued task is higher than that of the currently executing task. It is determined whether or not the priority is higher, and if the newly queued task has a higher priority level than the currently executing task, the task switch command signal and the priority level of the newly queued task are changed. The switch priority level information is output to the task execution means 1.

タスク実行手段1は、上記タスクスイッチ指令信号が
加わると、現在タスク実行中であれば、そのタスクの実
行を中断させ、上記スイッチ優先レベル情報の示す優先
レベル「i」に対応する優先レベルキュー2−iの先頭
にキューイングされているタスクの実行を開始する。
When the task switch command signal is added, if the task is currently being executed, the task execution means 1 interrupts the execution of the task, and the priority level queue 2 corresponding to the priority level "i" indicated by the switch priority level information. -Start execution of the task queued at the head of i.

一方、タスク実行手段1は、タスクの実行を終了する
と、それまで実行していたタスクの優先レベル「i」に
対応する割込み優先レベルキュー2−iにタスクがキュ
ーイングされているか否かを第1の記憶手段3aにより判
別し、タスクがキューイングされていればそのタスクの
実行を開始し、タスクがキューイングされていなけれ
ば、上記タスクスイッチ指令信号の入力により実行を中
断したタスクの実行を再開するとともに、そのタスクの
優先レベルを示す情報を第2の記憶手段3bに書き込む。
On the other hand, when the task execution means 1 terminates the execution of the task, the task execution means 1 determines whether or not the task is queued in the interrupt priority level queue 2-i corresponding to the priority level "i" of the task that has been executed so far. If the task is queued, the execution of the task is started. If the task is not queued, the execution of the task interrupted by the input of the task switch command signal is executed. At the same time as resuming, the information indicating the priority level of the task is written in the second storage means 3b.

このように、タスク実行手段1は、従来のように他の
手段(前記タスク管理プロセッサ)とハンドシェークす
ることなく、実行タスク選択手段3の出力情報と、タス
ク管理手段2内の割込み優先レベルキュー2−0〜2−
Nの直接参照とにより、実行すべきタスクを高速に知る
ことができるため、割込み要求に対応するタスクのスイ
ッチを高速に行うことができる。
As described above, the task execution unit 1 does not perform handshaking with other units (the task management processor) as in the related art, and outputs the output information of the execution task selection unit 3 and the interrupt priority level queue 2 in the task management unit 2. -0 to 2-
Since the task to be executed can be known at a high speed by directly referring to N, the task corresponding to the interrupt request can be switched at a high speed.

また、第2の発明は、上記第1の発明の作用に加え、
以下に示す作用を有する。
Further, the second aspect of the present invention provides the function of the first aspect of the invention,
It has the following functions.

タスク実行手段1は、Pレベルタスクの起動及び実行
をタスク終了時にPレベルよりも高い優先レベルのタス
クが割込み優先レベルキュー2−0〜2−Nに1個もキ
ューイングされていない場合、第3の記憶手段4に記憶
されている情報を直接読み出すことにより行う。
The task execution means 1 starts and executes the P-level task when no task with a priority level higher than the P level is queued in the interrupt priority level queues 2-0 to 2-N at the end of the task. 3 by directly reading the information stored in the storage means 4.

このように、Pレベルのタスクの実行・管理は、実行
タスク手段が他の手段(前記タスク管理プロセッサ40)
を介在せずに行えるため、Pレベルのタスクのスイッチ
を高速に行うことができる。
As described above, the execution / management of the P-level task is performed by executing the task by another means (the task management processor 40).
Can be performed without intervention, so that the switching of the P-level task can be performed at high speed.

〔実施例〕〔Example〕

以下、図面を参照しながら本発明の実施例について説
明する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.

第2図は本発明に係わる第一実施例のシステム構成図
である。
FIG. 2 is a system configuration diagram of a first embodiment according to the present invention.

尚、同図において前述した第8図に示す従来のシステ
ムと同一ブロックには同一番号を付与しており、それら
のブロックの詳しい説明は省略する。
In this figure, the same blocks as those of the conventional system shown in FIG. 8 described above are given the same numbers, and detailed description of those blocks is omitted.

同図において、タスクレベル優先順位決定回路100
は、割込み要求レベルレジスタ101と、現在実行中のタ
スクの優先レベルに対応する割込みマスクを記憶する割
込みレベルマスクレジスタ44、及び上記2つのレジスタ
101,44間のレベル優先判定を行うプライオリティエンコ
ーダ102とから構成されている。
In the figure, a task level priority determining circuit 100
Is an interrupt request level register 101, an interrupt level mask register 44 for storing an interrupt mask corresponding to the priority level of the task currently being executed, and the two registers
And a priority encoder 102 for performing a level priority determination between 101 and 44.

また、従来はタスク管理プロセッサ40内に設けられて
いたPレベルタスクNo.管理ファイル46は、データメモ
リ30′内に設けられている。そして、本実施例のタスク
管理プロセッサ40′は、上記割込みレベルマスクレジス
タ44及びPレベルタスクNo.管理ファイル46以外に、割
込み制御ファイル45をも有していない。
The P-level task number management file 46 conventionally provided in the task management processor 40 is provided in the data memory 30 '. The task management processor 40 'of this embodiment has no interrupt control file 45 other than the interrupt level mask register 44 and the P level task number management file 46.

次に、上記構成の本実施例の動作を、第3図乃至第5
図のフローチャートを参照しながら説明する。
Next, the operation of the present embodiment having the above configuration will be described with reference to FIGS.
This will be described with reference to the flowchart in FIG.

従来例と同様に、実行プロセッサ14が、任意の1つの
タスクを実行している間以下に示すEの処理を行う。
Similarly to the conventional example, the execution processor 14 performs the following process E while executing any one task.

E 通常命令をフェッチしMAPした場合、その通常命
令に対応する各種データ演算及びデータ転送処理等を行
う。
E When a normal instruction is fetched and mapped, various data operations and data transfer processing corresponding to the normal instruction are performed.

実行プロセッサ14が、このMAP→演算→MAP→演算→…
を繰り返し実行している間に、タスク管理プロセッサ4
0′は、前述した処理T,Tに続いて、以下に示す処
理Tを行う。
The execution processor 14 executes this MAP → operation → MAP → operation → ...
While the task management processor 4
For 0 ', the following processing T is performed following the processing T, T described above.

T 前記処理Tで求めた割込みレベルに相当する割
込み要求レベル信号をオン(ON)にして、タスクレベル
優先順位決定回路100の割込み要求レベルレジスタ101に
加える。
T Turns on the interrupt request level signal corresponding to the interrupt level obtained in the process T, and adds the signal to the interrupt request level register 101 of the task level priority determination circuit 100.

タスクレベル優先順位決定回路100のプライオリティ
エンコーダ102は、予め実行プロセッサ14より設定され
ている現在実行中のタスクのレベルに相当する割込みレ
ベルマスクレジスタ44と、タスク管理プロセッサ40′か
ら加わる複数の割込み要求レベル信号を記憶する割込要
求レベルレジスタ101との間で優先判定を行い、割込み
要求レベルレジスタ101にセットされているタスクの方
が現在実行中のタスクよりもレベルが高い場合には、MA
P制御回路13に対しタスクスイッチ指令を出力すると共
に、その割込み要求レベルレジスタ101にセットされて
いるタスクレベルを、実行プロセッサ14に対し出力す
る。尚、割込み要求レベルレジスタ101に、現在実行中
のタスクよりもレベルの高い複数のタスクからの割込み
要求がセットされている場合には、プライオリティエン
コーダ回路102は、最も高い割込みレベルのレベル情報
を自動的に生成し、実行プロセッサ14に出力する。一
方、割込み要求レジスタ101にセットされているレベル
が現在実行中のタスクのレベルより低い場合には、プラ
イオリティエンコーダ102は、MAP制御回路13に対しタス
クスイッチ指令を出力しない。
The priority encoder 102 of the task level priority determining circuit 100 includes an interrupt level mask register 44 corresponding to the level of the currently executing task set in advance by the execution processor 14 and a plurality of interrupt requests added from the task management processor 40 '. A priority determination is performed between the interrupt request level register 101 that stores the level signal and the task set in the interrupt request level register 101 has a higher level than the currently executing task.
A task switch command is output to the P control circuit 13, and the task level set in the interrupt request level register 101 is output to the execution processor 14. When interrupt requests from a plurality of tasks having higher levels than the currently executing task are set in the interrupt request level register 101, the priority encoder circuit 102 automatically outputs the level information of the highest interrupt level. And outputs it to the execution processor 14. On the other hand, when the level set in the interrupt request register 101 is lower than the level of the currently executing task, the priority encoder 102 does not output the task switch command to the MAP control circuit 13.

次に実行プロセッサ14は、従来例と同様なMAP制御回
路13がタスクスイッチ指令に応じて行うMAP処理により
タスク起動割込み処理にマッピッグされ、第4図のフロ
ーチャートに示す処理を行う。
Next, the execution processor 14 is mapped to the task activation interrupt processing by the MAP processing performed by the MAP control circuit 13 similar to the conventional example in response to the task switch command, and performs the processing shown in the flowchart of FIG.

E タスクレベル優先順位決定回路100から加わる割
込み起動タスクレベルに該当する割込み制御ファイル32
に、今まで実行していたレベルのタスクの各種タスク情
報(プログラムカウンタ、スタックポインタ、マスク情
報等)を退避する(前記処理Eと同様)。
E The interrupt control file 32 corresponding to the interrupt activation task level added from the task level priority determination circuit 100
Then, various task information (program counter, stack pointer, mask information, etc.) of the task of the level executed so far is saved (similar to the process E).

E 上記タスクスイッチ優先順位決定回路100から加
わる割込み起動タスクレベル以下のタスクの割込みをマ
スクするようにタスクレベル優先順位決定回路100の割
込みレベルマスクレジスタ44をセットする。
E The interrupt level mask register 44 of the task level priority order determination circuit 100 is set so as to mask the interrupt of the task lower than the task level of the interrupt activation task added from the task switch priority order determination circuit 100.

E タスク管理プロセッサ40′内の割込み要求キュー
ファイル43の上記割込み起動タスクレベルに対応する割
込み要求キューファイルから起動すべきタスクNo.を求
める。
E A task number to be activated is obtained from the interrupt request queue file corresponding to the above-mentioned interrupt activation task level in the interrupt request queue file 43 in the task management processor 40 '.

E タスク管理プロセッサ40′に対し、タスクスイッ
チ受付けレベル(新たに起動するタスクの割込みレベ
ル)を割込みにより通知する。
E Notify the task management processor 40 'of the task switch acceptance level (interrupt level of the newly activated task) by interruption.

E 前記割込みタスクNo.を有するタスクが格納され
ているプログラムメモリ11の先頭番地をTET31から求
め、その先頭番地をPC21へセットし、新たな割込みタス
クの実行を開始する(MAP→実行→MAP→実行…の繰り返
しにより通常命令を1命令ずつ実行していく。〈E
〉)。
E The start address of the program memory 11 in which the task having the interrupt task number is stored is obtained from the TET 31, the start address is set in the PC 21, and the execution of the new interrupt task is started (MAP → execution → MAP → The normal instruction is executed one instruction at a time by repeating execution.
〉).

タスク管理プロセッサ40′は、実行プロセッサ14から
前記タスクスイッチ受付け割込みが加わると第5図のフ
ローチャートに示す処理を行う。
The task management processor 40 'performs the processing shown in the flowchart of FIG. 5 when the task switch acceptance interrupt is added from the execution processor 14.

T 実行プロセッサ14が受け付けたレベルに該当する
割込み要求キューファイル43のキューファイルの先頭に
キューイングされているタスクNo.を削除する(キュー
はファースト・イン・ファースト・アウト構造)。
T The task number queued at the head of the queue file of the interrupt request queue file 43 corresponding to the level accepted by the execution processor 14 is deleted (the queue has a first-in first-out structure).

T 一方、上記該当レベルのキューファイルが空の場
合は、タスクレベル優先順位決定回路100に対し加える
上記該当する割込み要求レベル信号をオフ(OFF)にす
る。また、上記該当キューファイルが空でない場合に
は、直ちに、メイン・ルーチンに復帰する。
T On the other hand, when the queue file of the corresponding level is empty, the corresponding interrupt request level signal to be applied to the task level priority determining circuit 100 is turned off (OFF). If the queue file is not empty, the process immediately returns to the main routine.

一方、実行プロセッサ14は、タスク終了命令をフェッ
チしMAPした場合、現在実行中のタスクのレベルが割込
みレベル(0〜4レベル)もしくはPレベルかに応じ
て、第4図のフローチャートに示すように異なった処理
を行う。
On the other hand, when the execution processor 14 fetches and maps the task end instruction, as shown in the flowchart of FIG. 4, depending on whether the level of the currently executing task is the interrupt level (0 to 4 levels) or the P level, Perform different processing.

≪割込みレベル(0〜4レベル)の場合≫ E 現在実行中のタスクのレベルが割込みレベル(0
〜4レベル)であった場合、タスクレベル優先順位決定
回路100のマスクレジスタ44において、現実行レベルの
マスクビットを解除した後、現実行レベルと同レベルの
タスク割込み要求があるかチェックし、あれば前記処理
E〜Eを行い、なければ、次に示す処理Eを行
う。
{In the case of interrupt level (0 to 4 levels)} E The level of the currently executing task is set to the interrupt level (0
(4 levels), the mask bit of the current execution level is canceled in the mask register 44 of the task level priority determination circuit 100, and then it is checked whether there is a task interrupt request of the same level as the current execution level. If the above-mentioned processes E to E are performed, otherwise, the following process E is performed.

E 該当レベルの割込み制御ファイル32から、前回実
行していた下位レベルの各種タスク情報(PC、スタック
ポインタ、マスタ情報等)を復帰し、再びMAP→実行→M
AP→実行→…を繰り返す。
E Restore various lower-level task information (PC, stack pointer, master information, etc.) that was previously executed from the corresponding level of interrupt control file 32, and re-execute MAP → Execute → M
Repeat AP → Execute →….

≪Pレベルタスクの場合≫ E PレベルタスクNo.管理ファイル46から、次に実
行すべきPレベルタスクのタスクNo.を見つけ出し、プ
ログラムメモリ11内のそのタスクの格納領域の先頭番地
をTET31から求めてPC21へセットし、そのPレベルタス
クを新たに実行する。
<< P-level task >> The task number of the next P-level task to be executed is found from the EP-level task number management file 46, and the start address of the storage area of the task in the program memory 11 is obtained from the TET31. To the PC 21 to newly execute the P-level task.

〔発明の効果〕〔The invention's effect〕

以上説明したように、第1の発明によれば、割込みも
しくはプログラム起動により起動要求がなされたタスク
を当該優先レベルキューにキューイングする手段と、現
在実行中のタスクと優先レベルと新たにキューイングさ
れたタスクの優先レベルとを比較してタスクスイッチ指
令信号を出力する手段とを分離し、そのタスクスイッチ
指令出力を行う処理を、タスク実行と並列して高速に行
えるようにしたので、タスク実行中におけるタスクのス
イッチングを高速に行うことが可能となる。
As described above, according to the first aspect, means for queuing a task requested to be activated by an interrupt or program activation in the priority level queue, a task currently being executed, a priority level, and a new queue Means for outputting a task switch command signal by comparing with the priority level of the task that has been performed, and the task switch command output process can be performed at high speed in parallel with the task execution. It is possible to perform high-speed task switching.

また、タスク終了時においても、次に実行すべきタス
クをタスクレベル優先順位決定回路と優先レベルキュー
を直接参照することにより見つけ出すことができるた
め、タスクのスイッチングが高速になる。
Even at the end of the task, the task to be executed next can be found by directly referring to the task level priority determining circuit and the priority level queue, so that the task switching speed is increased.

また、第2の発明によれば、上記第1の発明の効果に
加え、サイクリックに起動されるPレベルのタスクの実
行・管理を、Pレベルのタスクに係る情報を記憶する手
段を直接参照して行えるため、オーバーヘッドが無くな
り、Pレベルのタスクを高速にスイッチングすることが
可能となる。
According to the second invention, in addition to the effect of the first invention, the execution and management of the P-level task started cyclically is directly referred to the means for storing information relating to the P-level task. Therefore, overhead can be eliminated and P-level tasks can be switched at high speed.

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

第1図は本発明の原理説明図、 第2図は本発明に係わる一実施例のシステム構成図、 第3図はタスク管理プロセッサの処理を説明するフロー
チャート、 第4図はタスク実行プロセッサの処理を説明するフロー
チャート、 第5図はタスク管理プロセッサにより行われる割込み要
求キューファイルに係る処理を説明するフローチャー
ト、 第6図はタスクの優先レベル及び各優先レベルに定義さ
れたタスクNo.の例を示す図、 第7図はタスクの実行管理の一例を示す図、第8図は従
来のタスク実行管理システムの一例を示す図である。 1……タスク実行手段、 2……タスク管理手段、 2−0〜2−N……優先レベルキュー、 3……実行タスク選択手段、 3a……第1の記憶手段、 3b……第2の記憶手段、 3c……エンコーダ、 4……第3の記憶手段.
FIG. 1 is a diagram for explaining the principle of the present invention, FIG. 2 is a system configuration diagram of one embodiment according to the present invention, FIG. 3 is a flowchart for explaining processing of a task management processor, and FIG. FIG. 5 is a flowchart for explaining processing relating to an interrupt request queue file performed by the task management processor. FIG. 6 shows an example of task priority levels and task numbers defined for each priority level. FIG. 7 is a diagram showing an example of task execution management, and FIG. 8 is a diagram showing an example of a conventional task execution management system. 1 ... task execution means, 2 ... task management means, 2-0 to 2-N ... priority level queue, 3 ... execution task selection means, 3a ... first storage means, 3b ... second Storage means, 3c ... encoder, 4 ... third storage means.

フロントページの続き (72)発明者 渡辺 哲仁 東京都日野市富士町1番地 富士ファコ ム制御株式会社内 (56)参考文献 特開 昭59−99553(JP,A) 特開 昭63−296139(JP,A) 特開 昭62−123530(JP,A) 特開 昭63−308661(JP,A)Continuation of the front page (72) Inventor Tetsuhito Watanabe No. 1, Fuji-cho, Hino-shi, Tokyo Inside Fuji Facom Control Co., Ltd. (56) References JP-A-59-99553 (JP, A) JP-A-63-296139 ( JP, A) JP-A-62-123530 (JP, A) JP-A-63-308661 (JP, A)

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】複数の優先レベルを有するタスクと前記各
優先レベルに1対1に対応して設けられた当該優先レベ
ルのタスクがキューイングされる複数の優先レベルキュ
ーとを有し、最も高い優先レベルのキューにキューイン
グされているタスクを優先的に実行させるタスク管理制
御方式において、 前記各優先レベルのタスクの実行を行なうタスク実行手
段(1)と、 前記各優先レベル毎の優先レベルキュー(2−0〜2−
N)を有し、割り込みもしくはプログラム起動により任
意のタスクの実行要求がなされた場合、その実行要求の
なされたタスクを、そのタスクの優先レベルに対応する
優先レベルキュー(2−0〜2−N)にキューイングす
ると共に、そのキューイングされたタスクの優先レベル
を示すキューイング優先レベル情報を出力するタスク管
理手段(2)と、 該タスク管理手段(2)から出力される前記優先レベル
情報に基づいて設定される現在実行待ちとなっているタ
スクの全ての優先レベルを記憶する第1の記憶手段(3
a)と、前記タスク実行手段(1)により現在実行され
ているタスクの優先レベルを記憶する第2の記憶手段
(3b)とを有し、タスク管理手段(2)から前記キュー
イング優先レベル情報が出力されたとき、そのキューイ
ング優先レベル情報の示す優先レベルを前記第1の記憶
手段(3a)に記憶すると共に、前記第1の記憶手段(3
a)と前記第2の記憶手段(3b)とに記憶されている情
報に基づいて、前記タスク実行手段(1)により現在実
行されているタスクの優先レベルと現在実行待ちとなっ
ているタスクの優先レベルとを比較し、実行待ちとなっ
ているタスクの方が優先レベルが高い場合には、タスク
のスイッチングを要求するタスクスイッチ指令信号と上
記実行待ちとなっているタスクの優先レベルのうち、最
も高い優先レベルを示すスイッチ優先レベル情報を出力
し、一方現在実行中のタスクの方が優先レベルが高けれ
ば、上記タスクスイッチ指令信号は出力しない実行タス
ク選択手段(3)とを備え、 前記タスク管理手段(2)は、前記タスク実行手段
(1)とは独立して備えられ、 前記実行タスク選択手段(3)は、前記タスク実行手段
(1)もしくは前記タスク管理手段(2)のいずれから
も独立して備えられ、 前記タスク実行手段(1)は、タスクの実行を開始する
際に、そのタスクの優先レベルを示す情報を前記実行タ
スク選択手段(3)内の第2の記憶手段(3b)に設定す
ると共に、前記実行タスク選択手段(3)から前記タス
クスイッチ指令信号と前記スイッチ優先レベル情報とを
入力すると、現在実行中のタスクの実行を中断し、その
上位レベルのタスクの優先レベルに対応する優先レベル
キュー(2−0〜2−N)の先頭にキューイングされて
いるタスクを新たに実行し、タスク実行終了時には、そ
れまで実行していたタスクと同じ優先レベルに対応する
優先レベルキュー(2−0〜2−N)にタスクがキュー
イングされているか否か判別し、タスクがキューイング
されていればそのタスクの実行を開始し、タスクがキュ
ーイングされていなければ、上記タスクスイッチ指令信
号の入力により中断したタスクの実行を再開されると共
に、そのタスクの優先レベルを示す情報を前記実行タス
ク選択手段(3)内の第2の記憶手段(3b)に書き込む
ことを特徴とするタスク管理制御方式。
A task having a plurality of priority levels and a plurality of priority level queues provided in a one-to-one correspondence with the respective priority levels, in which the tasks of the priority level are queued, are the highest. In a task management control method for preferentially executing a task queued in a priority level queue, a task execution means (1) for executing the task of each priority level; a priority level queue for each priority level (2-0-2-
N), when an execution request for an arbitrary task is made by interruption or program activation, the task for which the execution request is made is stored in a priority level queue (2-0 to 2-N) corresponding to the priority level of the task. ) And a task management means (2) for outputting queuing priority level information indicating a priority level of the queued task; and the priority level information output from the task management means (2). The first storage means (3) stores all priority levels of tasks currently waiting to be set, which are set based on the first priority level.
a), and second storage means (3b) for storing a priority level of the task currently being executed by the task execution means (1), and the queuing priority level information is transmitted from the task management means (2). Is output, the priority level indicated by the queuing priority level information is stored in the first storage means (3a), and the first storage means (3
a) the priority level of the task currently being executed by the task execution means (1) and the priority level of the task currently waiting to be executed, based on the information stored in the second storage means (3b). Compare the priority level, if the task waiting for execution has a higher priority level, of the task switch command signal requesting task switching and the priority level of the task waiting for execution, Executing task selecting means (3) for outputting switch priority level information indicating the highest priority level, while not outputting the task switch command signal if the currently executing task has a higher priority level; The management means (2) is provided independently of the task execution means (1), and the execution task selection means (3) is provided with the task execution means (1) or The task execution means (1) is provided independently of any of the task management means (2). When starting execution of a task, the task execution means (1) transmits information indicating a priority level of the task to the execution task selection means (3). If the task switch command signal and the switch priority level information are input from the execution task selection means (3) while being set in the second storage means (3b) in ()), the execution of the task currently being executed is interrupted. Then, the task queued at the head of the priority level queue (2-0 to 2-N) corresponding to the priority level of the higher-level task is newly executed, and when the task execution ends, the task is executed up to that time. It is determined whether or not the task is queued in a priority level queue (2-0 to 2-N) corresponding to the same priority level as the task that has been queued. Execution of the task is started, and if the task is not queued, the execution of the task interrupted by the input of the task switch command signal is resumed, and the information indicating the priority level of the task is transmitted to the execution task selecting means. (3) A task management control method, wherein the data is written in the second storage means (3b).
【請求項2】前記タスク実行手段(1)が直接アクセス
可能なサイクリックに起動されるPレベルの複数のタス
クの実行・管理に係わる情報を記憶する第3の記憶手段
(4)をさらに備え、 前記第3の記憶手段(4)は、前記タスク管理手段
(2)とは独立して備えられ、 前記タスク実行手段(1)は、前記第3の記憶手段
(4)に記憶されている前記複数のPレベルのタスクの
実行・管理に係わる情報に基づいて、複数のPレベルの
タスクを所定の順序でサイクリックに実行することを特
徴とする請求項1記載のタスク管理制御方式。
2. The apparatus according to claim 1, further comprising: third storage means (4) for storing information relating to execution and management of a plurality of P-level tasks which are cyclically started and which can be directly accessed by said task execution means (1). The third storage unit (4) is provided independently of the task management unit (2), and the task execution unit (1) is stored in the third storage unit (4). 2. The task management control method according to claim 1, wherein the plurality of P-level tasks are cyclically executed in a predetermined order based on information related to the execution and management of the plurality of P-level tasks.
【請求項3】前記実行タスク選択手段(3)は、前記第
1の記憶手段(3a)並びに前記第2の記憶手段(3b)に
記憶されているデータをエンコードして、前記タスクス
イッチ指令信号と前記スイッチ優先レベル信号を出力す
るエンコーダ(3c)を有することを特徴とする請求項1
または2記載のタスク管理制御方式。
3. An execution task selection means (3) encodes data stored in said first storage means (3a) and said second storage means (3b) and outputs said task switch command signal. And an encoder (3c) for outputting the switch priority level signal.
Or the task management control method described in 2.
【請求項4】前記第1の記憶手段(3a)は、前記現在実
行待ちとなっているタスクの優先レベルを該タスクの割
込み要求レベルに対応させて記憶するレジスタ、前記第
2の記憶手段(3b)は、前記現在実行されているタスク
の優先レベル以下のタスクの割込みをマスクする情報を
記憶するレジスタとなっていることを特徴とする請求項
3記載のタスク管理制御方式。
A register for storing a priority level of the task currently waiting to be executed in correspondence with an interrupt request level of the task; 4. The task management control method according to claim 3, wherein 3b) is a register for storing information for masking an interrupt of a task having a priority level lower than a priority level of the currently executed task.
JP2201505A 1990-07-31 1990-07-31 Task management control method Expired - Fee Related JP3071210B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2201505A JP3071210B2 (en) 1990-07-31 1990-07-31 Task management control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2201505A JP3071210B2 (en) 1990-07-31 1990-07-31 Task management control method

Publications (2)

Publication Number Publication Date
JPH0486923A JPH0486923A (en) 1992-03-19
JP3071210B2 true JP3071210B2 (en) 2000-07-31

Family

ID=16442167

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2201505A Expired - Fee Related JP3071210B2 (en) 1990-07-31 1990-07-31 Task management control method

Country Status (1)

Country Link
JP (1) JP3071210B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102001125B1 (en) 2010-12-30 2019-07-17 헌터더글라스인코포레이티드 Operating cord system for retractable coverings for architectural openings

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6091452A (en) * 1983-10-26 1985-05-22 Oki Electric Ind Co Ltd Task scheduling system of data processor
JPS63163640A (en) * 1986-12-26 1988-07-07 Hitachi Ltd Scheduling system
JPH01292539A (en) * 1988-05-20 1989-11-24 Toshiba Corp Task schedule device
JPH0241527A (en) * 1988-08-01 1990-02-09 Nec Corp Ready task queue managing system
JPH0266640A (en) * 1988-08-31 1990-03-06 Nec Corp Debugger task scheduling system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102001125B1 (en) 2010-12-30 2019-07-17 헌터더글라스인코포레이티드 Operating cord system for retractable coverings for architectural openings

Also Published As

Publication number Publication date
JPH0486923A (en) 1992-03-19

Similar Documents

Publication Publication Date Title
JP4072271B2 (en) A computer running multiple operating systems
KR100766732B1 (en) Device and method for performing high-speed low overhead context switch
US5701495A (en) Scalable system interrupt structure for a multi-processing system
KR100848603B1 (en) A data processing apparatus and method for saving return state
JP2001265609A (en) Arithmetic processor
JP3605978B2 (en) Microcomputer
JP3970609B2 (en) Processor system
JPS63310051A (en) Method and apparatus for executing input/output process containing program input/output instruction
JP2001282558A (en) Multi-operating computer system
JP3071210B2 (en) Task management control method
JPH0916409A (en) Microcomputer
JP2001256062A (en) Interruption processing method and operation processor using the same
JPS6115260A (en) Data processor
JPH05128078A (en) Parallel processor
JP3693183B2 (en) Data processing device
JP3900660B2 (en) Sequence controller
JP2595697B2 (en) Message processing system
JP2001306335A (en) Computer
JPH03257634A (en) Method and device for parallelly processing program
JPH04195539A (en) System call processing system
JPS6357821B2 (en)
JP2594557B2 (en) Multitask processing unit
JPH02173828A (en) Interruption process system
JPH11184712A (en) Information processor
JPH06266630A (en) Input/output controller with trace function

Legal Events

Date Code Title Description
R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

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

Free format text: PAYMENT UNTIL: 20090526

Year of fee payment: 9

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

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

Free format text: PAYMENT UNTIL: 20090526

Year of fee payment: 9

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20090526

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20100526

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees