JP2008033577A - Device with multi-task scheduling function and program - Google Patents
Device with multi-task scheduling function and program Download PDFInfo
- Publication number
- JP2008033577A JP2008033577A JP2006205474A JP2006205474A JP2008033577A JP 2008033577 A JP2008033577 A JP 2008033577A JP 2006205474 A JP2006205474 A JP 2006205474A JP 2006205474 A JP2006205474 A JP 2006205474A JP 2008033577 A JP2008033577 A JP 2008033577A
- Authority
- JP
- Japan
- Prior art keywords
- task
- segment
- time
- execution
- execution time
- 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
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、マルチタスクスケジューリング機能搭載装置及びプログラムに関する。特に、CPU(Central Processing Unit)を搭載した組み込み装置におけるマルチタスクスケジューリング技術に関する。 The present invention relates to a multitask scheduling function loading apparatus and program. In particular, the present invention relates to a multitask scheduling technique in an embedded device equipped with a CPU (Central Processing Unit).
従来、CPUによって実行されるオペレーティングシステム(OS:Operating System)は、複数のタスクの実行順序をスケジューリングし、複数のタスクを見かけ上、同時に処理するマルチタスクスケジューリング機能を有する。タスクとは、オペレーティングシステムから見た(ユーザから見た)処理の単位である。即ち、1つのアプリケーションの処理全体を1つのタスクとして扱う。例えば、メールの送受信やファイルダウンロードのような処理単位である。 2. Description of the Related Art Conventionally, an operating system (OS) executed by a CPU has a multitask scheduling function that schedules the execution order of a plurality of tasks and apparently processes the plurality of tasks simultaneously. A task is a unit of processing viewed from the operating system (viewed by the user). That is, the entire processing of one application is handled as one task. For example, it is a processing unit such as mail transmission / reception or file download.
マルチタスクスケジューリング機能は、CPUの処理時間を非常に短い単位に分割し、複数のアプリケーションに順番に割り当てる。即ち、一定時間間隔(タイムスライス)で、タスクが切り替えられる。これにより、複数のアプリケーションは、見かけ上、同時に処理される。マルチタスクスケジューリング機能には、主に以下の2つのアプローチがある。 The multitask scheduling function divides the CPU processing time into very short units and sequentially assigns them to a plurality of applications. That is, tasks are switched at regular time intervals (time slices). Thereby, a plurality of applications are apparently processed simultaneously. There are mainly the following two approaches to the multitask scheduling function.
第1のアプローチとして、ラウンドロビンスケジューリングについて、各タスクに実行優先順位を設け、それに基づいて各タスクの実行許可時間を決定し、各タスクを順番に実行する技術がある(例えば特許文献1参照)。 As a first approach, for round-robin scheduling, there is a technique in which execution priority is set for each task, execution permission time of each task is determined based on the priority, and each task is executed in order (see, for example, Patent Document 1). .
第2のアプローチとして、ラウンドロビンスケジューリングについて、過去に実行されたタスクの実行回数によって、優先度を決定する技術もある(例えば特許文献2参照)。 As a second approach, there is a technique for determining the priority of round robin scheduling based on the number of executions of tasks executed in the past (see, for example, Patent Document 2).
従来のマルチタスクスケジューリングによれば、アプリケーションの一連の処理を、処理内容に関係なく、強制的に切り替える。そのために、タスクを一時的に中止し、そのタスクの実行状態を、メモリに保存し且つメモリから回復する処理が必要となる。また、複数のタスクを高速に且つ頻繁に切り替えるため、CPU又はメモリ等のシステムリソースに多くの負荷がかかる。このような処理は、高い処理能力のシステムリソースを備えるパーソナルコンピュータでは殆ど問題とならないが、低い処理能力のシステムリソースしか搭載できない組み込み装置では負担となる。 According to conventional multitask scheduling, a series of processing of an application is forcibly switched regardless of processing contents. Therefore, it is necessary to perform processing for temporarily canceling the task, saving the execution state of the task in the memory, and recovering from the memory. In addition, since a plurality of tasks are switched at high speed and frequently, a lot of load is applied to system resources such as a CPU or a memory. Such processing is hardly a problem in a personal computer having a system resource with a high processing capability, but becomes a burden in an embedded device in which only a system resource with a low processing capability can be mounted.
一方で、OSがCPUを管理することなく、実行中の各アプリケーション自身が処理時間を管理する技術もある。即ち、各アプリケーションが、自らの空き時間に、自身が占有するシステムリソースを自発的に開放し、他のアプリケーションが利用できるようにする。この場合、OSがマルチタスクスケジューリング機能を搭載する必要がなくなる。しかしながら、アプリケーション開発者が、常にマルチタスクスケジューリング機能を意識して、アプリケーションを開発する必要があるため、開発コストや複雑度が非常に高い。 On the other hand, there is a technique in which each running application itself manages the processing time without the OS managing the CPU. That is, each application voluntarily releases the system resources occupied by itself in its own free time so that other applications can use it. In this case, the OS does not need to have a multitask scheduling function. However, since the application developer needs to always develop an application in consideration of the multitask scheduling function, the development cost and complexity are very high.
従って、本発明は、システムリソースに制限がある組み込み装置に適用され、システムリソースの負荷を低減することができるマルチタスクスケジューリング機能搭載装置及びプログラムを提供することを目的とする。 Therefore, an object of the present invention is to provide a multitask scheduling function-equipped device and a program that can be applied to an embedded device with limited system resources and can reduce the load of the system resources.
本発明によれば、複数のタスクの実行順序をスケジューリングするマルチタスクスケジューリング機能搭載装置において、
タスクは、実行命令として記述された実行ブレイクポイントに応じて、複数のセグメントルーチンに分割されており、
タスク毎に規定された占有可能時間と、セグメントルーチン毎に対応付けられたセグメント実行時間とを有するタスク参考情報を蓄積するタスク参考情報蓄積手段と、
タスク参考情報を用いて、実行すべき複数のセグメントルーチンのセグメント実行時間の合計が、当該タスクの占有可能時間以内となるように、当該タスクを実行するタスク切替手段とを有することを特徴とする。
According to the present invention, in a multitask scheduling function-equipped device that schedules the execution order of a plurality of tasks,
The task is divided into a plurality of segment routines according to execution breakpoints described as execution instructions.
Task reference information accumulating means for accumulating task reference information having an occupable time defined for each task and a segment execution time associated with each segment routine;
And a task switching means for executing the task so that the total of the segment execution times of the plurality of segment routines to be executed is within the occupying time of the task using the task reference information. .
本発明のマルチタスクスケジューリング機能搭載装置における他の実施形態によれば、タスク切替手段は、当該タスクにおける現時点までの総実行時間に、次セグメントルーチンのセグメント実行時間を合計した予測実行時間が、当該タスクの占有可能時間以内となる場合に、次セグメントルーチンを続けて実行することも好ましい。 According to another embodiment of the multi-task scheduling function-equipped device of the present invention, the task switching means includes the predicted execution time obtained by adding the segment execution time of the next segment routine to the total execution time up to the current time in the task. It is also preferable to continuously execute the next segment routine when it is within the task occupying time.
本発明のマルチタスクスケジューリング機能搭載装置における他の実施形態によれば、タスクは、オブジェクト指向における基底クラスによって実行ブレイクポイントの分割が実現されており、派生クラスによって基底クラスを継承したセグメントルーチンが実現されることも好ましい。 According to another embodiment of the multitask scheduling function-equipped device of the present invention, the task is divided into execution breakpoints by an object-oriented base class, and a segment routine that inherits the base class is realized by a derived class It is also preferred that
本発明のマルチタスクスケジューリング機能搭載装置における他の実施形態によれば、セグメント実行時間は、当該タスクの当該セグメントルーチンにおける平均実行時間であることも好ましい。 According to another embodiment of the apparatus with a multitask scheduling function of the present invention, the segment execution time is preferably an average execution time of the task in the segment routine.
本発明のマルチタスクスケジューリング機能搭載装置における他の実施形態によれば、タスク参考情報は、タスク毎に優先度を更に含み、占有可能時間は、優先度に応じて決定されていることも好ましい。 According to another embodiment of the multitask scheduling function-equipped device of the present invention, it is preferable that the task reference information further includes a priority for each task, and the occupable time is determined according to the priority.
本発明のマルチタスクスケジューリング機能搭載装置における他の実施形態によれば、タスク参考情報は、タスク識別子及びセグメント識別子に基づいて管理されていることも好ましい。 According to another embodiment of the apparatus with a multitask scheduling function of the present invention, the task reference information is preferably managed based on the task identifier and the segment identifier.
本発明によれば、複数のタスクの実行順序をスケジューリングするようにコンピュータを機能させるマルチタスクスケジューリングプログラムにおいて、
タスクは、実行命令として記述された実行ブレイクポイントに応じて、複数のセグメントルーチンに分割されており、
タスク毎に規定された占有可能時間と、セグメントルーチン毎に対応付けられたセグメント実行時間とを有するタスク参考情報を蓄積するタスク参考情報蓄積手段と、
タスク参考情報を用いて、実行すべき複数のセグメントルーチンのセグメント実行時間の合計が、当該タスクの占有可能時間以内となるように、当該タスクを実行するタスク切替手段としてコンピュータを機能させることを特徴とする。
According to the present invention, in a multitask scheduling program for causing a computer to function to schedule the execution order of a plurality of tasks,
The task is divided into a plurality of segment routines according to execution breakpoints described as execution instructions.
Task reference information accumulating means for accumulating task reference information having an occupable time defined for each task and a segment execution time associated with each segment routine;
Using the task reference information, the computer functions as task switching means for executing the task so that the total segment execution time of the plurality of segment routines to be executed is within the occupying time of the task. And
本発明のマルチタスクスケジューリングプログラムにおける他の実施形態によれば、タスク切替手段は、当該タスクにおける現時点までの総実行時間に、次セグメントルーチンのセグメント実行時間を合計した予測実行時間が、当該タスクの占有可能時間以内となる場合に、次セグメントルーチンを続けて実行するようにコンピュータを機能させることも好ましい。 According to another embodiment of the multitask scheduling program of the present invention, the task switching means is configured such that the predicted execution time obtained by adding the segment execution time of the next segment routine to the total execution time up to the current time in the task is It is also preferable to make the computer function so that the next segment routine is continuously executed when it becomes within the occupying time.
本発明のマルチタスクスケジューリングプログラムにおける他の実施形態によれば、タスクは、オブジェクト指向における基底クラスによって実行ブレイクポイントの分割が実現されており、派生クラスによって基底クラスを継承したセグメントルーチンが実現されることも好ましい。 According to another embodiment of the multitask scheduling program of the present invention, a task is divided into execution breakpoints by an object-oriented base class, and a segment routine that inherits the base class is realized by a derived class. It is also preferable.
本発明のマルチタスクスケジューリング機能搭載装置及びプログラムによれば、システムリソースに制限がある組み込み装置であっても、システムリソースの負荷を低減することができる。タスクは、複数のセグメントルーチンに分割され、一連の処理単位となるセグメントルーチンは、タスク切り替えの中止無しに処理されるために、タスク切替時のシステムリソースの負荷が少なくてすむ。 According to the apparatus and program with the multitask scheduling function of the present invention, it is possible to reduce the load of system resources even in an embedded apparatus with limited system resources. A task is divided into a plurality of segment routines, and a segment routine that is a series of processing units is processed without stopping task switching, so that the load of system resources at the time of task switching can be reduced.
以下では、図面を用いて、本発明を実施するための最良の形態について詳細に説明する。 Hereinafter, the best mode for carrying out the present invention will be described in detail with reference to the drawings.
図1は、本発明におけるマルチタスクスケジューリング機能搭載装置のソフトウェア機能構成図である。 FIG. 1 is a software function configuration diagram of a multitask scheduling function loading apparatus according to the present invention.
図1の装置は、オペレーティングシステム1と、複数のタスク2とを有する。これら機能部は、通常、コンピュータによって実行されるプログラムによって実現される。
The apparatus of FIG. 1 has an
タスク2は、基本的に、初期化部、実行部及び終了部を有する。初期化部は、メモリから、そのタスクの実行状態を回復する処理をする。一方、終了部は、そのタスクの実行状態を、メモリへ記憶する処理をする。
実行部は、本発明によれば複数のセグメントルーチンから構成される。複数のセグメントルーチンは、実行命令として記述された実行ブレイクポイントに応じて分割される。 According to the present invention, the execution unit is composed of a plurality of segment routines. The plurality of segment routines are divided according to execution breakpoints described as execution instructions.
実行ブレイクポイントを指定する第1の方法として、実行ブレイクポイントとして予め規定したコード"Do Something;"を、アプリケーションプログラムに記述する。通常、アプリケーション開発者は、OSのスケジューリング機能を全く意識しないけれども、本発明によれば、タスクの切替許可を指定する必要がある。 As a first method of designating an execution breakpoint, a code “Do Something;” defined in advance as an execution breakpoint is described in the application program. Normally, the application developer is not conscious of the OS scheduling function at all, but according to the present invention, it is necessary to specify task switching permission.
実行ブレイクポイントを指定する第2の方法として、オブジェクト指向における継承を用いる。 Object-oriented inheritance is used as a second method for specifying execution breakpoints.
図2は、本発明におけるタスクで用いられるクラスの記述である。 FIG. 2 is a description of classes used in the tasks in the present invention.
図2によれば、タスクは、基底クラスによって実行ブレイクポイントの分割が実現されており、派生クラスによってその基底クラスを継承したセグメントルーチンが実現される。図2によれば、"OnSegmentRoute1()"、"OnSegmentRoute2()"・・・"OnSegmentRouteN()"によって、セグメントルーチンが規定されている。 According to FIG. 2, the execution breakpoint is divided by the base class of the task, and a segment routine that inherits the base class is realized by the derived class. According to FIG. 2, the segment routine is defined by “OnSegmentRoute1 ()”, “OnSegmentRoute2 ()”... “OnSegmentRouteN ()”.
タスクが、メール送信アプリケーション(SMTP送信)である場合、例えば以下の5つのセグメントルーチンに分割される。
(1)Socket接続
(2)認証
(3)送受信文字列のエンコード
(4)送信
(5)Socket切断
When the task is a mail transmission application (SMTP transmission), it is divided into, for example, the following five segment routines.
(1) Socket connection (2) Authentication (3) Encoding of transmission / reception character string (4) Transmission (5) Socket disconnection
アプリケーション開発者は、本発明における基底クラスを継承した派生クラスを1つのタスクとして実装することにより、実行ブレイクポイントを意識する必要がない。マルチタスクスケジューリング部10は、アプリケーション開発者によって実装されたセグメントルーチン毎に、タスクを切り替えることができる。
Application developers need not be aware of execution breakpoints by implementing a derived class that inherits the base class in the present invention as one task. The
タスクは、一連の処理単位となるセグメントルーチンに分割される。本発明によれば、セグメントルーチンの処理中にはタスク切り替えが発生しない。即ち、例えばループ処理のように多くのメモリを消費している時点で、タスク切り替えが発生しない。これは、タスク切替時におけるメモリへの実行状態の保存や、メモリからの実行状態の回復のためのシステムリソースの負荷の低減につながる。また、ラウンドロビンスケジューリングのように、OSがタスク切り替えのタイミングを制御する必要もなくなり、システム全体の処理量が低減する。勿論、セグメントルーチンへの分割は、特定のハードウェアやOSへの依存性もない。 A task is divided into segment routines which are a series of processing units. According to the present invention, task switching does not occur during segment routine processing. In other words, task switching does not occur when a large amount of memory is consumed, for example, as in loop processing. This leads to a reduction in the load of system resources for saving the execution state in the memory at the time of task switching and for recovering the execution state from the memory. In addition, unlike the round robin scheduling, the OS does not need to control the task switching timing, and the processing amount of the entire system is reduced. Of course, the division into segment routines does not depend on specific hardware or OS.
図1のマルチタスクスケジューリング部10は、タスク起動部101と、タスク切替部102と、タイマ103と、タスク参考情報蓄積部104とを有する。これら機能部は、通常、コンピュータによって実行されるオペレーティングシステムプログラムの一部として実現される。
The
タスク起動部101は、必要に応じて複数のタスクを起動する。図1によれば、複数のタスク2A〜Cが起動されている。タスク起動部101は、起動されたタスクID(IDentifier:識別子)やその他のタスク情報を、タスク切替部102へ通知する。
The
タスク切替部102は、タイマ103から一定周期で通知される割り込み信号を用いて時間を管理し、起動された複数のタスクを切り替える。ここで、タスク切替部102は、タスク参考情報を用いて、実行すべき複数のセグメントルーチンのセグメント実行時間の合計が、そのタスクの占有可能時間以内となるように、そのタスクを実行する。具体的には、タスク切替部102は、そのタスクにおける現時点までの総実行時間に、次セグメントルーチンのセグメント実行時間を合計した予測実行時間が、そのタスクの占有可能時間以内となる場合に、次セグメントルーチンを続けて実行する。
The
タイマ103は、一定周期の割り込み信号をタスク切替部102へ出力する。
The
タスク参考情報蓄積部104は、タスク参考情報を蓄積する。タスク参考情報は、タスク毎に規定された占有可能時間(タイムスライス)と、セグメントルーチン毎に対応付けられたセグメント実行時間とを有する。また、タスク参考情報は、タスク毎に優先度を更に含む。
The task reference
占有可能時間は、タスクの優先度(1〜5の5段階)に応じて規定される。図1によれば、タイムスライス単位として50msが規定されている。占有可能時間は、以下の式によって決定される。
占有可能時間=タイムスライス単位(50ms)×優先度(1〜5)
これにより、優先度3のタスクAは占有可能時間150msとなり、優先度1のタスクBは占有可能時間50msとなり、優先度2のタスクCは占有可能時間100msとなる。
The occupable time is defined according to the priority of the task (5 levels from 1 to 5). According to FIG. 1, 50 ms is defined as a time slice unit. The occupable time is determined by the following equation.
Occupiable time = Time slice unit (50 ms) x Priority (1-5)
As a result, task A with
セグメント実行時間は、各セグメントルーチンの実際の実行時間であって平均的なものである。図2によれば、タスクAのセグメントルーチン1、2及び3の実行時間はそれぞれ、55ms、50ms及び60msである。タスクBのセグメントルーチン1及び2の実行時間はそれぞれ、50ms及び40msである。タスクCのセグメントルーチン1及び2の実行時間はそれぞれ、60ms及び40msである。
The segment execution time is the actual execution time of each segment routine and is average. According to FIG. 2, the execution time of
図3は、タスク切替部の動作説明図である。 FIG. 3 is an operation explanatory diagram of the task switching unit.
図3のシーケンスに沿って、図1に表されたタスク参考情報を用いて説明する。尚、タスクが切り替わる毎に、総実行時間はクリアされる(=0ms)とする。 A description will be given using the task reference information shown in FIG. 1 along the sequence of FIG. Note that the total execution time is cleared (= 0 ms) each time the task is switched.
(S301)最初に、タスクAが選択されたとする。タスク切替部は、タスクAのセグメントルーチン1を実行する。
(S301) First, assume that task A is selected. The task switching unit executes the
このとき、タスク切替部は、タスクAのセグメントルーチン1の現実行時間を計測する。現実行時間が50msであったとする。そうすると、現実行中タスクAの総実行時間は、50ms(=0ms+50ms)となる。
At this time, the task switching unit measures the current execution time of the
(S302)次に、タスクAのセグメントルーチン2の実行を試みる。タスクAのセグメントルーチン2の平均実行時間は50msである。総実行時間が50msであるので、予測実行時間は100ms(=50ms+50ms)となる。予測実行時間100msは、タスクAの占有可能時間150ms以内であるので、タスク切替部は、タスクAのセグメントルーチン2を実行する。
(S302) Next, an attempt is made to execute the
このとき、タスク切替部は、タスクAのセグメントルーチン2の現実行時間を計測する。現実行時間が40msであったとする。そうすると、現実行中タスクAの総実行時間は、90ms(=50ms+40ms)となる。
At this time, the task switching unit measures the current execution time of the
(S303)次に、タスクAのセグメントルーチン3の実行を試みる。タスクAのセグメントルーチン3の平均実行時間は60msである。総実行時間が90msであるので、予測実行時間は150ms(=90ms+60ms)である。予測実行時間150msは、タスクAの占有可能時間150ms以内であるので、タスク切替部は、タスクAのセグメントルーチン3を実行する。
(S303) Next, an attempt is made to execute
このとき、タスク切替部は、タスクAのセグメントルーチン3の現実行時間を計測する。現実行時間が70msであったとする。そうすると、現実行中タスクAの総実行時間は、160ms(=90ms+70ms)となる。ここで、タスクAの占有可能時間150msを越えたので、タスク切替部は、タスクA以外のタスクへ切り替える。
At this time, the task switching unit measures the current execution time of the
(S304)次に、タスクBが選択されたとする。タスク切替部は、タスクBのセグメントルーチン1を実行する。
(S304) Next, assume that task B is selected. The task switching unit executes the
このとき、タスク切替部は、タスクBのセグメントルーチン1の現実行時間を計測する。現実行時間が30msであったとする。そうすると、現実行中タスクBの総実行時間は、30ms(=0ms+30ms)となる。
At this time, the task switching unit measures the current execution time of the
次に、タスクBのセグメントルーチン2の実行を試みる。タスクBのセグメントルーチン2の平均実行時間は40msである。総実行時間が30msであるので、予測実行時間は70ms(=30ms+40ms)となる。予測実行時間70msは、タスクBの占有可能時間50msを越えるので、タスク切替部は、タスクB以外のタスクへ切り替える。
Next, execution of
(S305)次に、タスクCが選択されたとする。タスク切替部は、タスクCのセグメントルーチン1を実行する。
(S305) Next, assume that task C is selected. The task switching unit executes the
このとき、タスク切替部は、タスクCのセグメントルーチン1の現実行時間を計測する。現実行時間が50msであったとする。そうすると、現実行中タスクCの総実行時間は、50ms(=0ms+50ms)となる。
At this time, the task switching unit measures the current execution time of the
(S306)次に、タスクCのセグメントルーチン2の実行を試みる。タスクCのセグメントルーチン2の平均実行時間は40msである。総実行時間が50msであるので、予測実行時間は90ms(=50ms+40ms)となる。予測実行時間90msは、タスクBの占有可能時間100ms以内であるので、タスク切替部は、タスクCのセグメントルーチン2を実行する。
(S306) Next, an attempt is made to execute the
このとき、タスク切替部は、タスクCのセグメントルーチン2の現実行時間を計測する。現実行時間が50msであったとする。そうすると、現実行中タスクCの総実行時間は、100ms(=50ms+50ms)となる。
At this time, the task switching unit measures the current execution time of the
図4は、本発明におけるタスク切替部のフローチャートである。 FIG. 4 is a flowchart of the task switching unit in the present invention.
(S401)実行待ちのタスクが存在するか否かを判定する。存在しなければ、処理を終了する。
(S402)実行待ちのタスクを存在する場合、実行すべきタスクを選択する。
(S403)現実行中タスクの総実行時間をクリアする(=0ms)。
(S401) It is determined whether there is a task waiting to be executed. If it does not exist, the process ends.
(S402) When there is a task waiting for execution, the task to be executed is selected.
(S403) The total execution time of the currently executing task is cleared (= 0 ms).
(S404)現実行中タスクについて、1つのセグメントルーチンを実行する。このとき、そのセグメントルーチンの実行時間を計測する。例えば、タイマから出力される一定周期の割り込み信号によって、その回数をカウントすることによって計測することができる。
(S405)タスク参考情報のセグメントルーチンの平均実行時間を更新する。初めて実行されたセグメントルーチンについては、タスク参考情報に、その実行時間をそのまま登録する。2回以上実行されたセグメントルーチンについては、例えばタスク参考情報に実行回数を含めることにより、以下の式によって平均実行時間を算出する。
更新される平均実行時間=
{(既存の平均実行時間×実行回数)+計測された実行時間}/(実行回数+1)
算出された平均実行時間は、タスク参考情報へ更新される。
(S406)現実行中タスクの総実行時間に、実行したセグメントルーチンの実行時間を加算し、総実行時間を更新する。
(S404) One segment routine is executed for the currently executing task. At this time, the execution time of the segment routine is measured. For example, measurement can be performed by counting the number of times by an interrupt signal having a fixed period output from a timer.
(S405) The average execution time of the segment routine of the task reference information is updated. For the segment routine executed for the first time, its execution time is registered as it is in the task reference information. For a segment routine that has been executed twice or more, for example, the average execution time is calculated by the following equation by including the number of executions in the task reference information.
Updated average execution time =
{(Existing average execution time × execution count) + measured execution time} / (execution count + 1)
The calculated average execution time is updated to the task reference information.
(S406) The execution time of the executed segment routine is added to the total execution time of the currently executing task to update the total execution time.
(S407)総実行時間が、現実行中タスクの占有可能時間以内か否かを判定する。総実行時間が、現実行中タスクの占有可能時間を越えている場合、他のタスクへ切り替えるべく、S401へ移行する。
(S408)総実行時間が、現実行中タスクの占有可能時間以内である場合、予測実行時間が、現実行中タスクの占有可能時間以内か否かを判定する。予測実行時間とは、総実行時間に、次セグメント実行時間を加算した時間である。総実行時間が、現実行中タスクの占有可能時間を越えている場合、他のタスクへ切り替えるべく、S401へ移行する。
(S409)予測実行時間が、現実行中タスクの占有可能時間以内である場合、次セグメントルーチンを指定する。そして、S404へ移行し、次セグメントルーチンを実行する。
(S407) It is determined whether the total execution time is within the occupying time of the currently executing task. If the total execution time exceeds the occupying time of the currently executing task, the process proceeds to S401 to switch to another task.
(S408) If the total execution time is within the occupying time of the currently executing task, it is determined whether or not the predicted execution time is within the occupying time of the currently executing task. The predicted execution time is a time obtained by adding the next segment execution time to the total execution time. If the total execution time exceeds the occupying time of the currently executing task, the process proceeds to S401 to switch to another task.
(S409) If the predicted execution time is within the occupying time of the currently executing task, the next segment routine is designated. Then, the process proceeds to S404, and the next segment routine is executed.
以上、詳細に説明したように、本発明のマルチタスクスケジューリング機能搭載装置及びプログラムによれば、システムリソースに制限がある組み込み装置であっても、システムリソースの負荷を低減することができる。 As described above in detail, according to the multitask scheduling function-equipped device and program of the present invention, it is possible to reduce the load of system resources even in an embedded device with limited system resources.
タスクは、一連の処理単位となるセグメントルーチンに分割される。本発明によれば、セグメントルーチンの処理中にはタスク切り替えが発生しない。即ち、例えばループ処理のように多くのメモリを消費している時点で、タスク切り替えが発生しない。これは、タスク切替時におけるメモリへの実行状態の保存や、メモリからの実行状態の回復のためのシステムリソースの負荷の低減につながる。また、ラウンドロビンスケジューリングのように、OSがタスク切り替えのタイミングを制御する必要もなくなり、システム全体の処理量が低減する。勿論、セグメントルーチンへの分割は、特定のハードウェアやOSへの依存性もない。 A task is divided into segment routines which are a series of processing units. According to the present invention, task switching does not occur during segment routine processing. In other words, task switching does not occur when a large amount of memory is consumed, for example, as in loop processing. This leads to a reduction in the load of system resources for saving the execution state in the memory at the time of task switching and for recovering the execution state from the memory. In addition, unlike the round robin scheduling, the OS does not need to control the task switching timing, and the processing amount of the entire system is reduced. Of course, the division into segment routines does not depend on specific hardware or OS.
また、本発明によれば、各タスクは、占有可能時間内で実行可能な複数のセグメントルーチンをまとめて実行するために、無駄なタスク切替に伴うシステムリソースの使用を低減することができる。 Further, according to the present invention, since each task collectively executes a plurality of segment routines that can be executed within the occupiable time, it is possible to reduce the use of system resources associated with unnecessary task switching.
更に、本発明によれば、オブジェクト指向における基底クラスによって実行ブレイクポイントの分割が実現されているので、アプリケーション開発者は、その派生クラスのセグメントルーチンに処理を実装することにより、実行ブレイクポイントを意識する必要がない。 Furthermore, according to the present invention, since the execution breakpoint is divided by the base class in the object orientation, the application developer is aware of the execution breakpoint by implementing the process in the segment routine of the derived class. There is no need to do.
前述した本発明における種々の実施形態によれば、当業者は、本発明の技術思想及び見地の範囲における種々の変更、修正及び省略を容易に行うことができる。前述の説明はあくまで例であって、何ら制約しようとするものではない。本発明は、特許請求の範囲及びその均等物として限定するものにのみ制約される。 According to the various embodiments of the present invention described above, those skilled in the art can easily make various changes, modifications and omissions within the scope of the technical idea and the viewpoint of the present invention. The above description is merely an example, and is not intended to be restrictive. The invention is limited only as defined in the following claims and the equivalents thereto.
1 オペレーティングシステム
10 マルチタスクスケジューリング部
101 タスク起動部
102 タスク切替部
103 タイマ
104 タスク参照情報蓄積部
2 タスク
DESCRIPTION OF
Claims (9)
前記タスクは、実行命令として記述された実行ブレイクポイントに応じて、複数のセグメントルーチンに分割されており、
前記タスク毎に規定された占有可能時間と、前記セグメントルーチン毎に対応付けられたセグメント実行時間とを有するタスク参考情報を蓄積するタスク参考情報蓄積手段と、
前記タスク参考情報を用いて、実行すべき複数の前記セグメントルーチンのセグメント実行時間の合計が、当該タスクの占有可能時間以内となるように、当該タスクを実行する前記タスク切替手段と
を有することを特徴とするマルチタスクスケジューリング機能搭載装置。 In the multitask scheduling function-equipped device that schedules the execution order of multiple tasks,
The task is divided into a plurality of segment routines according to execution breakpoints described as execution instructions,
Task reference information storage means for storing task reference information having occupable time defined for each task and segment execution time associated with each segment routine;
Using the task reference information, the task switching means for executing the task so that the sum of the segment execution times of the plurality of segment routines to be executed is within the occupying time of the task. A device with a multitask scheduling function.
前記占有可能時間は、前記優先度に応じて決定されている
ことを特徴とする請求項1から4のいずれか1項に記載のマルチタスクスケジューリング機能搭載装置。 The task reference information further includes a priority for each task,
The multitask scheduling function-equipped device according to any one of claims 1 to 4, wherein the occupable time is determined according to the priority.
前記タスクは、実行命令として記述された実行ブレイクポイントに応じて、複数のセグメントルーチンに分割されており、
前記タスク毎に規定された占有可能時間と、前記セグメントルーチン毎に対応付けられたセグメント実行時間とを有するタスク参考情報を蓄積するタスク参考情報蓄積手段と、
前記タスク参考情報を用いて、実行すべき複数の前記セグメントルーチンのセグメント実行時間の合計が、当該タスクの占有可能時間以内となるように、当該タスクを実行する前記タスク切替手段と
してコンピュータを機能させることを特徴とするマルチタスクスケジューリングプログラム。 In a multitask scheduling program that causes a computer to function to schedule the execution order of a plurality of tasks,
The task is divided into a plurality of segment routines according to execution breakpoints described as execution instructions,
Task reference information storage means for storing task reference information having occupable time defined for each task and segment execution time associated with each segment routine;
Using the task reference information, cause the computer to function as the task switching means for executing the task so that the sum of the segment execution times of the plurality of segment routines to be executed is within the occupying time of the task. A multitask scheduling program characterized by that.
9. The task according to claim 7, wherein the execution breakpoint is divided by a base class in an object orientation, and a segment routine that inherits the base class is realized by a derived class. Multitask scheduling program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006205474A JP4614239B2 (en) | 2006-07-28 | 2006-07-28 | Multitask scheduling function-equipped device and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2006205474A JP4614239B2 (en) | 2006-07-28 | 2006-07-28 | Multitask scheduling function-equipped device and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2008033577A true JP2008033577A (en) | 2008-02-14 |
JP4614239B2 JP4614239B2 (en) | 2011-01-19 |
Family
ID=39122934
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2006205474A Expired - Fee Related JP4614239B2 (en) | 2006-07-28 | 2006-07-28 | Multitask scheduling function-equipped device and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4614239B2 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012079124A (en) * | 2010-10-01 | 2012-04-19 | Fuji Xerox Co Ltd | Job distribution processing system, information processor, and program |
CN103970612A (en) * | 2014-05-07 | 2014-08-06 | 田文洪 | Load balancing method and device based on pre-division of virtual machine |
CN108255596A (en) * | 2016-12-28 | 2018-07-06 | 福建省天奕网络科技有限公司 | A kind of method and system for performing timed task |
JP2019074913A (en) * | 2017-10-16 | 2019-05-16 | 株式会社日立製作所 | Information processing apparatus and data processing method of information processing apparatus |
CN112486658A (en) * | 2020-12-17 | 2021-03-12 | 华控清交信息科技(北京)有限公司 | Task scheduling method and device for task scheduling |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07110773A (en) * | 1993-10-12 | 1995-04-25 | Canon Inc | Task switching device |
JPH10228385A (en) * | 1997-02-17 | 1998-08-25 | Nec Corp | Real time os and its task management system |
JP2002163117A (en) * | 2000-11-24 | 2002-06-07 | Matsushita Electric Ind Co Ltd | Task scheduling device |
JP2002342097A (en) * | 2001-05-17 | 2002-11-29 | Matsushita Electric Ind Co Ltd | Task allocatable time deciding device and task allocatable time deciding method |
JP2003122596A (en) * | 2001-10-18 | 2003-04-25 | Matsushita Electric Ind Co Ltd | Microcomputer simulator |
-
2006
- 2006-07-28 JP JP2006205474A patent/JP4614239B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07110773A (en) * | 1993-10-12 | 1995-04-25 | Canon Inc | Task switching device |
JPH10228385A (en) * | 1997-02-17 | 1998-08-25 | Nec Corp | Real time os and its task management system |
JP2002163117A (en) * | 2000-11-24 | 2002-06-07 | Matsushita Electric Ind Co Ltd | Task scheduling device |
JP2002342097A (en) * | 2001-05-17 | 2002-11-29 | Matsushita Electric Ind Co Ltd | Task allocatable time deciding device and task allocatable time deciding method |
JP2003122596A (en) * | 2001-10-18 | 2003-04-25 | Matsushita Electric Ind Co Ltd | Microcomputer simulator |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012079124A (en) * | 2010-10-01 | 2012-04-19 | Fuji Xerox Co Ltd | Job distribution processing system, information processor, and program |
CN103970612A (en) * | 2014-05-07 | 2014-08-06 | 田文洪 | Load balancing method and device based on pre-division of virtual machine |
CN108255596A (en) * | 2016-12-28 | 2018-07-06 | 福建省天奕网络科技有限公司 | A kind of method and system for performing timed task |
JP2019074913A (en) * | 2017-10-16 | 2019-05-16 | 株式会社日立製作所 | Information processing apparatus and data processing method of information processing apparatus |
CN112486658A (en) * | 2020-12-17 | 2021-03-12 | 华控清交信息科技(北京)有限公司 | Task scheduling method and device for task scheduling |
Also Published As
Publication number | Publication date |
---|---|
JP4614239B2 (en) | 2011-01-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5405320B2 (en) | Virtual machine control device, virtual machine control method, and virtual machine control program | |
US8612986B2 (en) | Computer program product for scheduling ready threads in a multiprocessor computer based on an interrupt mask flag value associated with a thread and a current processor priority register value | |
US8161453B2 (en) | Method and apparatus for implementing task management of computer operations | |
EP2885707B1 (en) | Latency sensitive software interrupt and thread scheduling | |
US8056083B2 (en) | Dividing a computer job into micro-jobs for execution | |
US8479207B2 (en) | Priority inheritance in multithreaded systems | |
JP2007537504A (en) | Improvements in or related to operating systems for computer devices | |
TW201413594A (en) | Multi-core device and multi-thread scheduling method thereof | |
US20010034751A1 (en) | Real-time OS simulator | |
US10248456B2 (en) | Method and system for providing stack memory management in real-time operating systems | |
CN112416546A (en) | Multitask scheduling method, electronic device and computer storage medium | |
US10108449B2 (en) | Work item management among worker threads of a computing device | |
JP4614239B2 (en) | Multitask scheduling function-equipped device and program | |
US10271326B2 (en) | Scheduling function calls | |
CN111897637B (en) | Job scheduling method, device, host and storage medium | |
CN109491780B (en) | Multi-task scheduling method and device | |
US20070198997A1 (en) | Customer framework for embedded applications | |
JP2005190207A (en) | Interruption control device and control method | |
US7082607B2 (en) | Reduced-overhead context-saving in static priority scheduled operating systems | |
JP2015141584A (en) | information processing apparatus, information processing method and program | |
Labrosse | Operating systems | |
Belagali et al. | Implementation and validation of dynamic scheduler based on LST on FreeRTOS | |
JP2007193744A (en) | Information processing device, program and scheduling method | |
Ngolah et al. | The real-time task scheduling algorithm of RTOS+ | |
CN111813531B (en) | Clock scheduling method and system for operating system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20090125 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20100708 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20100720 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20100728 |
|
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: 20101013 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20101013 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4614239 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131029 Year of fee payment: 3 |
|
LAPS | Cancellation because of no payment of annual fees |