JP2013200667A - Schedule creating method, and system and program therefor - Google Patents

Schedule creating method, and system and program therefor Download PDF

Info

Publication number
JP2013200667A
JP2013200667A JP2012068034A JP2012068034A JP2013200667A JP 2013200667 A JP2013200667 A JP 2013200667A JP 2012068034 A JP2012068034 A JP 2012068034A JP 2012068034 A JP2012068034 A JP 2012068034A JP 2013200667 A JP2013200667 A JP 2013200667A
Authority
JP
Japan
Prior art keywords
task
layer
tasks
relationship
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2012068034A
Other languages
Japanese (ja)
Other versions
JP5486034B2 (en
Inventor
Kenjiro Yamanaka
顕次郎 山中
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.)
NTT Data Group Corp
Original Assignee
NTT Data Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NTT Data Corp filed Critical NTT Data Corp
Priority to JP2012068034A priority Critical patent/JP5486034B2/en
Publication of JP2013200667A publication Critical patent/JP2013200667A/en
Application granted granted Critical
Publication of JP5486034B2 publication Critical patent/JP5486034B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To create a schedule independent of an execution time of a task.SOLUTION: A schedule creating method includes the steps of: storing a direct precedence relationship and an indirect precedence relationship in precedence relationship storage means; calculating a start time of each task when setting an execution time of each task as one; generating a task arrangement structure having layers that correspond to the respective start times; dividing the layers in the task arrangement structure by the predetermined number of levels; arranging the tasks in an area divided so that each task and its subsequent task are at the same level; identifying the task y that cannot be arranged in the same level as a task subsequent to the task x, and storing the identified task y in event storage means; and creating a schedule on the basis of the task arrangement structure and the event storage means.

Description

本発明は、スケジュール作成方法、そのシステムおよびプログラムに関し、より詳細には、実行時間が特定されない複数のタスクを、そのタスク間の先行関係のみに基づいてスケジューリングする方法、そのシステムおよびプログラムに関する。   The present invention relates to a schedule creation method, a system thereof, and a program, and more particularly, to a method, a system, and a program for scheduling a plurality of tasks whose execution times are not specified based only on a prior relationship between the tasks.

クラウドコンピューティングは次世代のコンピューティング環境として期待を集めている。クラウドサービスを利用すると、システムの実行環境(サーバ、ストレージ、ネットワークなど)の調達・増強・縮退が短時間で可能であり、使った時間だけ利用料を払えばよい。従来、ソフトウェアシステムは、運用時にはごく稀にしか起きないピーク性能を基準に実行環境をサイジングし、その固定的な実行環境を前提に構築されてきた。その結果、低い平均負荷、高い運用コストを招いていた。クラウドでは、必要に応じて実行環境のサイズを変えられるので、運用コストの削減が期待できる。   Cloud computing is expected as a next-generation computing environment. By using cloud services, it is possible to procure, augment, and degenerate system execution environments (servers, storage, networks, etc.) in a short time, and you only have to pay the usage fee for the time you use them. Conventionally, software systems have been built on the premise of a fixed execution environment that is sized based on peak performance that occurs only rarely during operation. As a result, low average load and high operation cost were incurred. In the cloud, the size of the execution environment can be changed as needed, so reduction in operating costs can be expected.

図1に、クラウドコンピューティングの概略図を示す。複数のサーバ101a、101b、・・・、101n(以下、サーバ101と呼ぶ)が、インターネット102を介して、複数のクライアントコンピュータ103a、103b、・・・、103n(以下、クライアントコンピュータ103と呼ぶ)と相互に通信可能に接続される。   FIG. 1 shows a schematic diagram of cloud computing. A plurality of servers 101a, 101b,..., 101n (hereinafter referred to as server 101) are connected to a plurality of client computers 103a, 103b,..., 103n (hereinafter referred to as client computers 103) via the Internet 102. Are connected so that they can communicate with each other.

サーバ101は、利用者に提供するサービスを実現するためのプログラムを格納するメモリを有し、利用者の要求に応答して、ストレージに格納されたプログラムを処理するために必要なデータを用いて、サービスを提供する。   The server 101 has a memory for storing a program for realizing a service provided to the user, and uses data necessary for processing the program stored in the storage in response to a request from the user. Provide services.

クライアントコンピュータ103は、クラウドサービスの利用者によって使用される端末である。利用者は、クライアントコンピュータ103を介して、サーバ101が提供するサービスを、サーバ群を意識することなしに利用する。   The client computer 103 is a terminal used by a cloud service user. The user uses the service provided by the server 101 via the client computer 103 without being aware of the server group.

また、従来、ソフトウェアシステムの開発段階において、マシンリソースの不足が開発スケジュール遅延の原因となることが多かった。例えば、試験工程では、マシンリソースの不足により、多くの期間を費やすこととなる。開発段階においてクラウドコンピューティングを利用することで、マシンリソースに制約されない開発が可能になり、開発期間の短縮、開発費の削減が期待できる。このようにクラウドコンピューティングは、従来のソフトウェアシステムの諸問題を解決できる可能性を秘めている。   Conventionally, in the development stage of a software system, lack of machine resources often causes development schedule delay. For example, in the test process, a lot of time is spent due to lack of machine resources. By using cloud computing at the development stage, development that is not restricted by machine resources becomes possible, and shortening of the development period and reduction of development costs can be expected. In this way, cloud computing has the potential to solve problems of conventional software systems.

クラウドコンピューティングには課題もある。一般に、ソフトウェアシステムは、機能要求に加えて、性能要求も満たす必要がある。従来、固定された実行環境において性能試験を行うことにより、一定の性能を保証してきた。従来型システムでは、実際に運用される実行環境が固定されるので、同実行環境における試験結果が、運用時に成り立つと類推可能だからである。一方、クラウドサービスでは、ベストエフォートで実行環境を提供する。   Cloud computing also has challenges. In general, a software system needs to satisfy performance requirements in addition to function requirements. Conventionally, a constant performance has been guaranteed by performing a performance test in a fixed execution environment. This is because in the conventional system, the execution environment actually operated is fixed, so that it can be inferred that the test result in the execution environment holds at the time of operation. On the other hand, the cloud service provides an execution environment at best effort.

ベストエフォート型では、例えば、CPUのクロック数に関して、あるユーザーがCPU負荷の高いプログラムを実行すると、同一環境を利用する別のユーザーの性能は劣化する。また、ストレージに関して、あるユーザーがストレージに過剰な負荷をかける大量のトランザクションを処理すると、同様に、同一環境を利用する別のユーザーのI/O性能は劣化する。ネットワークに関しても同様である。これでは、実行環境を特定することができず、従って、性能試験の結果が運用時にも成り立つとの類推はできない。   In the best effort type, for example, when a user executes a program with a high CPU load with respect to the number of clocks of the CPU, the performance of another user who uses the same environment deteriorates. Further, regarding a storage, when a certain user processes a large number of transactions that place an excessive load on the storage, similarly, the I / O performance of another user who uses the same environment deteriorates. The same applies to the network. In this case, the execution environment cannot be specified, and therefore it cannot be inferred that the result of the performance test is valid even during operation.

このような問題を解決するため、本件出願人は、実行環境を固定できないクラウドコンピューティングにおいて、システムとしての性能(スループット)を保証する手段を提供することに成功した。システムとしての性能を保証するために、当該技術では、タイマーにより、定められた一定の処理を実行し、それが終了すると、次にタイマーにより駆動されるまで休むよう動作するクロック駆動プログラミング(CDP)のプログラムを処理する。高速マシンを使うと、実行時間は減少するが、その分休止時間が増える。低速マシンを使うと、実行時間が増加し、その分休止時間が減少する。すなわち、高速マシンおよび低速マシンのいずれを用いても、時間当たりの実行ステップ数は同じになる。従って、性能(スループット)はハードウェアには依存せずに同一になる。   In order to solve such a problem, the present applicant has succeeded in providing a means for guaranteeing the performance (throughput) as a system in cloud computing in which the execution environment cannot be fixed. In order to guarantee the performance of the system, in the art, a predetermined process is performed by a timer, and when it is completed, the clock-driven programming (CDP) operates so as to rest until it is driven by the timer. Process the program. Using a high-speed machine reduces the execution time, but increases the pause time accordingly. If you use a slow machine, the execution time increases and the pause time decreases accordingly. That is, the number of execution steps per hour is the same regardless of whether a high-speed machine or a low-speed machine is used. Therefore, the performance (throughput) is the same regardless of hardware.

ただし、周期Tを保ってプログラムを実行するために、以下の式で示されるデューティ率(D)は1未満である必要がある。τは実行時間である。   However, in order to execute the program while maintaining the period T, the duty ratio (D) expressed by the following formula needs to be less than 1. τ is the execution time.

Figure 2013200667
Figure 2013200667

複数のタスクをどの時刻でどのCPUにより実行するかを決定する従来のスケジューリング方法では、タスク間の先行関係、各タスクの実行時間、リソース数(CPU数)を特定し、リソース数の制約のもとで実行時間が最小となるスケジュールを作成することを目的としていた。   In a conventional scheduling method that determines which CPU executes a plurality of tasks at which time, the prior relationship between tasks, the execution time of each task, the number of resources (number of CPUs) are specified, and the number of resources is limited. The purpose was to create a schedule that would minimize execution time.

この方法では、まず第1に、タスクの実行時間が変わるたびに、スケジュールを再作成する必要があった。タスクの実行時間は、CPUのスペック(アーキテクチャ、クロック周波数、キャッシュサイズなど)に応じて変化する。今日、CPUのスペックは多種多様である。そのため、CPUのスペック毎に対応するスケジュールを作成する従来の方法では、多種多様なCPUをサポートすることは困難である。   In this method, firstly, it is necessary to re-create a schedule every time the execution time of a task changes. The task execution time varies depending on CPU specifications (architecture, clock frequency, cache size, etc.). Today, CPU specifications vary widely. Therefore, it is difficult to support a wide variety of CPUs with the conventional method for creating a schedule corresponding to each CPU specification.

また、第2に、リソース数に制約を設けることに疑問がもたれる。今日一般的に普及しているマルチコア環境では、CPU数を自由に増やすことができる。例えば、デスクトップコンピュータでは6コアや8コア、サーバコンピュータでは数十コアを容易に搭載し得る。このような技術進歩を考慮すると、もはや、リソース数は決定的な制約とはなりえない。   Secondly, there is a question about setting restrictions on the number of resources. In a multi-core environment that is generally popular today, the number of CPUs can be increased freely. For example, 6 or 8 cores can be easily installed in a desktop computer, and several tens of cores can be easily installed in a server computer. Considering such technological advances, the number of resources can no longer be a critical constraint.

さらに、第3に、実行時間が特定されない場合には、利用することができない。前述のCDPは、特に、実行環境を固定できないクラウドコンピューティングにおいて効果を発揮する。しかし、CPUの性能など、クラウドコンピューティングの実行環境により実行時間が変わるので、実行時間を特定することはできない。   Third, it cannot be used when the execution time is not specified. The aforementioned CDP is particularly effective in cloud computing where the execution environment cannot be fixed. However, since the execution time varies depending on the execution environment of the cloud computing such as the performance of the CPU, the execution time cannot be specified.

本発明は、このような問題に鑑みてなされたもので、その目的とするところは、実行時間が特定されない複数のタスクを、そのタスク間の先行関係のみに基づいてスケジューリングする手段を提供することにある。   The present invention has been made in view of such problems, and an object of the present invention is to provide means for scheduling a plurality of tasks whose execution times are not specified based only on the preceding relationship between the tasks. It is in.

上記の課題を解決するために、本発明に係るスケジュール作成方法は、先行タスク、後続タスク、先行関係タイプを格納する閉包先行関係記憶手段と、先行タスク、後続タスク、先行関係タイプを格納する縮退先行関係記憶手段と、通知タスク、待機タスク、イベント識別子を格納するイベント記憶手段とを備えたシステムにおいて、前記システムの先行関係管理手段が、スケジュール作成対象のプログラムのタスク間の先行関係データを受信するステップと、前記先行関係管理手段が、前記先行関係データに含まれる直接の先行関係および間接の先行関係に基づいて、前記受信した先行関係データの推移閉包を前記閉包先行関係記憶手段に、および前記受信した先行関係データの推移縮退を前記縮退先行関係記憶手段に記憶するステップと、前記システムのタスク配置手段が、前記縮退先行関係記憶手段に記録された先行関係に対し、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの開始時間を算出するステップと、前記タスク配置手段が、前記算出した開始時間に基づいて、各開始時間およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成するステップと、前記タスク配置手段が、レイヤ1をレイヤ1内に存在するタスク数のレベルで分割し、分割した領域にタスクを配置するステップと、前記タスク配置手段が、レイヤLにレイヤ2をセットするステップと、前記タスク配置手段が、前記レイヤLが前記フィニッシュ時間に対応するレイヤtであるか否か判定するステップであって、レイヤtである場合、前記タスク配置構造体および前記イベント記憶手段に基づいて、スケジュールを作成し、レイヤtでない場合、後続のステップを続けるステップと、前記タスク配置手段が、前記レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にするステップと、前記タスク配置手段が、前記閉包先行関係記憶手段に基づいて、前記レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定するステップと、前記タスク配置手段が、グラフの最大マッチングアルゴリズムを用いて、前記レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得するステップと、前記タスク配置手段が、前記最大マッチングのマッチング数が前記レイヤL−1内のタスク数より少ない場合、最大マッチングのマッチング数が前記レイヤL−1内のタスク数と一致するまで、マッチング数とタスク数の差の数、前記レイヤLおよび前記レイヤL−1に空タスクを生成し、空タスクを配置するために新たなレベルの領域を作成し、前記後続タスク候補の集合を判定するステップ、および前記最大マッチングを取得するステップを繰り返す、ステップと、前記タスク配置手段が、前記レイヤLを当該レイヤ内に存在するタスク数のレベルで分割し、前記レイヤL−1内の各タスクとその後続タスクとが、同一レベルになるように分割した領域にタスクを配置するステップと、前記システムのイベント識別手段が、前記レイヤL−1内のタスクxの後続として前記レイヤL内に配置できなかったタスクyを識別し、前記イベント記憶手段に記憶するステップと、前記タスク配置手段が、前記レイヤLにレイヤL+1をセットし、前記レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定するステップに戻る、ステップとを含むことを特徴とする。   In order to solve the above-described problem, the schedule creation method according to the present invention includes a closed preceding relationship storage unit that stores a preceding task, a succeeding task, and a preceding relationship type, and a degeneration that stores the preceding task, the succeeding task, and the preceding relationship type. In a system comprising a prior relationship storage means and an event storage means for storing a notification task, a standby task, and an event identifier, the prior relationship management means of the system receives the prior relationship data between tasks of the program to be scheduled And the preceding relationship management means, based on the direct preceding relationship and the indirect preceding relationship included in the preceding relationship data, transition closure of the received preceding relationship data in the closure preceding relationship storage means, and Storing the transition reduction of the received preceding relation data in the reduction preceding relation storage means; The task placement unit of the system calculates the start time of each task when the execution time of each task is set to 1 using PERT analysis for the preceding relationship recorded in the degenerate precedence relationship storage unit The task placement means generates a task placement structure having a layer corresponding to each start time and finish time based on the calculated start time, and the task placement means converts layer 1 to layer 1 And dividing the task at the level of the number of tasks existing therein, placing the task in the divided area, the step of placing the task in the layer L, and the step of placing the task in the layer L A step of determining whether or not the layer t corresponds to the finish time, and in the case of the layer t, the task placement structure And creating a schedule based on the event storage means, and if not a layer t, the step of continuing the subsequent steps and the task placement means compare the number of tasks in the layer L and the layer L-1, When the number of tasks in one of the layers is less than the number of tasks in the other layer, a step of generating an empty task to make the number of tasks in both layers the same, and the task placement means includes the closure precedence relationship A step of determining a set of tasks (subsequent task candidates) in the layer L that can be subsequent to each task in the layer L-1 based on the storage means; Obtaining a maximum matching for each task in the layer L-1 and its subsequent tasks using an algorithm; and In the case where the number of matching of the maximum matching is less than the number of tasks in the layer L-1, the placement unit determines whether the number of matching and the number of tasks are increased until the matching number of the maximum matching matches the number of tasks in the layer L-1. Generating empty tasks in the layer L and the layer L-1, creating a new level area to place empty tasks, determining the set of subsequent task candidates, and the maximum Repeating the step of obtaining matching, and the task placement means divides the layer L at the level of the number of tasks existing in the layer, and each task in the layer L-1 and its subsequent task are A task is arranged in an area divided so as to be at the same level, and an event identification means of the system includes a task in the layer L-1. Identifying the task y that could not be placed in the layer L as a successor of the queue x and storing it in the event storage means; the task placement means sets layer L + 1 to the layer L; And returning to the step of determining whether or not the layer is a layer t corresponding to the finish time.

本発明により、タスクの実行時間に依存しないスケジュールを作成することができる。そのため、タスクの実行時間が変わっても、スケジュールを再作成する必要はなくなる。また、得られるスケジュールは、いずれの実行環境においても、最小時間での実行を保障することができる。   According to the present invention, a schedule independent of task execution time can be created. Therefore, it is not necessary to recreate the schedule even if the task execution time changes. Moreover, the schedule obtained can guarantee execution in the minimum time in any execution environment.

さらに、本発明で導かれるスケジュールにより、最小時間で実行するための最少リソース数を得ることができる。最少リソース数を知ることにより、不必要なリソースを維持する不利益を回避することができる。   Furthermore, the schedule derived in the present invention can obtain the minimum number of resources to be executed in the minimum time. Knowing the minimum number of resources can avoid the disadvantage of maintaining unnecessary resources.

クラウドコンピューティングの概略図である。1 is a schematic diagram of cloud computing. FIG. 本発明の一実施形態に係るタスクのプログラム記述例を示す図である。It is a figure which shows the example of a program description of the task which concerns on one Embodiment of this invention. 本発明の一実施形態に係る別のタスクを利用するタスクのプログラム記述例を示す図である。It is a figure which shows the example of a program description of the task which utilizes another task which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク配列のプログラム記述例を示す図である。It is a figure which shows the example of a program description of the task arrangement | sequence which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスクのコールグラフを示す図である。It is a figure which shows the call graph of the task which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスクのPERT図である。It is a PERT figure of the task concerning one embodiment of the present invention. 本発明の一実施形態に係るタスクのコールグラフを示す図である。It is a figure which shows the call graph of the task which concerns on one Embodiment of this invention. ポーリングを用いたタスクのプログラム記述例を示す。An example of program description of a task using polling is shown. ポーリングを用いたタスクのプログラム記述例を示す。An example of program description of a task using polling is shown. 本発明の一実施形態に係るタスクのPERT図である。It is a PERT figure of the task concerning one embodiment of the present invention. 本発明の一実施形態に係るタスク間の先行関係を示す先行関係表である。It is a precedence relation table which shows precedence relation between tasks concerning one embodiment of the present invention. 変数リネーム技法を適用する前のプログラム記述例を示す図である。It is a figure which shows the example of a program description before applying a variable rename technique. 変数リネーム技法を適用する後のプログラム記述例を示す図である。It is a figure which shows the example of a program description after applying a variable rename technique. 個別化技法を適用する前後のコールグラフを示す図である。It is a figure which shows the call graph before and behind applying an individualization technique. 抽選化技法を適用したタスクのプログラム記述例を示す図である。It is a figure which shows the example of a program description of the task to which the lottery technique is applied. 抽選化技法を適用したタスクのプログラム記述例を示す図である。It is a figure which shows the example of a program description of the task to which the lottery technique is applied. 本発明の一実施形態に係るタスクのPERT図である。It is a PERT figure of the task concerning one embodiment of the present invention. 本発明の一実施形態に係るタスクを実行するプログラム記述例を示す図である。It is a figure which shows the example of a program description which performs the task which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスクを実行するプログラム記述例を示す図である。It is a figure which shows the example of a program description which performs the task which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスクを並列実行するシーケンス図である。It is a sequence diagram which performs the task which concerns on one Embodiment of this invention in parallel. 本発明の一実施形態に係るスケジュール作成システムの構成を示すブロック図である。It is a block diagram which shows the structure of the schedule creation system which concerns on one Embodiment of this invention. 本発明の一実施形態に係る閉包先行関係記憶手段に格納された情報の一例を示す図である。It is a figure which shows an example of the information stored in the closure precedence relationship memory | storage means which concerns on one Embodiment of this invention. 本発明の一実施形態に係る縮退先行関係記憶手段に格納された情報の一例を示す図である。It is a figure which shows an example of the information stored in the degeneracy precedence relationship memory | storage means which concerns on one Embodiment of this invention. 本発明の一実施形態に係るイベント記憶手段に格納された情報の一例を示す図である。It is a figure which shows an example of the information stored in the event memory | storage means which concerns on one Embodiment of this invention. 本発明の一実施形態に係るスケジュールを作成する工程を示すフローチャートである。It is a flowchart which shows the process of producing the schedule which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスクのPERT図である。It is a PERT figure of the task concerning one embodiment of the present invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るタスク構造体に配置されているPERT図のイメージ図である。It is an image figure of the PERT figure arrange | positioned at the task structure which concerns on one Embodiment of this invention. 本発明の一実施形態に係るスケジュールを作成する工程を示すフローチャートである。It is a flowchart which shows the process of producing the schedule which concerns on one Embodiment of this invention.

(CDPプログラム)
初めに、CDPプログラムについて説明する。CDPは、イベント駆動プログラミング(EDP)の一部である。従って、CDPは、EDPをサポートする任意のプログラミング言語、およびOSで実践できる。本実施形態では、C言語、およびWindows(登録商標)を用いるが、これに限定されるものではない。
(CDP program)
First, the CDP program will be described. CDP is part of Event Driven Programming (EDP). Thus, CDP can be practiced with any programming language and OS that supports EDP. In this embodiment, C language and Windows (registered trademark) are used, but the present invention is not limited to this.

CDPとEDPとの違いは、イベントハンドラーの使い方にある。EDPでは、任意の数のタイマーを利用することができるのに対し、CDPでは、タイマーイベントハンドラーを提供するタイマーを、必ず1つ利用することが要求される。   The difference between CDP and EDP is in the use of event handlers. In EDP, an arbitrary number of timers can be used, whereas in CDP, it is required to always use one timer that provides a timer event handler.

また、EDPでは、タイマーイベントハンドラーを含むすべてのイベントハンドラーにおいて、イベントに対応する処理を行う。一方、CDPでは、タイマーイベントハンドラー以外のイベントハンドラーにおいて、状態を示すフラグをセットすることにより、イベントの発生を記録するのみで、イベントに対応する処理は、ここでは行わない。CDPでは、タイマーイベントハンドラーにおいて、状態を示すフラグに基づいて、イベントの発生に対応するタスクを実行する。   In EDP, processing corresponding to an event is performed in all event handlers including a timer event handler. On the other hand, in CDP, in the event handlers other than the timer event handler, by setting a flag indicating the state, only the occurrence of the event is recorded, and the processing corresponding to the event is not performed here. In CDP, a timer event handler executes a task corresponding to the occurrence of an event based on a flag indicating a state.

CDPプログラムは、以下の手順で作成される。1)タスクを洗い出し、記述する。2)タスク間の先行関係を把握し、PERT図を作成する。3)PERT図によって与えられた先行関係の制約を満たすスケジュールを作成する。タスクの記述、PERT図の作成、スケジュールの作成を順に説明する。   The CDP program is created by the following procedure. 1) Identify and describe the task. 2) Understand the prior relationship between tasks and create a PERT diagram. 3) Create a schedule that satisfies the precedence relationship given by the PERT diagram. Task description, PERT diagram creation, and schedule creation will be described in this order.

(タスクの記述)
CDPのタスクを、図2のプログラム記述例に基づいて説明する。CDPのタスクは、以下の要素を用いて定義される。
内部変数:ステート間で値を引継ぐために使用する1以上の変数
インタフェース関数:内部変数を他のタスクが参照または更新するための0以上の関数
リセット関数:内部変数を初期化するための関数
タスク本体関数:タイマーイベントハンドラーによって呼び出される関数
(Task description)
The CDP task will be described based on the program description example of FIG. CDP tasks are defined using the following elements:
Internal variable: One or more variable interface functions used to take over values between states: Zero or more function reset functions for other tasks to reference or update internal variables Function: Function task body for initializing internal variables Function: Function called by timer event handler

CDPのタスクは、状態により、実行する動作が変化するステートマシンである。ステート間で値を引継ぐために、内部変数を用いる。図2の例では、行番号L5に、taskA_data_t構造体型の内部変数taskA_dataが定義されている。なお、taskA_data_t構造体型は、同図の行番号L2からL4により示されるように、taskA_state_t列挙型の変数state、int型のx、y、resultをメンバとして含む。   The CDP task is a state machine whose operation to be executed changes depending on the state. Use internal variables to transfer values between states. In the example of FIG. 2, an internal variable taskA_data of the taskA_data_t structure type is defined at line number L5. Note that the taskA_data_t structure type includes, as members, taskA_state_t enumerated variable state, int type x, y, and result, as indicated by line numbers L2 to L4 in FIG.

CDPのタスクは、前述の内部変数を他のタスクが参照または更新するためのインタフェース関数を必要に応じて定義する。図2の例では、行番号L13からL31で定義されるcalcメソッド、行番号L33からL43で定義されるget_resultメソッドがインタフェース関数である。calcメソッドは、図2に記述されるTaskAに処理を要求するための関数、get_resultメソッドは、処理結果を要求するための関数である。   The CDP task defines an interface function for other tasks to refer to or update the internal variables as necessary. In the example of FIG. 2, the calc method defined by line numbers L13 to L31 and the get_result method defined by line numbers L33 to L43 are interface functions. The calc method is a function for requesting processing to TaskA described in FIG. 2, and the get_result method is a function for requesting a processing result.

CDPのタスクはまた、内部変数を初期化するためのリセット関数を定義する。図2の例では、行番号L45からL48で定義されるtaskA_RSTメソッドがリセット関数である。本実施形態では、リセット関数において内部変数taskA_dataのメンバ変数stateを初期化している。   The CDP task also defines a reset function to initialize internal variables. In the example of FIG. 2, the taskA_RST method defined by line numbers L45 to L48 is a reset function. In this embodiment, the member variable state of the internal variable taskA_data is initialized in the reset function.

そして、CDPのタスクは、タイマーイベントハンドラーによって呼び出されるタスク本体関数を定義する。図2の例では、行番号L50からL84で定義されるtaskA_CLKメソッドがタスク本体関数である。図2に示されるように、タスク本体関数は、taskA_data.stateの値に従って計算を実行する。stateがcalc1の場合、F(x)を計算する。ここで、関数Fは、行番号L11で定義されるように、標準ライブラリなどの他のモジュールで定義される外部関数である。stateがcalc2の場合、定数LIMITを上限として、F(x)yを計算する。 The CDP task defines a task body function called by the timer event handler. In the example of FIG. 2, the taskA_CLK method defined by line numbers L50 to L84 is a task body function. As shown in FIG. 2, the task body function executes calculation according to the value of taskA_data.state. When state is calc1, F (x) is calculated. Here, the function F is an external function defined in another module such as a standard library, as defined by the line number L11. When state is calc2, F (x) y is calculated with the constant LIMIT as the upper limit.

ここで、タスクの実行時間は、タイマーの周期より短い必要がある。そのため、タスクは次の2つの要求を満たす必要がある。1)タスクは、実行ステップの上限を有する。2)タスクの各ステートメントは、実行時間の上限を有する。   Here, the task execution time needs to be shorter than the timer period. Therefore, the task needs to satisfy the following two requirements. 1) A task has an upper limit of execution steps. 2) Each statement of a task has an upper limit on execution time.

要求1)を満たすために、各関数は、構文的に停止性が保証される形で書く。すなわち、選択(if then else)および順次(;) の組み合わせに展開可能となるように記述する。ループに関しては、反復回数に上限があるものだけが記述可能であり、実行時に反復回数が決まるループを書くことは許されない。不定回数のループは、図2のtaskA_CLKメソッドのように、固定回数のループを周期的に実行することにより実現する。この場合、選択(if then else)によりステップ数は変化するが、1周期で実行されるステップ数には上限が存在するので、要求1)が満たされる。   In order to satisfy the requirement 1), each function is written in a form that syntactically guarantees termination. That is, it is described so that it can be expanded into a combination of selection (if then else) and sequential (;). Regarding loops, only loops with an upper limit on the number of iterations can be described, and it is not allowed to write a loop whose number of iterations is determined at execution time. The indefinite number of loops is realized by periodically executing a fixed number of loops as in the taskA_CLK method of FIG. In this case, although the number of steps varies depending on the selection (if then else), there is an upper limit to the number of steps executed in one cycle, so that the requirement 1) is satisfied.

要求2)を満たすために問題となるのは、ステートメントが関数呼び出しを含む場合である。呼び出す関数が他のタスクのインタフェース関数である場合は、呼び出し先の関数についても実行ステップ数に上限があり、結果として実行時間に上限があるので、問題はない。一方、呼び出す関数が、ライブラリ関数やOSの機能を呼び出すAPIなど、CDPに従わない関数である場合、実行時間に上限がない場合がある。   The problem in meeting requirement 2) is when the statement contains a function call. When the function to be called is an interface function of another task, there is no problem because there is an upper limit on the number of execution steps for the call destination function, resulting in an upper limit on the execution time. On the other hand, if the function to be called is a function that does not conform to CDP, such as an API that calls a library function or an OS function, there may be no upper limit on the execution time.

特に問題となるのが、OSのAPIに存在するblocking I/Oである。例えば、blocking I/O のREAD関数を用いてファイルの読み出しをする場合、ファイルの読み出しが完了するまで、呼び出し側プログラムに制御を戻さない。これでは、要求2)を満たすことができない。そこで、CDPのタスクでは、原則としてblocking I/Oの代わりに、non-blocking I/Oを用いる。あるいは、select関数等を用いてブロックされないことを確認した上でblocking I/Oを用いる。   Particularly problematic is blocking I / O existing in the OS API. For example, when a file is read using the blocking I / O READ function, control is not returned to the calling program until the file is read. This cannot satisfy the requirement 2). Thus, in principle, CDP tasks use non-blocking I / O instead of blocking I / O. Alternatively, blocking I / O is used after confirming that the block is not blocked using a select function or the like.

続いて、図3に、図2に記載のtaskAを利用するtaskBのプログラム記述例を示す。taskBは、列挙型の変数state、int型のa、b、zをメンバとして含む構造体型の内部変数taskB_dataを持つ。taskBのタスク本体関数では、図3の行番号L34に示されるように、stateがstate_10の場合、calcメソッドを呼ぶことによりtaskAに処理を要求する。図2の行番号L23に示されるように、taskAの状態に従って要求が受け入れられる場合のみ、戻り値として0が返される。従って、taskBは、要求が受け入れられるまでリトライし、要求が受け入れられると、state_11に遷移する。   Next, FIG. 3 shows a program description example of taskB that uses taskA shown in FIG. taskB has a structure type internal variable taskB_data including enumeration type variable state and int type a, b, and z as members. In the task body function of taskB, as indicated by the line number L34 in FIG. 3, when the state is state_10, processing is requested to taskA by calling the calc method. As shown in line number L23 of FIG. 2, 0 is returned as a return value only when the request is accepted according to the state of taskA. Therefore, taskB retries until the request is accepted, and transitions to state_11 when the request is accepted.

また、図3の行番号L40に示されるように、stateがstate_11の場合、get_resultメソッドを呼ぶことにより処理結果の取得を試みる。ここでも、図2の行番号L40に示されるように、taskAの状態に従って計算が終わっている場合のみ、戻り値として0が返される。従って、taskBは、戻り値として0が得られるまで、クロック毎にget_resultメソッドを呼び出し、処理結果を取得すると、state_12に遷移する。   Also, as indicated by the line number L40 in FIG. 3, when the state is state_11, an attempt is made to acquire the processing result by calling the get_result method. Again, as indicated by line number L40 in FIG. 2, 0 is returned as the return value only when the calculation is completed according to the state of taskA. Therefore, taskB calls the get_result method for each clock until a return value of 0 is obtained, and transitions to state_12 when the processing result is acquired.

(タスクの配列化)
図2の行番号L18に示されるように、taskAはstateがfreeである場合のみ、計算要求を受け入れる。つまり、taskAが先行する計算要求を受け入れ、計算を実行している間は、他のタスクからの計算要求を受け入れることはできない。そこで、同時に複数の計算要求を処理したい場合には、同一機能を持つ複数のタスクを用意するために、タスクを配列化したタスク配列を定義する。図4に、図2に記載のtaskAを配列化したタスク配列のプログラム記述例を示す。
(Task arrangement)
As shown in line number L18 in FIG. 2, taskA accepts a calculation request only when state is free. In other words, while taskA accepts a preceding calculation request and executes a calculation, it cannot accept a calculation request from another task. Therefore, in order to process a plurality of calculation requests at the same time, a task array in which tasks are arrayed is defined in order to prepare a plurality of tasks having the same function. FIG. 4 shows a program description example of a task array in which taskA shown in FIG. 2 is arrayed.

図4の行番号L4に示されるように、タスク配列では、内部変数を配列化する。そして、行番号L7に示されるように、インタフェース関数calcの引数としてインデクスを受け取り、内部変数の参照、更新時には受け取ったインデクスを指定して行う。他の関数においても、同様に引数としてインデクスを受け取り、受け取ったインデクスを指定して内部変数の参照更新を行うことにより、タスクを配列化することができる。内部変数配列の要素数をタスク配列の多重度と呼び、配列化されていないタスク(例えば、図2のtaskA)の多重度は1である。   As indicated by line number L4 in FIG. 4, in the task array, internal variables are arrayed. Then, as indicated by the line number L7, an index is received as an argument of the interface function calc, and the received index is designated when referring to or updating the internal variable. In other functions as well, tasks can be arranged by receiving an index as an argument, and specifying the received index and updating the reference of the internal variable. The number of elements in the internal variable array is referred to as task array multiplicity, and the multiplicity of unarranged tasks (for example, taskA in FIG. 2) is 1.

(PERT図の作成)
タスクを記述したら、次にタスク間の先行関係を把握しPERT図を作成する。タイマーイベントハンドラーが呼び出すのは、タスク本体関数であり、タスク間の先行関係とは、タスク本体関数間の先行関係である。あるタスクは、そのタスク本体関数において、他のタスクのインタフェース関数を呼び出して、他のタスクの処理結果を取得する。例えば、図3に示すtaskBは、タスク本体関数において、taskAのget_resultメソッドを呼び出して、taskAの処理結果F(x)yを取得する。このインタフェース関数の静的呼び出し関係を示したものが、図5のコールグラフである。
(Create a PERT diagram)
After the task is described, the prior relationship between the tasks is grasped and a PERT diagram is created. The timer event handler calls a task body function, and the precedence relationship between tasks is a precedence relationship between task body functions. A certain task calls an interface function of another task in its task body function, and acquires a processing result of the other task. For example, taskB shown in FIG. 3 calls the get_result method of taskA in the task body function, and acquires the processing result F (x) y of taskA. The call graph of FIG. 5 shows the static call relationship of this interface function.

ここで、taskBが処理結果を得るためには、taskAのタスク本体関数がtaskBのタスク本体関数の実行の前に完了している必要がある。この場合、taskAはtaskBに先行する。完了順序を示すPERT図は、コールグラフの矢印の向きを逆転することにより得ることができる(図6)。しかし、全てのコールグラフからPERT図を得ることができるわけではない。   Here, in order for taskB to obtain a processing result, the task body function of taskA needs to be completed before the task body function of taskB is executed. In this case, taskA precedes taskB. A PERT diagram showing the completion order can be obtained by reversing the direction of the arrows in the call graph (FIG. 6). However, PERT diagrams cannot be obtained from all call graphs.

PERT図を得るためには、コールグラフがacyclicである(ループがない)必要がある。図7に示すように、コールグラフがacyclicでない場合は、ポーリング(polling)を用いてタスク間のインタフェースの向きを入れ替える必要がある。taskAとtaskBとのコールグラフはacyclicであるので、タスク間のインタフェースの向きを入れ替える必要はない。ポーリングを用いる参考例として、図8Aおよび図8Bに、インタフェース方向を変えたtaskAおよびtaskBのプログラム記述例を示す。   In order to obtain a PERT diagram, the call graph needs to be acyclic (no loop). As shown in FIG. 7, when the call graph is not acyclic, it is necessary to change the interface direction between tasks by using polling. Since the call graph between taskA and taskB is acyclic, there is no need to change the interface direction between tasks. As a reference example using polling, FIGS. 8A and 8B show program description examples of taskA and taskB with the interface direction changed.

得られたPERT図から、同時実行され得るタスクを判断することができる。コールグラフに基づいて、図9に示すPERT図が得られたものとする。ここで、図9に示すPERT図のグラフGは、1から9のタスクに対応するノードの集合、およびタスク間の先行関係を表す矢印の集合により構成される。PERT図には、本来のタスク1から9に対応するノードに加えて、プログラム全体のスタートとフィニッシュをそれぞれ表す端点sと端点tが記されている。   Tasks that can be executed simultaneously can be determined from the obtained PERT diagram. Assume that the PERT diagram shown in FIG. 9 is obtained based on the call graph. Here, the graph G in the PERT diagram shown in FIG. 9 is composed of a set of nodes corresponding to tasks 1 to 9 and a set of arrows representing the preceding relationship between tasks. In the PERT diagram, in addition to the nodes corresponding to the original tasks 1 to 9, end points s and t representing the start and finish of the entire program are described.

図10に、図9のPERT図に含まれるタスク間の先行関係を示す先行関係表を示す。図中の◎は、2つのタスクが、直接の先行関係を有することを示す。例えば、タスク1と(タスク1のインタフェース関数を呼び出す)タスク4、タスク1と(タスク1のインタフェース関数を呼び出す)タスク6などは、直接の先行関係を有する。図中の○は、2つのタスクが、間接の先行関係を有することを示す。例えば、タスク1とタスク7、タスク1とタスク8、タスク1とタスク9などは、間接の先行関係を有する。図中の×は、2つのタスクが、先行関係を有し得ないことを示す。   FIG. 10 shows a prior relationship table showing the prior relationship between tasks included in the PERT diagram of FIG. In the figure, ◎ indicates that two tasks have a direct preceding relationship. For example, task 1 and task 4 (calling the interface function of task 1), task 1 and task 6 (calling the interface function of task 1) have a direct precedence relationship. ○ in the figure indicates that the two tasks have an indirect precedence relationship. For example, task 1 and task 7, task 1 and task 8, task 1 and task 9, etc. have an indirect precedence relationship. X in the figure indicates that two tasks cannot have a preceding relationship.

間接の先行関係は、直接の先行関係を有さないが、1または複数のタスクを経由して先行関係を有する2つのタスク間において生じる。例えば、タスク1とタスク7は、タスク1のインタフェース関数を呼び出し、かつタスク7によりそのインタフェース関数を呼び出されるタスク4を経由して、先行関係を有する。同様に、タスク1とタスク8も、タスク4を経由して先行関係を有する。また、タスク1とタスク9は、タスク4およびタスク7を経由して、あるいはタスク6を経由して、先行関係を有する。   An indirect predecessor relationship occurs between two tasks that do not have a direct predecessor relationship but have a predecessor relationship via one or more tasks. For example, task 1 and task 7 have a leading relationship via task 4 that calls the interface function of task 1 and that interface function is called by task 7. Similarly, task 1 and task 8 have a preceding relationship via task 4. Task 1 and task 9 have a preceding relationship via task 4 and task 7, or via task 6.

ここで、特定のタスクvのインタフェース関数を呼び出すタスクu、およびタスクwが、直接または間接の先行関係を有する場合、タスクuとタスクwとは、同時実行されることはない。例えば、タスク1のインタフェース関数を呼び出すタスク4およびタスク6は、図10に示されるように直接の先行関係を有するので、同時実行されることはない。一方、タスク3のインタフェース関数を呼び出すタスク5およびタスク8は、図10に示されるように先行関係を有さないので、同時実行され得る。   Here, when the task u calling the interface function of the specific task v and the task w have a direct or indirect precedence relationship, the task u and the task w are not executed simultaneously. For example, the task 4 and the task 6 that call the interface function of the task 1 have a direct precedence relationship as shown in FIG. On the other hand, the task 5 and the task 8 that call the interface function of the task 3 do not have a preceding relationship as shown in FIG.

複数のタスクが同時に同じタスクのインタフェース関数を呼び出す場合、タスクの実行される順序やインタフェース関数の実行される順序により、結果が変わってしまう可能性がある。そこで、複数のタスクから同時に呼び出され得るインタフェース関数は、Bernstein’s conditionsを満たす必要がある。Bernstein's conditionsは、プログラムの断片が並列実行できるための、周知の十分条件である。   When multiple tasks call the interface function of the same task at the same time, the result may change depending on the order in which the tasks are executed or the order in which the interface functions are executed. Therefore, an interface function that can be called simultaneously from a plurality of tasks needs to satisfy Bernstein's conditions. Bernstein's conditions are well-known sufficient conditions that allow program fragments to be executed in parallel.

例えば、タスク5およびタスク8から同時に呼び出され得る、タスク3に含まれる関数f、gは、関数fの中で構文的に参照される内部変数の集合(R(f))、関数fの中で構文的に代入される内部変数の集合(W(f))、関数gの中で構文的に参照される内部変数の集合(R(g))、および関数gの中で構文的に代入される内部変数の集合(W(g))について以下の(1)から(3)が成り立つ場合、Bernstein's conditionsを満たし、並列実行することができる。
R(f) ∩ W(g) = φ・・・(1)
R(g) ∩ W(f) = φ・・・(2)
W(f) ∩ W(g) = φ・・・(3)
For example, functions f and g included in task 3 that can be called from task 5 and task 8 at the same time are a set of internal variables (R (f)) syntactically referenced in function f, in function f. A set of internal variables (W (f)) that are syntactically assigned in, a set of internal variables that are syntactically referenced in function g (R (g)), and a syntactic assignment in function g When the following (1) to (3) are satisfied for the set of internal variables (W (g)), Bernstein's conditions are satisfied and parallel execution can be performed.
R (f) ∩ W (g) = φ ・ ・ ・ (1)
R (g) ∩ W (f) = φ ・ ・ ・ (2)
W (f) ∩ W (g) = φ ・ ・ ・ (3)

(Bernstein's conditionsを満たすプログラムへの書き換え技法)
同時実行され得るタスクがBernstein's conditionsを満たさない場合、書き替え技法を用いてプログラムを修正する必要がある。代表的な3つの書き換え技法を以下で紹介する。
(Rewriting technique to a program that satisfies Bernstein's conditions)
If tasks that can be executed simultaneously do not meet Bernstein's conditions, the program must be modified using rewrite techniques. Three typical rewriting techniques are introduced below.

第1の書き替え技法として、変数リネーム技法がある。図11Aおよび図11Bに、変数リネーム技法を適用する前後のプログラム記述例を示す。適用前のプログラム記述例では、図11Aに示されるように、インタフェース関数read、writeにおいて、R(read) ∩ W(write) = {taskA_x} ≠ φであり、Bernstein's conditionsを満たさない。一方、適用後のプログラム記述例では、図11Bに示されるように、別途内部変数を用いてプログラムを修正することにより、R(read) ∩ W(write) =φとなり、Bernstein's conditionsを満たすことができる。   There is a variable renaming technique as the first rewriting technique. 11A and 11B show program description examples before and after applying the variable renaming technique. In the example of the program description before application, as shown in FIG. 11A, in the interface functions read and write, R (read) ∩W (write) = {taskA_x} ≠ φ, and Bernstein's conditions are not satisfied. On the other hand, in the example of the program description after application, as shown in FIG. 11B, R (read) ∩W (write) = φ is satisfied by separately modifying the program using internal variables, and Bernstein's conditions are satisfied. it can.

第2の書き替え技法として、個別化技法がある。個別化技法では、Bernstein's conditionsを満たさないインタフェース関数を有するタスクを、配列化する。図12に、個別化技法を適用する前後のコールグラフを示す。適用前のコールグラフでは、図12(左)に示されるように、インタフェース関数calc_Fの競合がおき、R(calc_F) ∩ W(calc_F) = {taskB_data} ≠ φであり、Bernstein's conditionsを満たさない。一方、適用後のコールグラフでは、図12(右)に示されるように、taskBを配列化することにより、R(calc_F(0)) ∩ )W(calc_F(1)) = {taskB_data[0]} ∩ {taskB_data[1]} = φとなり、Bernstein's conditionsを満たすことができる。   As a second rewriting technique, there is an individualization technique. In the individualization technique, tasks having interface functions that do not satisfy Bernstein's conditions are arranged. FIG. 12 shows call graphs before and after applying the individualization technique. In the call graph before application, as shown in FIG. 12 (left), competition of the interface function calc_F occurs, R (calc_F) ∩W (calc_F) = {taskB_data} ≠ φ, and Bernstein's conditions are not satisfied. On the other hand, in the call graph after application, as shown in FIG. 12 (right), by arranging taskB, R (calc_F (0)) ∩) W (calc_F (1)) = {taskB_data [0] } ∩ {taskB_data [1]} = φ, and Bernstein's conditions can be satisfied.

第3の書き替え技法として、抽選化技法がある。前述した個別化技法は、唯一のリソースを使用する場合には適用することができない。この場合、内部変数のみを配列化し、タスクは配列化しない抽選化技法により、インタフェース関数の競合を防ぐ。具体的には、図13Aに示されるように、競合対象であるtaskBのタスク本体関数において、複数のインタフェース関数呼び出しのうちの1つを選択し(抽選)、選択された(当選した)呼び出しのみ処理を実行し、選択されなかった(落選した)呼び出しについてはエラーを返す。また、図13Bに示されるように、呼び出し側タスクであるtaskC(およびtaskD(図示せず))では、当選するまでインタフェース関数の呼び出しを繰り返す。   As a third rewriting technique, there is a lottery technique. The personalization technique described above cannot be applied when only one resource is used. In this case, competition of interface functions is prevented by a lottery technique in which only internal variables are arranged and tasks are not arranged. Specifically, as shown in FIG. 13A, in the task body function of taskB that is the target of competition, one of a plurality of interface function calls is selected (lottery), and only the selected (winned) call is selected. Execute the process and return an error for calls that were not selected (declined). Further, as shown in FIG. 13B, in the task C (and task D (not shown)) which is the calling task, the interface function is repeatedly called until it is won.

(スケジュールの作成)
PERT図が得られたら、次にスケジュールを作成する。スケジュールは、どのタイミングでどのリソースにタスクを割り当てるかを、PERT図で与えられた先行関係を満たすように定めたものである。利用可能なリソースの制約の元で、完了時間が最小となるスケジュールを作成することが望ましい。図14に示すPERT図に基づいて、スケジュールを作成する。
(Create schedule)
Once the PERT diagram is obtained, a schedule is created next. The schedule defines which task is assigned to which resource at which timing so as to satisfy the preceding relationship given in the PERT diagram. It is desirable to create a schedule that minimizes the completion time under the constraints of available resources. A schedule is created based on the PERT diagram shown in FIG.

(スケジュールの作成−逐次実行)
逐次実行する場合、PERT図を既知のアルゴリズムでトポロジカルソートすることにより、容易にスケジュールを作成することができる。図14のPERT図の場合、以下の3つのスケジュールが作成される。taskX、taskY、taskZ、taskWのタスク本体関数が、それぞれ、taskX_CLK()、taskY_CLK()、taskZ_CLK()、taskW_CLK()であるものとする。
スケジュール1=taskX_CLK(); taskY_CLK(); taskW_CLK(); taskZ_CLK();
スケジュール2=taskX_CLK(); taskY_CLK(); taskZ_CLK(); taskW_CLK();
スケジュール3=taskX_CLK(); taskZ_CLK(); taskY_CLK(); taskZ_CLK();
(Schedule creation-sequential execution)
In the case of sequential execution, a schedule can be easily created by topologically sorting the PERT diagrams using a known algorithm. In the case of the PERT diagram of FIG. 14, the following three schedules are created. It is assumed that task body functions of taskX, taskY, taskZ, and taskW are taskX_CLK (), taskY_CLK (), taskZ_CLK (), and taskW_CLK (), respectively.
Schedule 1 = taskX_CLK (); taskY_CLK (); taskW_CLK (); taskZ_CLK ();
Schedule 2 = taskX_CLK (); taskY_CLK (); taskZ_CLK (); taskW_CLK ();
Schedule 3 = taskX_CLK (); taskZ_CLK (); taskY_CLK (); taskZ_CLK ();

PERT図の先行関係を満たす限り、どの順序で実行しても同一の結果を得ることができ、また、同一の完了時間となる。従って、任意のスケジュールを選択することができる。図15に、スケジュール1でタスクを実行するプログラム記述例を示す。図15の行番号L25において、第3引数(presiod)で指定した100ミリ秒ごとに、第4引数(OnTimer)で指定した関数が呼ばれるよう、タイマーの設定が行われている。本実施形態ではスケジュール1を実行するために、図15の行番号L6からL9に示されるように、タスクの実行順序を定義する。   As long as the preceding relationship in the PERT diagram is satisfied, the same result can be obtained in any order, and the same completion time can be obtained. Therefore, an arbitrary schedule can be selected. FIG. 15 shows an example of a program description for executing a task according to schedule 1. In line number L25 in FIG. 15, the timer is set so that the function specified by the fourth argument (OnTimer) is called every 100 milliseconds specified by the third argument (presiod). In this embodiment, in order to execute the schedule 1, the task execution order is defined as indicated by line numbers L6 to L9 in FIG.

(スケジュールの作成−並列実行)
並列実行する場合、タスク間の先行関係は同期プリミティブを用いて実現する。本実施形態では、同期プリミティブとして、Windowsの提供するEvent Objectを用いる。Event Objectは、2つの状態(シグナル状態/非シグナル状態)を持つ。SetEvent(e)を呼び出すことにより、引数eのハンドルにより特定されるEvent Objectはシグナル状態になる。WaitForSingleObject(e)を呼び出すと、引数eのハンドルにより特定されるEvent Objectが非シグナル状態である場合、シグナル状態になるまでWaitForSingleObject(e)の呼び出し側スレッドは待機し続ける。他のスレッドによりSetEvent(e)が呼ばれ、eにより特定されるEvent Objectがシグナル状態になると、制御が戻され、呼び出し側スレッドは後続の処理を実行することができる。
(Schedule creation-parallel execution)
When executing in parallel, the precedence relationship between tasks is realized using synchronization primitives. In this embodiment, an Event Object provided by Windows is used as a synchronization primitive. The Event Object has two states (signal state / non-signal state). By calling SetEvent (e), the Event Object specified by the handle of the argument e becomes a signal state. When WaitForSingleObject (e) is called, if the Event Object specified by the handle of the argument e is in a non-signal state, the calling thread of WaitForSingleObject (e) continues to wait until it becomes a signal state. When SetEvent (e) is called by another thread and the Event Object specified by e is in a signal state, control is returned and the calling thread can execute the subsequent processing.

例えば、図14のPERT図を、並列度4で実行する場合を考える。
スケジュール4−0=taskX_CLK(); SetEvent(e1); SetEvent(e2);
スケジュール4−1=WaitForSingleObject(e1); taskZ_CLK();
スケジュール4−2=WaitForSingleObject(e2); taskY_CLK(); SetEvent(e3);
スケジュール4−3=WaitForSingleObject(e3); taskW_CLK();
For example, consider a case where the PERT diagram of FIG.
Schedule 4-0 = taskX_CLK (); SetEvent (e1); SetEvent (e2);
Schedule 4-1 = WaitForSingleObject (e1); taskZ_CLK ();
Schedule 4-2 = WaitForSingleObject (e2); taskY_CLK (); SetEvent (e3);
Schedule 4-3 = WaitForSingleObject (e3); taskW_CLK ();

スケジュール4−0では、taskX_CLKメソッドが完了すると、e1およびe2により特定されるEvent Objectをシグナル状態にする。スケジュール4−1では、WaitForSingleObject(e1)を呼び出し、e1により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskX_CLKメソッドの完了によりSetEvent(e1)が呼ばれると、スケジュール4−1に対応するスレッドに制御が戻され、taskZ_CLKメソッドが実行される。同様に、スケジュール4−2では、WaitForSingleObject(e2)を呼び出し、e2により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskX_CLKメソッドの完了によりSetEvent(e2)が呼ばれると、スケジュール4−2に対応するスレッド制御が戻され、taskY_CLKメソッドが実行される。スケジュール4−2では、taskY_CLKメソッドが完了すると、e3により特定されるEvent Objectをシグナル状態にする。スケジュール4−3も、WaitForSingleObject(e3)を呼び出し、e3により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskY_CLKメソッドの完了によりSetEvent(e3)が呼ばれると、スケジュール4−3に対応するスレッドに制御が戻され、taskW_CLKメソッドが実行される。   In the schedule 4-0, when the taskX_CLK method is completed, the Event Object specified by e1 and e2 is set in the signal state. In the schedule 4-1, WaitForSingleObject (e1) is called, and it waits until the Event Object specified by e1 becomes a signal state. When SetEvent (e1) is called upon completion of the taskX_CLK method, control is returned to the thread corresponding to the schedule 4-1, and the taskZ_CLK method is executed. Similarly, in schedule 4-2, WaitForSingleObject (e 2) is called, and the process continues to wait until the Event Object specified by e 2 becomes a signal state. When SetEvent (e2) is called by completing the taskX_CLK method, the thread control corresponding to the schedule 4-2 is returned, and the taskY_CLK method is executed. In the schedule 4-2, when the taskY_CLK method is completed, the Event Object specified by e3 is set in the signal state. The schedule 4-3 also calls WaitForSingleObject (e3) and keeps waiting until the Event Object specified by e3 becomes a signal state. When SetEvent (e3) is called upon completion of the taskY_CLK method, control is returned to the thread corresponding to the schedule 4-3, and the taskW_CLK method is executed.

図16に、スケジュール4−0から4−3でタスクを実行するプログラム記述例を示す。図16の行番号L43において、第3引数(presiod)で指定した100ミリ秒ごとに、第4引数(OnTimer)で指定した関数が呼ばれるよう、タイマーの設定が行われている。本実施形態では、図16の行番号L3からL14に示されるように、スケジュール4−1から4−3に対応するスレッドを用意する。   FIG. 16 shows an example of a program description for executing tasks according to schedules 4-0 to 4-3. In line number L43 in FIG. 16, the timer is set so that the function specified by the fourth argument (OnTimer) is called every 100 milliseconds specified by the third argument (presiod). In this embodiment, threads corresponding to schedules 4-1 to 4-3 are prepared as indicated by line numbers L3 to L14 in FIG.

OnTimerメソッドでは、まず、スレッド1、スレッド2、スレッド3にそれぞれ対応するs[0]、s[1]、s[2]により特定されるEvent Objectをシグナル状態にする。その後、メインスレッドでスケジュール4−0を実行し、スレッド1、スレッド2、スレッド3にそれぞれ対応するt[0]、t[1]、t[2]により特定されるEvent Object のWaitForSingleObjectメソッドを呼び出すことで、Event Objectがシグナル状態になるまで、すなわち該当のスレッドが完了するまで待機し続ける。図17に、並列実行のシーケンス図を示す。   In the OnTimer method, first, Event Objects specified by s [0], s [1], and s [2] corresponding to the thread 1, thread 2, and thread 3 are set in a signal state. Thereafter, schedule 4-0 is executed in the main thread, and the WaitForSingleObject method of the Event Object specified by t [0], t [1], and t [2] corresponding to thread 1, thread 2, and thread 3 is called. Thus, it continues to wait until the Event Object becomes a signal state, that is, until the corresponding thread is completed. FIG. 17 shows a sequence diagram of parallel execution.

スケジュール4−1に対応するスレッド1では、WaitForSingleObject(s[0])を呼び出し、s[0]により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。図16の行番号L18に示されるように、OnTimerメソッド内でSetEvent(s[0])が呼ばれると、スレッド1に制御が戻され、WaitForSingleObject(e1)を呼び出す。その後、e1により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskX_CLKメソッドの完了によりSetEvent(e1)が呼ばれると、スレッド1に制御が戻され、taskZ_CLKメソッドが実行される。スレッド1では、taskZ_CLKメソッドが完了すると、t[0]により特定されるEvent Objectをシグナル状態にすることで、スレッドの完了を通知する。   The thread 1 corresponding to the schedule 4-1 calls WaitForSingleObject (s [0]) and keeps waiting until the Event Object specified by s [0] becomes a signal state. As indicated by the line number L18 in FIG. 16, when SetEvent (s [0]) is called in the OnTimer method, control is returned to the thread 1 and WaitForSingleObject (e1) is called. After that, it continues to wait until the Event Object specified by e1 becomes a signal state. When SetEvent (e1) is called upon completion of the taskX_CLK method, control is returned to the thread 1 and the taskZ_CLK method is executed. When the taskZ_CLK method is completed, the thread 1 notifies the completion of the thread by setting the Event Object specified by t [0] to the signal state.

スケジュール4−2に対応するスレッド2(図示せず)においても、スレッド1同様、WaitForSingleObject(s[1])を呼び出し、s[1]により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。図16の行番号L19に示されるように、OnTimerメソッド内でSetEvent(s[1])が呼ばれると、スレッド2に制御が戻され、WaitForSingleObject(e2)を呼び出す。その後、e2により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskX_CLKメソッドの完了によりSetEvent(e2)が呼ばれると、スレッド2に制御が戻され、taskY_CLKメソッドが実行される。スレッド2では、taskY_CLKメソッドが完了すると、taskYの完了を通知するSetEvent(e3)を呼び出し、その後、t[1]により特定されるEvent Objectをシグナル状態にすることで、スレッドの完了を通知する。   Similarly to thread 1, thread 2 (not shown) corresponding to schedule 4-2 calls WaitForSingleObject (s [1]) and waits until the Event Object specified by s [1] becomes a signal state. to continue. As indicated by the line number L19 in FIG. 16, when SetEvent (s [1]) is called in the OnTimer method, control is returned to the thread 2 and WaitForSingleObject (e2) is called. After that, it continues to wait until the Event Object specified by e2 becomes a signal state. When SetEvent (e2) is called upon completion of the taskX_CLK method, control is returned to the thread 2 and the taskY_CLK method is executed. When the taskY_CLK method is completed, the thread 2 calls SetEvent (e3) that notifies the completion of taskY, and then notifies the completion of the thread by setting the Event Object specified by t [1] as a signal state.

スケジュール4−3に対応するスレッド3(図示せず)においても、スレッド1同様、WaitForSingleObject(s[2])を呼び出し、s[2]により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。図16の行番号L20に示されるように、OnTimerメソッド内でSetEvent(s[2])が呼ばれると、スレッド3に制御が戻され、WaitForSingleObject(e3)を呼び出す。その後、e3により特定されるEvent Objectがシグナル状態になるまで、待機し続ける。taskY_CLKメソッドの完了によりSetEvent(e3)が呼ばれると、スレッド3に制御が戻され、taskW_CLKメソッドが実行される。スレッド3では、taskW_CLKメソッドが完了すると、t[2]により特定されるEvent Objectをシグナル状態にすることで、スレッドの完了を通知する。   Similarly to thread 1, thread 3 (not shown) corresponding to schedule 4-3 calls WaitForSingleObject (s [2]) and waits until the Event Object specified by s [2] becomes a signal state. to continue. As indicated by the line number L20 in FIG. 16, when SetEvent (s [2]) is called in the OnTimer method, control is returned to the thread 3 and WaitForSingleObject (e3) is called. After that, it continues to wait until the Event Object specified by e3 becomes a signal state. When SetEvent (e3) is called upon completion of the taskY_CLK method, control is returned to the thread 3 and the taskW_CLK method is executed. In the thread 3, when the taskW_CLK method is completed, the completion of the thread is notified by setting the Event Object specified by t [2] to the signal state.

(スケジュールの作成−タスク配列)
タスク配列内の各タスク間に先行関係は存在しない。そのため、各タスクをどのような順序でスケジューリングしてもよい。また、タスク配列は、コードは全て同じで、内部変数の場所だけが異なるので、タスク配列内の各タスクの平均の実行時間は、同一であることが期待できる。従って、タスクの多重度がm、利用可能なCPU数がnである場合、各CPUにm/n個ずつタスクを分配する。
(Schedule creation-Task arrangement)
There is no predecessor relationship between each task in the task array. Therefore, each task may be scheduled in any order. In addition, since all codes of the task array are the same and only the location of the internal variable is different, it can be expected that the average execution time of each task in the task array is the same. Therefore, when the multiplicity of tasks is m and the number of available CPUs is n, m / n tasks are distributed to each CPU.

図14に示すPERT図のtaskYが多重度4のタスク配列で、利用可能なCPU数が5である場合、以下のスケジュールを作成することができる。
スケジュール5−0=taskX_CLK(); SetEvent(e1); SetEvent(e21); SetEvent(e22);
スケジュール5−1=WaitForSingleObject(e1); taskZ_CLK();
スケジュール5−2=WaitForSingleObject(e21); taskY_CLK(0); taskY_CLK(2);
SetEvent(e31);
スケジュール5−3=WaitForSingleObject(e22); taskY_CLK(1); taskY_CLK(3);
SetEvent(e32);
スケジュール5−4=WaitForSingleObject(e31); WaitForSingleObject(e32);
taskW_CLK();
If taskY in the PERT diagram shown in FIG. 14 is a task array with a multiplicity of 4, and the number of available CPUs is 5, the following schedule can be created.
Schedule 5-0 = taskX_CLK (); SetEvent (e1); SetEvent (e21); SetEvent (e22);
Schedule 5-1 = WaitForSingleObject (e1); taskZ_CLK ();
Schedule 5-2 = WaitForSingleObject (e21); taskY_CLK (0); taskY_CLK (2);
SetEvent (e31);
Schedule 5-3 = WaitForSingleObject (e22); taskY_CLK (1); taskY_CLK (3);
SetEvent (e32);
Schedule 5-4 = WaitForSingleObject (e31); WaitForSingleObject (e32);
taskW_CLK ();

このように、多重度の数だけ存在するタスク本体関数をインデックス指定して、各CPUに分配することにより、利用可能なCPU数に応じてスケジュールを作成することができる。   In this way, a task body function that exists in the number of multiplicity can be indexed and distributed to each CPU, whereby a schedule can be created according to the number of available CPUs.

ここまで、CDPプログラムについて詳述してきた。特に、スケジュールの作成に関する章では、PERT図で与えられた先行関係を満たすスケジュールの作成について述べている。前述したように、逐次実行する場合、PERT図を既知のアルゴリズムでトポロジカルソートすることにより、容易にスケジュールを作成することができる。しかし、並列実行する場合については、有用なスケジュール作成技術が、現在示されていない。以降の章では、実行時間が特定されない複数のタスクを、そのタスク間の先行関係のみに基づいてスケジューリングする技術を開示する。   So far, the CDP program has been described in detail. In particular, the chapter on schedule creation describes creation of a schedule that satisfies the precedence relationship given in the PERT diagram. As described above, in the case of sequential execution, a schedule can be easily created by topologically sorting the PERT diagrams using a known algorithm. However, no useful scheduling techniques are currently shown for parallel execution. In the following chapters, a technique for scheduling a plurality of tasks whose execution times are not specified based only on the preceding relationship between the tasks is disclosed.

(システム構成)
図18のブロック図を参照して、スケジュール作成システム1の構成を詳細に説明する。なお、図18では、単一のコンピュータシステムを想定し、必要な機能構成だけを示しているが、スケジュール作成システム1を、複数のコンピュータシステムによる多機能の分散システムの一部として構成することもできる。
(System configuration)
The configuration of the schedule creation system 1 will be described in detail with reference to the block diagram of FIG. In FIG. 18, only a necessary functional configuration is shown assuming a single computer system. However, the schedule creation system 1 may be configured as a part of a multi-function distributed system including a plurality of computer systems. it can.

スケジュール作成システム1は、CPU10に、システムバス11を介してRAM12、入力装置13、出力装置14、通信制御装置15および不揮発性記憶媒体(ROMやHDDなど)で構成される記憶装置16が接続された構成を有する。記憶装置16は、上記した機能を奏するためのソフトウェアプログラムを格納するプログラム格納領域と、随時取得するデータや処理結果としてのデータ等を格納するデータ格納領域とを備えている。以下に説明するプログラム格納領域の各手段は、実際は独立したソフトウェアプログラム、そのルーチンやコンポーネントなどであり、CPU10によって記憶装置16から呼び出されRAM12のワークエリアに展開されて、データベース等を適宜参照しながら順次実行されることで、各機能を奏するものである。   In the schedule creation system 1, a RAM 12, an input device 13, an output device 14, a communication control device 15, and a storage device 16 including a nonvolatile storage medium (ROM, HDD, etc.) are connected to a CPU 10 via a system bus 11. Have a configuration. The storage device 16 includes a program storage area for storing a software program for performing the above-described functions, and a data storage area for storing data acquired at any time, data as a processing result, and the like. Each means of the program storage area described below is actually an independent software program, its routine, component, etc., which is called from the storage device 16 by the CPU 10 and expanded in the work area of the RAM 12 while appropriately referring to the database and the like. Each function is performed by being executed sequentially.

データ格納領域は、閉包先行関係記憶手段17、縮退先行関係記憶手段18、タスク配置記憶手段19およびイベント記憶手段20を備える。何れも、記憶装置16内に確保された一定の記憶領域である。   The data storage area includes a closure precedence relationship storage unit 17, a degenerate precedence relationship storage unit 18, a task arrangement storage unit 19, and an event storage unit 20. Both are fixed storage areas secured in the storage device 16.

閉包先行関係記憶手段17および縮退先行関係記憶手段18は、図19および図20に示すように、先行タスク、後続タスク、先行関係タイプを格納する。本実施形態では、先行関係タイプには、直接の先行関係を示す2、または間接の先行関係を示す1のいずれかを格納する。   As shown in FIGS. 19 and 20, the closure precedence relationship storage unit 17 and the degenerate precedence relationship storage unit 18 store the precedence task, the succession task, and the precedence relationship type. In this embodiment, the preceding relationship type stores either 2 indicating a direct preceding relationship or 1 indicating an indirect preceding relationship.

タスク配置記憶手段19は、m個のレイヤ、およびn個のレベルを有し、m×n個の領域に分割されるタスク配置構造体を格納する。各領域には、0または1つのタスクが格納される。レイヤおよびレベルについては後述する。   The task placement storage unit 19 stores a task placement structure having m layers and n levels and divided into m × n areas. Each area stores 0 or 1 task. Layers and levels will be described later.

イベント記憶手段20は、図21に示すように、通知タスク、待機タスク、イベント識別子を格納する。通知タスクにタスクx、および待機タスクにタスクyが格納される場合、タスクxの実行完了後にタスクyを実行すべきであることがわかる。イベント識別子は、イベントを一意に識別する。   As shown in FIG. 21, the event storage unit 20 stores a notification task, a standby task, and an event identifier. When the task x is stored in the notification task and the task y is stored in the waiting task, it is understood that the task y should be executed after the execution of the task x is completed. The event identifier uniquely identifies the event.

プログラム格納領域に格納されているソフトウェアプログラムは、本発明に関連するものだけを列挙すると、先行関係管理手段21、タスク配置手段22、イベント識別手段23およびスケジュール変換手段24を備えている。   The software program stored in the program storage area includes a prior relationship management means 21, a task placement means 22, an event identification means 23, and a schedule conversion means 24, if only those relevant to the present invention are listed.

先行関係管理手段21は、スケジュール作成対象のプログラムのタスク間の先行関係データを受信する。一実施形態では、先行関係データの一例であるPERT図を受信する。また、先行関係管理手段21は、受信した先行関係データからタスクに対応するノードの集合、およびタスク間の先行関係を表す矢印の集合を抽出する。先行関係管理手段21は、タスク間に生じる間接の先行関係を識別する。間接の先行関係については後述する。先行関係管理手段21は、タスク間の直接の先行関係および間接の先行関係に基づいて、受信した先行関係データの推移閉包(Transitive Closure)を閉包先行関係記憶手段17に、および受信した先行関係データの推移縮退(Transitive Reduction)を縮退先行関係記憶手段18に登録する。   The preceding relationship management means 21 receives the preceding relationship data between tasks of the schedule creation target program. In one embodiment, a PERT diagram that is an example of prior relationship data is received. In addition, the preceding relationship management unit 21 extracts a set of nodes corresponding to the task and a set of arrows representing the preceding relationship between tasks from the received preceding relationship data. The preceding relationship management means 21 identifies an indirect preceding relationship that occurs between tasks. The indirect precedence relationship will be described later. Based on the direct preceding relationship and the indirect preceding relationship between tasks, the preceding relationship management unit 21 sends a transition closure (Transitive Closure) of the received preceding relationship data to the closed preceding relationship storage unit 17 and the received preceding relationship data. The transition reduction (Transitive Reduction) is registered in the reduction preceding relationship storage means 18.

タスク配置手段22は、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの最速開始時間を算出する。タスク配置手段22は、算出した開始時間に基づいて、スタート時間、各開始時間、およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成する。   The task placement unit 22 uses PERT analysis to calculate the fastest start time of each task when the execution time of each task is 1. Based on the calculated start time, the task placement means 22 generates a task placement structure having layers corresponding to the start time, each start time, and the finish time.

タスク配置手段22は、レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にする。空タスクについては後述する。また、タスク配置手段22は、閉包先行関係記憶手段17に基づいて、レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定する。タスク配置手段22は、グラフの最大マッチングアルゴリズムを用いて、レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得する。   The task placement unit 22 compares the number of tasks in the layer L and the layer L-1, and if the number of tasks in one of the layers is smaller than the number of tasks in the other layer, the task placement unit 22 generates an empty task and Make the number of tasks in the layer the same. The empty task will be described later. Further, the task placement unit 22 determines a set of tasks in the layer L (subsequent task candidates) that can be subsequent to each task in the layer L- 1 based on the closure precedence relationship storage unit 17. The task placement unit 22 obtains the maximum matching for each task in the layer L-1 and its subsequent tasks using the maximum matching algorithm of the graph.

タスク配置手段22は、得られた最大マッチングのマッチング数とレイヤL−1内のタスク数を比較する。マッチング数がタスク数より少ない場合、マッチング数とタスク数の差の数、レイヤLおよびレイヤL−1に空タスクを生成し、空タスクを配置するために、新たなレベルの領域を作成する。マッチング数とタスク数とが一致する場合には、各タスクを配置する領域をレイヤL内に作成し、作成した領域にタスクを配置する。   The task placement means 22 compares the obtained maximum matching number with the number of tasks in the layer L-1. When the number of matching is smaller than the number of tasks, empty tasks are generated in the difference between the number of matching and the number of tasks, layer L and layer L-1, and a new level area is created in order to place empty tasks. If the number of matching matches the number of tasks, an area for placing each task is created in layer L, and the task is placed in the created area.

イベント識別手段23は、レイヤL−1内のタスクxの後続としてレイヤL内に配置できなかったタスクyを識別し、イベント記憶手段20に記憶する。なお、レイヤL−1内のタスクxの後続としてレイヤL内に配置できなかったタスクyが存在する場合であっても、タスクxの後続として空タスクが配置されている場合には、この空タスクの後続としてタスクyが配置されないときのみ、イベント記憶手段20に記憶する。   The event identifying means 23 identifies the task y that could not be placed in the layer L as a successor of the task x in the layer L-1, and stores it in the event storage means 20. Even if there is a task y that could not be placed in the layer L as a successor of the task x in the layer L-1, if an empty task is placed as a successor of the task x, this empty Only when the task y is not arranged as a successor of the task, it is stored in the event storage means 20.

スケジュール変換手段24は、タスク構造体のレベルのうち、スケジュールを作成していないレベルを抽出する。スケジュール変換手段24は、レイヤCに配置されたタスクを識別する。スケジュール変換手段24は、イベント記憶手段20に基づいて、識別したタスクを実行する前に待機すべきイベントが存在するか否かを判定する。待機すべきイベントが存在する場合は、待機すべきイベントをスケジュールとして記述する。一実施形態では、Event Objectを用いて待機すべきイベントを記述する。   The schedule conversion unit 24 extracts a level for which no schedule has been created from the levels of the task structure. The schedule conversion unit 24 identifies tasks arranged in the layer C. Based on the event storage unit 20, the schedule conversion unit 24 determines whether there is an event to be waited for before executing the identified task. When there is an event to be waited for, the event to be waited for is described as a schedule. In one embodiment, an Event Object is used to describe an event to wait for.

スケジュール変換手段24は、識別したタスクが空タスクでない場合、当該タスクの実行をスケジュールとして記述する。スケジュール変換手段24は、イベント記憶手段20に基づいて、識別したタスクの完了を通知すべきイベントが存在するか否かを判定する。通知すべきイベントが存在する場合は、通知すべきイベントをスケジュールとして記述する。一実施形態では、Event Objectを用いて通知すべきイベントを記述する。   If the identified task is not an empty task, the schedule conversion unit 24 describes the execution of the task as a schedule. Based on the event storage unit 20, the schedule conversion unit 24 determines whether there is an event that should be notified of the completion of the identified task. When there is an event to be notified, the event to be notified is described as a schedule. In one embodiment, an event to be notified is described using an Event Object.

(スケジュール作成方法−タスク配置構造体の作成)
次に、図22のフローチャートを参照して、本実施形態に係るスケジュールを作成する工程を説明する。本実施形態では、図9に示されるPERT図で表される複数のタスクを、そのタスク間の先行関係のみに基づいてスケジューリングする。
(Schedule creation method-Create task layout structure)
Next, a process of creating a schedule according to the present embodiment will be described with reference to the flowchart of FIG. In the present embodiment, a plurality of tasks represented by the PERT diagram shown in FIG. 9 are scheduled based only on the prior relationship between the tasks.

処理S1において、先行関係管理手段21は、スケジュール作成対象のプログラムのタスク間の先行関係データを受信する。本実施形態では、先行関係データの一例である、図9に示されるPERT図を受信したものとする。この先行関係データは、コンピュータを介してユーザーから、または外部のシステムなどから受信することができる。   In process S1, the preceding relationship management means 21 receives the preceding relationship data between tasks of the program to be scheduled. In the present embodiment, it is assumed that the PERT diagram shown in FIG. This prior relationship data can be received from a user or from an external system via a computer.

処理S2において、先行関係管理手段21は、受信した先行関係データからタスクに対応するノードの集合、およびタスク間の先行関係を表す矢印の集合を抽出する。本実施形態では、タスク1からタスク9の計9個のタスクに対応するノード、およびタスク1からタスク4への先行関係を示す矢印<1,4>、タスク1からタスク6への先行関係を示す矢印<1,6>、・・・など、計12個の矢印が抽出される。   In process S2, the preceding relationship management means 21 extracts a set of nodes corresponding to the task and a set of arrows representing the preceding relationship between tasks from the received preceding relationship data. In this embodiment, nodes corresponding to a total of nine tasks from task 1 to task 9, arrows <1, 4> indicating the preceding relationship from task 1 to task 4, and the preceding relationship from task 1 to task 6 A total of twelve arrows, such as the indicated arrows <1, 6>,.

処理S3において、先行関係管理手段21は、タスク間に生じる間接の先行関係を識別する。本実施形態では、タスク4を経由して先行関係を有するタスク1とタスク6との間、タスク4を経由して先行関係を有するタスク1とタスク7との間、などに生じる間接の先行関係が識別される。   In process S3, the preceding relationship management means 21 identifies an indirect preceding relationship that occurs between tasks. In the present embodiment, an indirect precedence relationship that occurs between task 1 and task 6 having a precedence relationship via task 4, between task 1 and task 7 having a precedence relationship via task 4, and the like. Is identified.

処理S4において、先行関係管理手段21は、処理S2で抽出したタスク間の直接の先行関係、および処理S3で識別したタスク間の間接の先行関係に基づいて、受信した先行関係データの推移閉包を閉包先行関係記憶手段17に、および受信した先行関係データの推移縮退を縮退先行関係記憶手段18に登録する。本実施形態では、図19および図20に示されるようなレコードが登録される。   In process S4, the preceding relation management means 21 performs transition closure of the received preceding relation data based on the direct preceding relation between tasks extracted in process S2 and the indirect preceding relation between tasks identified in process S3. The transitional degeneracy of the received predecessor relation data is registered in the closure predecessor relation storage means 17 and the degeneracy advance relation storage means 18. In this embodiment, records as shown in FIGS. 19 and 20 are registered.

閉包先行関係記憶手段17には、先行関係を有するすべてのタスク間のレコードが登録される。ここで、例えばタスク1とタスク6とは、図9に示されるように直接の先行関係を有し、かつ、前述したように間接の先行関係も有する。すなわち、タスク1がタスク6に先行することは、タスク1とタスク6との直接の先行関係によって表されており、かつ、タスク1とタスク4との直接の先行関係およびタスク4とタスク6との直接の先行関係によっても表されている。このように、直接の先行関係および間接の先行関係を有する場合には、間接の先行関係を優先して登録する。このようにすることで、直接の先行関係のうち、他の直接の先行関係によって表される冗長関係を排除することができる。   In the closure precedence relationship storage unit 17, records between all tasks having a precedence relationship are registered. Here, for example, task 1 and task 6 have a direct preceding relationship as shown in FIG. 9, and also have an indirect preceding relationship as described above. That is, the fact that task 1 precedes task 6 is represented by the direct precedence relationship between task 1 and task 6, and the direct precedence relationship between task 1 and task 4, and task 4 and task 6, It is also expressed by its direct precedence relationship. Thus, in the case of having a direct preceding relationship and an indirect preceding relationship, the indirect preceding relationship is preferentially registered. By doing so, it is possible to eliminate a redundant relationship represented by another direct preceding relationship among the direct preceding relationships.

また、縮退先行関係記憶手段18には、閉包先行関係記憶手段17に登録されているレコードのうち、直接の先行関係を示すレコードのみが登録される。図23に、処理S4時点のPERT図を示す。図23に示されるように、処理S4時点では、タスク1とタスク6との直接の先行関係を示す矢印は削除される。   Further, only the records indicating the direct preceding relationship among the records registered in the closing precedence relationship storage unit 17 are registered in the degenerate precedence relationship storage unit 18. FIG. 23 shows a PERT diagram at the time of process S4. As shown in FIG. 23, the arrow indicating the direct preceding relationship between task 1 and task 6 is deleted at the time of process S4.

次に、処理S5において、タスク配置手段22は、縮退先行関係記憶手段18に記録された先行関係に対し、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの最速開始時間を算出する。本実施形態では、プログラム全体のスタートを0とし、実行時間1にタスク1、タスク2、タスク3が開始され、実行時間2にタスク4、タスク5が開始され、実行時間3にタスク6、タスク7、タスク8が開始され、実行時間4にタスク9が開始され、フィニッシュすることがわかる。   Next, in process S5, the task placement unit 22 uses the PERT analysis for the preceding relationship recorded in the degenerate precedence relationship storage unit 18 to set the fastest speed of each task when the execution time of each task is 1. Calculate the start time. In the present embodiment, the start of the entire program is set to 0, task 1, task 2, and task 3 are started at execution time 1, task 4 and task 5 are started at execution time 2, task 6 and task are started at execution time 3. 7 and task 8 are started, and task 9 is started at execution time 4 and finishes.

処理S6において、タスク配置手段22は、処理S5で算出した開始時間に基づいて、スタート時間、各開始時間、およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成する。本実施形態では、計6個のレイヤを有するタスク配置構造体が生成される。図24は、タスク構造体に配置されているPERT図のイメージ図である。   In step S6, the task placement unit 22 generates a task placement structure having layers corresponding to the start time, each start time, and finish time based on the start time calculated in step S5. In the present embodiment, a task arrangement structure having a total of six layers is generated. FIG. 24 is an image diagram of the PERT diagram arranged in the task structure.

処理S7において、タスク配置手段22は、レイヤ1の割り当てを決定する。具体的には、レイヤ1をレイヤ内に存在するタスク数のレベルに分割し、分割した領域にタスクを配置する。本実施形態では、レイヤ1内にタスクが3つ存在するので、レイヤ1を3つのレベルに分割して、タスク1、タスク2、タスク3を配置する。図25は、処理S7時点のタスク構造体に配置されたPERT図のイメージ図である。レイヤ1の割り当て完了後、タスク配置手段22は、レイヤLにレイヤ2をセットする。   In process S7, the task placement unit 22 determines the allocation of layer 1. Specifically, layer 1 is divided into the number of tasks existing in the layer, and tasks are arranged in the divided areas. In this embodiment, since there are three tasks in layer 1, task 1, task 2, and task 3 are arranged by dividing layer 1 into three levels. FIG. 25 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S7. After completing the assignment of the layer 1, the task placement unit 22 sets the layer 2 to the layer L.

処理S8において、タスク配置手段22は、レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定する。レイヤtでない場合、処理S9に進み、レイヤtである場合には処理S17に進む。本実施形態では、レイヤLはレイヤ2であるので、処理S9に進む。   In step S8, the task placement unit 22 determines whether or not the layer L is the layer t corresponding to the finish time. When it is not layer t, it progresses to process S9, and when it is layer t, it progresses to process S17. In the present embodiment, since the layer L is the layer 2, the process proceeds to step S9.

処理S9において、タスク配置手段22は、レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にする。本実施形態では、レイヤL(レイヤ2)内のタスク数が2、レイヤL−1(レイヤ1)内のタスク数が3であるので、レイヤ2に空タスクを1つ生成する。図26は、処理S9時点のタスク構造体に配置されたPERT図のイメージ図である。図26において、空タスクはεとして表される。空タスクは、スケジュール作成のために用いる、実行ステップを持たないタスクである。   In process S9, the task placement unit 22 compares the number of tasks in the layer L and the layer L-1, and if the number of tasks in one of the layers is smaller than the number of tasks in the other layer, the task placement unit 22 Generate the same number of tasks in both layers. In this embodiment, the number of tasks in layer L (layer 2) is 2, and the number of tasks in layer L-1 (layer 1) is 3, so one empty task is generated in layer 2. FIG. 26 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S9. In FIG. 26, the empty task is represented as ε. An empty task is a task that has no execution step and is used for creating a schedule.

処理S10において、タスク配置手段22は、閉包先行関係記憶手段17に基づいて、レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定する。ここで、タスクxおよびタスクyが先行関係を有する場合、タスクyはタスクxの後続となり得る。また、空タスクは、任意のタスクの後続になり得る。本実施形態では、タスク1の後続タスク候補としてタスク4および空タスク1、タスク2の後続タスク候補としてタスク4および空タスク1、タスク3の後続タスク候補としてタスク5および空タスク1が判定される。   In process S10, the task placement unit 22 determines a set of tasks (subsequent task candidates) in the layer L that can be subsequent to each task in the layer L-1, based on the closure precedence relationship storage unit 17. . Here, when task x and task y have a preceding relationship, task y can be a successor of task x. An empty task can be a successor to any task. In this embodiment, task 4 and empty task 1 are determined as subsequent task candidates for task 1, task 4 and empty task 1 are determined as subsequent task candidates for task 2, and task 5 and empty task 1 are determined as subsequent task candidates for task 3. .

処理S11において、タスク配置手段22は、グラフの最大マッチングアルゴリズムを用いて、レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得する。本実施形態では、組み合わせ1{[タスク1→タスク4],[タスク2→空タスク1],[タスク3→タスク5]}および組み合わせ2{[タスク1→空タスク1],[タスク2→タスク4],[タスク3→タスク5]}の2通りの最大マッチングが得られる。   In process S11, the task placement unit 22 obtains the maximum matching for each task in the layer L-1 and its subsequent task using the maximum matching algorithm of the graph. In this embodiment, combination 1 {[task 1 → task 4], [task 2 → empty task 1], [task 3 → task 5]} and combination 2 {[task 1 → empty task 1], [task 2 → Two types of maximum matching of [task 4] and [task 3 → task 5]} are obtained.

処理S12において、タスク配置手段22は、処理S11で得られた最大マッチングのマッチング数とレイヤL−1内のタスク数を比較する。マッチング数がタスク数より少ない場合、処理S13に進み、マッチング数とタスク数とが一致する場合には、処理S14に進む。本実施形態では、マッチング数およびタスク数が3と一致するので、処理S14に進む。処理S13については後述する。   In step S12, the task placement unit 22 compares the number of matching of the maximum matching obtained in step S11 with the number of tasks in the layer L-1. If the number of matching is less than the number of tasks, the process proceeds to step S13. If the number of matching matches the number of tasks, the process proceeds to process S14. In this embodiment, since the number of matching and the number of tasks match 3, the process proceeds to step S14. The process S13 will be described later.

処理S14において、タスク配置手段22は、レイヤLをレイヤ内に存在するタスク数のレベルに分割し、分割した領域にタスクを配置する。ここで、レイヤLおよびレイヤL−1は同じ数の領域が作成されている。図27に示すように、タスク配置構造体を区切る縦の単位をレイヤ、横の単位をレベルと呼ぶ。タスク配置手段22は、各タスクとその後続のタスクとが、同一レベルになるようにタスクを配置する。処理S11で複数の最大マッチングが得られた場合には、任意の1つを選択することができる。本実施形態では、組み合わせ1を選択し、レイヤ2のレベル1にタスク4を、レイヤ2のレベル2に空タスク1を、レイヤ2のレベル3にタスク5を配置する。図27は、処理S14時点のタスク構造体に配置されたPERT図のイメージ図である。   In process S14, the task placement unit 22 divides the layer L into the number of tasks existing in the layer, and places the task in the divided area. Here, the same number of areas are created in the layer L and the layer L-1. As shown in FIG. 27, a vertical unit that divides a task arrangement structure is called a layer, and a horizontal unit is called a level. The task placement unit 22 places tasks so that each task and the subsequent task are at the same level. When a plurality of maximum matchings are obtained in the process S11, any one can be selected. In this embodiment, the combination 1 is selected, the task 4 is arranged at the level 1 of the layer 2, the empty task 1 is arranged at the level 2 of the layer 2, and the task 5 is arranged at the level 3 of the layer 2. FIG. 27 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S14.

処理S15において、イベント識別手段23は、レイヤL−1内のタスクxの後続としてレイヤL内に配置できなかったタスクyを識別し、イベント記憶手段20に記憶する。本実施形態では、まず、タスク2の後続として配置できなかったタスク4が識別され、イベント記憶手段20に記憶される。また、レイヤ1内のタスク3の後続としてレイヤ2内に配置できなかったタスク8が識別され、イベント記憶手段20に記憶される。ここでは、図21のイベント識別子e0およびe1により識別されるレコードが登録される。   In process S15, the event identification unit 23 identifies the task y that could not be placed in the layer L as a successor of the task x in the layer L-1, and stores the task y in the event storage unit 20. In the present embodiment, first, task 4 that could not be arranged as a successor of task 2 is identified and stored in event storage means 20. Also, the task 8 that could not be placed in the layer 2 as a successor of the task 3 in the layer 1 is identified and stored in the event storage means 20. Here, records identified by event identifiers e0 and e1 in FIG. 21 are registered.

処理S8から処理S15までが、1つのレイヤに対する処理である。処理S16において、タスク配置手段22は、レイヤLに現在処理中のレイヤの次のレイヤをセットし、処理S8に戻る。本実施形態では、タスク配置手段22は、レイヤLにレイヤ3をセットし、処理S8に戻る。   Processes S8 to S15 are processes for one layer. In process S16, the task placement unit 22 sets a layer next to the layer currently being processed in layer L, and returns to process S8. In the present embodiment, the task placement unit 22 sets layer 3 to layer L, and returns to step S8.

本実施形態では、処理S8(2週目)において、タスク配置手段22は、レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定し、レイヤLはレイヤ3であるので、処理S9に進む。   In the present embodiment, in process S8 (second week), the task placement unit 22 determines whether or not the layer L is the layer t corresponding to the finish time. move on.

処理S9(2週目)において、タスク配置手段22は、レイヤ3およびレイヤ2内のタスク数を比較する。本実施形態では、両レイヤ内のタスク数は3で同一であるので、空タスクは生成せずに、処理S10に進む。   In process S9 (second week), the task placement unit 22 compares the number of tasks in layer 3 and layer 2. In this embodiment, since the number of tasks in both layers is the same, the process proceeds to step S10 without generating an empty task.

処理S10(2週目)において、タスク配置手段22は、閉包先行関係記憶手段17に基づいて、レイヤ2内の各タスクに対して、後続となり得るレイヤ3内のタスクの集合を判定する。本実施形態では、まず、タスク4の後続タスク候補としてタスク6、タスク7およびタスク8が判定される。ここで、空タスクの後続候補は、空タスクに先行する空タスク以外のタスクのうち、最も高レイヤのタスクxが直接または間接の先行関係を有するタスクyとなる。本実施形態では、空タスク1の後続タスク候補として、空タスクに先行する空タスク以外のタスクのうち、最も高レイヤのタスク2が間接の先行関係を有するタスク6、タスク7およびタスク8が判定される。一方、タスク5の後続タスク候補は存在しない。   In the process S10 (second week), the task placement unit 22 determines a set of tasks in the layer 3 that can be subsequent to each task in the layer 2, based on the closure precedence relationship storage unit 17. In the present embodiment, first, task 6, task 7, and task 8 are determined as subsequent task candidates for task 4. Here, the successor candidate of the empty task is the task y in which the highest layer task x has a direct or indirect preceding relationship among tasks other than the empty task preceding the empty task. In this embodiment, among the tasks other than the empty task preceding the empty task, the task 6, task 7 and task 8 in which the highest layer task 2 has an indirect preceding relationship are determined as the subsequent task candidates of the empty task 1. Is done. On the other hand, there is no subsequent task candidate for task 5.

処理S11(2週目)において、タスク配置手段22は、グラフの最大マッチングアルゴリズムを用いて、レイヤ2内の各タスクとその後続タスクについて、最大マッチングを取得する。本実施形態では、組み合わせ1{[タスク4→タスク6],[空タスク1→タスク7]}、組み合わせ2{[タスク4→タスク7],[空タスク1→タスク6]}など、複数の最大マッチングが得られる。   In the process S11 (second week), the task placement unit 22 obtains the maximum matching for each task in the layer 2 and the subsequent task using the maximum matching algorithm of the graph. In the present embodiment, a combination 1 {[task 4 → task 6], [empty task 1 → task 7]}, a combination 2 {[task 4 → task 7], [empty task 1 → task 6]}, etc. Maximum matching is obtained.

処理S12(2週目)において、タスク配置手段22は、処理S11で得られた最大マッチングのマッチング数2とレイヤ2内のタスク数3を比較する。本実施形態では、マッチング数がタスク数より少ないので、処理S13に進む。   In the process S12 (second week), the task placement unit 22 compares the matching number 2 of the maximum matching obtained in the process S11 with the task number 3 in the layer 2. In this embodiment, since the number of matching is less than the number of tasks, the process proceeds to step S13.

処理S13(2週目)において、タスク配置手段22は、マッチング数とタスク数の差の数、レイヤLおよびレイヤL−1に空タスクを生成し、空タスクを配置するために、新たなレベルの領域を作成する。本実施形態では、レイヤ2およびレイヤ3に空タスク2、空タスク3がそれぞれ生成され、空タスク2を配置するために、レベル4の領域が生成される。図28は、処理S13時点のタスク構造体に配置されたPERT図のイメージ図である。   In the process S13 (second week), the task placement unit 22 generates a blank task in the number of matching and the difference between the number of tasks, layer L and layer L-1, and sets a new level to place a blank task. Create an area for. In this embodiment, empty task 2 and empty task 3 are generated in layer 2 and layer 3, respectively, and a level 4 area is generated in order to place empty task 2. FIG. 28 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S13.

処理S13後、再度処理S10に戻る。処理S10(2週目、2度目)において、タスク配置手段22は、閉包先行関係記憶手段17に基づいて、レイヤ2内の各タスクに対して、後続となり得るレイヤ3内のタスクの集合を判定する。本実施形態では、タスク4、空タスク1、空タスク2の後続タスク候補として、いずれもタスク6、タスク7、タスク8および空タスク3が、タスク5の後続タスク候補として空タスク3が判定される。   After the process S13, the process returns to the process S10 again. In process S10 (second time and second time), the task placement unit 22 determines a set of tasks in the layer 3 that can be subsequent to each task in the layer 2, based on the closure precedence storage unit 17. To do. In the present embodiment, task 6, task 7, task 8, and empty task 3 are all determined as the succeeding task candidates of task 4, empty task 1, and empty task 2, and empty task 3 is determined as the subsequent task candidate of task 5. The

処理S11(2週目、2度目)において、タスク配置手段22は、グラフの最大マッチングアルゴリズムを用いて、レイヤ2内の各タスクとその後続タスクについて、最大マッチングを取得する。本実施形態では、組み合わせ1{[タスク4→タスク6],[空タスク1→タスク7],[タスク5→空タスク3],[空タスク2→タスク8]}、組み合わせ2{[タスク4→タスク7],[空タスク1→タスク6]}など、複数の最大マッチングが得られる。   In the process S11 (second time and second time), the task placement unit 22 obtains the maximum matching for each task in the layer 2 and the subsequent task using the maximum matching algorithm of the graph. In this embodiment, combination 1 {[task 4 → task 6], [empty task 1 → task 7], [task 5 → empty task 3], [empty task 2 → task 8]}, combination 2 {[task 4 → task 7], [empty task 1 → task 6]} and the like are obtained.

処理S12(2週目、2度目)において、タスク配置手段22は、処理S11で得られた最大マッチングのマッチング数4とレイヤ2内のタスク数4を比較する。本実施形態では、マッチング数とタスク数とが一致するので、処理S14に進む。   In process S12 (second week, second time), the task placement unit 22 compares the matching number 4 of the maximum matching obtained in process S11 with the task number 4 in the layer 2. In this embodiment, since the number of matching matches the number of tasks, the process proceeds to step S14.

処理S14(2週目)において、タスク配置手段22は、レイヤ3をレイヤ3内に存在するタスク数である4つのレベルに分割し、分割した領域にタスクを配置する。本実施形態では、レイヤ3のレベル1にタスク6を、レイヤ3のレベル2にタスク7を、レイヤ3のレベル3に空タスク3を、レイヤ3のレベル4にタスク8を配置する。図29は、処理S14(2週目)時点のタスク構造体に配置されたPERT図のイメージ図である。   In process S14 (second week), the task placement unit 22 divides layer 3 into four levels, which is the number of tasks existing in layer 3, and places tasks in the divided areas. In this embodiment, task 6 is arranged at level 3 of layer 3, task 7 is arranged at level 2 of layer 3, empty task 3 is arranged at level 3 of layer 3, and task 8 is arranged at level 4 of layer 3. FIG. 29 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S14 (second week).

処理S15(2週目)において、イベント識別手段23は、レイヤ2内のタスクxの後続としてレイヤ3内に配置できなかったタスクyを識別し、イベント記憶手段20に記憶する。本実施形態では、タスク4の後続として配置できなかったタスク7、タスク4の後続として配置できなかったタスク8が識別され、イベント記憶手段20に記憶される。なお、レイヤ2内のタスク5の後続としてレイヤ3内に配置できなかったタスク9については、ここでは記憶されない。レイヤL−1内のタスクxの後続としてレイヤL内に配置できなかったタスクyが存在する場合であっても、タスクxの後続として空タスクが配置されている場合には、この空タスクの後続としてタスクyが配置されないときのみ、イベント記憶手段20に記憶する。したがって、ここでは、図21のイベント識別子e2およびe3により識別されるレコードが登録される。   In the process S15 (second week), the event identifying unit 23 identifies the task y that could not be placed in the layer 3 as a successor of the task x in the layer 2, and stores it in the event storage unit 20. In this embodiment, task 7 that could not be placed as a successor of task 4 and task 8 that could not be placed as a successor of task 4 are identified and stored in event storage means 20. Note that task 9 that could not be placed in layer 3 as a successor of task 5 in layer 2 is not stored here. Even if there is a task y that could not be placed in the layer L as a successor of the task x in the layer L-1, if an empty task is placed as a successor of the task x, the empty task Only when the task y is not arranged as a successor, it is stored in the event storage means 20. Therefore, here, the record identified by the event identifiers e2 and e3 in FIG. 21 is registered.

レイヤ3に対する処理を終え、処理S16(2週目)において、タスク配置手段22は、レイヤLにレイヤ4をセットし、処理S8に戻る。   In the process S16 (2nd week), the task placement unit 22 sets the layer 4 to the layer L and returns to the process S8.

本実施形態では、処理S8(3週目)において、タスク配置手段22は、レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定し、レイヤLはレイヤ4であるので、処理S9に進む。   In the present embodiment, in process S8 (third week), the task placement unit 22 determines whether or not the layer L is the layer t corresponding to the finish time. move on.

処理S9(3週目)において、タスク配置手段22は、レイヤ4およびレイヤ3内のタスク数を比較する。本実施形態では、レイヤ4内のタスク数が1、レイヤ3内のタスク数が4であるので、レイヤ4に空タスクを3つ生成する。図30は、処理S9(3週目)時点のタスク構造体に配置されたPERT図のイメージ図である。   In process S9 (third week), task placement means 22 compares the number of tasks in layer 4 and layer 3. In this embodiment, since the number of tasks in layer 4 is 1 and the number of tasks in layer 3 is 4, three empty tasks are generated in layer 4. FIG. 30 is an image diagram of a PERT diagram arranged in the task structure at the time of processing S9 (third week).

処理S10(3週目)において、タスク配置手段22は、閉包先行関係記憶手段17に基づいて、レイヤ3内の各タスクに対して、後続となり得るレイヤ4内のタスクの集合を判定する。本実施形態では、タスク6、タスク7、タスク8、空タスク3の後続タスク候補として、いずれもタスク9、空タスク4、空タスク5および空タスク6が判定される。   In process S10 (third week), the task placement unit 22 determines a set of tasks in the layer 4 that can be subsequent to each task in the layer 3, based on the closure precedence relationship storage unit 17. In the present embodiment, task 9, empty task 4, empty task 5, and empty task 6 are all determined as subsequent task candidates for task 6, task 7, task 8, and empty task 3.

処理S11(3週目)において、タスク配置手段22は、グラフの最大マッチングアルゴリズムを用いて、レイヤ3内の各タスクとその後続タスクについて、最大マッチングを取得する。本実施形態では、組み合わせ1{[タスク6→空タスク4],[タスク7→空タスク5],[空タスク3→タスク9],[タスク8→空タスク6]}など、複数の最大マッチングが得られる。   In the process S11 (third week), the task placement unit 22 obtains the maximum matching for each task in the layer 3 and the subsequent task using the maximum matching algorithm of the graph. In this embodiment, a plurality of maximum matchings such as a combination 1 {[task 6 → empty task 4], [task 7 → empty task 5], [empty task 3 → task 9], [task 8 → empty task 6]}, etc. Is obtained.

処理S12(3週目)において、タスク配置手段22は、処理S11で得られた最大マッチングのマッチング数4とレイヤ3内のタスク数4を比較する。本実施形態では、マッチング数とタスク数とが一致するので、処理S14に進む。   In the process S12 (third week), the task placement unit 22 compares the matching number 4 of the maximum matching obtained in the process S11 with the task number 4 in the layer 3. In this embodiment, since the number of matching matches the number of tasks, the process proceeds to step S14.

処理S14(3週目)において、タスク配置手段22は、レイヤ4をレイヤ内に存在するタスク数である4つのレベルに分割し、分割した領域にタスクを配置する。本実施形態では、レイヤ4のレベル1に空タスク4を、レイヤ4のレベル2に空タスク5を、レイヤ4のレベル3にタスク9を、レイヤ4のレベル4に空タスク6を配置する。図31は、処理S14(3週目)時点のタスク構造体に配置されたPERT図のイメージ図である。   In process S14 (third week), the task placement unit 22 divides the layer 4 into four levels that are the number of tasks existing in the layer, and places the tasks in the divided areas. In this embodiment, an empty task 4 is arranged at level 4 of layer 4, an empty task 5 is arranged at level 2 of layer 4, a task 9 is arranged at level 3 of layer 4, and an empty task 6 is arranged at level 4 of layer 4. FIG. 31 is an image diagram of the PERT diagram arranged in the task structure at the time of processing S14 (third week).

処理S15(3週目)において、イベント識別手段23は、レイヤ3内のタスクxの後続としてレイヤ4内に配置できなかったタスクyを識別し、イベント記憶手段20に記憶する。本実施形態では、タスク6の後続として配置できなかったタスク9、タスク7の後続として配置できなかったタスク9、タスク8の後続として配置できなかったタスク9が識別され、イベント記憶手段20に記憶される。なお、レイヤ2内のタスク5の後続としてレイヤ3内に配置できなかったタスク9は、レイヤ3の空タスクを介して、レイヤ4内にタスク5の後続として配置されているので、イベント記憶手段20には記憶されない。したがって、ここでは、図21のイベント識別子e4、e5およびe6により識別されるレコードが登録される。   In process S15 (third week), the event identifying unit 23 identifies the task y that could not be placed in the layer 4 as a successor of the task x in the layer 3, and stores the task y in the event storage unit 20. In this embodiment, task 9 that could not be placed as a successor of task 6, task 9 that could not be placed as a successor of task 7, and task 9 that could not be placed as a successor of task 8 are identified and stored in event storage means 20. Is done. Note that the task 9 that could not be placed in the layer 3 as a successor of the task 5 in the layer 2 is placed as a successor of the task 5 in the layer 4 via an empty task in the layer 3, so that event storage means 20 is not stored. Therefore, here, the record identified by the event identifiers e4, e5 and e6 in FIG. 21 is registered.

レイヤ4に対する処理を終え、処理S16(3週目)において、タスク配置手段22は、レイヤLにレイヤtをセットし、処理S8に戻る。   In the process S16 (third week), the task placement unit 22 sets the layer t to the layer L and returns to the process S8.

本実施形態では、処理S8(4週目)において、タスク配置手段22は、レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定し、レイヤLはレイヤtであるので、処理S17に進む。   In the present embodiment, in process S8 (fourth week), the task placement unit 22 determines whether or not the layer L is the layer t corresponding to the finish time, and the layer L is the layer t. move on.

処理S17において、タスク配置手段22は、上述の処理で得られたタスク配置構造体の情報をタスク配置記憶手段19に記憶する。   In process S <b> 17, the task placement unit 22 stores the task placement structure information obtained by the above-described process in the task placement storage unit 19.

処理S18において、スケジュール変換手段24は、タスク配置記憶手段19のタスク配置構造体およびイベント記憶手段20に基づいて、スケジュールを作成する。   In process S 18, the schedule conversion unit 24 creates a schedule based on the task arrangement structure of the task arrangement storage unit 19 and the event storage unit 20.

(スケジュール作成方法−タスク配置構造体からの変換)
次に、図32のフローチャートを参照して、タスク配置記憶手段19のタスク配置構造体およびイベント記憶手段20に基づいて、スケジュールを作成する工程を詳述する。本実施形態では、(スケジュールの作成−並列実行)の章同様、Event Objectを用いるものとする。
(Schedule creation method-conversion from task allocation structure)
Next, the process of creating a schedule based on the task arrangement structure of the task arrangement storage means 19 and the event storage means 20 will be described in detail with reference to the flowchart of FIG. In the present embodiment, an Event Object is used as in the (Schedule creation-Parallel execution) chapter.

処理S1において、スケジュール変換手段24は、スケジュール未作成のレベルが存在するか否か判定する。未作成のレベルが存在する場合、処理S2に進み、未作成のレベルが存在しない場合には処理を終了する。本実施形態では、未作成のレベルが存在するので、処理S2に進む。   In process S1, the schedule conversion means 24 determines whether there is a level for which no schedule has been created. If there is an uncreated level, the process proceeds to step S2, and if there is no uncreated level, the process ends. In this embodiment, since there is an uncreated level, the process proceeds to step S2.

処理S2において、スケジュール変換手段24は、タスク構造体のレベルのうち、スケジュールを作成していないレベルを抽出し、かつ、レイヤCにレイヤ1をセットする。本実施形態では、レベル1を抽出するものとする。   In process S2, the schedule conversion means 24 extracts a level for which no schedule is created from the levels of the task structure, and sets layer 1 to layer C. In this embodiment, level 1 is extracted.

処理S3において、スケジュール変換手段24は、レイヤCがフィニッシュ時間に対応するレイヤtであるか否か判定する。レイヤtでない場合、処理S4に進み、レイヤtである場合には処理S1に戻る。本実施形態では、レイヤCはレイヤ1であるので、処理S4に進む。   In process S3, the schedule conversion means 24 determines whether or not the layer C is the layer t corresponding to the finish time. If it is not layer t, the process proceeds to process S4. If it is layer t, the process returns to process S1. In this embodiment, since layer C is layer 1, the process proceeds to step S4.

処理S4において、スケジュール変換手段24は、レイヤCに配置されたタスクを識別する。本実施形態では、レイヤ1に配置されたタスク1を識別する。   In process S4, the schedule conversion means 24 identifies the task arranged in the layer C. In the present embodiment, task 1 arranged in layer 1 is identified.

処理S5において、スケジュール変換手段24は、イベント記憶手段20に基づいて、処理S4で識別したタスクを実行する前に待機すべきイベントが存在するか否かを判定する。待機すべきイベントが存在する場合は処理S6に進み、存在しない場合には処理S7に進む。本実施形態では、イベント記憶手段20の待機タスクに対象となるタスクが格納されているか否かにより判定を行うことができる。ここでは、図21に示されるように、待機タスクにタスク1が格納されたレコードは存在しないので、処理S7に進む。処理S6については後述する。   In the process S5, the schedule conversion unit 24 determines whether or not there is an event to be waited for before executing the task identified in the process S4 based on the event storage unit 20. If there is an event to be waited for, the process proceeds to process S6, and if not, the process proceeds to process S7. In the present embodiment, the determination can be made based on whether or not the target task is stored in the standby task of the event storage unit 20. Here, as shown in FIG. 21, since there is no record in which task 1 is stored in the waiting task, the process proceeds to step S7. The process S6 will be described later.

処理S7において、スケジュール変換手段24は、処理S4で識別したタスクが空タスクでない場合、当該タスクの実行をスケジュールとして記述する。本実施形態では、タスク1の実行をtask1()と記述する。   In process S7, if the task identified in process S4 is not an empty task, the schedule conversion unit 24 describes the execution of the task as a schedule. In this embodiment, execution of task 1 is described as task1 ().

処理S8において、スケジュール変換手段24は、イベント記憶手段20に基づいて、処理S4で識別したタスクの完了を通知すべきイベントが存在するか否かを判定する。通知すべきイベントが存在する場合は処理S9に進み、存在しない場合には処理S10に進む。本実施形態では、イベント記憶手段20の通知タスクに対象となるタスクが格納されているか否かにより判定を行うことができる。ここでは、図21に示されるように、通知タスクにタスク1が格納されたレコードは存在しないので、処理S10に進む。処理S9については後述する。   In step S8, the schedule conversion unit 24 determines whether there is an event to be notified of the completion of the task identified in step S4 based on the event storage unit 20. If there is an event to be notified, the process proceeds to step S9, and if not, the process proceeds to process S10. In the present embodiment, the determination can be made based on whether or not a target task is stored in the notification task of the event storage unit 20. Here, as shown in FIG. 21, since there is no record in which task 1 is stored in the notification task, the process proceeds to step S10. The process S9 will be described later.

処理S3から処理S9までが、1つのレイヤに対する処理である。処理S10において、スケジュール変換手段24は、レイヤCに現在処理中のレイヤの次のレイヤをセットし、処理S3に戻る。ここでは、レイヤCにレイヤ2をセットする。   Processes S3 to S9 are processes for one layer. In process S10, the schedule conversion means 24 sets the layer next to the layer currently being processed in layer C, and returns to process S3. Here, layer 2 is set to layer C.

処理S3(2週目)において、スケジュール変換手段24は、レイヤCがフィニッシュ時間に対応するレイヤtであるか否か判定し、レイヤCはレイヤ2であるので、処理S4に進む。   In the process S3 (second week), the schedule conversion means 24 determines whether or not the layer C is the layer t corresponding to the finish time. Since the layer C is the layer 2, the process proceeds to the process S4.

処理S4(2週目)において、スケジュール変換手段24は、レイヤ2に配置されたタスク4を識別する。処理S5(2週目)において、スケジュール変換手段24は、イベント記憶手段20に基づいて、タスク4を実行する前に待機すべきイベントが存在するか否かを判定する。本実施形態では、図21に示されるように、タスク4を実行する前に待機すべきイベントが存在するので、処理S6に進む。   In the process S4 (second week), the schedule conversion unit 24 identifies the task 4 arranged in the layer 2. In the process S5 (second week), the schedule conversion unit 24 determines whether or not there is an event to wait before executing the task 4 based on the event storage unit 20. In the present embodiment, as shown in FIG. 21, there is an event that should be waited before executing task 4, so the process proceeds to step S <b> 6.

処理S6(2週目)において、スケジュール変換手段24は、待機すべきイベントをスケジュールとして記述する。本実施形態では、e0により特定されるEvent Objectがシグナル状態になるまで待機し続けるために、WaitForSingleObject(e0)の呼び出しを記述する。   In the process S6 (second week), the schedule conversion means 24 describes an event to be waited for as a schedule. In the present embodiment, a call to WaitForSingleObject (e0) is described in order to continue waiting until the Event Object specified by e0 becomes a signal state.

処理S7(2週目)において、スケジュール変換手段24は、処理S4で識別したタスク4の実行をスケジュールとして記述する。本実施形態では、タスク4の実行をtask4()と記述する。処理S8(2週目)において、スケジュール変換手段24は、イベント記憶手段20に基づいて、処理S4で識別したタスク4の完了を通知すべきイベントが存在するか否かを判定する。本実施形態では、図21に示されるように、タスク4の完了を通知すべきイベントが存在するので、処理S9に進む。   In the process S7 (second week), the schedule conversion unit 24 describes the execution of the task 4 identified in the process S4 as a schedule. In this embodiment, execution of task 4 is described as task4 (). In the process S8 (second week), the schedule conversion unit 24 determines, based on the event storage unit 20, whether there is an event to be notified of the completion of the task 4 identified in the process S4. In the present embodiment, as shown in FIG. 21, there is an event that should be notified of the completion of task 4, and therefore the process proceeds to step S9.

処理S9(2週目)において、スケジュール変換手段24は、通知すべきイベントをスケジュールとして記述する。本実施形態では、e2およびe3により特定されるEvent Objectをシグナル状態にするために、SetEvent(e2)およびSetEvent(e3)の呼び出しを記述する。   In the process S9 (second week), the schedule conversion means 24 describes the event to be notified as a schedule. In the present embodiment, calls to SetEvent (e2) and SetEvent (e3) are described in order to set the Event Object specified by e2 and e3 to the signal state.

処理S10において、スケジュール変換手段24は、レイヤCにレイヤ3をセットし、処理S3に戻る。同様に、レイヤ3、レイヤ4に対して処理S3から処理S9までの処理を行い、最後に、処理S10において、レイヤCにレイヤtがセットされると、処理S3の判定を経て、処理S1に戻る。ここまでの処理によって、レベル1に対応するスケジュールとして、以下に示すスケジュール6−0が作成される。   In process S10, the schedule conversion means 24 sets layer 3 to layer C, and returns to process S3. Similarly, processing from processing S3 to processing S9 is performed on layer 3 and layer 4. Finally, when layer t is set to layer C in processing S10, the processing in processing S3 is performed and the processing returns to processing S1. Return. By the processing so far, the following schedule 6-0 is created as a schedule corresponding to level 1.

また、同様に、処理S1からフローチャートに従って処理することにより、レベル2に対応するスケジュールとしてスケジュール6−1、レベル3に対応するスケジュールとしてスケジュール6−2、レベル4に対応するスケジュールとしてスケジュール6−3が得られる。
スケジュール6−0=task1(); WaitForSingleObject(e0); task4(); SetEvent(e2);
SetEvent(e3); task6(); SetEvent(e4);
スケジュール6−1=task2(); SetEvent(e0); WaitForSingleObject(e2); task7();
SetEvent(e5);
スケジュール6−2=task3(); SetEvent(e1); task5(); WaitForSingleObject(e4);
WaitForSingleObject(e5); WaitForSingleObject(e6); task9();
スケジュール6−3=WaitForSingleObject(e1); WaitForSingleObject(e3); task8();
SetEvent(e6);
Similarly, by performing processing from the process S1 according to the flowchart, the schedule corresponding to the level 2 is the schedule 6-1, the schedule corresponding to the level 3 is schedule 6-2, and the schedule corresponding to the level 4 is schedule 6-3. Is obtained.
Schedule 6-0 = task1 (); WaitForSingleObject (e0); task4 (); SetEvent (e2);
SetEvent (e3); task6 (); SetEvent (e4);
Schedule 6-1 = task2 (); SetEvent (e0); WaitForSingleObject (e2); task7 ();
SetEvent (e5);
Schedule 6-2 = task3 (); SetEvent (e1); task5 (); WaitForSingleObject (e4);
WaitForSingleObject (e5); WaitForSingleObject (e6); task9 ();
Schedule 6-3 = WaitForSingleObject (e1); WaitForSingleObject (e3); task8 ();
SetEvent (e6);

以上の処理により、図9に示されるPERT図で表される複数のタスクを、そのタスク間の先行関係のみに基づいてスケジューリングすることができる。タスクの実行時間に依存しないので、タスクの実行時間が変わっても、スケジュールを再作成する必要はなくなる。   Through the above processing, a plurality of tasks represented by the PERT diagram shown in FIG. 9 can be scheduled based only on the prior relationship between the tasks. Since it does not depend on the task execution time, the schedule need not be recreated even if the task execution time changes.

本発明で導かれるスケジュールは、リソース数の制約がない場合に実行時間が最小となるものであって、いずれの実行環境においても、最小時間での実行を保障することができる。さらに、本発明で導かれるスケジュールにより、実行時間が最小となるスケジュールを実行するための最少リソース数を得ることができる。最少リソース数を知ることにより、不必要なリソースを維持する不利益を回避することができる。   The schedule derived by the present invention has a minimum execution time when there is no restriction on the number of resources, and can guarantee the execution in the minimum time in any execution environment. Furthermore, the schedule derived by the present invention can obtain the minimum number of resources for executing the schedule having the minimum execution time. Knowing the minimum number of resources can avoid the disadvantage of maintaining unnecessary resources.

Claims (8)

先行タスク、後続タスク、先行関係タイプを格納する閉包先行関係記憶手段と、先行タスク、後続タスク、先行関係タイプを格納する縮退先行関係記憶手段と、通知タスク、待機タスク、イベント識別子を格納するイベント記憶手段とを備えたシステムにおいて、
前記システムの先行関係管理手段が、スケジュール作成対象のプログラムのタスク間の先行関係データを受信するステップと、
前記先行関係管理手段が、前記先行関係データに含まれる直接の先行関係および間接の先行関係に基づいて、前記受信した先行関係データの推移閉包を前記閉包先行関係記憶手段に、および前記受信した先行関係データの推移縮退を前記縮退先行関係記憶手段に記憶するステップと、
前記システムのタスク配置手段が、前記縮退先行関係記憶手段に記録された先行関係に対し、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの開始時間を算出するステップと、
前記タスク配置手段が、前記算出した開始時間に基づいて、各開始時間およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成するステップと、
前記タスク配置手段が、レイヤ1をレイヤ1内に存在するタスク数のレベルで分割し、分割した領域にタスクを配置するステップと、
前記タスク配置手段が、レイヤLにレイヤ2をセットするステップと、
前記タスク配置手段が、前記レイヤLが前記フィニッシュ時間に対応するレイヤtであるか否か判定するステップであって、レイヤtである場合、前記タスク配置構造体および前記イベント記憶手段に基づいて、スケジュールを作成し、レイヤtでない場合、後続のステップを続けるステップと、
前記タスク配置手段が、前記レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にするステップと、
前記タスク配置手段が、前記閉包先行関係記憶手段に基づいて、前記レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定するステップと、
前記タスク配置手段が、グラフの最大マッチングアルゴリズムを用いて、前記レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得するステップと、
前記タスク配置手段が、前記最大マッチングのマッチング数が前記レイヤL−1内のタスク数より少ない場合、最大マッチングのマッチング数が前記レイヤL−1内のタスク数と一致するまで、マッチング数とタスク数の差の数、前記レイヤLおよび前記レイヤL−1に空タスクを生成し、空タスクを配置するために新たなレベルの領域を作成し、前記後続タスク候補の集合を判定するステップ、および前記最大マッチングを取得するステップを繰り返す、ステップと、
前記タスク配置手段が、前記レイヤLを当該レイヤ内に存在するタスク数のレベルで分割し、前記レイヤL−1内の各タスクとその後続タスクとが、同一レベルになるように分割した領域にタスクを配置するステップと、
前記システムのイベント識別手段が、前記レイヤL−1内のタスクxの後続として前記レイヤL内に配置できなかったタスクyを識別し、前記イベント記憶手段に記憶するステップと、
前記タスク配置手段が、前記レイヤLにレイヤL+1をセットし、前記レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定するステップに戻る、ステップと
を含むことを特徴とする方法。
Closure precedence relationship storage means for storing the preceding task, successor task, and precedence relationship type, degenerate precedence relationship storage means for storing the precedence task, successor task, and precedence relationship type, notification task, standby task, and event for storing the event identifier In a system comprising storage means,
The preceding relationship management means of the system receives preceding relationship data between tasks of a program to be scheduled;
Based on the direct preceding relationship and the indirect preceding relationship included in the preceding relationship data, the preceding relationship management unit sends a transition closure of the received preceding relationship data to the closure preceding relationship storage unit, and the received preceding relationship. Storing transition degeneration of relational data in the degeneracy preceding relation storage means;
The task placement unit of the system calculates the start time of each task when the execution time of each task is set to 1 using PERT analysis for the preceding relationship recorded in the degenerate precedence relationship storage unit When,
The task placement means generating a task placement structure having a layer corresponding to each start time and finish time based on the calculated start time;
The task placement means divides layer 1 at the level of the number of tasks existing in layer 1 and places tasks in the divided areas;
The task placement means sets layer 2 to layer L;
The task placement unit is a step of determining whether or not the layer L is a layer t corresponding to the finish time. When the layer L is a layer t, based on the task placement structure and the event storage unit, Create a schedule and if not layer t, continue with the following steps;
The task placement unit compares the number of tasks in the layer L and the layer L-1, and if the number of tasks in one of the layers is smaller than the number of tasks in the other layer, generates a blank task. Making the number of tasks in both layers the same,
The task placement means determining, based on the closure precedence relationship storage means, a set of tasks in the layer L (subsequent task candidates) that can be subsequent to each task in the layer L-1.
The task placement means obtains a maximum matching for each task in the layer L-1 and its subsequent tasks using a maximum matching algorithm of a graph;
When the task placement means has a matching number of the maximum matching smaller than the number of tasks in the layer L-1, the matching number and the task until the matching number of the maximum matching matches the number of tasks in the layer L-1. Generating empty tasks in the layer L and the layer L-1, creating a new level area for placing empty tasks, and determining the set of subsequent task candidates; and Repeating the step of obtaining the maximum matching; and
The task placement unit divides the layer L at the level of the number of tasks existing in the layer, and each task in the layer L-1 and its subsequent task are divided into regions that are divided at the same level. Placing a task,
An event identifying means of the system for identifying a task y that could not be placed in the layer L as a successor of the task x in the layer L-1, and storing it in the event storage means;
The task placement means includes a step of setting layer L + 1 to the layer L and returning to the step of determining whether or not the layer L is a layer t corresponding to a finish time.
前記タスク配置構造体および前記イベント記憶手段に基づいて、スケジュールを作成するステップは、
前記システムのスケジュール変換手段が、前記タスク配置構造体にスケジュール未作成のレベルが存在するか否か判定し、存在する場合に、後続の処理を続けるステップと、
前記スケジュール変換手段が、前記タスク配置構造体のレベルのうち、スケジュールを作成していないレベルを抽出し、かつ、レイヤCに1をセットするステップと、
前記スケジュール変換手段が、前記レイヤCが前記レイヤtであるか否か判定するステップであって、レイヤtである場合、前記タスク配置構造体にスケジュール未作成のレベルが存在するか否か判定するステップに戻り、レイヤtでない場合、後続のステップを続けるステップと、
前記スケジュール変換手段が、前記レイヤCに配置されたタスクを識別するステップと、
前記スケジュール変換手段が、前記イベント記憶手段に基づいて、前記識別したタスクを実行する前に待機すべきイベントが存在するか否かを判定し、存在する場合に、待機すべきイベントをスケジュールとして記述するステップと、
前記スケジュール変換手段が、前記識別したタスクが空タスクでない場合、当該タスクの実行をスケジュールとして記述するステップと、
前記スケジュール変換手段が、前記イベント記憶手段に基づいて、前記識別したタスクの完了を通知すべきイベントが存在するか否かを判定し、存在する場合に、通知すべきイベントをスケジュールとして記述するステップと、
前記スケジュール変換手段が、前記レイヤCにレイヤC+1をセットし、前記レイヤCが前記レイヤtであるか否か判定するステップに戻るステップと
を含むことを特徴とする請求項1に記載の方法。
Based on the task arrangement structure and the event storage means, creating a schedule includes:
A schedule conversion unit of the system determines whether or not a non-scheduled level exists in the task arrangement structure, and if it exists, continuing the subsequent processing; and
The schedule conversion means extracting a level in which no schedule is created from the levels of the task arrangement structure, and setting 1 in the layer C;
The schedule conversion means is a step of determining whether or not the layer C is the layer t. If the layer C is the layer t, it is determined whether or not there is a non-scheduled level in the task arrangement structure. Returning to step, if not layer t, continuing the following steps;
The schedule conversion means identifying a task placed in the layer C;
Based on the event storage means, the schedule conversion means determines whether there is an event to wait before executing the identified task, and if so, describes the event to wait as a schedule And steps to
The schedule conversion means, if the identified task is not an empty task, describing the execution of the task as a schedule;
The schedule conversion means determines, based on the event storage means, whether or not there is an event that should be notified of completion of the identified task, and if so, describes the event to be notified as a schedule When,
2. The method according to claim 1, further comprising: setting the layer C + 1 to the layer C and returning to the step of determining whether or not the layer C is the layer t.
前記先行関係データはPERT図であり、
前記先行関係管理手段が、前記先行関係データからタスクに対応するノードの集合、およびタスク間の先行関係を表す矢印の集合を抽出するステップと、
前記先行関係管理手段が、タスク間に生じる間接の先行関係を識別するステップと
をさらに含むことを特徴とする請求項1または2に記載の方法。
The preceding relationship data is a PERT diagram,
The preceding relationship management means extracting a set of nodes corresponding to tasks and a set of arrows representing preceding relationships between tasks from the preceding relationship data;
The method according to claim 1 or 2, further comprising the step of: the prior relationship management means identifying an indirect prior relationship that occurs between tasks.
前記先行関係管理手段は、直接の先行関係および間接の先行関係を有する場合には、前記閉包先行関係記憶手段に間接の先行関係を優先して登録することを特徴とする請求項1乃至3のいずれかに記載の方法。   4. The predecessor relation management means preferentially registers an indirect predecessor relation in the closure precedence relation storage means when having a direct predecessor relation and an indirect predecessor relation. The method according to any one. 前記スケジュール変換手段は、同期プリミティブを用いて前記待機すべきイベントおよび前記通知すべきイベントを記述することを特徴とする請求項2に記載の方法。   The method according to claim 2, wherein the schedule conversion means describes the event to be waited and the event to be notified by using a synchronization primitive. 前記タスク配置構造体を、前記システムのタスク配置記憶手段に記憶するステップをさらに含むことを特徴とする請求項1乃至5のいずれかに記載の方法。   6. The method according to claim 1, further comprising the step of storing the task arrangement structure in a task arrangement storage unit of the system. 先行タスク、後続タスク、先行関係タイプを格納する閉包先行関係記憶手段と、
先行タスク、後続タスク、先行関係タイプを格納する縮退先行関係記憶手段と、
通知タスク、待機タスク、イベント識別子を格納するイベント記憶手段と、
スケジュール作成対象のプログラムのタスク間の先行関係データを受信し、前記先行関係データに含まれる直接の先行関係および間接の先行関係に基づいて、前記受信した先行関係データの推移閉包を前記閉包先行関係記憶手段に、および前記受信した先行関係データの推移縮退を前記縮退先行関係記憶手段に記憶する先行関係管理手段と、
前記縮退先行関係記憶手段に記録された先行関係に対し、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの開始時間を算出し、前記算出した開始時間に基づいて、各開始時間およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成し、レイヤ1をレイヤ1内に存在するタスク数のレベルで分割して、分割した領域にタスクを配置し、レイヤLにレイヤ2をセットし、前記レイヤLが前記フィニッシュ時間に対応するレイヤtであるか否か判定し、レイヤtでない場合、ステップ(1)から(6)を繰り返すタスク配置手段であって、
(1)前記レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にし、
(2)前記閉包先行関係記憶手段に基づいて、前記レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定し、
(3)グラフの最大マッチングアルゴリズムを用いて、前記レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得し、
(4)前記最大マッチングのマッチング数が前記レイヤL−1内のタスク数より少ない場合、最大マッチングのマッチング数が前記レイヤL−1内のタスク数と一致するまで、マッチング数とタスク数の差の数、前記レイヤLおよび前記レイヤL−1に空タスクを生成し、空タスクを配置するために新たなレベルの領域を作成し、(2)および(3)を繰り返し、
(5)前記レイヤLを当該レイヤ内に存在するタスク数のレベルで分割し、前記レイヤL−1内の各タスクとその後続タスクとが、同一レベルになるように分割した領域にタスクを配置し、
(6)前記レイヤLにレイヤL+1をセットし、前記レイヤLがフィニッシュ時間に対応するレイヤtでない場合、(1)に戻る
タスク配置手段と、
前記レイヤL−1内のタスクxの後続として前記レイヤL内に配置できなかったタスクyを識別し、前記イベント記憶手段に記憶するイベント識別手段と、
前記タスク配置構造体および前記イベント記憶手段に基づいて、スケジュールを作成するスケジュール変換手段と
を備えたことを特徴とするシステム。
A closure precedence relationship storage means for storing a precedence task, a succession task, and a precedence relationship type;
Degenerate predecessor storage means for storing a predecessor task, a follower task, and a predecessor relationship type;
An event storage means for storing a notification task, a standby task, and an event identifier;
Receiving precedence relationship data between tasks of the program to be scheduled, and based on the direct precedence relationship and indirect precedence relationship included in the precedence relationship data, the transitional closure of the received precedence relationship data is the closure precedence relationship Preceding relationship management means for storing in the storage means and the transition reduction of the received preceding relation data in the reduced preceding relation storage means;
Using PERT analysis for the preceding relationship recorded in the degenerate precedence relationship storage means, the start time of each task is calculated when the execution time of each task is 1, and based on the calculated start time , Generate a task placement structure having a layer corresponding to each start time and finish time, divide layer 1 at the level of the number of tasks existing in layer 1, place the task in the divided area, and Layer 2 is set, and it is determined whether or not the layer L is the layer t corresponding to the finish time. If the layer L is not the layer t, the task placement means repeats steps (1) to (6),
(1) When the number of tasks in the layer L and the layer L-1 is compared and the number of tasks in one of the layers is smaller than the number of tasks in the other layer, an empty task is generated and The number of tasks is the same,
(2) Based on the closure precedence relationship storage means, for each task in the layer L-1, determine a set of tasks in the layer L (subsequent task candidates) that can be subsequent,
(3) Using the maximum matching algorithm of the graph, obtain the maximum matching for each task in the layer L-1 and its subsequent tasks,
(4) If the maximum matching number is less than the number of tasks in the layer L-1, the difference between the matching number and the task number until the maximum matching number matches the number of tasks in the layer L-1. Generate empty tasks in the layer L and the layer L-1, create a new level area to place empty tasks, repeat (2) and (3),
(5) The layer L is divided at the level of the number of tasks existing in the layer, and the tasks are arranged in the divided areas so that each task in the layer L-1 and its subsequent task are at the same level. And
(6) When the layer L is set to the layer L and the layer L is not the layer t corresponding to the finish time, the task placement unit that returns to (1);
Event identifying means for identifying a task y that could not be placed in the layer L as a successor of the task x in the layer L-1, and storing it in the event storage means;
A system comprising: schedule conversion means for creating a schedule based on the task arrangement structure and the event storage means.
先行タスク、後続タスク、先行関係タイプを格納する閉包先行関係記憶手段と、先行タスク、後続タスク、先行関係タイプを格納する縮退先行関係記憶手段と、通知タスク、待機タスク、イベント識別子を格納するイベント記憶手段とを備えたシステムに、タスク間の先行関係に基づいてスケジュールを作成させるためのプログラムであって、
前記システムの先行関係管理手段が、スケジュール作成対象のプログラムのタスク間の先行関係データを受信するステップと、
前記先行関係管理手段が、前記先行関係データに含まれる直接の先行関係および間接の先行関係に基づいて、前記受信した先行関係データの推移閉包を前記閉包先行関係記憶手段に、および前記受信した先行関係データの推移縮退を前記縮退先行関係記憶手段に記憶するステップと、
前記システムのタスク配置手段が、前記縮退先行関係記憶手段に記録された先行関係に対し、PERT解析を使用して、各タスクの実行時間を1とした場合の各タスクの開始時間を算出するステップと、
前記タスク配置手段が、前記算出した開始時間に基づいて、各開始時間およびフィニッシュ時間に対応するレイヤを有するタスク配置構造体を生成するステップと、
前記タスク配置手段が、レイヤ1をレイヤ1内に存在するタスク数のレベルで分割し、分割した領域にタスクを配置するステップと、
前記タスク配置手段が、レイヤLにレイヤ2をセットするステップと、
前記タスク配置手段が、前記レイヤLが前記フィニッシュ時間に対応するレイヤtであるか否か判定するステップであって、レイヤtである場合、前記タスク配置構造体および前記イベント記憶手段に基づいて、スケジュールを作成し、レイヤtでない場合、後続のステップを続けるステップと、
前記タスク配置手段が、前記レイヤLおよびレイヤL−1内のタスク数を比較して、いずれか一方のレイヤ内のタスク数が他方のレイヤ内のタスク数より少ない場合、空タスクを生成して両レイヤ内のタスク数を同一にするステップと、
前記タスク配置手段が、前記閉包先行関係記憶手段に基づいて、前記レイヤL−1内の各タスクに対して、後続となり得るレイヤL内のタスク(後続タスク候補)の集合を判定するステップと、
前記タスク配置手段が、グラフの最大マッチングアルゴリズムを用いて、前記レイヤL−1内の各タスクとその後続タスクについて、最大マッチングを取得するステップと、
前記タスク配置手段が、前記最大マッチングのマッチング数が前記レイヤL−1内のタスク数より少ない場合、最大マッチングのマッチング数が前記レイヤL−1内のタスク数と一致するまで、マッチング数とタスク数の差の数、前記レイヤLおよび前記レイヤL−1に空タスクを生成し、空タスクを配置するために新たなレベルの領域を作成し、前記後続タスク候補の集合を判定するステップ、および前記最大マッチングを取得するステップを繰り返す、ステップと、
前記タスク配置手段が、前記レイヤLを当該レイヤ内に存在するタスク数のレベルで分割し、前記レイヤL−1内の各タスクとその後続タスクとが、同一レベルになるように分割した領域にタスクを配置するステップと、
前記システムのイベント識別手段が、前記レイヤL−1内のタスクxの後続として前記レイヤL内に配置できなかったタスクyを識別し、前記イベント記憶手段に記憶するステップと、
前記タスク配置手段が、前記レイヤLにレイヤL+1をセットし、前記レイヤLがフィニッシュ時間に対応するレイヤtであるか否か判定するステップに戻る、ステップと
を含むことを特徴とするプログラム。
Closure precedence relationship storage means for storing the preceding task, successor task, and precedence relationship type, degenerate precedence relationship storage means for storing the precedence task, successor task, and precedence relationship type, notification task, standby task, and event for storing the event identifier A program for causing a system having a storage means to create a schedule based on a prior relationship between tasks,
The preceding relationship management means of the system receives preceding relationship data between tasks of a program to be scheduled;
Based on the direct preceding relationship and the indirect preceding relationship included in the preceding relationship data, the preceding relationship management unit sends a transition closure of the received preceding relationship data to the closure preceding relationship storage unit, and the received preceding relationship. Storing transition degeneration of relational data in the degeneracy preceding relation storage means;
The task placement unit of the system calculates the start time of each task when the execution time of each task is set to 1 using PERT analysis for the preceding relationship recorded in the degenerate precedence relationship storage unit When,
The task placement means generating a task placement structure having a layer corresponding to each start time and finish time based on the calculated start time;
The task placement means divides layer 1 at the level of the number of tasks existing in layer 1 and places tasks in the divided areas;
The task placement means sets layer 2 to layer L;
The task placement unit is a step of determining whether or not the layer L is a layer t corresponding to the finish time. When the layer L is a layer t, based on the task placement structure and the event storage unit, Create a schedule and if not layer t, continue with the following steps;
The task placement unit compares the number of tasks in the layer L and the layer L-1, and if the number of tasks in one of the layers is smaller than the number of tasks in the other layer, generates a blank task. Making the number of tasks in both layers the same,
The task placement means determining, based on the closure precedence relationship storage means, a set of tasks in the layer L (subsequent task candidates) that can be subsequent to each task in the layer L-1.
The task placement means obtains a maximum matching for each task in the layer L-1 and its subsequent tasks using a maximum matching algorithm of a graph;
When the task placement means has a matching number of the maximum matching smaller than the number of tasks in the layer L-1, the matching number and the task until the matching number of the maximum matching matches the number of tasks in the layer L-1. Generating empty tasks in the layer L and the layer L-1, creating a new level area for placing empty tasks, and determining the set of subsequent task candidates; and Repeating the step of obtaining the maximum matching; and
The task placement unit divides the layer L at the level of the number of tasks existing in the layer, and each task in the layer L-1 and its subsequent task are divided into regions that are divided at the same level. Placing a task,
An event identifying means of the system for identifying a task y that could not be placed in the layer L as a successor of the task x in the layer L-1, and storing it in the event storage means;
The task placement means sets the layer L + 1 to the layer L, and returns to the step of determining whether or not the layer L is the layer t corresponding to the finish time.
JP2012068034A 2012-03-23 2012-03-23 Schedule creation method, system and program thereof Active JP5486034B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012068034A JP5486034B2 (en) 2012-03-23 2012-03-23 Schedule creation method, system and program thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012068034A JP5486034B2 (en) 2012-03-23 2012-03-23 Schedule creation method, system and program thereof

Publications (2)

Publication Number Publication Date
JP2013200667A true JP2013200667A (en) 2013-10-03
JP5486034B2 JP5486034B2 (en) 2014-05-07

Family

ID=49520880

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012068034A Active JP5486034B2 (en) 2012-03-23 2012-03-23 Schedule creation method, system and program thereof

Country Status (1)

Country Link
JP (1) JP5486034B2 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001282551A (en) * 2000-03-29 2001-10-12 Hitachi Ltd Job processor and job processing method
JP2003029988A (en) * 2001-07-13 2003-01-31 Nec Corp Task scheduling system and method, program
JP2003296124A (en) * 2002-03-29 2003-10-17 Japan Research Institute Ltd Device, system and method for setting job execution order
JP2005038332A (en) * 2003-07-18 2005-02-10 Matsushita Electric Ind Co Ltd Job schedule device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001282551A (en) * 2000-03-29 2001-10-12 Hitachi Ltd Job processor and job processing method
JP2003029988A (en) * 2001-07-13 2003-01-31 Nec Corp Task scheduling system and method, program
JP2003296124A (en) * 2002-03-29 2003-10-17 Japan Research Institute Ltd Device, system and method for setting job execution order
JP2005038332A (en) * 2003-07-18 2005-02-10 Matsushita Electric Ind Co Ltd Job schedule device

Also Published As

Publication number Publication date
JP5486034B2 (en) 2014-05-07

Similar Documents

Publication Publication Date Title
US11226848B2 (en) Systems, methods, and apparatuses for implementing a scheduler and workload manager with snapshot and resume functionality
US11237865B2 (en) Systems, methods, and apparatuses for implementing a scheduler and workload manager that identifies and consumes global virtual resources
US10031775B2 (en) Backfill scheduling for embarrassingly parallel jobs
US11243807B2 (en) Systems, methods, and apparatuses for implementing a scheduler and workload manager with workload re-execution functionality for bad execution runs
US11243818B2 (en) Systems, methods, and apparatuses for implementing a scheduler and workload manager that identifies and optimizes horizontally scalable workloads
Carver et al. In search of a fast and efficient serverless dag engine
US20200026563A1 (en) Systems, methods, and apparatuses for implementing a scheduler and workload manager with scheduling redundancy and site fault isolation
JP2012511204A (en) How to reorganize tasks to optimize resources
CN113535367A (en) Task scheduling method and related device
US8484649B2 (en) Amortizing costs of shared scans
Becker et al. Scheduling multi-rate real-time applications on clustered many-core architectures with memory constraints
Zeng et al. Mechanisms for guaranteeing data consistency and flow preservation in AUTOSAR software on multi-core platforms
US10514949B1 (en) Efficient data processing in a serverless environment
CN113205417A (en) Alliance chain oriented transaction parallel processing method and system
Suzuki et al. Real-time ros extension on transparent cpu/gpu coordination mechanism
EP2840513B1 (en) Dynamic task prioritization for in-memory databases
JP5480322B2 (en) Performance control method, system and program thereof
JP5486034B2 (en) Schedule creation method, system and program thereof
CN113094260B (en) Distributed system time sequence relation modeling and simulation analysis method
JP5465745B2 (en) Program processing method and system
Wong et al. Priority-based functional reactive programming (P-FRP) using deferred abort
Hsiung RTFrame: An object-oriented application framework for real-time applications
Panahi et al. The design and implementation of service reservations in Real-Time SOA
WO2018198745A1 (en) Calculation resource management device, calculation resource management method, and computer-readable recording medium
Kumar et al. Global analysis of resource arbitration for MPSoC

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131119

RD13 Notification of appointment of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7433

Effective date: 20140109

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140115

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20140109

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140212

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140220

R150 Certificate of patent or registration of utility model

Ref document number: 5486034

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250