JP2004171142A - Real-time task control device, real-time task control method and program - Google Patents

Real-time task control device, real-time task control method and program Download PDF

Info

Publication number
JP2004171142A
JP2004171142A JP2002334024A JP2002334024A JP2004171142A JP 2004171142 A JP2004171142 A JP 2004171142A JP 2002334024 A JP2002334024 A JP 2002334024A JP 2002334024 A JP2002334024 A JP 2002334024A JP 2004171142 A JP2004171142 A JP 2004171142A
Authority
JP
Japan
Prior art keywords
task
processing amount
time
deadline
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2002334024A
Other languages
Japanese (ja)
Other versions
JP3915672B2 (en
Inventor
Takehiro Iwamura
剛宏 岩村
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.)
Denso Corp
Original Assignee
Denso Corp
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 Denso Corp filed Critical Denso Corp
Priority to JP2002334024A priority Critical patent/JP3915672B2/en
Publication of JP2004171142A publication Critical patent/JP2004171142A/en
Application granted granted Critical
Publication of JP3915672B2 publication Critical patent/JP3915672B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a real-time task control system capable of conducting proper QoS control. <P>SOLUTION: An executable processing quantity up to a determining point is estimated when finishing scheduling of a task (S140). An execution requiring processing quantity is estimated by adding estimation by making the estimation of a processing quantity on a part known for an execution state by starting already and the estimation of a predictive processing quantity (S150). The executable processing quantity up to the determining point is compared with the execution requiring processing quantity (S160), and when the executable processing quantity exceeds the execution requiring processing quantity, determination is made that the task can be executed up to a deadline. While, when the execution requiring processing quantity exceeds the executable processing quantity, the determination is made that the task cannot be executed up to the deadline. When determined that the task unexecutable up to the deadline exists by repeatedly making this determination by the number of determining points, the task thinning-out QoS control having low significance is executed (S200). <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、時間的に制約のある複数のタスクのスケジューリングや実行を制御するリアルタイムマルチタスクオペレーティングシステムにおけるタスク制御装置および方法に関する。
【0002】
【従来の技術】
リアルタイムマルチタスクオペレーティングシステムにおけるリアルタイム制御において、タスクがデッドラインまでに実行できるかを判定する方法として従来より種々の方法が知られている(例えば、特許文献1〜3参照。)。
【0003】
特許文献1には、図10に示す構成をとり、タスクを実行する直前において、現在時刻と実行直前のタスクの最悪実行時間(計測などにより求める実行(処理)時間の最悪値)を加算し、それがデッドラインよりも早ければそのタスクはデッドラインまでに実行できると判定する一方、デッドラインよりも遅ければデッドラインまでに実行できないと判定する方法が示されている。このように特許文献1の方法は、実行する直前のタスクのみに注目した方法である。
【0004】
また、特許文献2には、デッドライン判定部の構成に関して図示されていないが、上述のように特許文献1においては実行する直前のタスクに対して判定するのに対し、特許文献2の方法は、現在実行可能状態のタスクの全てに対してデッドラインまでに実行できるかを判定する方法である。
【0005】
また、特許文献3では、図11に示す構成をとり、データベースに平均CPU効率を記憶し、起動しているタスクの平均CPU効率の加算結果が、n(21/n―1)(n:タスク数)以下であれば全てのタスクがデッドラインまでに実行できると判定する一方、これ以上であればデッドラインまでに実行できないタスクがあると判定している。
【0006】
【特許文献1】
特開平8−272627号公報
【特許文献2】
特開平8−55036号公報
【特許文献3】
特開平10−240548号公報
【0007】
【発明が解決しようとする課題】
しかしながら、これら上記3つの方式のうち特許文献1と特許文献2に記載の方法では、実行直前のタスクや、実行可能状態のタスクのみで判定が行われており、起動が予想されるタスクを考慮していないため、判定精度が落ちると考えられる。したがって、結果的にデッドラインまでに実行できないという判定がなされるタイミングが遅れる。この判定がなされるタイミングが遅れるとQoS制御の余地が狭まる(例えば重要なタスクをQoS制御しなければいけなくなる)可能性が高まり、処理内容や処理結果の品質が落ちるという問題がある。
【0008】
また、特許文献3では、タスクが周期的に起動するタスクである周期タスクであることを前提にしており、非周期に起動するタスクである非周期タスクを扱う場合、周期的に起動しないにも関わらず周期的に起動した場合と同様にCPUを使用すると計算するため大きな誤差となってしまう。そして、本来デッドラインまでに実行できるのにもかかわらず実行できないと判定されて、QoS制御が行われることで、処理内容や処理結果の品質が落ちるという問題がある。
【0009】
上記課題を具体例を用いて説明する。タスク数が3で、タスクA,タスクB,タスクCがあり、タスクAとタスクBを周期タスク、タスクCを非周期タスクとする。また、タスクAは、周期=デッドライン、タスクBは、周期≠デッドラインである。(当然タスクCも周期≠デッドラインである。)図5(a)にタスクAの起動の様子、図5(b)にタスクBの起動の様子、図5(c)にタスクCの起動の様子を示す。
【0010】
図6(a)は、これらの条件において、実際に、デッドラインの近いものから順番に実行する方法で最も効果的にCPUを使える方法であるEDF(earliest deadline first)法でスケジューリングした例を示したものであり、時刻16においてタスクAがデッドラインまでに実行できないというケースを示したものである。
【0011】
特許文献1に記載の方法では、実行直前のタスクがデッドラインまでに実行できるかを判定するため、図6(b)の「特許文献1の方法」の欄に▲印で示すように、時刻16においてタスクAを実行しようした際にデッドライン違反を検出する。そのため、デッドラインに至る時刻16までは、デッドラインまでに実行できないタスクがあるという判定がなされない。
【0012】
また、特許文献2に記載の方法では、現在実行可能状態のタスクの全てに対してデッドラインまでに実行できるかを判定する。すなわち、起動しているタスクのデッドラインをみて判定するので、図6(b)の「特許文献2の方法」の欄に▲印で示すように、時刻14において、タスクAの残りの実行時間1とデッドライン時刻16、タスクBの残りの実行時間2とデッドライン時刻16という状況から、QoS制御が必要であると判定する。このように、時刻14までは、デッドラインまでに実行できないタスクがあるという判定がなされない。時刻14で、デッドラインまでに実行できないタスクがあると判定されたとしても、時刻14でQoS制御できるのは、タスクAまたはタスクBだけである。そのためタスクA,タスクBが重要なタスクであったとしても、QoS制御せざるをえないという問題がある。
【0013】
また、特許文献3に記載の方法では、タスクAは、周期2、最悪実行時間1なのでタスクAの平均使用効率は1/2であり、タスクBは、起動からデッドラインまでの時間6、最悪実行時間3なので、タスクBの平均使用効率は1/2であり、タスクCは、起動からデッドラインまでの時間4、最悪実行時間1なので、タスクCの平均使用効率は、1/4である。したがって、図6(b)の「特許文献3の方法」の欄に▲印で示すように、時刻4、時刻10において、タスクCが起動すると、1/2+1/2+1/4>1となり、能力をオーバーし、デッドラインまでに実行できないタスクがあると判定される。しかし、時刻4では、デッドラインまでに実行できないタスクがあると判定されているにも関わらず、実際は、この部分の全てのタスクについてデッドラインまでに実行できている。このように、実際はデッドラインまでに実行できないタスクがないにも関わらず、デッドラインまでに実行できないタスクがあると判定されてQoS制御がなされてしまい、タスクの処理内容や処理結果の品質が落ちてしまうという問題がある。
【0014】
そこで、本発明は、できるだけ早い時点で、精度よく、デッドラインまでに実行できないタスクがあることを判定することが可能とすることでQoS制御できる範囲を広げることができ、重要なタスクのデッドラインを守ることが可能となるリアルタイムタスク制御装置を提供することを目的とする。
【0015】
【課題を解決するための手段及び発明の効果】
上述した問題点を解決するためになされた請求項1に記載のリアルタイムタスク制御装置は、タスクの制御情報を記憶しており、記憶されたタスク制御情報を用いてタスクの実行順序を制御するタスクスケジューリングを行い、そのスケジューリング結果に基づいて実行するタスクの切り替えを行うことでタスクの実行を制御し、全てのタスクが終了予定時刻であるデッドラインまでに実行を完了できない場合に、負荷量を調整しサービスの品質を制御するQoS制御を行うリアルタイムタスク制御装置において、タスク制御情報を用いて、判定対象のタスクのデッドラインである判定ポイントまでの起動しているタスクと起動が予測されるタスクの実行必要処理量を見積もり、判定ポイントまでの実行可能処理量を見積もって、この見積もった実行必要処理量と実行可能処理量を比較し、実行可能処理量が実行必要処理量を上回ればタスクはデッドラインまでに実行可能であると判定し、逆に実行必要処理量が実行可能処理量を上回ればデッドラインまでに実行できないと判定する。そして、この判定結果を用いてQoS制御を行う。
【0016】
このように、実行必要処理量を見積もる際に、起動しているタスクだけでなく、起動が予測されるタスクを考慮して判定することで、従来よりも、早い時点で、精度よく、デッドラインまでに実行できないことを検知することができ、QoS制御できる範囲を広げることができ、重要なタスクのデッドラインを守ることが可能となる。
【0017】
この実行必要処理量を見積もる際には、各タスクが判定ポイントまでにどれだけの処理を行う必要があるのかを計算する。その際に、請求項2に示すようにして、起動部分処理量と、予測部分処理量とを分けて計算し、計算された起動部分処理量と予測部分処理量とを各タスクごとに加算して、加算結果の各タスク毎の処理量を、全てのタスク分について足し合わせて、実行必要処理量を求めることができる。
【0018】
また、タスク制御情報としてタスクの最悪実行時間を記憶しており、起動部分処理量見積手段は、タスクの最悪実行時間からそのタスクが既に実行された時間である実行途中時間を減算することで、タスクの残りの処理量を求める減算手段と、前記判定ポイントと前記デッドラインの大小を比較する比較手段と、前記比較手段による比較の結果、前記判定ポイントよりも前記デッドラインが早い場合はタスクの残りの処理量を起動部分処理量とし、前記判定ポイントよりも前記デッドラインが遅い場合は判定ポイントまでに実行する必要がないため起動部分処理量を”0”とする処理量変換手段とを備えるようにすることができる。
【0019】
また、請求項4に示すように、予測部分処理量見積手段は、前記判定ポイントから前記デッドラインを引いて、その差分を求める減算手段と、前記減算手段による減算結果が、正の値の場合は当該減算結果を予測時間とし、負の値の場合は予測時間を”0”とし、さらに、当該タスクの属性が非周期タスクの場合は、予測時間が正負に関わらず”0”とする予測時間変換手段と、前記予測時間変換手段によって求められた予測時間を、当該タスクの起動周期で割って周期タスクの繰り返し回数を求める除算手段と、前記除算手段によって求められた繰り返し回数と当該タスクの最悪実行時間を乗算して、当該タスクの予測部分の処理量を求める乗算手段とを備える構成とすることができる。非周期タスクは、繰り返し起動しないので予測部分処理量を”0”とすることで、非周期タスクも精度よく取り扱うことができる。
【0020】
そして、請求項5に示すように、前記タスク制御情報記憶手段は、タスクの固定情報である最悪実行時間、起動周期、実行許容時間を記憶するタスク固定情報記憶手段と、タスクの動的情報であるデッドライン、実行途中時間を記憶するタスク動的情報記憶手段とを備えるとよい。そして、タスク動的情報記憶手段は、実行されているタスクの実行途中時間をインクリメントしながらその情報を記憶する実行途中時間記憶手段と、タスクのデッドラインをデクリメントしながらその情報を記憶するデッドライン記憶手段とを備えて構成することができる。
【0021】
また、上述した問題点を解決するためになされた請求項7に記載のリアルタイムタスク制御方法は、アプリケーションであるタスクを実行するステップと、タスクの情報を設定更新するタスク制御情報更新ステップと、タスクの実行順序をデッドラインの近いものから順番にタスク制御情報を並べ替えるスケジューリングステップと、判定ポイントまでの処理可能処理量である実行可能処理量を見積もる実行可能処理量見積ステップと、判定ポイントまでに行うべき実行必要処理量を見積もる実行必要処理量見積ステップと、前記実行可能処理量見積ステップで見積もられた実行可能処理量と前記実行必要処理量見積ステップで見積もられた実行必要処理量とを比較し、実行可能処理量が、実行必要処理量を上回ればタスクがデッドラインまでに実行できると判定し、逆に実行可能処理量が、実行必要処理量を下回ればデッドラインまでに実行できないと判定するステップと、当該判定の結果、デッドラインまでに実行できない場合、QoS制御内容を決定するステップと、全ての判定ポイントで判定したかを確認し、判定が出来ていなければ再度別の判定ポイントで判定をするステップと、タスクの実行順序に変化があった場合、タスクを切り替えるタスク切り替えステップとを備える。
【0022】
そして、請求項8に示すように、タスクが周期タスクか非周期タスクかを判定するタスク属性判定ステップを備え、タスク属性判定ステップによって周期タスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行う一方、非周期タスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行わないようにすることができる。このようにすれば、「周期タスクのみが起動しているときはデッドラインまでに実行可能で、非周期タスクが起動したときのみデッドラインまでに実行できない」という条件下で用いることで、想定した以上のタスク(非周期タスク)が起動したとき(=CPU効率が100%を超える可能性のあるとき)のみに前記実行可能処理量見積ステップ以降に記載のステップを行うようにすることができるので、処理が削減できる。
【0023】
また請求項9に示すように、タスクがQoS制御可能なタスクか否かを判定するタスク属性判定ステップを備え、タスク属性判定ステップによってQoS制御可能なタスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行う一方、QoS制御不可能なタスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行わないようにすることができる。このようにすれば「所定のタスクをQoS制御すれば全てのタスクをデッドラインまでに実行できる」という条件下において、QoS制御可能なタスク起動時にのみ実行可能処理量見積ステップ以降に記載のステップの処理を行わせることができるので、処理が削減できる。
【0024】
なお、請求項10に示すように、請求項7〜9のいずれかに記載のリアルタイムタスク制御方法をコンピュータシステムにて実現する場合、例えば、コンピュータシステム側で起動するプログラムとして備えることができる。このようなプログラムの場合、例えば、フレキシブルディスク、光磁気ディスク、CD−ROM、ハードディスク、ROM、RAM等のコンピュータ読み取り可能な記録媒体に記録し、必要に応じてコンピュータシステムにロードして起動することにより用いることができ、また、ネットワークを介してロードして起動することにより用いることもできる。
【0025】
【発明の実施の形態】
以下、本発明が適用された実施例について図面を用いて説明する。なお、本発明の実施の形態は、下記の実施例に何ら限定されることなく、本発明の技術的範囲に属する限り種々の形態を採りうることは言うまでもない。下記の実施例の構成は、ハードウェア、ソフトウェア(プログラム)、あるいは、これらの組み合わせのいずれによっても実現できる。
[第1実施例]
本実施例は、図1に示すように、CPU上で動作するタスクの実行を制御するRTOS(リアルタイムオペレーティングシステム)に適用した例である。タスクとは、アプリケーション(ソフトウェア)の処理単位である。
【0026】
このRTOSは、図1に示すように、タスク制御手段11と、タスク制御情報記憶手段12と、タスクスケジューリング手段13と、時刻カウンタ14と、実行可能処理量見積手段15と、実行必要処理量見積手段16と、処理量比較手段17と、QoS制御手段18とを備える。
【0027】
タスク制御情報記憶手段12は、タスクの起動周期(周期タスクが起動する間隔)、実行許容時間(タスクが起動してから終了しなければいけない時間幅)、最悪実行時間などのタスクの固定パラメータを記憶するタスク固定パラメータ記憶手段50と、タスクの動的パラメータを記憶するタスク動的パラメータ記憶手段51とを備える。そしてタスク動的パラメータ記憶手段51は、タスクの実行中にそのタスクの実行がどこまで進んだかを示す時間であるタスク実行途中時間を記憶する実行途中時間記憶手段60と、デッドラインを記憶するデッドライン記憶手段61とを備える。
【0028】
アプリケーション(タスク)によって別のタスクが起動されると、デッドライン記憶手段61は、デッドラインに実行許容時間を設定し、実行途中時間記憶手段60は、実行途中時間に”0”を設定する。時間が経過するにつれ、デッドライン記憶手段61は、時刻カウンタ14を用いて、全てのタスクのデッドラインをデクリメントしながら、その結果を記憶し、実行途中時間記憶手段60は、時刻カウンタ14を用いて実行中のタスクの実行途中時間をインクリメントしながらその結果を記憶する。
【0029】
タスクスケジューリング手段13は、タスク制御情報記憶手段12に記憶されるデッドラインに基づいてデッドラインの近いものから順に実行されるようにタスク制御情報記憶手段12の内容を並べ替える。
実行必要処理量見積手段16は、図2に示すように、各タスク毎に既に起動している部分の処理量を計算する起動部分処理量見積手段20と、各タスク毎に起動が予想できる周期タスクの処理量を計算する予測部分処理量見積手段21と、それらを足し合わせタスクの処理量を求める加算手段22と、全てのタスクの処理量を足し合わせる合算手段23を備え、ある判定ポイントまでに実行する必要がある処理量である実行必要処理量を求める。起動部分処理量見積手段20と予測部分処理量見積手段21についての詳細な構成は、後述する。
【0030】
実行可能処理量見積手段15は、ある判定ポイントまでにCPUの100%の能力を使用できるものとして、判定ポイントまでの時間を実行可能処理量として求める。
処理量比較手段17は、実行必要処理量見積手段16で求められる実行必要処理量と、実行可能処理量見積手段15で求められる実行可能処理量を比較する比較器で構成される。実行可能処理量が実行必要処理量を上回ればタスクはデッドラインまでに実行可能であると判定し、逆に実行必要処理量が実行可能処理量を上回ればデッドラインまでに実行できないと判定をする。
【0031】
また、QoS制御手段18は、処理量比較手段17によって、デッドラインまでに実行できないと判定された時に、どのようなQoS制御を行うかを決定し、アプリケーション(タスク)10に対してQoS制御を行うことを要求する。
タスク制御手段11は、タスクスケジューリング手段13がタスク制御情報の順番を並べ替えた結果、最もデッドラインの近いタスクが変わった場合、CPUがそのタスクを実行するようにタスク10を切り替える。
【0032】
次に、起動部分処理量見積手段20の詳細を述べる。起動部分処理量見積手段20は、減算手段30と、比較手段31と、処理量変換手段33を備える。減算手段30は、タスク制御情報記憶手段12に記憶されるタスクの最悪実行時間から実行途中時間を減算することで、タスクの残りの処理量を求める。比較手段31は、判定ポイントとデッドラインの大小を比較する。処理量変換手段33は、上記比較手段31による比較の結果、判定ポイントよりもデッドラインが早い場合は、タスクの残りの処理量をそのまま起動部分処理量とし、判定ポイントよりもデッドラインが遅い場合は判定ポイントまでに実行する必要のないため、起動部分処理量を”0”とする。
【0033】
次に、予測部分処理量見積手段21の詳細を述べる。減算手段40と予測時間変換手段41と除算手段42と乗算手段43とを備える。減算手段40は、タスク制御情報記憶手段12が記憶している判定ポイントからデッドラインを引いて、その差分を求める。予測時間変換手段41では、その差分が正の値の場合はこの差分を予測時間とし、負の値の場合は判定ポイントのほうがデッドラインより近いため予測する部分は存在しないので予測時間を”0”とする。さらに、タスクの属性が非周期タスクの場合は、非周期タスクは、周期的に起動しないので、上記予測時間が正負に関わらず”0”とする。除算手段42は、予測時間変換手段41によって求められた予測時間を起動周期で割ることで、周期タスクが判定ポイントまでに何回繰り返し起動されるかを求める。乗算手段43は、除算手段42によって求められた繰り返し回数と、最悪実行時間を乗算することで各タスクの予測部分の処理量を求める。
【0034】
次に、図3に示すフローチャートを用いて、動作説明を行う。
まず、タスク実行中に(S110(図中、Sはステップを示す、以下同じ。))、タスクの起動終了などの制御が要求される。それに伴い、タスクの制御情報の設定変更を行う(S120)。
【0035】
タスクの情報の設定、更新が行われると、タスクスケジューリング手段13において、制御情報がデッドラインの早いもの順に並べ替えられる(S130)。
タスクのスケジューリングが終わると、実行可能処理量見積手段15において判定ポイントまでの実行可能処理量を見積もる(S140)。また、起動部分処理量見積手段20において、既に起動していて、実行状態が分かっている部分に関する処理量の見積もりと、予測部分処理量見積手段21において予測される処理量の見積もりを行い、これを足し合わせることで実行必要処理量を見積もる(S150)。
【0036】
判定ポイントまでの実行可能処理量と、実行必要処理量の見積もりが終わると、実行可能処理量と実行必要処理量を比較し、実行可能処理量が実行必要処理量を上回ればタスクはデッドラインまでに実行可能であると判定し(S160:YES)、逆に実行必要処理量が実行可能処理量を上回ればデッドラインまでに実行できないと判定をする(S160:NO)。
【0037】
これを判定ポイントの数だけ繰り返し行う(S170の判定によるS140〜S170の繰り返し)。
デッドラインまでに実行できないタスクが存在すると判定された場合は(S160:NO)、QoS制御手段18が、重要性の低いタスクを間引いたり処理量を減らすように制御内容を決定し、その結果にもとづいてQoS制御を決定し(S200)、決定された制御内容に基づき再度タスクの情報の設定、更新を行う(S120)。
【0038】
全てのタスクがデッドラインまでに実行できると判定されると(S170:YES)、タスク制御手段11は、最もデッドラインの近いタスクがタスクスケジューリング手段13により並べ替えられたとき(S180)、そのデッドラインの近いタスクを実行するようにタスクの切り替えを行う(S190)。
【0039】
以上を繰り返し行う。
また、上記のフローとは別に、タスクの情報の更新も適宜行う必要がある。この処理を図4に示すタスク情報の更新処理のフローチャートを用いて説明する。
タスクが、実行されているいないに関わらず、デッドラインは近づいてくるので、時刻カウンタ14を用いて(S310)、デッドラインを更新(デクリメント)する(S320)。
【0040】
また、タスクがどこまで実行したのかを把握するため、時刻カウンタ14を用いて(S310)、実行中のタスクの実行済み時間である実行途中時間を更新(インクリメント)する。
以上から、起動しているタスクと、起動が予測されるタスクがデッドラインを満足できるリアルタイム制御動作が出来る。
【0041】
次に、本方式の効果を説明する。
発明が解決しようとする課題の欄で示した例(図5、図6)と同じ例で比較する。タスク数3つで、タスクA,タスクB,タスクCがあり、タスクAとタスクBを周期タスク、タスクCを非周期タスクとする。また、タスクAは、周期=デッドライン、タスクBは周期≠デッドラインである。(当然タスクCも周期≠デッドラインである。)各タスクの起動の様子を図5に示す。この条件において、実際にEDF法でスケジューリングして実行した場合のタスクの実行の様子を図6(a)に示す。時刻16においてタスクAがデッドラインまでに実行できないというケースである。
【0042】
これを従来法で判定してみると、特許文献1の方法では時刻16で、特許文献2の方法では時刻14でデッドラインまでに実行できないタスクがあると判定される。また、特許文献3の方法では、時刻4と時刻10において、デッドラインまでに実行できないタスクがあると判定されることは、発明が解決しようとする課題の欄で図6(b)を参照して既に示した通りである。
【0043】
本実施例の方法を用いた場合を、図6(b)の「提案方式」の欄に示す。図6(a)の例では、タスクは3つあるので、判定ポイントは、タスクAの実行可能処理量とタスクAの実行必要処理量の比較ポイントと、タスクBの実行可能処理量とタスクBの実行必要処理量の比較ポイントと、タスクCの実行可能処理量とタスクCの実行必要処理量の比較ポイントの3箇所がある。各判定ポイントにおける実行可能処理量と実行必要処理量の計算結果を図7に示す。
【0044】
図7において「タスク A可」は、実行可能処理量見積手段15によって求められたタスクAの実行可能処理量を示し、「タスク A必」は、実行必要処理量見積手段16によって求められたタスクAの実行必要処理量を示している。同様に、「タスク B可」はタスクBの実行可能処理量、「タスク B必」はタスクBの実行必要処理量、「タスク C可」はタスクCの実行可能処理量、「タスク
C必」はタスクCの実行必要処理量である。
【0045】
以下に実行必要処理量の計算式とその計算過程を、時刻10におけるタスクBの例で示す。
時刻10における
実行可能処理量 = 6
であり、
時刻10における

Figure 2004171142
である。
なお、
各タスクの起動部分処理量の合計=タスクAの起動部分処理量+タスクBの起動部分処理量+タスクCの起動部分処理量=1+3+1=5
各タスクの予測部分処理量の合計=タスクAの予測部分処理量+タスクBの予測部分処理量+タスクC予測部分処理量= 1×(6−2) / 2 + 3×(6−6) / 6 + 0×(6−4) / 4 = 2+0+0 = 2
である。
【0046】
処理量比較手段17は、上述したように、タスク毎に、実行可能処理量と実行必要処理量を比較して、実行必要処理量が実行可能処理量よりも大きい場合には、デッドラインまでに実行できないと判定する。図6の処理では、図7に示すように、破線で囲む部分(時刻10)で、タスクBの実行必要処理量が実行可能処理量よりも大きくなり、この時刻10でデッドラインまでに実行できないことが検出される。
【0047】
よって、図6(b)に示すように、上述した本実施例の提案方式は、従来法(例えば特許文献1、2)に比べて早期にデッドラインまでに実行ができないことが検出できており、また、従来法(例えば特許文献3)に比べ、検出する必要のない部分(時刻4)は検出していない。このように、精度よく、従来より早い時点で、デッドラインまでに実行できないタスクがあることを判定できる。したがってQoS制御できる範囲を広げることができ、重要なタスクのデッドラインを守ることが可能となる。
[第2実施例]
本実施例は、第1実施例の構成よりも判定回数を減らし、RTOSへの負担を軽くする例である。すなわち、周期タスクのみが起動しているときにはデッドラインまでに実行可能する実施例である。本実施例では、第1実施例と同様で図3のフローチャートに代えて図8のフローチャートに示す処理を行う。
【0048】
図8に示す処理は、基本的に、第1実施例の図3に示して説明した処理と同様であり(同様の処理には同一のステップ番号を付している)、以下では異なる点のみ説明する。図8に示す処理では、S130の後に、S135の処理を行う。S135では、非周期タスクか否かを判定し、非周期タスクであれば(S135:YES)、S140へ移行し、周期タスクであれば(S135:NO)、S110へ戻る。したがって、非周期タスクが起動したときのみ、デッドラインまでに実行できないか否かの判定を行うこととなり、周期タスクの場合の判定を行う必要がなくなるので、図3のフローと比較して判定回数が削減できる。
[第3実施例]
本実施例は、第1実施例の構成よりも判定回数を減らし、RTOSへの負担を軽くする別の例である。
【0049】
本実施例では、第1実施例と同様で図3のフローチャートに代えて図9のフローチャートに示す処理を行う。図8に示す処理は、基本的に、第1実施例の図3に示して説明した処理と同様であり(同様の処理には同一のステップ番号を付している)、以下では異なる点のみ説明する。本実施例では、図8に示すように、S130の後に、S136の処理を行う。
【0050】
S136では、QoS制御可能なタスクか否かを判定し、QoS制御可能なタスクであれば(S137:YES)、S140へ移行し、QoS制御可能でないタスクであれば(S137:NO)、S110へ戻る。したがって、処理を軽減できないタスクはそのまま実行させ、処理を軽減できるもののみその実行前にデッドラインまでに実行できないか否かの判定を行うこととなり、同じQoS制御の効果を得るのに、図3のフローと比較して判定回数を削減できる。
【図面の簡単な説明】
【図1】実施例のリアルタイムタスク制御装置としてのRTOSの構成を示すブロック図である。
【図2】図1のRTOSの構成の一部についてさらに詳細な構成を示すブロック図である。
【図3】第1実施例のRTOSの処理の流れを示すフローチャートである。
【図4】RTOSにおけるタスク情報の更新処理の流れを示すフローチャートである。
【図5】タスクの起動の様子の例を示す説明図である。
【図6】タスクの実行例と、デッドラインまでに実行できないと検出される位置を示す説明図である。
【図7】各判定ポイントにおける実行可能処理量と実行必要処理量の計算結果を示す説明図である。
【図8】第2実施例のRTOSの処理の流れを示すフローチャートである。
【図9】第3実施例のRTOSの処理の流れを示すフローチャートである。
【図10】従来のリアルタイム制御装置の構成を示すブロック図である。
【図11】従来のリアルタイム制御装置の構成を示すブロック図である。
【符号の説明】
10…タスク(アプリケーション)
11…タスク制御手段
12…タスク制御情報記憶手段
13…タスクスケジューリング手段
14…時刻カウンタ
15…実行可能処理量見積手段
16…実行必要処理量見積手段
17…処理量比較手段
18…QoS制御手段
20…起動部分処理量見積手段
21…予測部分処理量見積手段
23…合算手段
30…減算手段
31…比較手段
33…処理量変換手段
40…減算手段
41…予測時間変換手段
42…除算手段
43…乗算手段
50…タスク固定パラメータ記憶手段
51…タスク動的パラメータ記憶手段
60…実行途中時間記憶手段
61…デッドライン記憶手段[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a task control device and method in a real-time multitasking operating system that controls scheduling and execution of a plurality of tasks that have time constraints.
[0002]
[Prior art]
In real-time control in a real-time multitasking operating system, various methods have conventionally been known as methods for determining whether a task can be executed by a deadline (for example, see Patent Documents 1 to 3).
[0003]
Patent Literature 1 adopts the configuration shown in FIG. 10 and adds the current time and the worst execution time of the task immediately before execution (the worst value of the execution (processing) time obtained by measurement or the like) immediately before executing the task, A method is shown in which it is determined that the task can be executed by the deadline if it is earlier than the deadline, while it is determined that the task cannot be executed by the deadline if it is later than the deadline. As described above, the method of Patent Document 1 focuses on only the task immediately before execution.
[0004]
Further, although the configuration of the deadline determination unit is not illustrated in Patent Literature 2, as described above, in Patent Literature 1, the determination is made on the task immediately before execution, whereas the method of Patent Literature 2 This is a method for determining whether all tasks that can be currently executed can be executed by the deadline.
[0005]
In Patent Document 3, the configuration shown in FIG. 11 is used, the average CPU efficiency is stored in a database, and the result of adding the average CPU efficiency of the activated task is n (2 1 / n -1) If it is equal to or less than (n: the number of tasks), it is determined that all tasks can be executed by the deadline. If it is more than this, it is determined that there are tasks that cannot be executed by the deadline.
[0006]
[Patent Document 1]
JP-A-8-272627
[Patent Document 2]
JP-A-8-55036
[Patent Document 3]
JP-A-10-240548
[0007]
[Problems to be solved by the invention]
However, in the methods described in Patent Literature 1 and Patent Literature 2 among these three methods, the determination is made only by the task immediately before execution or the task in the executable state, and the task that is expected to be started is considered. Therefore, it is considered that the determination accuracy is reduced. As a result, the timing at which it is determined that execution cannot be performed before the deadline is delayed. If the timing at which this determination is made is delayed, there is a greater possibility that the scope of QoS control becomes narrower (for example, QoS control of important tasks must be performed), and there is a problem that the processing content and the quality of the processing result deteriorate.
[0008]
Further, in Patent Document 3, it is assumed that a task is a periodic task that is a task that starts periodically, and when a non-periodic task that is a task that starts aperiodically is handled, the task is not started periodically. Regardless, when the CPU is used in the same manner as in the case where the CPU is periodically started, a large error occurs due to calculation. Then, it is determined that the processing cannot be performed even though the processing can be performed before the deadline, and the QoS control is performed. As a result, there is a problem that the processing content and the quality of the processing result deteriorate.
[0009]
The above problem will be described using a specific example. The number of tasks is 3, and there are tasks A, B, and C. Tasks A and B are periodic tasks, and task C is an aperiodic task. Task A has a cycle = deadline, and task B has a cycle ≠ deadline. (Of course, the period of task C is also the deadline.) FIG. 5 (a) shows the state of the activation of task A, FIG. 5 (b) shows the state of the activation of task B, and FIG. Show the situation.
[0010]
FIG. 6A shows an example in which scheduling is performed by the EDF (earlyest deadline first) method, which is a method in which the CPU can be used most effectively in the order of those with the closest deadline under these conditions. In this case, at time 16, task A cannot be executed by the deadline.
[0011]
According to the method described in Patent Literature 1, in order to determine whether the task immediately before execution can be performed by the deadline, the time in the “Method of Patent Literature 1” column of FIG. At 16, a deadline violation is detected when trying to execute task A. Therefore, it is not determined that there is a task that cannot be executed before the deadline until time 16 when the deadline is reached.
[0012]
Further, according to the method described in Patent Document 2, it is determined whether all tasks that can be currently executed can be executed by the deadline. That is, since the determination is made by looking at the deadline of the running task, the remaining execution time of the task A at the time 14 is shown in FIG. 1 and the deadline time 16, the remaining execution time 2 of the task B and the deadline time 16, it is determined that the QoS control is necessary. Thus, until time 14, it is not determined that there is a task that cannot be executed before the deadline. Even if it is determined at time 14 that there is a task that cannot be executed before the deadline, only task A or task B can perform QoS control at time 14. For this reason, there is a problem that even if the tasks A and B are important tasks, QoS control must be performed.
[0013]
In the method described in Patent Document 3, task A has a cycle of 2 and a worst execution time of 1, so the average use efficiency of task A is 1/2, and task B has a time of 6 from the start to the deadline and a worst case of Since the execution time is 3, the average use efficiency of the task B is 1 /, the task C is the time 4 from the start to the deadline, and the worst execution time 1 is 1. Therefore, the average use efficiency of the task C is 4. . Therefore, when the task C is activated at time 4 and time 10 as shown by the mark 印 in the column of “Method of Patent Document 3” in FIG. 6B, + 1 ++ 1 ++ 1> 1 and the capability Is exceeded, and it is determined that there is a task that cannot be executed before the deadline. However, at time 4, although it has been determined that there are tasks that cannot be executed before the deadline, all the tasks in this portion can be actually executed before the deadline. As described above, although there are no tasks that cannot be actually executed before the deadline, it is determined that there are tasks that cannot be executed before the deadline, and the QoS control is performed, thereby deteriorating the processing content of the task and the quality of the processing result. Problem.
[0014]
Therefore, the present invention can broaden the range in which QoS control can be performed by making it possible to accurately determine, as soon as possible, a task that cannot be executed before the deadline, and to increase the deadline of an important task. It is an object of the present invention to provide a real-time task control device capable of protecting the task.
[0015]
Means for Solving the Problems and Effects of the Invention
2. A real-time task control device according to claim 1, wherein the real-time task control device stores task control information and controls a task execution order using the stored task control information. Performs scheduling, controls task execution by switching tasks to be executed based on the scheduling result, and adjusts the load when all tasks cannot be completed by the deadline that is the scheduled end time In a real-time task control device that performs QoS control for controlling the quality of service, the task control information is used to determine which tasks have been activated up to the decision point, which is the deadline of the task to be determined, and which tasks are expected to be activated. Estimate the required processing amount, estimate the executable processing amount up to the judgment point, and The required execution amount and the executable amount are compared, and if the executable amount exceeds the required amount, the task is determined to be executable by the deadline. If it exceeds the amount, it is determined that it cannot be executed by the deadline. Then, QoS control is performed using the determination result.
[0016]
In this way, when estimating the required processing amount, not only the activated task but also the task that is expected to be activated is taken into account, and the deadline can be determined more accurately and earlier than before. By doing so, it is possible to detect that the task cannot be executed by this time, to expand the range in which the QoS control can be performed, and to protect deadlines of important tasks.
[0017]
When estimating the required processing amount, it is necessary to calculate how much processing each task needs to perform up to the determination point. At this time, as described in claim 2, the activation partial processing amount and the predicted partial processing amount are separately calculated, and the calculated activation partial processing amount and the predicted partial processing amount are added for each task. Then, the processing amount for each task of the addition result is added up for all tasks, and the required processing amount can be obtained.
[0018]
Further, the worst execution time of the task is stored as the task control information, and the activation partial processing amount estimating means subtracts the halfway execution time, which is the time at which the task has already been executed, from the worst execution time of the task, Subtraction means for obtaining the remaining processing amount of the task; comparison means for comparing the judgment point with the size of the deadline; as a result of the comparison by the comparison means, if the deadline is earlier than the judgment point, The remaining processing amount is defined as a starting partial processing amount, and a processing amount conversion unit for setting the starting partial processing amount to “0” when the deadline is later than the determination point because it is not necessary to execute the deadline before the determination point. You can do so.
[0019]
According to another aspect of the present invention, the predictive partial processing amount estimating means draws the deadline from the determination point and calculates a difference between the deadline and the deadline. Sets the subtraction result to the prediction time, sets the prediction time to “0” if the value is negative, and sets the prediction time to “0” regardless of whether the prediction time is positive or negative if the attribute of the task is an aperiodic task. Time converting means, dividing means for dividing the predicted time obtained by the predicted time converting means by the activation cycle of the task to obtain the number of repetitions of the periodic task, and the number of repetitions obtained by the dividing means A multiplying means for multiplying the worst execution time to obtain the processing amount of the predicted portion of the task. Since the aperiodic task does not start repeatedly, setting the predicted partial processing amount to “0” enables the aperiodic task to be handled with high accuracy.
[0020]
As described in claim 5, the task control information storage means includes a task fixed information storage means for storing a worst execution time, a start cycle, and a permissible execution time, which are fixed information of the task, and a task fixed information storage means. It is preferable to include a task dynamic information storage unit that stores a certain deadline and an intermediate execution time. The task dynamic information storage means includes an execution time storage means for storing the information while incrementing the execution time of the task being executed, and a deadline for storing the information while decrementing the deadline of the task. Storage means.
[0021]
Further, a real-time task control method according to claim 7, which has been made to solve the above-mentioned problems, includes a step of executing a task which is an application, a task control information updating step of setting and updating task information, A scheduling step of rearranging the task control information in order from the one with the closest deadline, an executable processing amount estimating step of estimating an executable processing amount which is a processing amount that can be processed up to the determination point, and An execution necessary processing amount estimating step for estimating an execution necessary processing amount to be performed, an executable processing amount estimated in the executable processing amount estimating step, and an execution necessary processing amount estimated in the execution necessary processing amount estimating step. If the executable processing amount exceeds the required processing amount, the task And if the executable processing amount is less than the required processing amount, it is determined that the processing cannot be performed by the deadline. If the determination result indicates that the processing cannot be performed by the deadline, the QoS control content And the step of determining whether or not the determination has been made at all the determination points, and if the determination has not been successful, the step of determining again at another determination point, and if there is a change in the task execution order, the task is switched. And a task switching step.
[0022]
And a task attribute determining step of determining whether the task is a periodic task or an aperiodic task. If the task attribute determining step determines that the task is a periodic task, the executable process is performed. While the processing of the steps described after the amount estimation step is performed, if it is determined that the task is an aperiodic task, the processing of the steps described after the executable processing amount estimation step can be prevented from being performed. . In this way, it was assumed that it was used under the condition that "if only periodic tasks are activated, it can be executed by the deadline, and only if acyclic tasks are activated, it cannot be executed by the deadline". The steps described after the executable processing amount estimation step can be performed only when the above task (aperiodic task) is started (= when the CPU efficiency is likely to exceed 100%). , Processing can be reduced.
[0023]
Further, as set forth in claim 9, the method further comprises a task attribute determining step of determining whether the task is a QoS controllable task. If the task attribute determining step determines that the task is a QoS controllable task, While the processing of the steps described after the executable processing amount estimation step is performed, if it is determined that the task cannot be QoS-controlled, the processing of the steps described after the executable processing amount estimation step is not performed. You can do so. In this way, under the condition that "all tasks can be executed by deadline if QoS control is performed for a predetermined task", the steps described after the step of estimating the executable processing amount only when the task capable of QoS control is started are executed. Since the processing can be performed, the processing can be reduced.
[0024]
When the real-time task control method according to any one of claims 7 to 9 is realized by a computer system, the real-time task control method according to any one of claims 7 to 9 may be provided as, for example, a program started on the computer system side. In the case of such a program, for example, the program is recorded on a computer-readable recording medium such as a flexible disk, a magneto-optical disk, a CD-ROM, a hard disk, a ROM, and a RAM, and is loaded into a computer system as needed and activated. It can also be used by loading and starting via a network.
[0025]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments to which the present invention is applied will be described with reference to the drawings. It is needless to say that the embodiments of the present invention are not limited to the following examples, and can take various forms within the technical scope of the present invention. The configuration of the following embodiment can be realized by any of hardware, software (program), or a combination thereof.
[First embodiment]
This embodiment is an example in which the present invention is applied to an RTOS (real-time operating system) that controls execution of a task operating on a CPU, as shown in FIG. A task is a processing unit of an application (software).
[0026]
As shown in FIG. 1, the RTOS includes a task control unit 11, a task control information storage unit 12, a task scheduling unit 13, a time counter 14, an executable processing amount estimation unit 15, an execution required processing amount estimation unit It comprises means 16, processing amount comparing means 17, and QoS control means 18.
[0027]
The task control information storage unit 12 stores fixed parameters of the task such as a task start cycle (interval at which a periodic task starts), a permissible execution time (a time width that must end after the task starts), and a worst execution time. The system includes a task fixed parameter storage unit 50 for storing a task and a task dynamic parameter storage unit 51 for storing a task dynamic parameter. The task dynamic parameter storage means 51 includes a task execution time storage means 60 for storing a task execution time which is a time indicating how far the execution of the task has progressed during the task execution, and a deadline for storing the deadline. Storage means 61.
[0028]
When another task is started by the application (task), the deadline storage unit 61 sets an allowable execution time for the deadline, and the mid-execution time storage unit 60 sets “0” to the mid-execution time. As the time elapses, the deadline storage means 61 uses the time counter 14 to store the results while decrementing the deadlines of all tasks, and the in-execution time storage means 60 uses the time counter 14. Then, the result of the task being executed is stored while incrementing the halfway time.
[0029]
The task scheduling means 13 rearranges the contents of the task control information storage means 12 based on the deadlines stored in the task control information storage means 12 so that the tasks are executed in order from the one with the closest deadline.
As shown in FIG. 2, the execution necessary processing amount estimating means 16 includes a starting partial processing amount estimating means 20 for calculating the processing amount of a part which has already been started for each task, and a period for which starting can be predicted for each task. A prediction partial processing amount estimating unit 21 for calculating the processing amount of a task, an adding unit 22 for adding them together to obtain the processing amount of the task, and a summing unit 23 for adding up the processing amounts of all the tasks. The required processing amount, which is the amount of processing that needs to be performed, is calculated. The detailed configurations of the activation partial processing amount estimating means 20 and the predicted partial processing amount estimating means 21 will be described later.
[0030]
The executable processing amount estimating unit 15 obtains the time up to the determination point as the executable processing amount, assuming that 100% of the capacity of the CPU can be used by a certain determination point.
The processing amount comparing means 17 is constituted by a comparator for comparing the required processing amount calculated by the required processing amount estimating means 16 with the executable processing amount calculated by the feasible processing amount estimating means 15. If the executable processing amount exceeds the required processing amount, it is determined that the task can be executed by the deadline. Conversely, if the required processing amount exceeds the executable processing amount, it is determined that the task cannot be executed by the deadline. .
[0031]
The QoS control unit 18 determines what kind of QoS control is to be performed when the processing amount comparison unit 17 determines that the application cannot be executed by the deadline, and performs QoS control on the application (task) 10. Request to do.
When the task scheduling unit 13 rearranges the order of the task control information and the task with the closest deadline changes, the task control unit 11 switches the task 10 so that the CPU executes the task.
[0032]
Next, details of the activation partial processing amount estimating means 20 will be described. The activation partial processing amount estimating unit 20 includes a subtracting unit 30, a comparing unit 31, and a processing amount converting unit 33. The subtraction unit 30 obtains the remaining processing amount of the task by subtracting the halfway execution time from the worst execution time of the task stored in the task control information storage unit 12. The comparing means 31 compares the judgment point with the size of the deadline. If the result of the comparison by the comparing means 31 indicates that the deadline is earlier than the determination point, the processing amount conversion means 33 uses the remaining processing amount of the task as the startup partial processing amount as it is, and if the deadline is later than the determination point. Is not required to be executed before the determination point, and thus the activation partial processing amount is set to “0”.
[0033]
Next, details of the prediction partial processing amount estimating means 21 will be described. It comprises a subtraction means 40, a prediction time conversion means 41, a division means 42 and a multiplication means 43. The subtraction means 40 draws a deadline from the determination point stored in the task control information storage means 12 and obtains the difference. When the difference is a positive value, the prediction time conversion means 41 uses the difference as a prediction time. When the difference is a negative value, the judgment point is closer to the deadline and there is no portion to be predicted. ". Further, when the attribute of the task is a non-periodic task, the non-periodic task does not start periodically, so that the predicted time is set to “0” regardless of whether the task is positive or negative. The dividing unit 42 divides the predicted time obtained by the predicted time converting unit 41 by the activation period to determine how many times the periodic task is repeatedly activated by the determination point. The multiplication unit 43 obtains the processing amount of the predicted portion of each task by multiplying the number of repetitions obtained by the division unit 42 by the worst execution time.
[0034]
Next, the operation will be described with reference to the flowchart shown in FIG.
First, during execution of a task (S110 (S indicates a step in the figure, the same applies hereinafter)), control such as termination of activation of the task is required. Accordingly, the setting of the task control information is changed (S120).
[0035]
When the setting and updating of the task information are performed, the task scheduling means 13 sorts the control information in the order of the deadline (S130).
When the task scheduling is completed, the executable processing amount estimating means 15 estimates the executable processing amount up to the determination point (S140). In addition, the starting partial processing amount estimating means 20 estimates the processing amount of the part which has already been started and whose execution state is known, and estimates the processing amount predicted by the predicted partial processing amount estimating means 21. Are added to estimate the required processing amount (S150).
[0036]
When the amount of executable processing up to the judgment point and the required processing amount are estimated, the executable processing amount and the required processing amount are compared, and if the executable processing amount exceeds the required processing amount, the task reaches the deadline. Is determined to be executable (S160: YES). Conversely, if the required processing amount exceeds the executable processing amount, it is determined that the processing cannot be performed by the deadline (S160: NO).
[0037]
This is repeated for the number of determination points (repetition of S140 to S170 by the determination of S170).
If it is determined that there is a task that cannot be executed before the deadline (S160: NO), the QoS control means 18 determines the control content so as to thin out less important tasks or reduce the amount of processing. Based on the determined QoS control (S200), task information is set and updated again based on the determined control content (S120).
[0038]
When it is determined that all the tasks can be executed by the deadline (S170: YES), the task control unit 11, when the tasks closest to the deadline are rearranged by the task scheduling unit 13 (S180), the deadline is determined. The task is switched so as to execute the task near the line (S190).
[0039]
The above is repeated.
In addition to the above flow, it is necessary to appropriately update task information. This processing will be described with reference to the flowchart of the task information update processing shown in FIG.
Regardless of whether the task is being executed or not, the deadline is approaching. Therefore, the deadline is updated (decremented) using the time counter 14 (S310) (S320).
[0040]
In addition, in order to grasp how far the task has been executed, the time counter 14 is updated (incremented) by using the time counter 14 (S310), which is the executed time of the task being executed.
From the above, a real-time control operation in which the activated task and the task whose activation is predicted can satisfy the deadline can be performed.
[0041]
Next, effects of the present method will be described.
The comparison is made with the example (FIGS. 5 and 6) shown in the column of the problem to be solved by the invention. There are three tasks, task A, task B, and task C. Tasks A and B are periodic tasks, and task C is an aperiodic task. Task A has a cycle = deadline, and task B has a cycle ≠ deadline. (Of course, the cycle of the task C is also a deadline.) FIG. 5 shows how each task is activated. FIG. 6A shows the state of task execution when the task is actually scheduled and executed by the EDF method under these conditions. At time 16, task A cannot be executed by the deadline.
[0042]
When this is determined by the conventional method, it is determined that there is a task that cannot be executed by the deadline at time 16 in the method of Patent Document 1 and at time 14 in the method of Patent Document 2. Further, in the method of Patent Document 3, it is determined at time 4 and time 10 that there is a task that cannot be executed before the deadline, by referring to FIG. 6B in the column of the problem to be solved by the invention. As already indicated.
[0043]
The case where the method of the present embodiment is used is shown in the column of “proposed method” in FIG. In the example of FIG. 6A, since there are three tasks, the determination points are a comparison point between the executable processing amount of the task A and the required processing amount of the task A, the executable processing amount of the task B and the task B There are three points: a comparison point of the required processing amount of the task C, and a comparison point of the executable processing amount of the task C and the required processing amount of the task C. FIG. 7 shows the calculation results of the executable processing amount and the required processing amount at each determination point.
[0044]
In FIG. 7, “task A possible” indicates the executable processing amount of task A determined by the executable processing amount estimating unit 15, and “task A required” indicates the task amount determined by the necessary processing amount estimating unit 16. A shows the required processing amount of A. Similarly, “Task B Allowed” is the executable processing amount of Task B, “Task B Required” is the required processing amount of Task B, “Task C Allowed” is the executable processing amount of Task C, “Task C
“C required” is the required processing amount of task C.
[0045]
The calculation formula of the required processing amount and its calculation process will be described below using the example of task B at time 10.
At time 10
Executable processing amount = 6
And
At time 10
Figure 2004171142
It is.
In addition,
Total of the activated partial processing amount of each task = the activated partial processing amount of task A + the activated partial processing amount of task B + the activated partial processing amount of task C = 1 + 3 + 1 = 5
Total predicted partial processing amount of each task = Predicted partial processing amount of task A + Predicted partial processing amount of task B + Task C predicted partial processing amount = 1 × (6-2) / 2 + 3 × (6-6) / 6 + 0x (6-4) / 4 = 2 + 0 + 0 = 2
It is.
[0046]
As described above, the processing amount comparison unit 17 compares the executable processing amount and the execution required processing amount for each task, and when the execution required processing amount is larger than the executable processing amount, It is determined that it cannot be executed. In the processing of FIG. 6, as shown in FIG. 7, the required processing amount of the task B becomes larger than the executable processing amount at the portion surrounded by the broken line (time 10), and the task B cannot be executed by the deadline at this time 10. Is detected.
[0047]
Therefore, as shown in FIG. 6B, it is possible to detect that the proposed method of the present embodiment described above cannot be executed earlier than the conventional method (for example, Patent Documents 1 and 2) before the deadline. In addition, a portion that does not need to be detected (time 4) is not detected as compared with the conventional method (for example, Patent Document 3). In this way, it is possible to accurately determine at an earlier point in time that there is a task that cannot be executed by the deadline. Therefore, the range in which QoS control can be performed can be expanded, and deadlines for important tasks can be protected.
[Second embodiment]
This embodiment is an example in which the number of determinations is reduced as compared with the configuration of the first embodiment, and the load on the RTOS is reduced. That is, in this embodiment, when only the periodic task is activated, the task can be executed before the deadline. In the present embodiment, similarly to the first embodiment, the processing shown in the flowchart of FIG. 8 is performed instead of the flowchart of FIG.
[0048]
The processing shown in FIG. 8 is basically the same as the processing shown in FIG. 3 of the first embodiment (the same processing is denoted by the same step number), and only the different points will be described below. explain. In the processing illustrated in FIG. 8, the processing of S135 is performed after S130. In S135, it is determined whether or not the task is an aperiodic task. If the task is an aperiodic task (S135: YES), the process proceeds to S140. If the task is a periodic task (S135: NO), the process returns to S110. Therefore, only when the aperiodic task is started, it is determined whether or not the task can be executed before the deadline, and it is not necessary to perform the determination in the case of the periodic task. Can be reduced.
[Third embodiment]
This embodiment is another example in which the number of determinations is reduced compared to the configuration of the first embodiment, and the load on the RTOS is reduced.
[0049]
In the present embodiment, similarly to the first embodiment, the processing shown in the flowchart of FIG. 9 is performed instead of the flowchart of FIG. The processing shown in FIG. 8 is basically the same as the processing shown in FIG. 3 of the first embodiment (the same processing is denoted by the same step number), and only the different points will be described below. explain. In the present embodiment, as shown in FIG. 8, the process of S136 is performed after S130.
[0050]
In S136, it is determined whether or not the task is QoS controllable. If the task is QoS controllable (S137: YES), the process proceeds to S140. If the task is not QoS controllable (S137: NO), the process proceeds to S110. Return. Therefore, a task whose processing cannot be reduced is executed as it is, and only a task whose processing can be reduced is determined whether or not it can be executed by the deadline before its execution, and the same QoS control effect as described in FIG. The number of times of determination can be reduced as compared with the flow of FIG.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration of an RTOS as a real-time task control device according to an embodiment.
FIG. 2 is a block diagram showing a more detailed configuration of a part of the configuration of the RTOS of FIG. 1;
FIG. 3 is a flowchart illustrating a flow of processing of the RTOS according to the first embodiment.
FIG. 4 is a flowchart illustrating a flow of a task information update process in the RTOS.
FIG. 5 is an explanatory diagram showing an example of how a task is activated.
FIG. 6 is an explanatory diagram showing an execution example of a task and a position where it is detected that the task cannot be executed before the deadline.
FIG. 7 is an explanatory diagram showing calculation results of an executable processing amount and an execution required processing amount at each determination point.
FIG. 8 is a flowchart illustrating a flow of processing of an RTOS according to a second embodiment.
FIG. 9 is a flowchart illustrating a flow of processing of an RTOS according to a third embodiment.
FIG. 10 is a block diagram showing a configuration of a conventional real-time control device.
FIG. 11 is a block diagram showing a configuration of a conventional real-time control device.
[Explanation of symbols]
10 Tasks (applications)
11 ... task control means
12 task control information storage means
13. Task scheduling means
14: Time counter
15. Executable processing amount estimation means
16 means for estimating the required processing amount
17 Processing amount comparison means
18 QoS control means
20: means for estimating the starting partial processing amount
21 ... means for estimating the predicted partial processing amount
23 ... summing means
30 ... subtraction means
31 ... Comparison means
33 ... Processing amount conversion means
40 ... subtraction means
41 ... Estimated time conversion means
42 ... Division means
43 Multiplication means
50: Task fixed parameter storage means
51: Task dynamic parameter storage means
60: means for storing the time during execution
61: Deadline storage means

Claims (10)

タスクの制御情報を記憶するタスク制御情報記憶手段と、
前記タスク制御情報記憶手段に記憶されたタスク制御情報を用いてタスクの実行順序を制御するタスクスケジューリング手段と、
前記タスクスケジューリング手段によるスケジューリング結果に基づいて実行するタスクの切り替えを行うことでタスクの実行を制御するタスク制御手段と、
全てのタスクが終了予定時刻であるデッドラインまでに実行を完了できない場合に、負荷量を調整しサービスの品質を制御するQoS制御を行うQoS制御手段と
を備えるリアルタイムタスク制御装置において、
前記タスク制御情報記憶手段に記憶されたタスク制御情報を用いて、判定対象のタスクのデッドラインである判定ポイントまでの起動しているタスクと起動が予測されるタスクの実行必要処理量を見積もる実行必要処理量見積手段と、
前記タスク制御情報記憶手段に記憶されたタスク制御情報を用いて、判定ポイントまでの実行可能処理量を見積もる実行可能処理量見積手段と、
前記実行必要処理量見積手段で見積もった実行必要処理量と、前記実行可能処理量見積手段で見積もった実行可能処理量を比較し、実行可能処理量が実行必要処理量を上回ればタスクはデッドラインまでに実行可能であると判定し、逆に実行必要処理量が実行可能処理量を上回ればデッドラインまでに実行できないと判定をする処理量比較手段と
を備え、
前記QoS制御手段は、前記処理量比較手段の判定結果を用いて前記QoS制御を行うこと
を特徴とするリアルタイムタスク制御装置。
Task control information storage means for storing task control information;
Task scheduling means for controlling the execution order of tasks using the task control information stored in the task control information storage means,
Task control means for controlling the execution of the task by switching the task to be executed based on the scheduling result by the task scheduling means,
A real-time task control device comprising: a QoS control unit that performs a QoS control that adjusts a load amount and controls a quality of service when execution of all tasks cannot be completed by a deadline that is a scheduled end time;
Using the task control information stored in the task control information storage means, executing the task to be executed up to the judgment point, which is a deadline of the task to be judged, and estimating the required processing amount of the task expected to be started. Means for estimating the required processing volume,
Using the task control information stored in the task control information storage means, an executable processing amount estimating means for estimating an executable processing amount up to a determination point,
The required processing amount estimated by the required processing amount estimating means is compared with the executable processing amount estimated by the feasible processing amount estimating means. If the executable processing amount exceeds the required processing amount, the task becomes a deadline. And a processing amount comparing means for determining that the required processing amount cannot be executed by the deadline if the required processing amount exceeds the executable processing amount,
The real-time task control device, wherein the QoS control means performs the QoS control using a determination result of the processing amount comparison means.
前記実行必要処理量見積手段は、
前記タスク制御情報記憶手段に記憶されたタスク制御情報を用いて、起動しているタスクの処理量を各タスクごとに計算する起動部分処理量見積手段と、
前記タスク制御情報記憶手段のタスク制御情報を用いて、起動が予測できるタスクの処理量を各タスクごとに計算する予測部分処理量見積手段と、
前記起動部分処理量見積手段によって計算された起動部分処理量と、前記予測部分処理量見積手段によって計算された予測部分処理量を各タスクごとに加算する加算手段と、
前記加算手段によって計算された各タスク毎の処理量を、全てのタスク分について足し合わせる合算手段と
を備えることを特徴とする請求項1に記載のリアルタイムタスク制御装置。
The execution necessary processing amount estimating means includes:
Using the task control information stored in the task control information storage means, starting partial processing amount estimating means for calculating the processing amount of the activated task for each task,
Using the task control information of the task control information storage means, a predicted partial processing amount estimating means for calculating the processing amount of the task whose activation can be predicted for each task,
An adding unit that adds, for each task, a starting partial processing amount calculated by the starting partial processing amount estimating unit and a predicted partial processing amount calculated by the predicted partial processing amount estimating unit;
2. The real-time task control device according to claim 1, further comprising a summing unit that adds the processing amount of each task calculated by the adding unit for all tasks.
前記タスク制御情報記憶手段は、前記タスク制御情報としてタスクの最悪実行時間を記憶しており、
前記起動部分処理量見積手段は、
前記タスク制御情報記憶手段に記憶されたタスクの最悪実行時間からそのタスクが既に実行された時間である実行途中時間を減算することで、タスクの残りの処理量を求める減算手段と、
前記判定ポイントと前記デッドラインの大小を比較する比較手段と、
前記比較手段による比較の結果、前記判定ポイントよりも前記デッドラインが早い場合はタスクの残りの処理量を起動部分処理量とし、前記判定ポイントよりも前記デッドラインが遅い場合は判定ポイントまでに実行する必要がないため起動部分処理量を”0”とする処理量変換手段と
を備えることを特徴とする請求項2に記載のリアルタイムタスク制御装置。
The task control information storage means stores the worst execution time of the task as the task control information,
The activation partial processing amount estimating means includes:
Subtracting the remaining processing amount of the task from the worst execution time of the task stored in the task control information storage means by subtracting the intermediate execution time that is the time when the task has already been executed;
Comparing means for comparing the size of the deadline with the determination point;
As a result of the comparison by the comparing means, when the deadline is earlier than the determination point, the remaining processing amount of the task is set as the starting partial processing amount, and when the deadline is later than the determination point, the processing is executed by the determination point. 3. The real-time task control device according to claim 2, further comprising a processing amount conversion unit that sets the activation partial processing amount to "0" because there is no need to perform the processing.
前記予測部分処理量見積手段は、
前記判定ポイントから前記デッドラインを引いて、その差分を求める減算手段と、
前記減算手段による減算結果が、正の値の場合は当該減算結果を予測時間とし、負の値の場合は予測時間を”0”とし、さらに、当該タスクの属性が非周期タスクの場合は、予測時間が正負に関わらず”0”とする予測時間変換手段と、
前記予測時間変換手段によって求められた予測時間を、当該タスクの起動周期で割って周期タスクの繰り返し回数を求める除算手段と、
前記除算手段によって求められた繰り返し回数と当該タスクの最悪実行時間を乗算して、当該タスクの予測部分の処理量を求める乗算手段と、
を備えることを特徴とする請求項3に記載のリアルタイムタスク制御装置。
The predicted partial processing amount estimation means,
Subtraction means for drawing the deadline from the determination point and calculating the difference,
If the result of the subtraction by the subtraction means is a positive value, the result of the subtraction is used as the predicted time. If the result is a negative value, the predicted time is set to “0”. Further, if the attribute of the task is an aperiodic task, Prediction time conversion means for setting the prediction time to “0” regardless of whether it is positive or negative;
Dividing means for dividing the predicted time obtained by the predicted time converting means by the activation cycle of the task to obtain the number of repetitions of the periodic task,
Multiplying means for multiplying the number of repetitions obtained by the dividing means and the worst execution time of the task to obtain a processing amount of a predicted portion of the task;
The real-time task control device according to claim 3, further comprising:
前記タスク制御情報記憶手段は、
タスクの固定情報である最悪実行時間、起動周期、実行許容時間を記憶するタスク固定情報記憶手段と、
タスクの動的情報であるデッドライン、実行途中時間を記憶するタスク動的情報記憶手段と
を備えることを特徴とする請求項1〜4のいずれかに記載のリアルタイムタスク制御装置。
The task control information storage means,
Task fixed information storage means for storing the worst execution time, start cycle, and allowable execution time, which are fixed information of the task,
The real-time task control device according to any one of claims 1 to 4, further comprising: a task dynamic information storage unit that stores a deadline, which is dynamic information of a task, and an intermediate execution time.
前記タスク動的情報記憶手段は、
実行されているタスクの実行途中時間をインクリメントしながらその情報を記憶する実行途中時間記憶手段と、
タスクのデッドラインをデクリメントしながらその情報を記憶するデッドライン記憶手段と
を備えることを特徴とする請求項5に記載のリアルタイムタスク制御装置。
The task dynamic information storage means,
Mid-execution time storage means for storing the information while incrementing the mid-execution time of the task being executed;
6. The real-time task control device according to claim 5, further comprising: a deadline storage unit configured to store information of the task while decrementing the deadline.
リアルタイムタスク制御方法において
アプリケーションであるタスクを実行するステップと、
タスクの情報を設定更新するタスク制御情報更新ステップと、
タスクの実行順序をデッドラインの近いものから順番にタスク制御情報を並べ替えるスケジューリングステップと
判定ポイントまでの処理可能処理量である実行可能処理量を見積もる実行可能処理量見積ステップと、
判定ポイントまでに行うべき実行必要処理量を見積もる実行必要処理量見積ステップと、
前記実行可能処理量見積ステップで見積もられた実行可能処理量と前記実行必要処理量見積ステップで見積もられた実行必要処理量とを比較し、実行可能処理量が、実行必要処理量を上回ればタスクがデッドラインまでに実行できると判定し、逆に実行可能処理量が、実行必要処理量を下回ればデッドラインまでに実行できないと判定するステップと、
当該判定の結果、デッドラインまでに実行できない場合、QoS制御内容を決定するステップと、
全ての判定ポイントで判定したかを確認し、判定が出来ていなければ再度別の判定ポイントで判定をするステップと、
タスクの実行順序に変化があった場合、タスクを切り替えるタスク切り替えステップと、
を備えることを特徴とするリアルタイムタスク制御方法。
Executing a task that is an application in the real-time task control method;
A task control information update step for setting and updating task information;
A scheduling step for rearranging the task control information in order of task execution order from the closest deadline and an executable processing amount estimating step for estimating an executable processing amount which is an allowable processing amount up to a determination point;
An execution necessary processing amount estimating step for estimating an execution necessary processing amount to be performed up to the judgment point,
The executable processing amount estimated in the executable processing amount estimation step is compared with the execution required processing amount estimated in the execution necessary processing amount estimation step, and the executable processing amount exceeds the execution required processing amount. If the task can be executed by the deadline, and conversely, if the executable processing amount is less than the required processing amount, it is determined that the task cannot be executed by the deadline;
If the result of the determination indicates that the QoS control cannot be performed by the deadline, the step of determining the QoS control content;
A step of checking whether or not the determination has been made at all the determination points, and, if the determination has not been made, a step of making a determination again at another determination point;
A task switching step for switching tasks when the execution order of the tasks is changed;
A real-time task control method, comprising:
タスクが周期タスクか非周期タスクかを判定するタスク属性判定ステップを備え、
タスク属性判定ステップによって周期タスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行う一方、非周期タスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行わないこと
を特徴とする請求項7に記載のリアルタイムタスク制御方法。
A task attribute determining step of determining whether the task is a periodic task or an aperiodic task,
When the task is determined to be a periodic task by the task attribute determining step, the processing of the steps described after the executable processing amount estimation step is performed, while when the task is determined to be an aperiodic task, the execution is performed. 8. The real-time task control method according to claim 7, wherein the steps described after the possible processing amount estimation step are not performed.
タスクがQoS制御可能なタスクか否かを判定するタスク属性判定ステップを備え、
タスク属性判定ステップによってQoS制御可能なタスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行う一方、QoS制御不可能なタスクであると判定された場合には、前記実行可能処理量見積ステップ以降に記載のステップの処理を行わないこと
を特徴とする請求項7に記載のリアルタイムタスク制御方法。
A task attribute determining step of determining whether the task is a QoS controllable task,
When it is determined by the task attribute determining step that the task is a QoS controllable task, while the processing of the steps described after the executable processing amount estimating step is performed, it is determined that the task is a QoS uncontrollable task. 8. The real-time task control method according to claim 7, wherein in the case, the processing of the steps described after the executable processing amount estimation step is not performed.
請求項7〜9のいずれかに記載のリアルタイムタスク制御方法の各ステップの処理をコンピュータに実行させるためのプログラム。A program for causing a computer to execute the processing of each step of the real-time task control method according to claim 7.
JP2002334024A 2002-11-18 2002-11-18 Real-time task control device Expired - Fee Related JP3915672B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002334024A JP3915672B2 (en) 2002-11-18 2002-11-18 Real-time task control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002334024A JP3915672B2 (en) 2002-11-18 2002-11-18 Real-time task control device

Publications (2)

Publication Number Publication Date
JP2004171142A true JP2004171142A (en) 2004-06-17
JP3915672B2 JP3915672B2 (en) 2007-05-16

Family

ID=32698578

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002334024A Expired - Fee Related JP3915672B2 (en) 2002-11-18 2002-11-18 Real-time task control device

Country Status (1)

Country Link
JP (1) JP3915672B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013114435A (en) * 2011-11-29 2013-06-10 Mitsubishi Electric Corp Information processing device, information processing method, and program
JPWO2013030908A1 (en) * 2011-08-26 2015-03-23 富士通株式会社 Scheduling system, data processing system, and scheduling method
US9626307B2 (en) 2013-07-19 2017-04-18 Samsung Electronics Co., Ltd. Mobile device and a method of controlling the mobile device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2013030908A1 (en) * 2011-08-26 2015-03-23 富士通株式会社 Scheduling system, data processing system, and scheduling method
JP2013114435A (en) * 2011-11-29 2013-06-10 Mitsubishi Electric Corp Information processing device, information processing method, and program
US9626307B2 (en) 2013-07-19 2017-04-18 Samsung Electronics Co., Ltd. Mobile device and a method of controlling the mobile device

Also Published As

Publication number Publication date
JP3915672B2 (en) 2007-05-16

Similar Documents

Publication Publication Date Title
US8112644B2 (en) Dynamic voltage scaling scheduling mechanism for sporadic, hard real-time tasks with resource sharing
KR101254009B1 (en) Method of dynamic voltage scaling of the CPU using workload estimator and computer readable medium storing the method
JP5347451B2 (en) Multiprocessor system, conflict avoidance program, and conflict avoidance method
JP3828112B2 (en) Scheduling method and system for controlling execution of processing
JP2010160715A (en) Electronic control unit for vehicle
JP2004171142A (en) Real-time task control device, real-time task control method and program
US8555285B2 (en) Executing a general-purpose operating system as a task under the control of a real-time operating system
JP2010003213A (en) Controller, arithmetic mode changeover method and program
JP2007122527A (en) Flow control method
JP2002351852A (en) System operation management method
JP2011108140A (en) Data processor
JP2001236236A (en) Task controller and its task scheduling method
JP2002073354A (en) Task control device and task contol method
JP7435182B2 (en) electronic control unit
CN112286684B (en) Memory usage control method, device, equipment and medium
JP2000056989A (en) Task designing method
Marinho et al. Job phasing aware preemption deferral
KR20090116184A (en) Data processing device and method for controlling the operating period thereof
JP7263746B2 (en) Information processing equipment
JP3027526B2 (en) Job scheduling method
JP2004070579A (en) Task scheduling device, task scheduling method and program
KR101211817B1 (en) Apparatus and method for scheduling task period
JP2002366373A (en) Method and device for task scheduling
JP2007323256A (en) Interruption control method and information processor
JP2011232937A (en) Interruption control device and interruption control method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050113

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061107

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061208

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20070116

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070129

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20110216

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120216

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130216

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20140216

Year of fee payment: 7

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees