JP2010134494A - Program conversion device, conversion method, program control method and program - Google Patents
Program conversion device, conversion method, program control method and program Download PDFInfo
- Publication number
- JP2010134494A JP2010134494A JP2008306958A JP2008306958A JP2010134494A JP 2010134494 A JP2010134494 A JP 2010134494A JP 2008306958 A JP2008306958 A JP 2008306958A JP 2008306958 A JP2008306958 A JP 2008306958A JP 2010134494 A JP2010134494 A JP 2010134494A
- Authority
- JP
- Japan
- Prior art keywords
- program
- resource
- section
- task
- measurement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
本発明は、プリエンプティブなマルチタスクOSで実行されるプログラムに係り、プログラムの指定した区間に対してCPU資源(利用率)を確保する形に、プログラムを変換するプログラム変換装置、方法及び記録媒体に関するものである。 The present invention relates to a program executed by a preemptive multitasking OS, and relates to a program conversion apparatus, method, and recording medium for converting a program so as to ensure CPU resources (utilization rate) for a specified section of the program. Is.
時間的制約を持ったリアルタイム処理は、試行錯誤を経て綿密な微調整が施された形でハードコーディングされる事が多いため、その多くは最終的に性能要求や実装意図の読み取れない職人芸的プログラムになってしまう。可読性の悪い職人芸的プログラムは、バグ対応や性能チューニング等の保守作業において、プログラマに多大な労力を費やさせ、ソフトウェアの生産性・品質を低下させてしまう。Linux のようなプリエンプティブなマルチタスク機能をサポートするOSではより深刻であり、タスクスケジューリングを最適化しながら各タスクのリアルタイム性を満たさなければならない。そもそも、タイムシェアリング用のOSでは、構造自体が時間的制約を満たしにくい事も指摘されている。 Since real-time processing with time constraints is often hard-coded with careful fine tuning after trial and error, many of them are craftsmanship that ultimately cannot read performance requirements and implementation intentions. It becomes a program. A craftsmanship program with poor readability causes programmers to spend a great deal of labor in maintenance work such as bug handling and performance tuning, and lowers the productivity and quality of software. OSs that support preemptive multitasking functions such as Linux are more serious and must meet the real-time nature of each task while optimizing task scheduling. In the first place, it has been pointed out that the structure itself does not satisfy time constraints in the OS for time sharing.
また、リアルタイム性が特に重要である組み込みシステムにおいても、近年、ますます時間的制約の保障が困難になってきている。従来、組み込み向けのリアルタイムOSを適用したシステムでは、システム内のタスクが予め固定されている事が多かった。そのため、熟練者が注意深く各タスクの時間的制約が満たされる優先関係を設定し、優先度ベーススケジューリングを用いて、制約の違反を避けることができた。優先度ベーススケジューリングでは、実行可能となった上位優先度タスクが下位優先度タスクの実行を即座に中断できるアルゴリズムである。 Even in an embedded system in which real-time performance is particularly important, it is becoming increasingly difficult to guarantee time constraints in recent years. Conventionally, in a system to which an embedded real-time OS is applied, tasks in the system are often fixed in advance. For this reason, skilled workers carefully set priority relationships that satisfy the time constraints of each task, and used priority-based scheduling to avoid constraint violations. In priority-based scheduling, an upper priority task that can be executed is an algorithm that can immediately interrupt the execution of the lower priority task.
しかしながら、最近では、組み込みシステムとはいえ、デジタル化、ネットワーク化によって、開放型システムになりつつあり加速度的に高機能化が進んでいる。そのようなシステム上では、動作するアプリケーションの種類や挙動を予め把握する事は非常に困難となる。 However, recently, although it is an embedded system, it is becoming an open system due to digitalization and networking, and its functionality is increasing at an accelerated speed. On such a system, it is very difficult to grasp in advance the type and behavior of an application that operates.
そこで、近年、資源予約型システムが提案されている。資源予約型システムでは、明示的に設定されたプロセッサの実行時間を確実にタスクへ割り当てる事で、必要な処理量を確保し、時間的制約を有するタスクを満足させる事ができる。 Therefore, in recent years, a resource reservation type system has been proposed. In the resource reservation type system, by assigning the execution time of the explicitly set processor to the task with certainty, it is possible to secure the necessary processing amount and satisfy the task having time constraints.
非特許文献1で報告された Resource Kernel では、周期とその周期のうちで割り当てるべき計算時間を明示して予約を行い、その予約に応じてプロセッサを割り当てることにより、デッドラインまでに処理が終了することを保障する。特許文献1では、時間的制約を満たしたプロセス群の優先度組み合わせを記録し、その順序通りにタスクスケジュールを再現する手法が述べられている。
In the Resource Kernel reported in
しかしながら、これらの方法では、Linuxプロセスに対してCPU資源を予約するため、きめ細やかに資源を割り当てる事が難しい。プロセス単位の粗粒度な制御では、一部区間のCPU資源を予約するために、当該処理をプロセスへと再分割する必要が出てきてしまう。 However, with these methods, it is difficult to allocate resources in detail because CPU resources are reserved for Linux processes. In coarse-grained control in process units, it is necessary to subdivide the processing into processes in order to reserve CPU resources in a partial section.
特許文献2では、時間的制約を満たすように自動的に指定された処理のプログラムを並列化する方法が述べられている。しかし、当然ながら、適用対象が並列化によって性能向上が見込まれるプログラムに限定される。
したがって、十分な並列度の内在しない又は効果の少ないプログラムでは、実行時間を大きく制御できない。さらに、Resource Kernel のようなカーネルの改変を要求するシステムの場合、システムのプラットフォーム依存度が強くなるため移植性が損なわれてしまう。 Therefore, the execution time cannot be largely controlled in a program that does not have sufficient parallelism or has little effect. Furthermore, in the case of a system that requires modification of the kernel such as Resource Kernel, portability is impaired because the platform dependency of the system becomes strong.
非特許文献2では、特別なプラットフォームを用意せず、プログラム変換器によって、特定スレッドの時間的制約の違反を回避する QoSWeaver が提案されている。QoSWeaver は、特に J2EE アプリケーションサーバにおいて、オーバーロード時、過度にCPU 資源を占有するスレッドのプログラムに対して、静的に適度なプリエンプションコードを挿入する。しかし、このような間接的に特定のスレッドへの影響を抑えるアプローチでは、一部区間の時間的制約を満たすために、不要に多くの CPU 処理時間を与えてしまう場合が出てくるため精度がよくない。
Non-Patent
上記の資源予約技術は、プロセスやスレッドという粒度に捉われず、任意の処理単位で計算資源を保障する事が困難だった。一方、プログラムの並列化技術は、並列度の無い処理を分割する事ができないため、処理時間の調整を施せない。 The resource reservation technology described above is not limited by the granularity of processes and threads, and it has been difficult to guarantee computing resources in an arbitrary processing unit. On the other hand, the program parallelization technique cannot divide processes without parallelism, and therefore cannot adjust the processing time.
また、時間制約を満たすためのプログラム変換技術では、挿入される静的なクリティカルセクションやリリースセクションが、実行時の非決定的動作に追従できない事がある。 In addition, in the program conversion technique for satisfying the time constraint, the inserted static critical section or release section may not follow the non-deterministic operation at the time of execution.
本発明は、上記課題を解決し、プリエンプティブなマルチタスクOSにおいて、プログラムの資源要求を保証することができ、かつそのようなプログラムを自動生成するプログラム変換装置を提供することを目的とする。 An object of the present invention is to solve the above-described problems and to provide a program conversion apparatus that can guarantee a resource requirement of a program in a preemptive multitasking OS and that automatically generates such a program.
上記目的を達成するために、本発明は、プログラムソースに対して、資源要求の対象区間に、資源利用率を計測しながら実行優先度の上下や資源解放を行う資源制御ルーチンを適切な間隔で挿入し、それとは別に対象区間の中断時間を計測する資源測定ルーチンを他タスクのメインループ前後へ挿入することによって、所定の資源要求を保ちながら処理を完遂することを保障するものである。中断時間とは、対象区間を実行するタスクが、上位優先度タスクによって割り込まれる時間を指す。生成された資源予約プログラムは、要求区間では、上位優先度タスクの実行時間と自タスクの実行時間を比較し、指定の資源利用率を守るように実行優先度を上下させる。資源利用率が目標よりも下回ると、自タスクの優先度を上昇させ、逆に上回ると超過分の資源を解放する。また、対象区間の実行が終わると、自タスクの優先度を元に下降させる。 In order to achieve the above object, the present invention provides a resource control routine for increasing and decreasing the execution priority and releasing resources while measuring the resource utilization rate in the target section of the resource request with respect to the program source. In addition, by inserting a resource measurement routine for measuring the interruption time of the target section before and after the main loop of another task, it is ensured that the processing is completed while maintaining a predetermined resource request. The interruption time refers to the time during which the task executing the target section is interrupted by the higher priority task. In the request section, the generated resource reservation program compares the execution time of the higher priority task with the execution time of its own task, and raises or lowers the execution priority so as to protect the specified resource utilization rate. When the resource utilization rate falls below the target, the priority of the invoking task is increased, and when it exceeds the resource utilization rate, the excess resources are released. When the execution of the target section is completed, the task is lowered based on the priority of the invoking task.
また、本発明によるプログラム変換装置は、複数のタスクを同時に処理するプリエンプティブなマルチタスクOSにおいて、CPU利用率で示された所定の資源要求を持つ処理に対し、前記資源要求を満たしつつ処理を完遂することを保証させるプログラム変換装置であって、プログラムソース外に記述された資源要求を表す資源要求コードとその要求区間を表す要求区間コードを取得する資源要求及び要求区間コード取得部と、資源要求を満たすように資源制御ルーチンが挿入された資源予約プログラムを生成する資源予約プログラム生成部と、各タスクの資源利用量を測定するための資源測定コードが挿入された資源測定プログラムを生成する資源測定プログラム生成部、とを備えたものである。 The program conversion apparatus according to the present invention, in a preemptive multitasking OS that processes a plurality of tasks at the same time, completes the processing while satisfying the resource request with respect to a process having a predetermined resource request indicated by the CPU utilization rate. A resource conversion and request section code acquisition unit for acquiring a resource request code indicating a resource request described outside the program source and a request section code indicating the request section, and a resource request A resource reservation program generation unit that generates a resource reservation program in which a resource control routine is inserted so as to satisfy the condition, and a resource measurement that generates a resource measurement program in which a resource measurement code for measuring the resource usage of each task is inserted And a program generation unit.
本発明によれば、プリエンプティブなマルチタスクOSにおいて、プログラムの任意の指定区間を処理する際、実行時のCPU利用率に応じて、適切な処理群を高優先度で実行しつつ適度に資源解放を行う事で、資源要求を保証することができ、かつそのようなプログラムを自動生成することできるので、プログラムの品質向上をおこなうことができるとともに、プログラムの生産性を向上することもできる。 According to the present invention, when processing an arbitrary designated section of a program in a preemptive multitasking OS, appropriate resources are appropriately released while executing an appropriate processing group with high priority according to the CPU usage rate at the time of execution. By performing the above, it is possible to guarantee the resource requirement and to automatically generate such a program, so that the quality of the program can be improved and the productivity of the program can be improved.
以下、本発明を図面に示した具体的な実施の形態に沿って説明するが、本発明は、後述する実施の形態に限定されるものではない。 Hereinafter, the present invention will be described along specific embodiments shown in the drawings, but the present invention is not limited to the embodiments described below.
図1は、本発明のプログラム変換装置を組み込んだプログラム開発システムの実施例を示した図である。図1には、リモートコントローラ20と、デジタル放送アンテナ30と、表示装置40と、本発明のプログラム変換装置50と、デジタル放送受信機60とからなるシステム10が示されている。
FIG. 1 is a diagram showing an embodiment of a program development system incorporating the program conversion apparatus of the present invention. FIG. 1 shows a
デジタル放送受信機60には、変換プログラムが格納される記憶装置61と、プロセッサ62、リモートコントローラ20からの信号を受信する信号受信部63、デジタル放送アンテナ30を介して映像データ、音声データ及び字幕データを受信するデジタル放送チューナー64とデジタル放送受信機ソフトウェア65が搭載され、さらに各種資源の管理及びアプリケーションがそれら資源を利用できるようにするためのOS及びアプリケーションが格納されている。
The
デジタル放送受信機ソフトウェア65は、リモートコントローラタスク651と、チューナータスク652と、描画タスク653と、電子番組ガイドタスク654及びデータ放送ブラウザタスク655を備えている。
The digital
図1に示す実施の形態では、デジタル放送受信機ソフトウェア65はプログラム変換装置50により、資源予約プログラムへ変換され記憶装置61へ格納される。記憶装置61へ格納された資源予約プログラムは、プロセッサ62によりデジタル放送受信機65のOSへ読み込まれ、実行される。プロセッサ62は、リモートコントローラ20使用したユーザ操作に対するリモートコントローラタスク651による受信処理とその適切な応答処理を行っている。
In the embodiment shown in FIG. 1, the digital
例えば、選局に伴うチューナータスク652による放送局を切り替え、電子番組ガイド視聴に伴う電子番組ガイドタスク654による電子番組ガイド取得及び複合化、データ放送視聴に伴うデータ放送ブラウズタスク655によるデータ放送コンテンツ取得及び複合化を行い、変更された映像を描画タスク653が合成して表示装置40に出力している。
For example, the broadcasting station is switched by the
リモートコントローラタスク651による受信処理は、確実に行わなければならず、常にプロセッサ62によって稼動させられなければならない。しかし、同時に電子番組ガイドタスク654による電子番組ガイドの取得及び複合化、データ放送ブラウズタスク655によるデータ放送コンテンツの取得及び複合化においても、ユーザ操作に連動した処理の場合は、一定の時間内に処理を完遂させたいという要求がある。しかしながら、これらの応答処理は、平時においては状態変化の通知等の重要で無い処理を行うため、従来は低い優先度で稼動するものとされていた。
Reception processing by the
デジタル放送受信機ソフトウェア65の動作は、優先度ベーススケジューリングアルゴリズムに基づくため、優先度の高いタスクは低いタスクを優先し、場合によっては中断させて処理される。したがって、例えば、いざ電子番組ガイド及びデータ放送コンテンツを視聴したい場合でも、プロセッサ62は、高優先度で稼動するリモートコントローラタスク651や、チューナータスク652及び描画タスク653に処理時間を優先して与えている。
Since the operation of the digital
そうなると、一時的に時間的制約を持つ電子番組ガイドタスク654及びデータ放送ブラウザタスク655には、十分な処理時間が確保されにくかった。なぜなら、優先度ベーススケジューリングでは、優先度の低いタスクは高いタスクの処理を中断しないため、高優先度で稼動するリモートコントローラタスク651や、チューナータスク652及び描画タスク653の処理が完了して実行待ち状態へ遷移するまで、電子番組ガイドタスク654やデータ放送ブラウザタスク655は処理を待たされる事になるからである。
As a result, it has been difficult to secure sufficient processing time for the electronic
つぎに、本発明のプログラム変換の概要について説明する。本発明のプログラム変換装置は、特定の処理区間に対し、CPU利用率要求が保証されるだけの計算資源が与えられるように、プログラムを変換するシステム、言い換えればプログラム変換時の資源予約システムである。ここでは、CPUによる処理時間を計算資源とする。変換されたプログラムは、資源要求の無い区間では静的に設定された実行優先度に基づく計算資源がOSスケジューラにより与えられるが、資源要求のある区間では、OSスケジューラに依らず、制約を満たすのに十分な計算資源が与えられる。 Next, an outline of program conversion according to the present invention will be described. The program conversion apparatus of the present invention is a system for converting a program so that a calculation resource sufficient to guarantee a CPU utilization rate is given to a specific processing section, in other words, a resource reservation system at the time of program conversion. . Here, the processing time by the CPU is a computing resource. In the section where there is no resource request, the converted program is given a calculation resource based on the statically set execution priority by the OS scheduler. However, in the section where there is a resource request, it satisfies the constraints regardless of the OS scheduler. Sufficient computing resources are provided.
具体的には、プログラム変換装置は、資源要求のある区間に、適切な処理単位で資源制御ルーチンを挿入する。資源制御ルーチンは、資源利用率が資源要求を下回れば実行優先度を上げ、上回れば超過分の資源を解放し、要求区間の実行が終わると実行優先度を元に戻すような制御を実施する。 Specifically, the program conversion apparatus inserts a resource control routine in an appropriate processing unit in a section where a resource request is made. The resource control routine increases the execution priority when the resource utilization rate falls below the resource request, releases the excess resources when the resource utilization rate exceeds the resource request, and executes control to restore the execution priority when the requested section is completed. .
資源制御ルーチンの挿入間隔は、関数呼び出し単位、ステートメント単位、ブロック単位、行単位等、任意の粒度で設定してもよい。ステートメントとは、プログラムの一文を表し、C言語やJava(登録商標)言語等の多くの高水準言語ではセミコロンで区切られる。一方、プログラム変換装置は、各タスクの周期実行のメインルーチン前後に資源測定ルーチンを挿入し、要求区間処理中に他タスクが割り込む時間、すなわち自タスクの中断時間を求める。 The insertion interval of the resource control routine may be set at an arbitrary granularity such as a function call unit, a statement unit, a block unit, or a line unit. A statement represents a sentence of a program and is separated by a semicolon in many high-level languages such as C language and Java (registered trademark) language. On the other hand, the program conversion apparatus inserts a resource measurement routine before and after the main routine of the periodic execution of each task, and obtains the time during which another task interrupts during the requested section processing, that is, the suspension time of its own task.
一般に、優先度に基づくタスクスケジューリングを行うOSでは、実行優先度の高いタスクは、低いタスクの処理を中断し割り込んで処理できる。したがって、資源測定ルーチンが計測するタスクの処理時間のうち、要求区間を処理するタスクよりも高優先度タスクの処理時間の合算が、要求区間での処理中断時間になる。 In general, in an OS that performs task scheduling based on priority, a task with a high execution priority can be processed by interrupting and interrupting the processing of a low task. Therefore, among the task processing times measured by the resource measurement routine, the sum of the processing times of the higher priority tasks than the task processing the request interval is the processing interruption time in the request interval.
こうして、資源制御ルーチンは、経過時間と処理中断時間の差分から、自タスクの実際の処理時間を求め、資源利用率を算出する。ただし、資源測定ルーチンは、周期的に処理されるタスクにのみ挿入され、外部割り込みのハンドリング処理による中断時間は考慮しない。 Thus, the resource control routine calculates the resource utilization rate by obtaining the actual processing time of the invoking task from the difference between the elapsed time and the processing interruption time. However, the resource measurement routine is inserted only in a periodically processed task, and does not consider the interruption time due to external interrupt handling processing.
より具体的に図1を参照して説明すると、ユーザがデータ放送視聴用のリモートコントローラ信号を送信すると、その信号に応答して、プロセッサ62で実行されているOSは、リモートコントローラタスク651をディスパッチする。次に、データ放送ブラウザタスク655がディスパッチされ、データ放送コンテンツの取得及び複合化処理が実行される。
More specifically, referring to FIG. 1, when a user transmits a remote controller signal for viewing data broadcasting, in response to the signal, the OS executed in the
本発明のプログラム変換システムは、図2のように、プログラムソース51及び資源資源要求コード及び要求区間コード52から、要求区間中に適切な間隔で資源制御ルーチン55を挿入し、各タスクのメインルーチンの前後に資源測定ルーチン56を挿入した、資源予約プログラムソース53及び資源測定プログラムソース54を出力する。こうして、本発明のプログラム変換システムで資源予約プログラムへ変換されたデータ放送ブラウザタスク655は、設定された資源要求を指標に、実行優先度の上下や資源解放を行う。
As shown in FIG. 2, the program conversion system of the present invention inserts a
図3では、資源予約プログラムの挙動を、プログラムステップにおける資源要求区間での実行優先度とCPU利用率の変化として模式的に示している。資源要求60%要求区間では、プログラムを実行するタスクの実行優先度は最大値まで上昇させられる。CPU利用率が要求値60%を超えると、実行優先度は最大値を保ちつつ、超過した資源が解放される。ここで、CPU利用率及び超過利用分の解放時間は、要求区間における累積処理時間を基に算出される。要求区間の処理が終わると、プログラムを実行するタスクの実行優先度は、初期優先度まで下降させられる。
In FIG. 3, the behavior of the resource reservation program is schematically shown as a change in execution priority and CPU utilization rate in the resource request section in the program step. In the
図4には、資源予約プログラムソース53と資源測定プログラムソース54の一つの例を示す。本発明のプログラム変換装置によって、資源測定ルーチンは、プログラマが指定したタスクグループの中で、資源要求区間を処理するタスクよりも高優先度なタスクに挿入される。具体的には、資源要求区間を処理するタスクの優先度が50で、タスクグループを20,30,40の優先度を持つタスク群とするとき、優先度20,30,40のタスク処理時間、すなわちメインループのタスクコード処理にかかる時間を測定するコードが挿入される。
FIG. 4 shows an example of the resource
また、資源制御ルーチンは、資源要求区間内のソースコードに対して適度な間隔で挿入される。具体的には、要求区間入口での優先度上昇、要求区間出口での優先度下降、要求区間内での処理時間測定と資源解放、のためのコードが挿入される。ただし、それぞれのコードは、タスクグループ内でのCPU利用率と資源要求を比較した結果、実行するか否かが判定される。また、算出したCPU利用率を基に、資源解放時間も求められる。 The resource control routine is inserted at an appropriate interval with respect to the source code in the resource request section. Specifically, codes for increasing the priority at the request section entrance, decreasing the priority at the request section exit, and measuring the processing time and releasing resources in the request section are inserted. However, it is determined whether each code is executed as a result of comparing the CPU usage rate and the resource request in the task group. The resource release time is also obtained based on the calculated CPU usage rate.
図5は、本発明のプログラム変換装置の機能を表すブロック図である。本発明のプログラム変換装置50は、複数のプロセスを同時に処理するプリエンプティブなマルチタスクOSにおいて、所定のCPU利用率を用いた資源要求を持つ処理に対し、前記資源要求を保ちながら処理を完遂することを保証させるプログラム変換装置であって、プログラムソース外に記述された資源要求を表す資源要求コードとその要求区間を表す要求区間コードを取得する資源要求及び要求区間コード取得部501と、資源要求を満たすように資源制御ルーチンが挿入された資源予約プログラムを生成する資源予約プログラム生成部502と、各タスクの資源利用量を測定するための資源測定ルーチンが挿入された資源測定プログラムを生成する資源生成プログラム生成部503とを備えたものである。
図6、図7には、それぞれ資源予約プログラム生成部502と資源測定プログラム生成部503の詳細を表すブロック図を示す。
FIG. 5 is a block diagram showing the function of the program conversion apparatus of the present invention. The
6 and 7 are block diagrams showing details of the resource reservation
資源予約プログラム生成部502は、プログラムソース51を読み込んで解析し、資源要求コード及び要求区間コード52で表された区間を特定する要求区間特定部5021と、要求区間中で資源制御ルーチンを挿入する位置及び粒度を決定する資源制御ルーチン位置解決部5022と、決定した位置で資源利用率を測定し、優先度を増加・減少の一方へと切り替える資源制御ルーチンを挿入する資源制御ルーチン挿入変換部5023とを備える。
The resource reservation
また、資源測定プログラム生成部503は、プログラムソース51を読み込んで解析し、資源の測定区間を特定する測定区間特定部5031と、測定区間に対して資源測定ルーチンを挿入する位置を決定する資源測定ルーチン位置解決部5032と、決定した位置で資源利用量、すなわち処理時間を測定する資源測定ルーチンを挿入する資源測定ルーチン挿入変換部5033とを備える。
In addition, the resource measurement
図8に、入力として与えられる資源要求及び要求区間コード52のうち、資源要求コード521の記述例を、図9に要求区間コード522の記述例を示し説明する。資源要求コード521は、例えばObject Constraint Language(OCL)で記述され、要求区間コード522は、AspectJ言語で記述されている。ただし、本発明では、資源要求及び要求区間コード52、さらには入力されるプログラムソース51、出力される資源予約プログラムソース53及び資源測定プログラムソース54の言語や文法を規定するものでない。
FIG. 8 illustrates a description example of the
資源要求コード521には、資源要求としてCPU利用率、実行優先度の範囲(CPU利用率を算出するタスクグループ)、資源制御ルーチンの挿入間隔、資源測定ルーチンの挿入箇所等と、要求区間を記述できる。図8の記述例では、BML-policyという名前の資源要求コードテンプレート(521a)を用いて、CPU利用率を表すパラメータutilizationに対して60%以上であるという資源要求(521b)を、実行優先度の範囲を表すパラメータpriorityRangeに対して上限が20、下限が50であるという指定(521c)を、資源制御ルーチンの挿入間隔を表すパラメータsampling-intervalに対して、関数呼び出し単位での挿入を表すcallという指定(521d)を記述している。
In the
資源制御ルーチンの挿入間隔は、関数呼び出し単位だけでなく、プログラム行、プログラムの基本ブロック、経過時間等、様々な単位を指定できる。また、資源測定ルーチンの挿入箇所を表すパラメータsamplingに対しては、名前がevnt、又はgui、tuneであり、戻り値がint型である関数群の指定(521e)を記述している。資源測定ルーチンの挿入箇所は、関数だけでなく、プログラム中の任意の箇所を指定できる。 As the insertion interval of the resource control routine, various units such as a program line, a basic block of a program, and an elapsed time can be designated as well as a function call unit. In addition, for the parameter sampling indicating the insertion location of the resource measurement routine, a function group specification (521e) whose name is evnt, gui, tune, and whose return value is an int type is described. The resource measurement routine can be inserted not only at a function but also at any point in the program.
一方、要求区間コード522には、プログラム中の区間を指定するためのポイントカット表現が記述できる。ポイントカット表現とは、多くのアスペクト指向言語でサポートされる、プログラム中の位置を特定するための表現形式である。
On the other hand, the
図9の記述例では、QoSContractという名前の要求区間コードテンプレート(522a)を宣言し、BML-policyという名前の資源要求コードに対する要求区間である事を明示し(522b)、ポイントカット表現として名前がupdateで戻り値の無い関数呼び出しの中で、名前がsend_commandである関数呼び出し以外の区間を指定している(522c)。つまり、関数 send_comand()の呼び出しを除いた、関数update()のコールフロー全体を要求区間に指定している。ポイントカット表現522cでは、関数呼び出しだけでなく、プログラム行番号や変数アクセス等、プログラム中の任意の位置を指定できる。
In the description example of FIG. 9, a request section code template (522a) named QoSContract is declared, clearly indicates that it is a request section for a resource request code named BML-policy (522b), and the name is expressed as a pointcut expression. In a function call with no return value in update, a section other than the function call whose name is send_command is specified (522c). That is, the entire call flow of the function update () is specified as the request section, except for the function send_comand (). In the
資源要求及び要求区間コード取得部501は、図10に示す処理フローにしたがって、資源要求及び要求区間コード52を字句解析し、資源要求及び要求区間を取得し、図11に示す構造で資源要求及び要求区間の情報を保持する。
The resource request and request section
図10では、まず有効な要求区間コードがあるかどうかを調べ(5010)、もしあれば要求区間コードを取得し記憶する(5011)。次に、記憶した要求区間に対応する有効な資源要求コードがあるかどうかを調べ(5012)、もしあれば資源要求コードを取得し記憶する(5013)。 In FIG. 10, first, it is checked whether there is a valid request section code (5010), and if there is, the request section code is acquired and stored (5011). Next, it is checked whether there is a valid resource request code corresponding to the stored request section (5012), and if there is, the resource request code is acquired and stored (5013).
資源要求コードは、図11に示すような構造で、定義された資源要求の識別子(名前)5210、CPU利用率5211、実行優先度の範囲5212、資源制御の間隔5213、資源測定の位置5214が保持される。
The resource request code has a structure as shown in FIG. 11, and includes a defined resource request identifier (name) 5210, a
要求区間コードは、図12に示すような構造で、定義された要求区間の識別子(名前)5220、対応する資源要求の識別子(名前)5221、要求区間を表すポイントカット表現5222が保持される。図10に示される資源要求及び要求区間取得処理は、有効なコードをすべて記録するまで繰り返される。
The request section code has a structure as shown in FIG. 12, and holds a defined request section identifier (name) 5220, a corresponding resource request identifier (name) 5221, and a
資源予約プログラム生成部502において、要求区間特定部5021は、図13に示す処理フローにしたがって、要求区間コード522を取得し、図14に示すような構造で要求区間のプログラム中の位置を保持する。
In the resource reservation
図13では、まず要求区間特定部5021は、プログラムを読み込み(50210)、要求区間コードを読み込む(50211)。もしプログラム中に、有効な要求区間があれば(50212)、要求区間コードのポイントカット表現で示される位置を探索する(50213)。そして、もし要求区間コードのポイントカット表現で示される位置の始点があり(50214)、終点もあるならば(50215)、そのプログラム位置を記憶する(50216)。
In FIG. 13, first, the requested
プログラム位置は、図14に示すような構造で、対応する要求区間名510、始点511のファイル名512と行番号513、終点514のファイル名515と行番号516が保持される。図13に示される要求区間特定部処理は、要求区間コードのポイントカット表現で示される位置をすべて記憶するまで繰り返され、さらにすべての有効な要求区間コードに対して繰り返される。
The program position has a structure as shown in FIG. 14 and holds the corresponding
資源予約プログラム生成部502において、資源制御ルーチン挿入変換部5023は、図17に示す処理フローにしたがって、プログラムソース51を読み込み、資源制御ルーチン位置解決部5022で決定した資源制御ルーチンの挿入位置に対して、資源制御ルーチンを挿入するプログラム変換を行う。
In the resource reservation
図17では、まず資源制御ルーチン挿入変換部5023は、プログラムソース51を読み込み(50230)、字句解析、構文解析を行い、要求区間特定部5021で特定された要求区間内の全てのステートメントを記憶する(50231)。そして、要求区間内の全てのステートメントに対して、資源制御ルーチン位置解決部5022で決定された資源制御位置かどうかをチェックする(50232)。もし、資源制御位置であれば(50233)、当該ステートメント直前に資源制御ルーチンを挿入し(50234)、資源予約プログラムソースとしてファイルに書き出す(50235)。資源制御位置でなければ、そのステートメントはそのまま資源予約プログラムソースのファイルに書き出す。
In FIG. 17, first, the resource control routine
資源予約プログラム生成部502において、資源制御ルーチン位置解決部5022は、図15に示す処理フローにしたがって、プログラムソース51を読み込み、要求区間特定部5021で記憶された始点から終点の範囲で、資源制御ルーチンを挿入する位置を決定し、そのプログラム位置を図16に示すような構造で保持する。
In the resource reservation
図15では、まず資源制御ルーチン位置解決部5022は、プログラムを読み込み(50220)、記憶されている要求区間の始点と終点を読み込む(50221)。もし始点と終点の位置がプログラム中で有効なれば(50222)、記憶されている資源制御間隔を読み込む(50223)。そして、プログラムの要求区間である始点から終点までの、制御フローにおいて、資源制御間隔毎にプログラム位置を記憶する(50224)。
In FIG. 15, first, the resource control routine
資源制御間隔は、関数呼び出し単位やプログラム行等を単位とする。プログラム位置は、図16に示すような構造で、対応するファイル名517と行番号518が保持される。図15に示される資源制御ルーチン位置解決部処理は、要求区間内のプログラムにおいて、指定された資源制御間隔で特定されるプログラム位置を全て記憶するまで繰り返される。
The resource control interval is in units of function calls or program lines. The program position has a structure as shown in FIG. 16, and a
図18に、ステップ50234において、資源制御ルーチン挿入変換部5023によって挿入される資源制御ルーチン55の処理フローの一つの例を示す。資源制御ルーチン55は、まず実行中のタスクが既に優先度を上限まで引き上げた状態、つまりブースト状態にあるかどうかを調べる(551)。優先度ブースト中で無い場合は、要求区間の始点からの経過時間を取得し(552)、要求区間における総中断時間、つまり上位優先度タスクの総処理時間を取得する(553)。
FIG. 18 shows an example of the processing flow of the
次に、得られた経過時間と総中断時間から、要求区間における資源利用率を算出する(554)。そして、資源制御ルーチンは、資源要求と資源利用率を比較し(555)、資源要求が満たされていなければ優先度ブーストを行う(556)。ステップ556における優先度ブーストは、多くのOSで提供されている優先度変更関数を利用する。例えば、Linuxでは、nice()やsetpriority()システムコールによって実行優先度の相対値や絶対値を設定でき、ITRON系OSでは、chg_pri()サービスコールによって設定できる。
Next, the resource utilization rate in the requested section is calculated from the obtained elapsed time and total interruption time (554). Then, the resource control routine compares the resource request with the resource utilization rate (555), and if the resource request is not satisfied, boosts the priority (556). The priority boost in
一方、資源要求を超える資源量を利用していた場合は、超過した資源利用量から超過時間を算出し(557)、超過時間分だけ資源を解放する(558)。ステップ558における、資源解放についても、多くのOSで提供されているCPU資源解放関数を利用する。例えば、Linuxでは、sleep()システムコール、ITRON系OSでは、tsk_slp()サービスコールによって指定時間だけ、CPU資源を解放することができる。
On the other hand, if the resource amount exceeding the resource request is used, the excess time is calculated from the excess resource usage amount (557), and the resource is released by the excess time (558). As for the resource release in
図19に、資源制御ルーチン挿入変換部5023によって、資源制御ルーチンが挿入された資源予約プログラムソースの1つの例を示す。図19では、プログラムソース5101において、5102の要求区間が2〜9行目と決定されており、資源要求としてCPU利用率、優先度の範囲、資源測定位置が与えられ、資源制御間隔は行単位とされているものとする。
FIG. 19 shows an example of the resource reservation program source into which the resource control routine is inserted by the resource control routine
本発明のプログラム変換装置50によって、資源予約プログラムソース5301には、資源制御ルーチンとして、resource-control()関数5302がプログラムソース5101の2〜9行目に行単位で挿入されている。resource-control()関数は、図18に示す処理フローにしたがって、2〜9行目の処理について、資源要求を満たすように、実行優先度の増加や資源解放を行う。
By the
また、図19のプログラムソース5101及び資源予約プログラムソース5301では、要求区間5102及び資源制御ルーチンの挿入箇所はプログラムの静的な位置として示されているが、関数呼び出しやジャンプ等を考慮した動的な制御フローに対して要求区間を設定し、資源制御ルーチンを挿入することもできる。
Further, in the
資源測定プログラム生成部503において、測定タスク特定部5031は、図20に示す処理フローにしたがって、資源要求コード521から測定対象タスクを特定し、その優先度リストを保持する。
In the resource measurement
図20では、まず測定タスク特定部5031は、プログラムを読み込み(50310)、資源要求コードを読み込む(50311)。有効な資源要求コードがあれば(50312)、資源要求コードの優先度範囲を取得し(50313)、その範囲内の優先度を持つタスクがあるか否かを判定する(50314)。図20に示される測定タスク特定部処理は、優先度範囲内のすべての優先度について繰り返され、さらにすべての有効な資源要求コードに対して繰り返される。
In FIG. 20, first, the measurement
資源測定プログラム生成部503において、資源測定ルーチン位置解決部5032は、図21に示す処理フローにしたがって、プログラムソース51を読み込み、測定タスク特定部5031で記憶された優先度を持つタスクの、メインループ始点と終点の位置を解決し、そのプログラム位置を図14と同様の構造で保持する。
In the resource measurement
図21では、まず資源測定ルーチン位置解決部5032は、プログラムを読み込み(50320)、記憶されている測定タスクの優先度を読み込む(50321)。そして、読み込んだ優先度が有効であれば(50322)、プログラム中から、その優先度が設定される測定タスクのメインループを探索する(50323)。そして、メインループの始点と終点の位置を記憶する(50324)。
In FIG. 21, first, the resource measurement routine
図21に示される資源測定ルーチン位置解決部処理は、記憶された全ての測定タスクのメインループ始点と終点を記憶するまで繰り返される。タスクのメインループは、外部設定ファイルにて宣言されている場合があるため、資源測定ルーチン位置解決部処理は、測定タスクのメインループを探索する前に外部設定ファイルから情報を取得しても良い。 The resource measurement routine position resolution process shown in FIG. 21 is repeated until the main loop start point and end point of all stored measurement tasks are stored. Since the task main loop may be declared in the external setting file, the resource measurement routine position resolution processing may obtain information from the external setting file before searching the main loop of the measurement task. .
資源測定プログラム生成部503において、資源測定ルーチン挿入変換部5033は、図22に示す処理フローにしたがって、プログラムソース51を読み込み、資源測定ルーチン位置解決部5032で決定した資源測定ルーチンの挿入位置に対して、資源測定ルーチンを挿入するプログラム変換を行う。
In the resource measurement
図22では、まず資源測定ルーチン挿入変換部5033は、プログラムソース51を読み込み(50330)、全タスクのメインループを特定して記憶する(50331)。次に、記憶したメインループが、資源測定ルーチン位置解決部で決定された測定対象かどうかをチェックする(50332)。もし、測定対象のメインループであれば(50333)、その始点直後と終点直後に資源制御ルーチンを挿入し(50334)、資源測定プログラムソースとしてファイルに書き出す(50335)。
In FIG. 22, first, the resource measurement routine
図23に、ステップ50334において、資源測定ルーチン挿入変換部5033によって挿入される資源測定ルーチン56の処理フローの一つの例を示す。資源測定ルーチン56は、まず資源要求区間を処理するタスクが優先度ブースト状態にあるかどうかを調べる(561)。優先度ブースト状態にあって、下位優先度でも自タスクでもまだ処理時間測定を開始してないならば測定を開始し(565)、測定中ならば測定を終了して(566)処理時間を累積処理時間へ加算する(567)。優先度ブースト状態でなければ累積処理時間を0にリセットする(562)。
FIG. 23 shows an example of the processing flow of the
ここで、上位優先度タスクは下位優先度タスクの処理を中断するため、下位優先度タスクで測定される処理時間にはその中断時間も含まれる。したがって、すでに下位優先度タスクで処理時間を測定中であれば、上位優先度タスクの資源測定ルーチンでは測定は行われない。ステップ565と566における測定開始及び終了は、多くのOSで提供されている時刻取得関数を利用する。例えば、Linuxでは、gettimeofday()システムコールによって絶対時間の取得ができ、ITRON系OSでも、get_tim()サービスコールによって取得できる。したがって、処理時間は測定終了時と開始時の時刻との差分で求められる。
Here, since the upper priority task interrupts the processing of the lower priority task, the processing time measured by the lower priority task includes the interruption time. Therefore, if the processing time is already being measured in the lower priority task, the measurement is not performed in the resource measurement routine of the upper priority task. The measurement start and end in
図24に、資源測定ルーチン挿入変換部5033によって、資源測定ルーチンが挿入された資源測定プログラムソースの1つの例を示す。図24では、プログラムソース5103において、5104のメインループが2〜9行目と確定されており、資源要求として優先度の範囲が与えられているものとする。本発明のプログラム変換装置50によって、資源測定プログラムソース5401には、資源測定ルーチンとして、resource-measure()関数5402がプログラムソース5103のメインループの始点直後と終点直前に挿入されている。
FIG. 24 shows an example of the resource measurement program source into which the resource measurement routine is inserted by the resource measurement routine
resource-measure関数は、図23に示す処理フローにしたがって、メインループの処理時間を測定して累積処理時間を記憶する。また、資源測定プログラムソース5401に変換されるプログラムソースは、資源要求として与えられた優先度範囲内で優先度が設定されるタスクの中で、資源要求の対象区間を処理するタスクよりも高優先度タスクのメインループが記述されたものになる。
The resource-measure function measures the processing time of the main loop and stores the accumulated processing time according to the processing flow shown in FIG. Also, the program source converted to the resource
ここまで、本発明を図面に示した実施の形態に基づいて説明してきたが、本発明は図面に示した実施の形態に限定されるものでなく、各部の機能を上述してきたようなプログラムを実行させることにより達成することができる。また、この場合、プログラムが記録された記録媒体として提供することも可能である。 Up to this point, the present invention has been described based on the embodiments shown in the drawings. However, the present invention is not limited to the embodiments shown in the drawings, and programs that have described the functions of the respective units have been described above. This can be achieved by executing. In this case, the program can be provided as a recording medium.
本発明のプログラム変換装置を用いれば、プログラムの任意の区間に対して細粒度にCPU利用率を用いた資源要求を与え、それを満たすような資源要求プログラムへ自動変換できるため、映像音声処理や自動制御システム、医療システムのようなリアルタイムシステムの開発環境に適用可能である。 By using the program conversion device of the present invention, it is possible to give a resource request using the CPU utilization rate to an arbitrary section of the program and automatically convert it into a resource request program that satisfies it, so that video and audio processing and It can be applied to development environments for real-time systems such as automatic control systems and medical systems.
10 システム、20 リモートコントローラ、30 デジタル放送アンテナ、40 表示装置、50 プログラム変換装置、
51、510、5101、5103 プログラムソース、52 資源要求コード及び要求区間コード、53、5301 資源予約プログラムソース、54、5401 資源測定プログラムソース、55、5302 資源制御ルーチン、56、5402 資源測定ルーチン、
501 資源要求及び要求区間コード取得部、502 資源予約プログラム生成部、503 資源測定プログラム生成部、521 資源要求コード、522 要求区間コード、
5021 要求区間特定部、5022 資源制御ルーチン位置解決部、5023 資源制御ルーチン挿入変換部、5031 測定タスク特定部、5032 資源測定ルーチン位置解決部、5033 資源測定ルーチン挿入変換部、5102 要求区間、5104 メインループ、
60 デジタル放送受信機、61 記憶装置、62 プロセッサ、63 信号受信部、64 デジタル放送チューナー、65 デジタル放送受信機ソフトウェア、651 リモートコントローラプロセス、
652 チューナープロセス、653 描画プロセス、654 電子番組ガイドプロセス、655 データ放送ブラウズプロセス
10 system, 20 remote controller, 30 digital broadcasting antenna, 40 display device, 50 program conversion device,
51, 510, 5101, 5103 Program source, 52 Resource request code and request section code, 53, 301 Resource reservation program source, 54, 5401 Resource measurement program source, 55, 5302 Resource control routine, 56, 5402 Resource measurement routine,
501 Resource request and request section
5021 Request section identification unit, 5022 Resource control routine position resolution section, 5023 Resource control routine insertion conversion section, 5031 Measurement task identification section, 5032 Resource measurement routine position resolution section, 5033 Resource measurement routine insertion conversion section, 5102 Request section, 5104 main loop,
60 digital broadcast receiver, 61 storage device, 62 processor, 63 signal receiver, 64 digital broadcast tuner, 65 digital broadcast receiver software, 651 remote controller process,
652 tuner process, 653 drawing process, 654 electronic program guide process, 655 data broadcast browsing process
Claims (9)
前記プログラムと、前記プログラムの所定処理区間毎のCPU資源要求情報と、変換されたプログラムとを記録する記録部と、
前記情報に基づいて、前記プログラムの所定位置に資源利用時間測定コードを挿入する資源測定プログラム生成部と、
前記資源利用時間測定コードの測定結果と前記CPU資源要求情報とを比較して、前記プログラムの所定処理区間毎のスケジューラを制御する資源制御コードを挿入する資源予約プログラム生成部と、を備えたことを特徴とするプログラム変換装置。 A program conversion device that performs code conversion of a program executed by a preemptive multitasking OS (operating system),
A recording unit for recording the program, CPU resource request information for each predetermined processing section of the program, and the converted program;
Based on the information, a resource measurement program generation unit that inserts a resource usage time measurement code at a predetermined position of the program;
A resource reservation program generating unit that inserts a resource control code that controls a scheduler for each predetermined processing section of the program by comparing the measurement result of the resource usage time measurement code with the CPU resource request information; A program conversion apparatus characterized by the above.
前記資源制御コードは、資源利用率が目標よりも下回るとタスクの優先度を上昇させ、資源利用率が目標よりも上回ると超過分の資源を解放することを特徴とするプログラム変換装置。 The program conversion device according to claim 1,
The resource conversion code increases the priority of a task when the resource utilization rate is lower than the target, and releases the excess resource when the resource utilization rate exceeds the target.
前記プログラムを記憶する第1の記憶部と、
前記プログラムに対して処理ステートメントの始点位置と終点位置から成る区間情報毎に、CPU資源の要求値の下限値と上限値、実行優先度の下限値と上限値、資源制御間隔を設定する第2の記録部と、
前記第1の記憶部に記録されたプログラムを構成するタスクの内で、測定対象となるタスクを判定する測定タスク特定部と、
前記測定タスク特定部により測定対象と判定されたタスクについて、周期実行のメインループの始点と終点の位置を確定する資源測定ルーチン位置解決部と、
測定区間について、前記第1の記憶部に記録されたプログラムに資源測定ルーチンを挿入する資源測定ルーチン挿入変換部と、
前記第1の記憶部に記録されたプログラムから、前記第2の記録部に記録されている要求区間を特定する要求区間特定部と、
前記要求区間特定部により特定された要求区間毎に、前記第2の記録部に記録される当該区間の資源制御間隔から、プログラムのステートメント毎に資源制御位置かどうかを判定する資源制御ルーチン位置解決部と、
資源制御位置について、前記第1の記録部に記録されたプログラムに資源制御ルーチンを挿入する資源制御ルーチン挿入変換部と、を備えたことを特徴とするプログラム変換装置。 A program conversion device for converting code of a program executed on a preemptive multitasking OS,
A first storage unit for storing the program;
A second value that sets a lower limit value and an upper limit value of a CPU resource request value, a lower limit value and an upper limit value of an execution priority, and a resource control interval for each section information including a start position and an end position of a processing statement for the program Recording section of
A measurement task specifying unit for determining a task to be measured among the tasks constituting the program recorded in the first storage unit;
A resource measurement routine position resolution unit that determines the positions of the start point and the end point of the main loop of periodic execution for the task determined as the measurement target by the measurement task specifying unit,
A resource measurement routine insertion conversion unit for inserting a resource measurement routine into the program recorded in the first storage unit for the measurement section;
From a program recorded in the first storage unit, a request section specifying unit for specifying a request section recorded in the second recording unit;
Resource control routine position resolution for determining whether or not the resource control position for each statement of the program from the resource control interval of the section recorded in the second recording unit for each request section specified by the request section specifying unit And
A program conversion apparatus comprising: a resource control routine insertion conversion unit that inserts a resource control routine into a program recorded in the first recording unit with respect to a resource control position.
前記測定タスク特定部は、前記第1の記憶部に記録されたプログラムを構成するタスクの内で、前記第2の記録部に記録される要求区間を処理するタスクよりも高優先度に設定されるタスクのみ測定対象とすることを特徴とするプログラム変換装置。 In the program conversion apparatus according to claim 3,
The measurement task specifying unit is set to a higher priority than a task for processing a request section recorded in the second recording unit among the tasks constituting the program recorded in the first storage unit. A program conversion apparatus characterized in that only tasks to be measured are measured.
前記資源測定ルーチン挿入変換部が挿入する資源測定ルーチンは、前記第2の記録部に記録される要求区間が処理されている間で、かつ下位優先度タスクが測定中で無い場合にのみ、処理時間を測定することを特徴とするプログラム変換装置。 In the program conversion apparatus according to claim 3,
The resource measurement routine inserted / converted by the resource measurement routine insertion / conversion unit is processed only when the requested section recorded in the second recording unit is being processed and when the lower priority task is not being measured. A program conversion device for measuring time.
前記資制御ルーチン挿入変換部が挿入する資源制御ルーチンは、前記第2の記録部に記録される要求区間の始点で優先度上昇、終点で優先度下降、要求区間内では超過資源を解放することを特徴とするプログラム変換装置。 In the program conversion apparatus according to claim 3,
The resource control routine inserted by the resource control routine insertion conversion unit increases the priority at the start point of the request section recorded in the second recording unit, decreases the priority at the end point, and releases excess resources in the request section. A program conversion apparatus characterized by the above.
前記プログラムの所定区間毎の要求CPU利用率と優先度範囲を取得するステップと、
前記ステップで取得した所定区間毎の優先度範囲から、所定区間を処理するタスクよりも高優先度に設定されるタスクのメインループに資源測定コードを挿入するステップと、
前記ステップで挿入した資源測定コードが保持する前記高優先度タスクによる累積中断時間を確認しながら、CPU利用率が要求CPU利用率を上回れば超過分に相当する時間だけ資源を解放する資源制御コードを、前記プログラムの所定区間に挿入するステップと、を有することを特徴とするプログラム変換方法。 A program conversion method for performing code conversion of a program executed on a preemptive multitasking OS,
Obtaining a required CPU usage rate and priority range for each predetermined section of the program;
Inserting a resource measurement code into the main loop of a task that is set to a higher priority than the task that processes the predetermined section from the priority range for each predetermined section acquired in the step;
Resource control code that releases resources for the time corresponding to the excess if the CPU usage rate exceeds the requested CPU usage rate while checking the cumulative suspension time by the high priority task held by the resource measurement code inserted in the step Inserting the program into a predetermined section of the program.
前記プログラムの所定位置に挿入された資源利用時間測定コードにより当該プログラムの所定区間毎のCPU利用率を取得するステップと、
前記取得したCPU利用率が予め設定された所定区間毎の要求CPU利用率とを比較して資源利用率が目標よりも下回るとタスク優先度を上昇させるステップと、
前記取得したCPU利用率が予め設定された所定区間毎の要求CPU利用率とを比較して資源利用率が目標よりも上回るとCPU資源を開放するステップと、を含むことを特徴とするプログラム制御方法。 A method for controlling a program executed by a preemptive multitasking OS,
Obtaining a CPU usage rate for each predetermined section of the program by means of a resource usage time measurement code inserted at a predetermined position of the program;
The step of increasing the task priority when the resource utilization rate is lower than the target by comparing the acquired CPU utilization rate with the requested CPU utilization rate for each predetermined section set in advance,
The obtained CPU usage rate is compared with a requested CPU usage rate for each predetermined section that is set in advance, and when the resource usage rate exceeds a target, a CPU resource is released. Method.
前記プログラムの所定位置に挿入された資源利用時間測定コードにより当該プログラムの所定区間毎のCPU利用率を取得するステップと、
前記取得したCPU利用率が予め設定された所定区間毎の要求CPU利用率とを比較して資源利用率が目標よりも下回るとタスク優先度を上昇させるステップと、
前記取得したCPU利用率が予め設定された所定区間毎の要求CPU利用率とを比較して資源利用率が目標よりも上回るとCPU資源を開放するステップと、を実行させるためのプログラム。 A program executed on a device equipped with a preemptive multitasking OS,
Obtaining a CPU usage rate for each predetermined section of the program by means of a resource usage time measurement code inserted at a predetermined position of the program;
The step of increasing the task priority when the resource utilization rate is lower than the target by comparing the acquired CPU utilization rate with the requested CPU utilization rate for each predetermined section set in advance,
A program for executing a step of releasing the CPU resource when the obtained CPU utilization rate is compared with a requested CPU utilization rate for each predetermined section set in advance and the resource utilization rate exceeds a target.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008306958A JP2010134494A (en) | 2008-12-02 | 2008-12-02 | Program conversion device, conversion method, program control method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008306958A JP2010134494A (en) | 2008-12-02 | 2008-12-02 | Program conversion device, conversion method, program control method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010134494A true JP2010134494A (en) | 2010-06-17 |
Family
ID=42345768
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008306958A Pending JP2010134494A (en) | 2008-12-02 | 2008-12-02 | Program conversion device, conversion method, program control method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010134494A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016057798A (en) * | 2014-09-09 | 2016-04-21 | 三菱電機株式会社 | Program embedding device |
-
2008
- 2008-12-02 JP JP2008306958A patent/JP2010134494A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016057798A (en) * | 2014-09-09 | 2016-04-21 | 三菱電機株式会社 | Program embedding device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6199477B2 (en) | System and method for using a hypervisor with a guest operating system and virtual processor | |
US9858115B2 (en) | Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core processor system and related non-transitory computer readable medium | |
US8397235B2 (en) | User tolerance based scheduling method for aperiodic real-time tasks | |
US9569260B2 (en) | Efficient priority-aware thread scheduling | |
US20150121387A1 (en) | Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core system and related non-transitory computer readable medium | |
US8943252B2 (en) | Latency sensitive software interrupt and thread scheduling | |
US9430283B2 (en) | Information processing apparatus and job scheduling method | |
JP2009541848A (en) | Method, system and apparatus for scheduling computer microjobs to run uninterrupted | |
JP2007519103A (en) | Resource management in multiprocessor systems | |
US10310891B2 (en) | Hand-off scheduling | |
CN113326107A (en) | Kubernetes cluster-based periodic task scheduling method and electronic equipment | |
CN107820605B (en) | System and method for dynamic low-latency optimization | |
Kato et al. | A loadable real-time scheduler suite for multicore platforms | |
JP2010277171A (en) | Device and method task assignment | |
JP2009238051A (en) | Program conversion device and program conversion method | |
JP2010134494A (en) | Program conversion device, conversion method, program control method and program | |
CN112579271A (en) | Real-time task scheduling method, module, terminal and storage medium for non-real-time operating system | |
CN114816703A (en) | Task processing method, device, equipment and medium | |
JP5299869B2 (en) | Computer micro job | |
JP2019079336A (en) | Numerical control device | |
US20220300322A1 (en) | Cascading of Graph Streaming Processors | |
JP2008225641A (en) | Computer system, interrupt control method and program | |
CN114035926A (en) | Application thread scheduling method and device, storage medium and electronic equipment | |
WO2000063776A2 (en) | Object-oriented system having anonymous scheduler design pattern | |
US20030204639A1 (en) | Task dispatch in priority pre-emptive real-time operating systems |