JP2009238051A - Program conversion device and program conversion method - Google Patents

Program conversion device and program conversion method Download PDF

Info

Publication number
JP2009238051A
JP2009238051A JP2008085165A JP2008085165A JP2009238051A JP 2009238051 A JP2009238051 A JP 2009238051A JP 2008085165 A JP2008085165 A JP 2008085165A JP 2008085165 A JP2008085165 A JP 2008085165A JP 2009238051 A JP2009238051 A JP 2009238051A
Authority
JP
Japan
Prior art keywords
section
program
code
time
scheduler control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008085165A
Other languages
Japanese (ja)
Inventor
Yoshiki Sato
芳樹 佐藤
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2008085165A priority Critical patent/JP2009238051A/en
Publication of JP2009238051A publication Critical patent/JP2009238051A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program conversion device and program conversion method, capable of meeting a temporal limitation about a process for a specified section of a program, on an preemptive multi-task OS. <P>SOLUTION: A program conversion device 50 for converting a program source includes a time and section code acquiring part 501, which acquires a time code representing a time requirement described outside the program source and a section code 52 representing its objective section; an execution profile acquiring part 502 which acquires an execution profile information 53 of the objective section; a critical section position resolving part 503, which resolves the position of a critical section; a scheduler control means selecting part 504, which selects a means for realizing the critical section by controlling a scheduler; and a scheduler control code inserting converting part 505, which generates a resource preservation program source from a scheduler control code by converting and inserting a program source. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、プリエンプティブなマルチタスクOSにおいて、プログラムの指定した区間に対してスケジューリングを制御するために、プログラムを変換することを可能とするプログラム変換装置及びプログラム変換方法に関するものである。   The present invention relates to a program conversion apparatus and a program conversion method capable of converting a program in order to control scheduling for a specified section of the program in a preemptive multitasking OS.

従来、プログラムにより時間的制約を持ったリアルタイム処理をおこなう際には、プログラムが試行錯誤を経て綿密な微調整が施された形でハードコーディングされる事が多かった。このため、その多くは最終的に性能要求や実装意図の読み取れない職人芸的プログラムになってしまうことがあった。このような可読性の悪い職人芸的プログラムは、バグ対応や性能チューニング等の保守作業において、プログラマに多大な労力を費やさせ、ソフトウェアの生産性・品質を低下させてしまう問題がある。   Conventionally, when performing real-time processing with time constraints by a program, the program is often hard-coded in a form that has been finely adjusted through trial and error. For this reason, many of them eventually became craftsmanship programs whose performance requirements and implementation intentions could not be read. Such a craftsmanship program with poor readability has a problem in that it causes a programmer to spend a great deal of labor in maintenance work such as bug handling and performance tuning, thereby reducing the productivity and quality of software.

Linuxのようなプリエンプティブなマルチタスク機能をサポートするOSでは、これはより深刻であり、タスクスケジューリングを最適化しながら各タスクのリアルタイム性を満たさなければならない。そもそも、タイムシェアリング用のOSの場合、構造自体が時間的制約を満たしにくい事も指摘されている。   In an OS that supports preemptive multitasking functions such as Linux, this is more serious, and the real-time nature of each task must be met while optimizing task scheduling. In the first place, it has been pointed out that in the case of an OS for time sharing, the structure itself is difficult to satisfy the time constraints.

近年、リアルタイム性が重要である組み込みシステムにおいても、ますます時間的制約の保障が困難になってきている。従来の組み込み向けのリアルタイムOSを適用したシステムでは、システム内のタスクが予め固定されている事が多かった。そのため、熟練者が注意深く各タスクの時間的制約が満たされる優先関係を設定すれば、制約の違反を避けることができた。   In recent years, it has become increasingly difficult to guarantee time constraints even in embedded systems where real-time performance is important. In a system using a conventional embedded real-time OS, tasks in the system are often fixed in advance. Therefore, if a skilled person carefully sets a priority relationship that satisfies the time constraint of each task, the violation of the constraint could be avoided.

しかしながら、最近では、組み込みシステムとはいえ、デジタル化、ネットワーク化によって、開放型システムになりつつあり加速度的に高機能化が進んでいる。そのようなシステム上では、動作するアプリケーションの種類や挙動を予め把握する事は非常に困難となる。   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.

上記の問題に対応するため、近年、資源予約型システムが提案されている。資源予約型システムでは、明示的に設定されたプロセッサの実行時間を確実に割り当てる事で、必要な処理量を確保し、時間的制約を有するタスクを満足させる事ができる。   In order to deal with the above problem, a resource reservation type system has recently been proposed. In the resource reservation type system, it is possible to ensure a necessary processing amount and satisfy a task having a time constraint by surely assigning the execution time of the explicitly set processor.

例えば、非特許文献1で報告された Resource Kernel では、周期とその周期のうちで割り当てるべき計算時間を明示して予約を行い、その予約に応じてプロセッサを割り当てることにより、デッドラインまでに処理が終了することを保障する。   For example, Resource Kernel reported in Non-Patent Document 1 makes a reservation by specifying the period and the calculation time to be allocated within that period, and assigning processors according to the reservation allows processing up to the deadline. Ensure that it ends.

また、特許文献1では、時間的制約を満たしたプロセス群の優先度組み合わせを記録し、その順序通りにタスクスケジュールを再現する手法が述べられている。しかしながら、これらの方法では、Linuxプロセスに対してCPU資源を予約するため、きめ細やかに資源を割り当てる事が難しい。プロセス単位の粗粒度な制御では、一部区間のCPU資源を予約するために、当該処理をプロセスへと再分割する必要が出てきてしまう。   Patent Document 1 describes a method of recording a priority combination of process groups satisfying a time constraint and reproducing a task schedule in the order. 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では、時間的制約を満たすように自動的に指定された処理のプログラムを並列化する方法が述べられている。しかし、当然ながら、適用対象が並列化によって性能向上が見込まれるプログラムに限定される。したがって、十分な並列度の内在しない又は効果の少ないプログラムでは、実行時間を大きく制御できない。   Further, Patent Document 2 describes a method of parallelizing processing programs that are automatically specified so as to satisfy time constraints. However, as a matter of course, the application target is limited to a program whose performance is expected to be improved by parallelization. Therefore, the execution time cannot be largely controlled in a program that does not have sufficient parallelism or has little effect.

さらに、Resource Kernel のようなカーネルの改変を要求するシステムの場合、システムのプラットフォーム依存度が強くなるため移植性が損なわれてしまう。非特許文献2では、特別なプラットフォームを用意せず、プログラム変換器によって、特定スレッドの時間的制約の違反を回避する QoSWeaver が提案されている。   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. Non-Patent Document 2 proposes QoSWeaver that avoids violation of the time constraint of a specific thread by a program converter without preparing a special platform.

QoSWeaver は、特に J2EE アプリケーションサーバにおいて、オーバーロード時、過度にCPU 資源を占有するスレッドのプログラムに対して、静的に適度なプリエンプションコードを挿入する。しかし、このような間接的に特定のスレッドへの影響を抑えるアプローチでは、一部区間の時間的制約を満たすために、不要に多くの CPU 処理時間を与えてしまう場合が出てくる。   QoSWeaver inserts a statically appropriate preemption code for a thread program that occupies CPU resources excessively when overloading, especially in J2EE application servers. However, such an approach that indirectly suppresses the influence on a specific thread may unnecessarily give a lot of CPU processing time in order to satisfy the time constraint of a certain section.

特開平6-202884号公報JP-A-6-202884 特開2006-126977号公報JP 2006-126977 S. Oikawa and R. Rajkumar, “Portable RK: A Portable Resource Kernel for Guaranteed and Enforced Timing Behavior”, IEEE Real-Time Technology and Applications Symposium, 1996S. Oikawa and R. Rajkumar, “Portable RK: A Portable Resource Kernel for Guaranteed and Enforced Timing Behavior”, IEEE Real-Time Technology and Applications Symposium, 1996 K. Kourai, H. Hibino and K. Kourai, “A Dynamic Aspect-Oriented System for OS Kernels”, 6th International Conference on Aspect-Oriented Software Development, 2007K. Kourai, H. Hibino and K. Kourai, “A Dynamic Aspect-Oriented System for OS Kernels”, 6th International Conference on Aspect-Oriented Software Development, 2007

上記で述べたように従来の技術では、プリエンプティブなマルチタスクOS上で、プロセスやスレッドに捉われず、きめ細やかに処理の時間的制約を満足させる事が困難だった。一方、プログラムの並列化技術を用いて、順序依存で並列度の無い処理をプロセスやスレッドとして抜き出したとしても所期の目的は達成され得ない。   As described above, with the conventional technology, it has been difficult to satisfy detailed processing time constraints on a preemptive multitasking OS without being caught by processes and threads. On the other hand, the intended purpose cannot be achieved even if the parallel processing of the program is used to extract a process that is dependent on the order and has no degree of parallelism as a process or thread.

本発明は、上記の課題を解決し、プリエンプティブなマルチタスクOS上で、プログラムの指定した区間の処理の時間的制約を満足させるプログラム変換装置及びプログラム変換方法を提供することを目的とする。   An object of the present invention is to solve the above-described problems and to provide a program conversion apparatus and a program conversion method that satisfy the time restriction of processing of a specified section of a program on a preemptive multitasking OS.

上記目的を達成するために、本発明のプログラム変換装置及びプログラム変換方法は、プログラムに対して時間要求とその対象区間を、プログラム外から与え、時間要求を満たすよう該当区間にクリティカルセクション(資源占有区間)及びリリースセクション(資源解放区間)を設ける事でスケジューリングを制御する資源予約プログラムを生成することにした。   In order to achieve the above object, the program conversion apparatus and the program conversion method of the present invention provide a time request and its target section to the program from outside the program, and set the critical section (resource occupancy) to satisfy the time request. It was decided to generate a resource reservation program that controls scheduling by providing a section) and a release section (resource release section).

詳しくは、プログラムソース中で、要求時間の対象区間中に含まれるステートメント群の中で、要求時間を満たすためにクリティカルセクション及びリリースセクションにすべきステートメントのセットを選び出し、そのステートメントのセットに CPU を占有させるようなスケジューラ制御コードを挿入することによって、所定の要求時間内に処理を完遂することを保証するものである。   Specifically, in the program source, a set of statements that should be the critical section and the release section to satisfy the required time is selected from the group of statements included in the target section of the required time, and the CPU is assigned to the set of statements. By inserting a scheduler control code to occupy, it is guaranteed that the processing is completed within a predetermined request time.

また、本発明の他の観点によれば、複数のプロセスを同時に処理するプリエンプティブなマルチタスクOSにおいて、所定の時間要求を持つ処理に対し、前期時間要求で前期処理を完遂することを保証させるプログラム変換装置であって、プログラムソース外に記述された時間要求を表す時間コードとその対象区間を表す区間コードを取得する時間及び区間コード取得部と、該当区間における実行プロファイル情報を取得する実行プロファイル取得部と、クリティカルセクション及びリリースセクションの位置を解決するスケジューラ制御位置解決部と、スケジューラを制御してクリティカルセクション及びリリースセクションを実現する手段を選択するスケジューラ制御手段選択部と、スケジューラ制御コードをプログラムソースを変換して挿入し資源予約プログラムソースを生成するスケジューラ制御コード挿入変換部とを備えたものである。   According to another aspect of the present invention, in a preemptive multitasking OS that processes a plurality of processes at the same time, a program that guarantees that a process having a predetermined time request completes the previous process with the previous time request. A conversion device, a time code indicating a time request described outside the program source and a time and interval code acquisition unit for acquiring the interval code indicating the target interval, and an execution profile acquisition for acquiring execution profile information in the interval A scheduler control position resolution unit for resolving the position of the critical section and the release section, a scheduler control unit selection unit for selecting a means for controlling the scheduler to realize the critical section and the release section, and a scheduler control code as a program source Convert It is obtained by a scheduler control code insertion conversion unit that generates an input shi resource reservation program source.

本発明により、プリエンプティブなマルチタスクOSにおいて、プログラムの任意の指定区間を処理する際、適切なステートメントのセットをクリティカルセクション及びリリースセクションとして実行することで、時間要求を保証することでき、かつそのようなプログラムを自動生成することが可能となる。   According to the present invention, in a preemptive multitasking OS, when processing an arbitrary designated section of a program, a time requirement can be guaranteed by executing an appropriate set of statements as a critical section and a release section. It is possible to automatically generate a simple program.

以下、本発明を図面に示した具体的な実施の形態に沿って説明するが、本発明は、後述する実施の形態に限定されるものではない。図1は、本発明のプログラム変換装置を組み込んだシステム10の実施例を示した図である。   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. FIG. 1 is a diagram showing an embodiment of a system 10 incorporating a program conversion apparatus of the present invention.

図1には、リモートコントローラ20と、デジタル放送アンテナ30と、表示装置40と、本発明のプログラム変換装置50と、デジタル放送受信機60とからなるシステム10が示されている。   FIG. 1 shows a system 10 including a remote controller 20, a digital broadcast antenna 30, a display device 40, a program conversion device 50 of the present invention, and a digital broadcast receiver 60.

デジタル放送受信機60には、変換プログラムが格納される記憶装置61と、プロセッサ62、リモートコントローラ20からの信号を受信する信号受信部63、デジタル放送アンテナ30を介して映像データ、音声データ及び字幕データを受信するデジタル放送チューナー64とデジタル放送受信機ソフトウェア65が搭載され、さらに各種資源の管理及びアプリケーションがそれら資源を利用できるようにするためのOS及びアプリケーションが格納されている。   The digital broadcast receiver 60 includes a storage device 61 in which a conversion program is stored, a processor 62, a signal receiver 63 that receives a signal from the remote controller 20, and video data, audio data, and subtitles via the digital broadcast antenna 30. A digital broadcast tuner 64 for receiving data and digital broadcast receiver software 65 are installed, and an OS and applications for managing various resources and making them available to applications are stored.

デジタル放送受信機ソフトウェア65は、リモートコントローラプロセス651と、チューナープロセス652と、描画プロセス653と、電子番組ガイドプロセス654及びデータ放送ブラウザプロセス655を備えている。   The digital broadcast receiver software 65 includes a remote controller process 651, a tuner process 652, a drawing process 653, an electronic program guide process 654, and a data broadcast browser process 655.

図1に示す実施の形態では、デジタル放送受信機ソフトウェア65はプログラム変換装置50により、資源予約プログラムへ変換され記憶装置61へ格納される。記憶装置61へ格納された資源予約プログラムは、プロセッサ62によりデジタル放送受信機65のOSへ読み込まれ、実行される。   In the embodiment shown in FIG. 1, the digital broadcast receiver software 65 is converted into a resource reservation program by the program conversion device 50 and stored in the storage device 61. The resource reservation program stored in the storage device 61 is read into the OS of the digital broadcast receiver 65 by the processor 62 and executed.

プロセッサ62は、リモートコントローラ20使用したユーザ操作に対するリモートコントローラプロセス651による受信処理とその適切な応答処理を行っている。例えば、選局に伴うチューナープロセス652による放送局を切り替え、電子番組ガイド視聴に伴う電子番組ガイドプロセス654による電子番組ガイド取得及び複合化、データ放送視聴に伴うデータ放送ブラウズプロセス655によるデータ放送コンテンツ取得及び複合化を行い、変更された映像を描画プロセス653が合成して表示装置40に出力している。   The processor 62 performs a reception process by the remote controller process 651 and an appropriate response process for a user operation using the remote controller 20. For example, the broadcast station is switched by the tuner process 652 associated with the channel selection, the electronic program guide is acquired and combined by the electronic program guide process 654 when the electronic program guide is viewed, and the data broadcast content is acquired by the data broadcast browse process 655 when the data broadcast is viewed. In addition, the rendering process 653 synthesizes and outputs the changed video to the display device 40.

リモートコントローラプロセス651による受信処理は、確実に行わなければならず、常にプロセッサ62によって稼動させられなければならない。しかし、同時に電子番組ガイドプロセス654による電子番組ガイドの取得及び複合化、データ放送ブラウズプロセス655によるデータ放送コンテンツの取得及び複合化においても、ユーザ操作に連動した処理の場合は、一定の時間内に処理を完遂させたいという要求がある。   Reception processing by the remote controller process 651 must be performed reliably and must always be operated by the processor 62. However, at the same time, in the acquisition and combination of the electronic program guide by the electronic program guide process 654 and the acquisition and combination of the data broadcast content by the data broadcast browse process 655, in the case of processing linked to the user operation, within a certain time. There is a request to complete the process.

しかしながら、これらの応答処理は、平時においては状態変化の通知等の重要で無い処理を行うため、従来は低い優先度で稼動するものとされていた。したがって、例えば、いざ電子番組ガイド及びデータ放送コンテンツを視聴したい場合でも、プロセッサ62は、高優先度で稼動するリモートコントローラプロセス651や、チューナープロセス652及び描画プロセス653に処理時間を優先して与えていた。そうなると、一時的に時間的制約を持つ電子番組ガイドプロセス654及びデータ放送ブラウザ655には、十分な処理時間が確保されにくかった。   However, since these response processes perform processes that are not important, such as notification of a state change during normal times, the response processes have been conventionally performed with low priority. Therefore, for example, even when it is desired to view the electronic program guide and the data broadcasting content, the processor 62 gives priority to the processing time to the remote controller process 651, the tuner process 652, and the drawing process 653 that operate with high priority. It was. As a result, it has been difficult to secure sufficient processing time for the electronic program guide process 654 and the data broadcast browser 655 that have temporal constraints temporarily.

本発明のプログラム変換装置は、きめ細かい粒度で特定の処理区間における時間要求を保証できるだけの計算資源を与えるように、プログラムを変換する。言い換えればプログラム変換時の資源予約システムである。本実施例では、プロセッサによる処理時間を計算資源として説明する。   The program conversion apparatus of the present invention converts a program so as to provide a calculation resource capable of guaranteeing a time requirement in a specific processing section with a fine granularity. In other words, it is a resource reservation system at the time of program conversion. In this embodiment, the processing time by the processor will be described as a calculation resource.

変換されたプログラムの時間要求の無い区間では、設定された優先度にしたがった計算資源がOSスケジューラにより与えられ、時間要求のある区間では、OSスケジューラに依らず制約を満たすのに十分な計算資源が与えられる。   In the section of the converted program where there is no time requirement, the computing resource is given by the OS scheduler according to the set priority, and in the section where there is a time requirement, the computing resource is sufficient to satisfy the constraints regardless of the OS scheduler. Is given.

具体的には、プログラム変換装置は、時間要求のある区間において、他のタスクの影響が全く無いとき(クリティカルセクションにした時)の実行時間と、マルチタスク実行時の実行時間のプロファイル情報から、他のタスクによって割り込まれたために生じる遅延時間を求める。ここで、クリティカルセクションでの実行時間に遅延時間を加えたものが、マルチタスク実行時、即ち平時の実行時間になる。   Specifically, the program conversion device, based on the execution time profile information when there is no influence of other tasks (when the critical section is selected) and the execution time profile information at the time of multitasking in the section with the time request, Find the delay time caused by being interrupted by another task. Here, the execution time in the critical section plus the delay time is the execution time during multitask execution, that is, normal time.

そこで、さらに、区間内での遅延時間の内訳をプログラム中の適当なステートメント単位に算出する。ステートメントは、プログラムの一文を表し、C 言語や Java(登録商標) 言語等多くの高水準言語ではセミコロンで区切られる。ステートメント単位の遅延時間が求められれば、平時の実行時間を要求時間内に抑えるために、クリティカルセクションにすべきステートメントセットが求められる。求められたステートメントセットに対しては、OSスケジューラを制御するためのコードを挿入し、アプリケーションレベルでのクリティカルセクションを実現できるようにする。   Therefore, the breakdown of the delay time in the section is further calculated for each appropriate statement unit in the program. 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. If a delay time for each statement is obtained, a statement set to be a critical section is obtained in order to keep the execution time during normal times within the requested time. For the requested statement set, insert code to control the OS scheduler so that critical sections at the application level can be realized.

一方、要求時間が平時の実行時間よりも大きいならば、要求時間を越えるリリースセクションを実現するための OS スケジューラを制御するコードを挿入する。また、クリティカルセクション及びリリースセクションには、ステートメントだけでなく、ブロックやユーザの指定した任意の区間(セクション)を対象にできる。   On the other hand, if the request time is greater than the normal execution time, the code that controls the OS scheduler to implement the release section that exceeds the request time is inserted. In addition, the critical section and the release section can target not only a statement but also an arbitrary section (section) designated by a block or a user.

図1を参照して説明すると、ユーザがデータ放送視聴用のリモートコントローラ信号を送信すると、その信号に応答して、プロセッサ62で実行されているOSは、リモートコントローラプロセス651をディスパッチする。次に、データ放送ブラウズプロセス655がディスパッチされ、データ放送コンテンツの取得及び複合化処理が実行される。   Referring to FIG. 1, when a user transmits a remote controller signal for viewing a data broadcast, the OS running on the processor 62 dispatches a remote controller process 651 in response to the signal. Next, a data broadcast browsing process 655 is dispatched, and data broadcast content acquisition and decryption processing are executed.

当該処理区間には、予め要求時間及び平時の処理時間、クリティカルセクション時の処理時間が決められている。また、区間中のステートメント毎の平時の処理時間及びクリティカルセクション時の処理時間も決められている。   In the processing section, a request time, a normal processing time, and a critical section processing time are determined in advance. Also, the processing time during normal times and the processing time during critical sections are determined for each statement in the section.

本発明のプログラム変換システムは、図2のように、プログラムソース51及び時間要求コード及び対象区間コード52、平時の処理時間とクリティカルセクション時の処理時間を保持する実行プロファイル情報53から、対象区間中の適切なステートメントをクリティカルセクション55にし、資源予約プログラムソース54を出力する。   As shown in FIG. 2, the program conversion system according to the present invention includes a program source 51, a time request code, a target section code 52, execution profile information 53 that holds a processing time in normal times and a processing time in critical sections. To the critical section 55 and output the resource reservation program source 54.

これにより、本発明のプログラム変換システム50で資源予約プログラムへ変換されたデータ放送ブラウズプロセス655は、クリティカルセクションに設定されたステートメントの処理では、他のプロセスに割り込まれずに処理を行えるようになる。   As a result, the data broadcast browsing process 655 converted into the resource reservation program by the program conversion system 50 of the present invention can perform processing without interrupting other processes in processing the statement set in the critical section.

また、本発明のプログラム変換装置50は、クリティカルセクションにする適切なステートメントセットが求められない場合、判定コードと共にスケジューラ制御コードを挿入し、クリティカルセクションを動的に切り替えられるようにする。これによって、クリティカルセクションを処理する前に、余裕時間が確認された場合に、クリティカルセクションを狭める事ができる。   Further, the program conversion apparatus 50 of the present invention inserts a scheduler control code together with a determination code when a suitable statement set to be a critical section is not required, so that the critical section can be dynamically switched. As a result, the critical section can be narrowed when the margin time is confirmed before the critical section is processed.

その一方で、クリティカルセクションを処理した後に、遅延時間が確認された場合に、クリティカルセクションを広める事ができる。余裕時間及び遅延時間は、クリティカルセクションを処理する前後での時刻と平時での処理時刻との差分から求められる。   On the other hand, if the delay time is confirmed after processing the critical section, the critical section can be spread. The allowance time and the delay time are obtained from the difference between the time before and after processing the critical section and the processing time in normal time.

同様に、本発明のプログラム変換装置50は、リリースセクションの適切な位置や区間を求められない場合、判定コードと共にスケジューラ制御コードを挿入し、リリースセクションを動的に切り替えられるようにする。   Similarly, the program conversion apparatus 50 of the present invention inserts a scheduler control code together with the determination code when the appropriate position or section of the release section cannot be obtained, so that the release section can be switched dynamically.

図3により本発明のプログラム変換装置の実施例の構成をより詳細に説明する。本発明のプログラム変換装置50は、複数のプロセスを同時に処理するプリエンプティブなマルチタスクOSにおいて、所定の時間要求を持つ処理に対し、前記時間要求で前記処理を完遂することを保証させるプログラム変換装置であって、プログラムソース外に記述された時間要求を表す時間コードとその対象区間を表す区間コードを取得する時間及び区間コード取得部501と、該当区間における実行プロファイル情報を取得する実行プロファイル取得部502と、クリティカルセクション及びリリースセクションの位置を解決するスケジューラ制御位置解決部503と、スケジューラを制御してクリティカルセクション及びリリースセクションを実現する手段を選択するスケジューラ制御手段選択部504と、プログラムソースを変換してスケジューラ制御コードを挿入し資源予約プログラムソース54を生成するスケジューラ制御コード挿入変換部505とを備えたものである。   The configuration of the embodiment of the program conversion apparatus of the present invention will be described in more detail with reference to FIG. The program conversion apparatus 50 according to the present invention is a program conversion apparatus that guarantees that a process having a predetermined time request completes the process with the time request in a preemptive multitasking OS that processes a plurality of processes simultaneously. In addition, a time code indicating a time request described outside the program source and a time and interval code acquisition unit 501 for acquiring an interval code indicating the target interval, and an execution profile acquisition unit 502 for acquiring execution profile information in the corresponding interval A scheduler control position resolving unit 503 for resolving the positions of the critical section and the release section, a scheduler control means selecting unit 504 for selecting means for controlling the scheduler to realize the critical section and the release section, and converting the program source. It is obtained by a scheduler control code insertion converting unit 505 that generates a resource reservation program source 54 inserts the scheduler control code.

図4にて、入力として与えられる時間要求及び対象区間コード52の記述例を示し説明する。ただし、本発明では、時間要求及び対象区間コード52、さらには入力されるプログラムソース51、出力される資源予約プログラムソース54の言語や文法を規定するものではない。   In FIG. 4, a description example of the time request given as input and the target section code 52 is shown and described. However, in the present invention, the language and grammar of the time request and target section code 52, the input program source 51, and the output resource reservation program source 54 are not specified.

図4に示すように、時間要求及び対象コード52は、時間要求コード520及び対象区間コード521から構成される。時間要求コード520には、要求時間の下限、上限、相対時間及び絶対時間等を指定するコードが記述される。対象区間コード521には、プログラム中の区間を示すために、ファイル名、行番号、関数名、変数読み書き等の処理を指定するコードが記述される。   As shown in FIG. 4, the time request and target code 52 includes a time request code 520 and a target section code 521. In the time request code 520, a code that specifies a lower limit, an upper limit, a relative time, an absolute time, and the like of the required time is described. In the target section code 521, a code designating processing such as a file name, a line number, a function name, and variable reading / writing is described in order to indicate a section in the program.

ここで、図4の時間要求及び対象区間コード52では、名前が draw で始まり、戻り値が void である全ての関数呼び出し(521a)に対して、50ms 以内に処理する、という要求を表現している。また、同時に名前が updateBegin という関数の呼び出しから、updateEnd という関数の呼び出しまで(521b)についても、50ms 以内に処理する、という要求を表現している。さらに、browser.c という名前のファイルの1行目から14行目まで(521c)について、30ms 以上90ms 以下で処理する、という要求を表現している。   Here, the time request and target section code 52 in FIG. 4 expresses a request for processing within 50 ms for all function calls (521a) whose name starts with draw and whose return value is void. Yes. At the same time, the request from the function call updateBegin to the function call updateEnd (521b) is processed within 50ms. Furthermore, the request from the first line to the 14th line (521c) of the file named browser.c is processed in 30 ms to 90 ms.

時間及び区間コード取得部501は、図5に示す処理フローにしたがって、要求時間及び対象区間コード52を字句解析し、要求時間及び対象区間を取得する。このとき、要求時間及び対象区間の情報を図6に示すような構造で保持する。   The time and section code acquisition unit 501 performs lexical analysis on the requested time and the target section code 52 according to the processing flow shown in FIG. 5, and acquires the requested time and the target section. At this time, the request time and the target section information are held in a structure as shown in FIG.

まず、要求時間及び対象区間コードに有効なコードがあるかどうかを調べ(5010)、時間コードを取得し記憶する(5011)。次に、区間コードを取得し記憶する(5014)。時間及び区間取得処理は、有効なコードをすべて記録するまで繰り返される。記憶される情報は、図6に示すような構造で、要求時間の下限(5220)、上限(5221)及び対象区間の始点(5222)、終点(5223)に整理されて保持される。図5に示す時間及び区間取得処理は、全ての要求時間及び対象区間コードを処理するまで繰り返される。   First, it is checked whether there is a valid code in the requested time and the target section code (5010), and the time code is acquired and stored (5011). Next, the section code is acquired and stored (5014). The time and interval acquisition process is repeated until all valid codes are recorded. The information to be stored is organized and held at the lower limit (5220), the upper limit (5221) of the request time, the start point (5222), and the end point (5223) of the target section in the structure as shown in FIG. The time and section acquisition process shown in FIG. 5 is repeated until all the requested time and target section codes are processed.

実行プロファイル取得部502は、図7に示す処理フローにしたがって、実行プロファイル情報53を読み込む。このとき、実行プロファイル情報は、図8に示すような構造で保持される。   The execution profile acquisition unit 502 reads the execution profile information 53 according to the processing flow shown in FIG. At this time, the execution profile information is held in a structure as shown in FIG.

まず、実行プロファイル情報に有効なデータがあるかどうかを調べ(5020)、ステートメントの平時の処理時間を取得し記憶する(5021)。次に、ステートメントの資源占有時(クリティカルセクション時)の処理時間を取得し記憶する(5022)。また、平時の処理時間と占有時の処理時間の差分から、ステートメント毎の遅延時間を計算して記憶する(5023)。遅延時間は、他のタスクに割り込まれて、CPU 資源を明け渡す時間を表す。   First, it is checked whether there is valid data in the execution profile information (5020), and the normal processing time of the statement is acquired and stored (5021). Next, the processing time when the statement resource is occupied (during the critical section) is acquired and stored (5022). Also, the delay time for each statement is calculated and stored from the difference between the processing time during normal times and the processing time during occupation (5023). The delay time represents the time to give up CPU resources by interrupting other tasks.

記憶される情報は、図8に示すような構造で、関数名5300、ステートメントのID5301、平時の処理時間5302、占有時の処理時間5303、ステートメントの遅延時間5304から構成される。図7に示す実行プロファイル取得処理は、全ての実行プロファイル情報を処理するまで繰り返される。   The stored information has a structure as shown in FIG. 8 and includes a function name 5300, a statement ID 5301, a normal processing time 5302, an occupation processing time 5303, and a statement delay time 5304. The execution profile acquisition process shown in FIG. 7 is repeated until all execution profile information is processed.

スケジューラ制御位置解決部503は、図9に示す処理フローにしたがって、プログラムソース51中でのクリティカルセクション及びリリースセクションの位置を決定する。まず、対象区間において、要求時間と占有時(クリティカルセクション時)の処理時間を比較し、要求時間が大きい場合につぎに処理を進め、小さい場合にはエラーとなり、次の時間要求または対象区間の処理を行う(5030)。これは、占有時(クリティカルセクション時)の処理時間よりも小さい要求時間は満たす事ができないためである。   The scheduler control position resolution unit 503 determines the positions of the critical section and the release section in the program source 51 according to the processing flow shown in FIG. First, in the target section, the request time and the processing time at the time of occupancy (during critical section) are compared. If the request time is large, the process proceeds next. If it is small, an error occurs, and the next time request or target section Processing is performed (5030). This is because a request time smaller than the processing time at the time of occupancy (at the time of a critical section) cannot be satisfied.

次に、対象区間において、要求時間と平時の処理時間を比較する(5031)。要求時間の方が小さければクリティカルセクションが適用される事が決定し(5032)、大きければリリースセクションが(5034)適用される事が決定する。   Next, in the target section, the requested time is compared with the normal processing time (5031). If the request time is smaller, it is determined that the critical section is applied (5032), and if it is larger, it is determined that the release section is applied (5034).

クリティカルセクションに決定した場合、合計の遅延時間が、平時の処理時間と要求時間の差分となるステートメントのセットが選択され記憶される(5033)。一方、リリースセクションに決定した場合、要求時間と平時の処理時間の差分が解放時間に設定される(5035)。そして、リリースセクション位置が決定され、解放時間と共に設定される(5036)。   When the critical section is determined, a set of statements whose total delay time is the difference between the normal processing time and the request time is selected and stored (5033). On the other hand, when the release section is determined, the difference between the request time and the normal processing time is set as the release time (5035). The release section position is then determined and set along with the release time (5036).

図9に示すスケジューラ制御位置解決処理は、すべての時間要求及び対象区間について、スケジューラ制御位置を解決するまで繰り返される。   The scheduler control position resolution process shown in FIG. 9 is repeated until the scheduler control position is resolved for all time requests and target sections.

ここで、ステップ5033における遅延時間の合計が、平時の処理時間-要求時間となるステートメントセットの選定では、ステートメントは実行プロファイル情報の出現順に選択され、他のタスクとの通信を含むステートメントは除外される。また、ステートメントセットの選定では、ステートメント数が最小となるセットを選択しても良い。この場合、資源占有区間が小さくその影響が最小限に止められる。   Here, in selecting a statement set in which the total delay time in Step 5033 is normal processing time-request time, the statements are selected in the order of appearance of the execution profile information, and statements including communication with other tasks are excluded. The In selecting a statement set, a set having the minimum number of statements may be selected. In this case, the resource occupation section is small and the influence is minimized.

また、ステートメントセットの選定では、ステートメント数が最大となるセットを選択しても良い。この場合、資源占有区間は大きいが、一度に占有する区間が小さい。また、クリティカルセクションの平均時間や分散が最小となるセットを選択しても良い。この場合、一度に資源を占有する区間が小さい。ただし、クリティカルセクションとするステートメントセットの選定は、これらの基準に限定されるものではない。   In selecting a statement set, a set having the maximum number of statements may be selected. In this case, the resource occupation section is large, but the section occupied at one time is small. A set that minimizes the average time and variance of the critical section may be selected. In this case, the section that occupies resources at a time is small. However, the selection of a statement set as a critical section is not limited to these criteria.

さらに、ステップ5036における、リリースセクション位置の決定では、時間要求の対象区間における先頭ステートメントが選択される。また、リリースセクションの位置は、時間要求の対象区間の全ステートメントの先頭へ等しく設定しても良い。その場合、一つのリリースセクションでの資源解放時間は、解放時間を対象区間中のステートメント数で割った値になる。ただし、リリースセクション位置の選定は、これらの基準に限定されるものではない。   Further, in the determination of the release section position in step 5036, the head statement in the target section for the time request is selected. Further, the position of the release section may be set equal to the head of all statements in the time request target section. In that case, the resource release time in one release section is a value obtained by dividing the release time by the number of statements in the target section. However, the selection of the release section position is not limited to these criteria.

スケジューラ制御手段選択部504は、図10に示す処理フローにしたがって、スケジューラ制御位置解決部503で決定されたクリティカルセクション及びリリースセクションを実現する手段を選択する。スケジューラ制御手段選択部では、クリティカルセクションを実現するためのスケジューラ制御手段を選択する。   The scheduler control means selection unit 504 selects means for realizing the critical section and the release section determined by the scheduler control position resolution unit 503 according to the processing flow shown in FIG. The scheduler control means selection unit selects a scheduler control means for realizing the critical section.

リリースセクションについては、多くの OS が提供している sleep のような CPU 解放コードを選択するものとする。したがって、まず、クリティカルセクションであるかどうかが判定される(5040)。   For the release section, select the CPU release code such as sleep provided by many operating systems. Therefore, first, it is determined whether it is a critical section (5040).

次に、クリティカルセクションに設定されたステートメントが、割り込み禁止可能かどうかを判定する(5041)。判定は、ステートメント中を割り込み禁止とする事で、他タスクとの通信ができなくなるかどうかを基準に決定される。   Next, it is determined whether or not the statement set in the critical section can disable the interrupt (5041). Judgment is made based on whether or not communication with other tasks is disabled by disabling interrupts in the statement.

割り込み禁止可能な場合、スケジューラ制御手段に割り込み禁止が選択される(5042)。割り込み禁止が可能で無い場合、クリティカルセクションに設定されたステートメントが、優先度増加可能かどうかを判定する(5043)。   If interrupt prohibition is possible, the scheduler control means selects interrupt prohibition (5042). If interrupt prohibition is not possible, it is determined whether or not the statement set in the critical section can increase the priority (5043).

優先度増加可能な場合、スケジューラ制御手段に優先度増加が選択され、目的優先度が決定され記憶される(5044)。最後に、決定したスケジューラ制御手段を実現するためのスケジューラ制御開始コードとスケジューラ制御終了コードが確定される(5046)。   If the priority can be increased, priority increase is selected by the scheduler control means, and the target priority is determined and stored (5044). Finally, a scheduler control start code and a scheduler control end code for realizing the determined scheduler control means are determined (5046).

クリティカルセクションに設定されたステートメントが、割り込み禁止も優先度増加も可能でない場合、スケジューラ制御位置解決処理へ戻り、ステートメントセットの再選択がなされる(5045)。   If the statement set in the critical section is neither disabled nor disabled, the process returns to the scheduler control position resolution process, and the statement set is reselected (5045).

図10に示すスケジューラ制御手段選択処理は、クリティカルセクションに設定されたすべてのステートメントセットについて、スケジューラ制御手段が選択されるまで繰り返される。   The scheduler control means selection process shown in FIG. 10 is repeated for all statement sets set in the critical section until the scheduler control means is selected.

また、目的優先度の設定は、他のプロセスの優先度及びステートメント中の通信相手の優先度を勘案して決定しても良い。その場合、実行プロファイル情報53には、他のプロセスの優先度が含まれる。   The setting of the target priority may be determined in consideration of the priority of another process and the priority of the communication partner in the statement. In this case, the execution profile information 53 includes the priorities of other processes.

また、他のタスクと通信するステートメントの場合、通信相手のプロセスの優先度も含まれる。該当ステートメントに対しては、通信相手と同等の優先度を設定する事で、割り込み禁止や優先度増加による通信相手とのデッドロック状態を回避することができる。   In the case of a statement communicating with another task, the priority of the communication partner process is also included. By setting a priority equivalent to that of the communication partner for the corresponding statement, it is possible to avoid a deadlock state with the communication partner due to prohibition of interruption or increase in priority.

スケジューラ制御コード挿入変換部505は、図11に示す処理フローにしたがって、プログラムソース51を読み込み、スケジューラ制御位置解決部503で決定されたクリティカルセクション及びリリースセクションに対して、スケジューラ制御手段選択部504で選択されたスケジューラ制御開始コード及びスケジューラ制御終了コードを挿入するプログラム変換を行う。   The scheduler control code insertion / conversion unit 505 reads the program source 51 in accordance with the processing flow shown in FIG. 11 and uses the scheduler control means selection unit 504 for the critical section and the release section determined by the scheduler control position resolution unit 503. Program conversion for inserting the selected scheduler control start code and scheduler control end code is performed.

スケジューラ制御コード挿入変換部505は、詳細を後述する手順により、プログラムソース51を字句解析、構文解析し、ステートメント単位に分割して記憶する。まず、プログラムソースからステートメント単位でプログラムを読み込み(5050)、クリティカルセクションにすべきか否かを判定する(5051)。   The scheduler control code insertion / conversion unit 505 performs lexical analysis and syntax analysis on the program source 51 according to a procedure described in detail later, and stores the program source 51 in units of statements. First, a program is read from the program source in a statement unit (5050), and it is determined whether or not it should be a critical section (5051).

当該ステートメントをクリティカルセクションにすべきか否かは、スケジューラ制御位置解決処理503において決定されている。クリティカルセクションであれば、スケジューラ制御開始コードを当該ステートメントの直前へ、スケジューラ制御終了コードを直後へ挿入する(5052、5053)。   Whether or not the statement should be a critical section is determined in the scheduler control position resolution processing 503. If it is a critical section, the scheduler control start code is inserted immediately before the statement, and the scheduler control end code is inserted immediately after (5052, 5053).

スケジューラ制御開始コード及びスケジューラ制御終了コードは、スケジューラ制御手段選択処理504で選択されたコードが挿入される。図12に、スケジューラ制御コード挿入変換処理505がクリティカルセクションを実現するスケジューラ制御コードを挿入した場合の、資源予約プログラムソースの1つの例を示す。   As the scheduler control start code and the scheduler control end code, the code selected in the scheduler control means selection process 504 is inserted. FIG. 12 shows an example of a resource reservation program source when the scheduler control code insertion conversion process 505 inserts a scheduler control code for realizing a critical section.

図12では、プログラムソース510において、550、551のクリティカルセクションが決定されているものとする。本発明のプログラム変換装置50によって出力された資源予約プログラムソース540には、スケジューラ制御開始コードとして、割り込み禁止のためのcli()関数(5400、5402)、スケジューラ制御終了コードとして、割り込み許可のためのsti() 関数(5401、5403)が挿入されている。割り込み禁止から許可までの区間では、他のプロセスからの割り込みは禁止され、資源予約プログラムのプロセスが、CPU を占有して処理することができる。   In FIG. 12, it is assumed that critical sections 550 and 551 are determined in the program source 510. The resource reservation program source 540 output by the program conversion apparatus 50 of the present invention includes a cli () function (5400, 5402) for disabling interrupts as a scheduler control start code, and an interrupt permission as a scheduler control end code. The sti () function (5401, 5403) is inserted. In the interval from interrupt disable to enable, interrupts from other processes are prohibited, and the resource reservation program process can occupy the CPU and process it.

一方、当該ステートメントにリリースセクションを挿入すると判定された場合(5051)についても、スケジューラ制御開始コードが当該ステートメントの直前へ、スケジューラ制御終了コードが直後へ挿入される(5052、5053)。図13に、スケジューラ制御コード挿入変換処理505がリリースセクションを実現するスケジューラ制御コードを挿入した場合の、資源予約プログラムソースの1つの例を示す。   On the other hand, also when it is determined that the release section is inserted into the statement (5051), the scheduler control start code is inserted immediately before the statement, and the scheduler control end code is inserted immediately after (5052, 5053). FIG. 13 shows an example of a resource reservation program source when the scheduler control code insertion conversion process 505 inserts a scheduler control code for realizing a release section.

図13では、プログラムソース510において、552のリリースセクションが決定されているものとする。本発明のプログラム変換装置50によって、出力された資源予約プログラムソース540には、スケジューラ制御コードとして、CPU資源を解放するためのsleep()関数(5404)が挿入されている。   In FIG. 13, it is assumed that 552 release sections have been determined in the program source 510. In the resource reservation program source 540 output by the program conversion apparatus 50 of the present invention, a sleep () function (5404) for releasing CPU resources is inserted as a scheduler control code.

また、解放時間として、sleep()関数の引数に10msが与えられている。CPU資源が解放されている区間では、解放時間が経過するまでは、資源予約プログラムのプロセスは処理を進まない事になる。図11に示すスケジューラ制御コード挿入変換処理は、すべてのクリティカルセクション及びリリースセクションを挿入するまで繰り返される。   Also, 10ms is given to the argument of sleep () function as the release time. In the section where the CPU resource is released, the process of the resource reservation program does not proceed until the release time elapses. The scheduler control code insertion conversion process shown in FIG. 11 is repeated until all critical sections and release sections are inserted.

図14に示すように、図11に示したスケジューラ制御コード挿入変換処理505では、ガード条件と共にスケジューラ制御開始コード及びスケジューラ制御終了コードを挿入しても良い。以下に詳細に説明する。   As shown in FIG. 14, in the scheduler control code insertion conversion process 505 shown in FIG. 11, a scheduler control start code and a scheduler control end code may be inserted together with the guard condition. This will be described in detail below.

図11と同様に、プログラムソースからステートメントを読み込み(5055)、ステートメントがクリティカルセクションかどうかを判定する(5056)。次に、ガード条件を挿入するかどうかを判定し(5057)、挿入する場合、スケジューラ制御開始コード及びスケジューラ制御終了コードへ予定処理時間と共に付加する(5058)。   As in FIG. 11, a statement is read from the program source (5055), and it is determined whether the statement is a critical section (5056). Next, it is determined whether or not a guard condition is to be inserted (5057), and if it is to be inserted, it is added to the scheduler control start code and scheduler control end code along with the scheduled processing time (5058).

ガード条件は、スケジューラ制御開始コード及びスケジューラ制御終了コードの直前に付加され、直後のステートメントをクリティカルセクションやリリースセクションにすべきか否かを検査するためのコードである。   The guard condition is a code that is added immediately before the scheduler control start code and the scheduler control end code, and for checking whether the immediately following statement should be a critical section or a release section.

スケジューラ制御位置解決処部503にて、クリティカルセクション及びリリースセクションと、リリースセクションの開放時間が決定しているため、すべてのステートメントに関する時間要求の対象区間における予定処理時間は判明しているものとする。こうして、ガード条件を付加したスケジューラ制御開始コード及びスケジューラ制御終了コードが当該ステートメントの前後へ挿入される(5059、5060)。   Since the scheduler control position resolution processing unit 503 determines the release time of the critical section, the release section, and the release section, it is assumed that the scheduled processing time in the target section of the time request for all statements is known. . Thus, the scheduler control start code and scheduler control end code to which the guard condition is added are inserted before and after the statement (5059, 5060).

ガード条件が付加されたスケジューラ制御開始コード及びスケジューラ制御終了コードは、実行時に予定処理時間と実際の処理時間を比較し、スケジューラ制御を開始すべきか否か、終了すべきか否かを判定する。   The scheduler control start code and the scheduler control end code to which the guard condition is added compare the scheduled processing time with the actual processing time at the time of execution, and determine whether the scheduler control should be started or not.

ガード条件での処理は図15、図16に示した処理フローにしたがって行われる。図15は、クリティカルセクションにおけるガード条件での処理を示している。まず、ガード条件が適用されるステートメントの予定開始・終了時間を取得し(5062)、実際の経過時間を取得する(5063)。経過時間と予定開始時間を比較する(5064)。   The processing under the guard condition is performed according to the processing flow shown in FIGS. FIG. 15 shows the processing under the guard condition in the critical section. First, the scheduled start / end time of the statement to which the guard condition is applied is acquired (5062), and the actual elapsed time is acquired (5063). The elapsed time is compared with the scheduled start time (5064).

予定時間よりも進捗が進んでいる場合、当該ステートメントをクリティカルセクションにすべきか否かの判定を行う。判定は、当該ステートメントの遅延時間、即ち平時の処理時間とクリティカルセクション時の処理時間の差分、を経過時間に足し合わせた時間と予定終了時間との比較で行う(5065)。   If progress is ahead of the scheduled time, determine whether the statement should be a critical section. The determination is made by comparing the delay time of the statement, that is, the difference between the processing time at the normal time and the processing time at the critical section, with the elapsed time and the scheduled end time (5065).

つまり、当該ステートメントをクリティカルセクションに設定しないで、予定終了時間に間に合うようであれば、スケジューラ制御コードをスキップする(5067)。さもなければ、スケジューラ制御コードを実行する(5066)。   That is, if the statement is not set as a critical section and the scheduled end time is met, the scheduler control code is skipped (5067). Otherwise, the scheduler control code is executed (5066).

一方、図16は、リリースセクションいおけるガード条件での処理を示している。同様に、ガード条件が適用されるステートメントの予定開始時間を取得し(5068)、実際の経過時間を取得する(5069)。経過時間と予定開始時間を比較し(5070)、その差分を CPU の解放時間に設定しなおす(5071、5072)。その後、スケジューラ制御コードを実行する(5073)。   On the other hand, FIG. 16 shows processing under guard conditions in the release section. Similarly, the scheduled start time of the statement to which the guard condition is applied is acquired (5068), and the actual elapsed time is acquired (5069). The elapsed time and the scheduled start time are compared (5070), and the difference is reset to the CPU release time (5071, 5072). Thereafter, the scheduler control code is executed (5073).

ここまで、本発明を図面に示した実施の形態に基づいて説明してきたが、本発明は図面に示した実施の形態に限定されるものでなく、各部の機能を上述してきたようなプログラムを実行させることにより達成することができる。また、この場合、プログラムが記録された記録媒体として提供することも可能である。   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.

プログラム変換装置が組み込まれたシステムの実施例を示した図である。It is the figure which showed the Example of the system with which the program conversion apparatus was integrated. プログラムソースから資源予約プログラムソースへの変換を示した図である。It is the figure which showed conversion from a program source to a resource reservation program source. プログラム変換装置の1つの実施の形態を示した図である。It is the figure which showed one embodiment of the program conversion apparatus. 時間要求コード及び対象区間コードの1つの記述例を示した図である。It is the figure which showed one description example of the time request code and the object section code. 時間コード及び区間コード取得部501の処理フローを示した図である。FIG. 10 is a diagram illustrating a processing flow of a time code and section code acquisition unit 501. 時間コード及び区間コード取得部501で保持する時間要求コード及び対象区間コードの1つの構造例を示した図である。It is the figure which showed one structural example of the time request code and the object area code which the time code and area code acquisition part 501 hold | maintains. 実行プロファイル取得部502の処理フローを示した図である。FIG. 6 is a diagram illustrating a processing flow of an execution profile acquisition unit 502. 実行プロファイル取得部502で保持する実行プロファイル情報の1つの構造例を示した図である。6 is a diagram illustrating an example of a structure of execution profile information held by an execution profile acquisition unit 502. FIG. スケジューラ制御位置解決部503の処理フローを示した図である。It is the figure which showed the processing flow of the scheduler control position resolution part 503. スケジューラ制御手段選択部504の処理フローを示した図である。FIG. 5 is a diagram showing a processing flow of a scheduler control means selection unit 504. スケジューラ制御コード挿入変換部505の処理フローを示した図である。It is the figure which showed the processing flow of the scheduler control code insertion conversion part. 本発明のプログラム変換装置が変換する資源予約プログラムソースのクリティカルセクションを実現するコードの1つの例を示した図である。It is the figure which showed one example of the code | cord | chord which implement | achieves the critical section of the resource reservation program source which the program conversion apparatus of this invention converts. 本発明のプログラム変換装置が変換する資源予約プログラムソースのリリースセクションを実現するコードの1つの例を示した図である。It is the figure which showed one example of the code | cord | chord which implement | achieves the release section of the resource reservation program source which the program conversion apparatus of this invention converts. スケジューラ制御コード挿入変換部505の処理フローの別の形態を示した図である。It is the figure which showed another form of the processing flow of the scheduler control code insertion conversion part. 資源予約プログラムソース中のクリティカルセクションにおけるガード条件の処理を示した図である。It is the figure which showed the process of the guard condition in the critical section in a resource reservation program source. 資源予約プログラムソース中のリリースセクションにおけるガード条件の処理を示した図である。It is the figure which showed the process of the guard condition in the release section in a resource reservation program source.

符号の説明Explanation of symbols

10…システム、20…リモートコントローラ、30…デジタル放送アンテナ、40…表示装置、50…プログラム変換装置、501…時間及び区間コード取得部、502…実行プロファイル取得部、503…スケジューラ制御位置解決部、504…スケジューラ制御手段選択部、505…スケジューラ制御コード挿入変換部、51、510…プログラムソース、52…時間要求コード及び対象区間コード、520…時間要求コード、521…対象区間コード、522…時間要求コード及び対象区間コードの構造例、53…実行プロファイル情報、530…実行プロファイル情報の構造例、54、540…資源予約プログラムソース、55、550、551…クリティカルセクション、552…リリースセクション、60…デジタル放送受信機、61…記憶装置、62…プロセッサ、63…信号受信部、64…デジタル放送チューナー、65…デジタル放送受信機ソフトウェア、651…リモートコントローラプロセス、652…チューナープロセス、653…描画プロセス、654…電子番組ガイドプロセス、655…データ放送ブラウズプロセス   DESCRIPTION OF SYMBOLS 10 ... System, 20 ... Remote controller, 30 ... Digital broadcasting antenna, 40 ... Display apparatus, 50 ... Program conversion apparatus, 501 ... Time and section code acquisition part, 502 ... Execution profile acquisition part, 503 ... Scheduler control position resolution part, 504 ... Scheduler control means selection unit, 505 ... Scheduler control code insertion conversion unit, 51, 510 ... Program source, 52 ... Time request code and target section code, 520 ... Time request code, 521 ... Target section code, 522 ... Time request Code and target section code structure example, 53 ... execution profile information, 530 ... execution profile information structure example, 54,540 ... resource reservation program source, 55,550,551, critical section, 552 ... release section, 60 ... digital Broadcast reception , 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 (6)

プリエンプティブなマルチタスクOS上で実行されるプログラムのコードを変換するプログラム変換装置であって、
前記プログラムを記憶する記憶部と、
前記プログラムに対して処理の区間ごとに処理時間要求を設定する記録部と、
前記プログラムの実行プロファイル情報を記録する記録部と、
前記記録部に記録された情報の基づいて、前記プログラムの所定区間ごとに当該区間がクリティカルセクション(資源占有区間)であるかリリースセクション(資源解放区間)であるかを判定し、判定結果により前記マルチタスクOSのスケジューラ制御コードを前記プログラムの所定区間ごとに挿入するスケジューラ制御コードの挿入処理部と、
前記挿入処理部によりスケジューラ制御コードが挿入されたプログラムを記憶する記憶部と、
を備えたことを特徴とするプログラム変換装置。
A program conversion device for converting code of a program executed on a preemptive multitasking OS,
A storage unit for storing the program;
A recording unit for setting a processing time request for each section of processing for the program;
A recording unit for recording execution profile information of the program;
Based on the information recorded in the recording unit, for each predetermined section of the program, it is determined whether the section is a critical section (resource occupying section) or a release section (resource release section). A scheduler control code insertion processing unit for inserting a scheduler control code of a multitask OS for each predetermined section of the program;
A storage unit for storing a program in which a scheduler control code is inserted by the insertion processing unit;
A program conversion apparatus comprising:
プリエンプティブなマルチタスクOS上で実行されるプログラムのコードを変換するプログラム変換装置であって、
前記プログラムを記憶する第1の記憶部と、
前記プログラムに対して処理ステートメントの始点位置と終点位置から成る区間情報ごとに、処理時間の要求値の下限値と上限値を設定する第2の記録部と、
関数ステートメントの平時の処理時間と占有時の処理時間と前記処理時間の差である遅延時間とから成るプログラムの実行プロファイル情報を記録する第3の記録部と、
前記第1の記憶部に記録されたプログラムのステートメント区間ごとに、前記第2の記録部に記録される当該区間の要求処理時間から前記第3の記録を参照して、当該区間がクリティカルセクション(資源占有区間)であるかリリースセクション(資源解放区間)であるかを判定するスケジューラ制御位置解決部と、
前記スケジューラ制御位置解決部によりクリティカルセクションと判定された区間について、マルチタスクOSのスケジューラ制御コードを確定するスケジューラ制御手段選択部と、
クリティカルセクションと判定された区間について、前期第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 recording unit for setting a lower limit value and an upper limit value of a required processing time value for each section information including a start point position and an end point position of a processing statement for the program;
A third recording unit that records execution profile information of a program including a normal processing time of a function statement, a processing time at the time of occupation, and a delay time that is a difference between the processing times;
For each statement section of the program recorded in the first storage unit, the section is referred to as a critical section (refer to the third recording from the request processing time of the section recorded in the second recording unit. A scheduler control position resolution unit that determines whether it is a resource occupying section) or a release section (resource releasing section);
For a section determined as a critical section by the scheduler control position resolution unit, a scheduler control means selection unit for determining a scheduler control code of a multitask OS,
For a section determined to be a critical section, a scheduler control code insertion conversion unit that inserts a scheduler control start code and a scheduler control end code into the program recorded in the first recording unit in the previous period;
A program conversion apparatus comprising:
請求項2に記載のプログラム変換装置において、
前記スケジューラ制御位置解決部は、前記区間の要求処理時間が前記第3の記録を参照して対象区間の平時の処理時間より小さい場合に当該区間はクリティカルセクションと判定し、
前記区間の要求処理時間が前記第3の記録を参照して対象区間の平時の処理時間より大きい場合に当該区間はリリースセクションと判定することを特徴とするプログラム変換装置。
The program conversion apparatus according to claim 2, wherein
The scheduler control position resolution unit determines that the section is a critical section when the requested processing time of the section is smaller than the normal processing time of the target section with reference to the third record,
The program conversion apparatus according to claim 1, wherein when the requested processing time of the section is larger than a normal processing time of the target section with reference to the third record, the section is determined as a release section.
請求項2に記載のプログラム変換装置において、
前記スケジューラ制御コード挿入変換部は、スケジューラ制御開始コード及びスケジューラ制御終了コードに割り込み禁止及び許可のための関数を挿入することを特徴とするプログラム変換装置。
The program conversion apparatus according to claim 2, wherein
The scheduler control code insertion conversion unit inserts a function for interrupt prohibition and permission into a scheduler control start code and a scheduler control end code.
請求項2に記載のプログラム変換装置において、
前記スケジューラ制御コード挿入変換部は、スケジューラ制御開始コード及びスケジューラ制御終了コードに優先度増加及び減少のための関数を挿入することを特徴とするプログラム変換装置。
The program conversion apparatus according to claim 2, wherein
The scheduler control code insertion / conversion unit inserts a function for increasing and decreasing priority into a scheduler control start code and a scheduler control end code.
プリエンプティブなマルチタスクOS上で実行されるプログラムのコードを変換するプログラム変換方法であって、
前記プログラムの所定区間ごとの要求処理時間を取得するステップと、
前記ステップで取得した所定区間の要求処理時間と当該区間の平時の処理時間を比較するステップと、
前記プログラムの所定区間の要求処理時間が平時の処理時間より小さいときに当該区間をクリティカルセクションとしてスケジューラ制御コードを前記プログラムに挿入するステップとを有することを特徴とするプログラム変換方法。
A program conversion method for converting code of a program executed on a preemptive multitasking OS,
Obtaining a request processing time for each predetermined section of the program;
Comparing the requested processing time of the predetermined section acquired in the step with the normal processing time of the section;
And a step of inserting a scheduler control code into the program as a critical section when the requested processing time of the predetermined section of the program is smaller than a normal processing time.
JP2008085165A 2008-03-28 2008-03-28 Program conversion device and program conversion method Pending JP2009238051A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008085165A JP2009238051A (en) 2008-03-28 2008-03-28 Program conversion device and program conversion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008085165A JP2009238051A (en) 2008-03-28 2008-03-28 Program conversion device and program conversion method

Publications (1)

Publication Number Publication Date
JP2009238051A true JP2009238051A (en) 2009-10-15

Family

ID=41251887

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008085165A Pending JP2009238051A (en) 2008-03-28 2008-03-28 Program conversion device and program conversion method

Country Status (1)

Country Link
JP (1) JP2009238051A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011180883A (en) * 2010-03-02 2011-09-15 Nippon Steel Corp Program diagnosis device and program diagnosis method
KR20140109970A (en) * 2011-12-30 2014-09-16 비오메리으 Job scheduler for electromechanical system for biological analyses
JP2015204014A (en) * 2014-04-15 2015-11-16 三菱電機株式会社 Software generation method, software generation device, and software execution device
JP2016057798A (en) * 2014-09-09 2016-04-21 三菱電機株式会社 Program embedding device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011180883A (en) * 2010-03-02 2011-09-15 Nippon Steel Corp Program diagnosis device and program diagnosis method
KR20140109970A (en) * 2011-12-30 2014-09-16 비오메리으 Job scheduler for electromechanical system for biological analyses
KR101669919B1 (en) 2011-12-30 2016-11-09 비오메리으 Job scheduler for electromechanical system for biological analyses
JP2015204014A (en) * 2014-04-15 2015-11-16 三菱電機株式会社 Software generation method, software generation device, and software execution device
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
US20110035751A1 (en) Soft Real-Time Load Balancer
JP4170227B2 (en) Executing processing in a multiprocessing environment
TWI512619B (en) Method and system for thread scheduling
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
JP2009541848A (en) Method, system and apparatus for scheduling computer microjobs to run uninterrupted
US20090222830A1 (en) Methods for Multi-Tasking on Media Players
WO2009147802A1 (en) Priority controller and priority control method
US20140052882A1 (en) Latency Sensitive Software Interrupt and 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
KR100959548B1 (en) A method of interrupt scheduling
JP2005165470A (en) Electronic apparatus, and method for controlling processor speed
JP2009238051A (en) Program conversion device and program conversion method
WO2018176507A1 (en) Systems and methods for dynamic low latency optimization
KR20030015234A (en) Method of AND system for withdrawing budget from a blocking task
CN116225728B (en) Task execution method and device based on coroutine, storage medium and electronic equipment
JP6861275B2 (en) Vehicle control unit
KR100848323B1 (en) Method for enhancing real time response in embedded OS kernel
JP5299869B2 (en) Computer micro job
JP2010134494A (en) Program conversion device, conversion method, program control method and program
JP2019079336A (en) Numerical control device
JP2008225641A (en) Computer system, interrupt control method and program
CN114035926A (en) Application thread scheduling method and device, storage medium and electronic equipment
JPH1063515A (en) Scheduling method for multitask control
JP2006004092A (en) Computer system