JP6341066B2 - Timer control program, timer control method, and information processing apparatus - Google Patents
Timer control program, timer control method, and information processing apparatus Download PDFInfo
- Publication number
- JP6341066B2 JP6341066B2 JP2014231112A JP2014231112A JP6341066B2 JP 6341066 B2 JP6341066 B2 JP 6341066B2 JP 2014231112 A JP2014231112 A JP 2014231112A JP 2014231112 A JP2014231112 A JP 2014231112A JP 6341066 B2 JP6341066 B2 JP 6341066B2
- Authority
- JP
- Japan
- Prior art keywords
- timer
- slot
- time
- time slice
- current
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、タイマ制御プログラム、タイマ制御方法及び情報処理装置に関する。 The present invention relates to a timer control program, a timer control method, and an information processing apparatus.
多数のタイマを制御する方法として、タイムスライス毎に更新されるカレントスロットを保持し、カレントスロットから指定スロット数+1進んだタイマスロットにタイマ要求を登録して、指定されたタイマ時間の経過後に処理する方法がある。ここで、タイムスライスとは、所定の単位時間であり、指定スロット数とは、タイムアウトまでの時間/タイムスライスの小数点以下を切り上げた整数である。また、タイマスロットは、タイムスライスの間隔で配置され、タイマ要求が登録される場所である。 As a method of controlling a large number of timers, the current slot updated for each time slice is held, a timer request is registered in the timer slot advanced by the designated number of slots + 1 from the current slot, and processed after the designated timer time elapses There is a way to do it. Here, the time slice is a predetermined unit time, and the number of designated slots is an integer obtained by rounding up the time before timeout / the decimal point of the time slice. In addition, the timer slots are arranged at time slice intervals and are places where timer requests are registered.
図26は、従来のタイマ制御を説明するための図である。図26に示すように、タイマトラック上にタイムスライスの間隔で複数のタイマスロットが配置され、カレントスロットが指すタイマトラックは、タイムスライス毎に右に遷移する。タイマスロットにはタイマ要求が登録され、タイマ要求が登録されたタイマスロットにカレントスロットが遷移すると、登録されたタイマ要求のタイムアウト処理が行われる。ここで、タイムアウト処理とは、タイマ要求で指定されたタイマ時間が経過したときに行われる処理である。 FIG. 26 is a diagram for explaining conventional timer control. As shown in FIG. 26, a plurality of timer slots are arranged at intervals of time slices on the timer track, and the timer track pointed to by the current slot shifts to the right for each time slice. A timer request is registered in the timer slot, and when the current slot transitions to the timer slot in which the timer request is registered, the registered timer request is timed out. Here, the timeout process is a process performed when the timer time specified by the timer request has elapsed.
例えば、タイムスライスを100msec(ミリ秒)とし、カレントスロットが1の状態であるとする。このとき、200msecのタイマ要求があると、指定スロット数は200/100の小数点以下を切り上げた2となり、カレントスロットが2+1=3だけ進んだ4のタイマスロットにタイマ要求が登録される。そして、カレントスロットが4の状態になると、4のタイマスロットに登録されたタイマ要求が取り出されて、タイムアウト処理が行われる。 For example, assume that the time slice is 100 msec (milliseconds) and the current slot is 1. At this time, if there is a 200 msec timer request, the number of designated slots is 2, rounded up to the nearest 200/100, and the timer request is registered in the 4 timer slots which are advanced by 2 + 1 = 3. When the current slot becomes 4, the timer request registered in the 4 timer slot is taken out, and a time-out process is performed.
タイマ処理を行うタスクは、タイマスロットに登録されたタイマ要求の処理が終了すると、タイムスライスの間休止し、タイムスライスの時間が経過すると、起床されて次のタイマスロットに登録されたタイマ要求の処理を行う。 When the timer request registered in the timer slot is completed, the task that performs timer processing pauses for the time slice, and when the time slice time elapses, the task that wakes up and registers the timer request registered in the next timer slot. Process.
なお、複数のタイマを制御する従来技術として、監視時間をタイマの許容誤差で除した数のタイマを設け、タイマを許容誤差の時間分ずらしながら順次起動することで、許容誤差の時間で定義されるタイミング中に発生するタイマ起動要求を全て処理する技術がある。 In addition, as a conventional technique for controlling a plurality of timers, the number of timers obtained by dividing the monitoring time by the allowable error of the timer is provided, and the timers are sequentially started while being shifted by the allowable error time. There is a technique for processing all timer activation requests that occur during the timing.
しかしながら、図26で示したタイマ制御には、タイムスライスの量だけ誤差が生じるという問題がある。図27は、図26で示したタイマ制御の問題点を説明するための図である。カレントスロットはタイムスライス経過後に更新されるため、タイムスライス休止直後にタイマ登録された場合と、タイムスライス起床直前にタイマ登録された場合とでは、最大でタイムスライスの量のタイマ誤差が生じる。ここで、タイムスライス休止とは、タイムスライスの時間分、タイマ制御を休止することである。 However, the timer control shown in FIG. 26 has a problem that an error occurs by the amount of time slice. FIG. 27 is a diagram for explaining the problem of the timer control shown in FIG. Since the current slot is updated after the time slice elapses, a timer error of the amount of time slice occurs at the maximum when the timer is registered immediately after the time slice pause and when the timer is registered immediately before the time slice wakes up. Here, the time slice suspension means that the timer control is suspended for the time slice.
図27(a)は、タイムスライス休止直後にタイマ登録された場合を示し、図27(b)は、タイムスライス起床直前にタイマ登録された場合を示す。図27(a)に示すように、タイムスライス休止直後として例えばタイムスライス休止の開始から10msec経過後に指定タイマ値が200msecのタイマの登録が行われると、登録されたタイマは290msec後に処理される。ここで、指定タイマ値は、タイマ要求で指定された時間であり、タイマ値は、タイムアウトまでの時間である。 FIG. 27A shows a case where the timer is registered immediately after the time slice pause, and FIG. 27B shows a case where the timer is registered immediately before the time slice wakes up. As shown in FIG. 27A, when a timer whose designated timer value is 200 msec is registered after 10 msec from the start of the time slice pause, for example, immediately after the time slice pause, the registered timer is processed after 290 msec. Here, the designated timer value is the time designated by the timer request, and the timer value is the time until timeout.
一方、図27(b)に示すように、タイムスライス起床直前として例えばタイムスライス休止の開始から90msec経過後に指定タイマ値が200msecのタイマの登録が行われると、登録されたタイマは210msec後に処理される。すなわち、タイマ登録時におけるタイムスライス経過時間により、最大でタイムスライスの量の誤差が生じる。ここで、タイムスライス経過時間とは、タイムスライス休止の開始からタイマ登録までの経過時間である。なお、タイマ精度を向上させるためにタイムスライスを短くすると、タイマ制御の負荷が増加してしまう。 On the other hand, as shown in FIG. 27B, when a timer with a specified timer value of 200 msec is registered after 90 msec from the start of the time slice pause, for example, as soon as the time slice wakes up, the registered timer is processed after 210 msec. The That is, the maximum time slice error occurs due to the elapsed time slice at the time of timer registration. Here, the time slice elapsed time is the elapsed time from the start of the time slice pause to the timer registration. Note that if the time slice is shortened in order to improve timer accuracy, the load of timer control increases.
本発明は、1つの側面では、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることを目的とする。 In one aspect, an object of the present invention is to reduce a timer error caused by a time slice elapsed time at the time of timer registration.
本願の開示するタイマ制御プログラムは、1つの態様において、複数のタイマスロットを用いてタイマの制御を行うタイマ制御プログラムである。タイマ制御プログラムは、タイムスロット間をN(Nは2以上の整数)個に分割する。タイマ制御プログラムは、カレントスロット、タイマ値及びタイムスライス経過時間から、タイマのタイムアウト処理が起床されるタイマスロットをタイムスライスより小さい時間間隔のタイマスロットから決定する処理をコンピュータに実行させる。そして、タイマ制御プログラムは、決定したタイマスロットにタイマ要求を登録する処理をコンピュータに実行させる。また、タイマ制御プログラムは、前記カレントスロットと該カレントスロットから前記タイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在するか否かを判定する処理をコンピュータに実行させる。そして、存在する場合、タイマ制御プログラムは、該登録されたタイマスロットの位置に応じてタイムスライスP個分(Pは1以上N−1以下の整数)進めた位置にカレントスロットが遷移する処理をコンピュータに実行させる。 The timer control program disclosed in the present application is a timer control program that controls a timer using a plurality of timer slots in one aspect. The timer control program divides the time slots into N (N is an integer of 2 or more). The timer control program causes the computer to execute a process of determining, from the current slot, the timer value, and the time slice elapsed time, a timer slot in which a timer timeout process is woken up from a timer slot having a time interval smaller than the time slice. Then, the timer control program causes the computer to execute processing for registering the timer request in the determined timer slot. In addition, the timer control program executes processing for determining whether or not there is a timer slot to which a timer request is registered between the current slot and a timer slot after the current slice by the time slice. Let If the timer slot exists, the timer control program performs a process of transitioning the current slot to a position advanced by P time slices (P is an integer not less than 1 and not more than N-1) according to the position of the registered timer slot. Let the computer run.
1実施態様によれば、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることができる。 According to one embodiment, it is possible to reduce a timer error due to the time slice elapsed time at the time of timer registration.
以下に、本願の開示するタイマ制御プログラム、タイマ制御方法及び情報処理装置の実施例を図面に基づいて詳細に説明する。なお、この実施例は開示の技術を限定するものではない。また、実施例では、主にタイムスライスが100msec、タイマ要求で指定される指定タイマ値が200msecの場合を例として説明する。 Embodiments of a timer control program, a timer control method, and an information processing apparatus disclosed in the present application will be described below in detail with reference to the drawings. Note that this embodiment does not limit the disclosed technology. In the embodiment, a case where the time slice is mainly 100 msec and the designated timer value designated by the timer request is 200 msec will be described as an example.
まず、実施例に係る情報通信システムについて説明する。図1は、実施例に係る情報通信システムを説明するための図である。図1に示すように、情報通信システム1は、情報処理システム2と通信制御装置3を有し、他の情報通信システム4と通信する。
First, an information communication system according to an embodiment will be described. FIG. 1 is a diagram for explaining the information communication system according to the embodiment. As shown in FIG. 1, the
例えば、情報通信システム1は、金融機関の基幹システムであり、他の情報通信システム4は、他の金融機関のシステム、端末装置、ATM(Automated Teller Machine)等である。情報処理システム2と通信制御装置3との間は、例えば、LAN(Local Area Network)で接続され、情報通信システム1と他の情報通信システム4との間は、例えば、WAN(Wide Area Network)で接続される。
For example, the
情報通信システム1は、他の情報通信システム4と通信する場合に、1つの通信で帯域を占有することのないように、帯域を制限することがある。この場合、情報通信システム1は、コネクション毎に仮想的な帯域を設けることで、それぞれの通信の品質を保っている。図1では、仮想的な帯域幅が大である場合、中である場合、小である場合が示されている。
When the
図2は、仮想帯域を実現する方法を説明するための図である。図2に示すように、通信制御装置3が、送信電文に対する応答電文を送信元に即座には応答せず、コネクション毎にタイマを利用して応答電文を規定時間内保持することで、単位時間当たりの電文量を制御する。このようなタイマの利用においては、コネクション毎にタイマが使用されるため、数千〜数万のオーダのタイマが使用される。
FIG. 2 is a diagram for explaining a method of realizing a virtual band. As shown in FIG. 2, the
次に、実施例に係る通信制御装置3で実行されるソフトウェアの構成について説明する。図3は、実施例に係る通信制御装置3で実行されるソフトウェアの構成を示す図である。通信制御装置3は、CPUとメモリを有し、図3に示すタスクをCPUで実行する。ここで、タスクとは、CPUで実行される実行単位であり、例えばプロセスである。
Next, a configuration of software executed by the
図3に示すように、通信制御装置3で実行されるタスクには、伝送制御タスク31と、電文制御タスク32と、伝送制御タスク33と、タイマ登録タスク51と、タイマ処理タスク52とが含まれる。タイマ制御プログラム5は、タイマ制御を行うプログラムであり、タイマ登録タスク51と、タイマ処理タスク52と、タイマ管理表53により実現される。
As shown in FIG. 3, the tasks executed by the
タイマ管理表53には、タイマ制御に用いられる情報が登録される。タイマ管理表53には、タイマ登録タスク51及びタイマ処理タスク52が使用する情報が登録される。タイマ管理表53は、メモリに記憶される。なお、タイマ管理表53の詳細については後述する。
Information used for timer control is registered in the timer management table 53. Information used by the
伝送制御タスク31は、情報処理システム2との通信を制御し、コネクションの確立等を行う。伝送制御タスク31は、例えば、コネクション確立を監視するためにコネクション単位にタイマ登録を要求する。
The
電文制御タスク32は、情報処理システム2と情報通信システム4との間で送受信される電文を中継する。電文制御タスク32は、例えば、送信電文の応答を監視するために電文単位にタイマ登録を要求する。
The
伝送制御タスク33は、情報通信システム4との通信を制御し、コネクションの確立等を行う。伝送制御タスク33は、例えば、コネクション確立を監視するためにコネクション単位にタイマ登録を要求する。
The
タイマ登録タスク51は、タイマ登録が要求されると起動され、カレントスロットと指定タイマ値とタイムスライス経過時間に基づいて、登録が要求されたタイマのタイムアウト処理を起床すべきタイマスロットを特定する。そして、タイマ登録タスク51は、特定したタイマスロットにタイマを登録する。
The
図4は、タイマ登録を説明するための図である。図4(a)に示すように、タイマ制御プログラム5は、タイマスロット間をN分割する。したがって、タイマスロットの元々の数をMとすると、タイマスロットの数はM×Nとなる。図4(a)では、N=2であり、元のタイマスロットを黒丸で示し、分割により追加されたタイマスロットを模様付丸で示す。また、0のタイマスロットとMのタイマスロットは同一のタイマスロットを表す。
FIG. 4 is a diagram for explaining timer registration. As shown in FIG. 4A, the
タイマ登録タスク51は、タイマ登録を要求されると、タイムスライス経過時間がタイムスライスの1/2より小さい場合には、図4(b)に示すように、カレントスロット+指定スロット数+1/2のタイマスロットにタイマ登録する。図4(b)では、カレントスロットが1であり、タイムスライス経過時間が50msecより小さいので、200msecのタイマが3.5のタイマスロットに登録される。
When the
一方、タイムスライス経過時間がタイムスライスの1/2以上の場合には、図4(c)に示すように、タイマ登録タスク51は、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録する。図4(c)では、カレントスロットが1であり、タイムスライス経過時間が50msec以上なので、200msecのタイマが4のタイマスロットに登録される。
On the other hand, when the time slice elapsed time is ½ or more of the time slice, the
タイマ処理タスク52は、タイマ処理として、タイムスライスをN分割した時間に基づく可変の休止時間でカレントスロットを遷移させ、タイムアウト処理を行う。具体的には、タイマ処理タスク52は、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットがない場合には、カレントスロットと次の整数のタイマスロットとの差の時間を休止時間とする。そして、タイマ処理タスク52は、休止時間後に次の整数のタイマスロットにカレントスロットを遷移させる。
As a timer process, the
図5は、タイマ処理を説明するための図である。図5(a)に示すように、カレントスロットが1のとき、1.5のタイマスロットにタイマ要求が存在しない場合には、タイマ処理タスク52は、100msec休止する。そして、タイマ処理タスク52は、次の整数である2のタイマスロットにカレントスロットを遷移させる。すなわち、タイマ処理タスク52は、1回にカレントスロットをN個進める。また、カレントスロットが2のとき、2.5のタイマスロットにタイマ要求が存在しない場合には、タイマ処理タスク52は、100msec休止後に次の整数である3のタイマスロットにカレントスロットを遷移させる。
FIG. 5 is a diagram for explaining timer processing. As shown in FIG. 5A, when the current slot is 1 and there is no timer request in the 1.5 timer slot, the
一方、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットがある場合には、タイマ処理タスク52は、カレントスロットとタイマ登録が行われた最初のタイマスロットとの差の時間を休止時間とする。そして、タイマ処理タスク52は、休止時間後に、タイマ登録が行われた最初のタイマスロットにカレントスロットを遷移させる。図5(b)に示すように、カレントスロットが3のとき、3.5のタイマスロットにタイマ要求が存在する場合には、タイマ処理タスク52は、50msec休止する。そして、タイマ処理タスク52は、タイマ登録が行われた最初のタイマスロットである3.5のタイマスロットにカレントスロットを遷移させ、タイムアウト処理を行う。すなわち、タイマ処理タスク52は、1回にカレントスロットを1個進める。
On the other hand, if there is a timer slot for which timer registration has been performed between the current slot and the next integer timer slot, the
このように、タイマ処理タスク52は、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットが有るか否かに基づいて休止時間を変更する。したがって、タイマ処理タスク52は、タイムスライスをN分の1にする場合のように常にタイマ処理タスクがN倍動作することを防ぐことができる。
In this way, the
図6は、タイムスライスを50msecとするタイマ制御方法と実施例に係るタイマ制御方法との相違を説明するための図である。図6(a)はタイムスライスを50msecとするタイマ制御方法を示し、図6(b)は実施例に係るタイマ制御方法を示す。 FIG. 6 is a diagram for explaining the difference between the timer control method in which the time slice is 50 msec and the timer control method according to the embodiment. FIG. 6A shows a timer control method for setting a time slice to 50 msec, and FIG. 6B shows a timer control method according to the embodiment.
図6(a)に示すように、タイムスライスを50msecとするタイマ制御方法では、50msec毎にタイマ処理が行われる。一方、実施例に係るタイマ制御方法では、図6(b)に示すように、タイマスロット間の2分割により新たに追加されたタイマスロット、すなわち、0.5等のタイマスロットにタイマ要求が登録されている場合だけ50msecの休止後にタイマ処理が行われる。したがって、実施例に係るタイマ制御方法は、常にタイマ処理タスク52が2倍動作することを防ぐことができる。
As shown in FIG. 6A, in the timer control method in which the time slice is set to 50 msec, timer processing is performed every 50 msec. On the other hand, in the timer control method according to the embodiment, as shown in FIG. 6B, a timer request is registered in a timer slot newly added by dividing the timer slot into two, that is, a timer slot such as 0.5. The timer process is performed after 50 msec pause only when it is set. Therefore, the timer control method according to the embodiment can always prevent the
図7は、タイムスライス経過時間を特定する方法を説明するための図である。タイマ処理タスク52は、休止する直前に休止開始時刻Xを獲得して記憶する。タイマ登録タスク51は、タイマ登録時にタイマ登録時刻Yを獲得する。そして、タイマ登録タスク51は、タイマ登録時刻Yと休止開始時刻Xとの差分Y−Xを計算することでタイムスライス経過時間を特定する。
FIG. 7 is a diagram for explaining a method of specifying the time slice elapsed time. The
そして、タイマ登録タスク51は、タイマ登録時刻Y−休止開始時刻X<タイムスライス/2の場合、カレントスロット+指定スロット数+1/2のタイマスロットにタイマ登録する。また、タイマ登録タスク51は、タイマ登録時刻Y−休止開始時刻X≧タイムスライス/2の場合、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録する。
Then, when the timer registration time Y−pause start time X <time slice / 2, the
図8は、タイマスロット間を4分割した場合のタイマ要求の登録位置を説明するための図である。図8(a)に示すように、タイマスロット間を4分割した場合、1.25、1.5、1.75、2.25、2.5、2.75、3.25、3.5、3.75等のタイマスロットが追加される。 FIG. 8 is a diagram for explaining the registration position of the timer request when the timer slot is divided into four. As shown in FIG. 8A, when the timer slots are divided into four, 1.25, 1.5, 1.75, 2.25, 2.5, 2.75, 3.25, 3.5 A timer slot such as 3.75 is added.
そして、タイマ登録タスク51は、図8(b)に示すように、タイマ登録時のタイムスライス経過時間が0からタイムスライス×1/4未満の場合、カレントスロット+指定スロット数+1/4のタイマスロットにタイマ登録する。また、タイマ登録タスク51は、タイマ登録時のタイムスライス経過時間がタイムスライス×1/4以上タイムスライス×2/4未満の場合、カレントスロット+指定スロット数+2/4のタイマスロットにタイマ登録する。
Then, as shown in FIG. 8B, when the time slice elapsed time at the time of timer registration is 0 to less than time slice × 1/4, the
また、タイマ登録タスク51は、タイマ登録時のタイムスライス経過時間がタイムスライス×2/4以上タイムスライス×3/4未満の場合、カレントスロット+指定スロット数+3/4のタイマスロットにタイマ登録する。また、タイマ登録タスク51は、タイマ登録時のタイムスライス経過時間がタイムスライス×3/4以上タイムスライス未満の場合、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録する。
The
カレントスロットの値が整数のとき、タイマ処理タスク52は、以下のように休止する。タイマ処理タスク52は、カレントスロット+1/4のタイマスロットにタイマ要求が存在する場合、タイムスライス×1/4の間休止し、カレントスロット+2/4のタイマスロットにタイマ要求が存在する場合、タイムスライス×2/4の間休止する。また、タイマ処理タスク52は、カレントスロット+3/4のタイマスロットにタイマ要求が存在する場合、タイムスライス×3/4の間休止し、カレントスロット+1/4〜カレントスロット+3/4のタイムスロットにタイマ要求が存在しない場合、タイムスライスの間休止する。
When the value of the current slot is an integer, the
図9は、タイマスロット間を4分割した場合のタイマ処理を説明するための図である。ここでは、図9(a)に示すように、カレントスロットが1で、3.25と3.75のタイマスロットにタイマ要求が存在する場合を例として説明する。 FIG. 9 is a diagram for explaining timer processing when the timer slots are divided into four. Here, as shown in FIG. 9A, an example will be described in which the current slot is 1 and timer requests exist in the 3.25 and 3.75 timer slots.
タイマ処理タスク52は、カレントスロットとカレントスロット+1の間にタイマ要求が存在しない場合、タイムスライスの間休止した後、カレントスロットを4個進める。例えば、図9(b)に示すように、カレントスロットが1のとき、1と2のタイマスロットの間にはタイマ要求が存在するタイマスロットはないので、タイマ処理タスク52は、100msecの間休止した後、カレントスロットを4個進める。同様に、カレントスロットが2のとき、2と3のタイマスロットの間にはタイマ要求が存在するタイマスロットはないので、タイマ処理タスク52は、100msecの間休止した後、カレントスロットを4個進める。
When there is no timer request between the current slot and the current slot + 1, the
一方、カレントスロットとカレントスロット+1の間にタイマ要求が存在する場合、タイマ処理タスク52は、タイマスロット間の直近のタイマ登録位置を特定する。例えば、図9(c)に示すように、タイマ処理タスク52は、タイマ登録位置として3.25を特定する。そして、タイマ処理タスク52は、タイムスライス×1/4=25msecの間休止した後にカレントスロットを1個だけ遷移させ、3.25のタイマスロットに登録されたタイマ要求を処理する。
On the other hand, when a timer request exists between the current slot and the current slot + 1, the
次に、3.75にタイマ要求が登録されているため、タイマ処理タスク52は、図9(d)に示すように、タイマ登録位置の3.75とカレントスロット位置の3.25との差分である1/2にタイムスライスを乗じた50msecの間休止する。そして、タイマ処理タスク52は、50msecの間休止した後、カレントスロットを2個遷移させ、3.75のタイマスロットに登録されたタイマ要求を処理する。
Next, since the timer request is registered at 3.75, the
そして、3.75と4のタイマスロットの間には、タイマ要求が存在しないため、タイマ処理タスク52は、図9(e)に示すように、25msecの間休止した後、カレントスロットを1個遷移させる。
Since there is no timer request between the 3.75 and 4 timer slots, the
このように、タイマ処理タスク52は、カレントスロットとカレントスロットからタイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在するか否かを判定する。そして、タイマ処理タスク52は、タイマ要求が登録されたタイマスロットが存在する場合、登録されたタイマスロットの位置に応じてタイムスライスP個分進めた位置にカレントスロットを遷移させる。ここで、Pは1以上N−1以下の整数である。したがって、タイマ制御プログラム5は、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることができる。
As described above, the
図10は、タイムスライスを25msecとするタイマ制御方法と実施例に係るタイマ制御方法との相違を説明するための図である。図10(a)はタイムスライスを25msecとするタイマ制御方法を示し、図10(b)は実施例に係るタイマ制御方法を示す。 FIG. 10 is a diagram for explaining the difference between the timer control method for setting the time slice to 25 msec and the timer control method according to the embodiment. FIG. 10A shows a timer control method for setting a time slice to 25 msec, and FIG. 10B shows a timer control method according to the embodiment.
図10(a)に示すように、タイムスライスを25msecとするタイマ制御方法では、25msec毎にタイマ処理が行われる。一方、実施例に係るタイマ制御方法では、タイマスロット間の4分割により新たに追加されたタイマスロットにタイマ要求が登録されている場合だけ25msecに基づく可変時間の休止後にタイマ処理が行われる。 As shown in FIG. 10A, in the timer control method in which the time slice is set to 25 msec, timer processing is performed every 25 msec. On the other hand, in the timer control method according to the embodiment, timer processing is performed after a variable time suspension based on 25 msec only when a timer request is registered in a timer slot newly added by dividing the timer slot into four.
例えば、図10(b)では、カレントスロットが3及び3.75のとき、25msecの間休止した後にタイマ処理が行われ、カレントスロットが3.25のとき、50msecの間休止した後にタイマ処理が行われる。したがって、実施例に係るタイマ制御方法は、常にタイマ処理タスク52が4倍動作することを防ぐことができる。
For example, in FIG. 10B, when the current slot is 3 and 3.75, the timer process is performed after pausing for 25 msec, and when the current slot is 3.25, the timer process is performed after pausing for 50 msec. Done. Therefore, the timer control method according to the embodiment can always prevent the
次に、タイマ処理の遅延について説明する。タイマ精度が求められる装置において、装置が高負荷状態になった場合、タイマ処理タスク52の処理が遅延し、その結果、遅延時間がタイマ時間に上乗せされ、タイマ精度が悪化する。
Next, the delay of the timer process will be described. In a device that requires timer accuracy, when the device is in a high load state, the processing of the
図11は、タイマ処理の遅延を説明するための図である。図11(a)に示すように、カレントスロットが1の状況で4のタイマスロットにタイマ要求が登録されると、装置の負荷が少ない状況では、図11(b)に示すように、カレントスロットは100msec毎に更新される。したがって、指定された指定タイマ値から誤差100msec以内でタイムアウトする。 FIG. 11 is a diagram for explaining the delay of the timer process. As shown in FIG. 11 (a), when a timer request is registered in 4 timer slots in a situation where the current slot is 1, in a situation where the load on the apparatus is low, as shown in FIG. Is updated every 100 msec. Therefore, a time-out occurs within an error of 100 msec from the designated designated timer value.
一方、装置の負荷が高くなると、タイマ処理タスクの処理遅延が発生することから、図11(c)に示すように、カレントスロットは例えば120msec毎に更新され、指定タイマ値を大幅に超えてタイムアウトする。タイマ処理タスクの処理遅延が発生する理由は、OS(Operating System)に対して100msec休止するように命令を出した場合、休止時間は最低100msecが保証されているにすぎないためである。なお、図11では、タイマスロット間の分割数N=1とする。 On the other hand, when the load on the device increases, a processing delay of the timer processing task occurs, so that the current slot is updated every 120 msec, for example, as shown in FIG. To do. The reason why the processing delay of the timer processing task occurs is that when a command is issued to pause for 100 msec for an OS (Operating System), the pause time is only guaranteed at least 100 msec. In FIG. 11, the number of divisions between timer slots is N = 1.
図12は、タイマ処理の遅延による問題を説明するための図である。図12に示すように、通信制御装置3のタイマ処理で遅延が発生すると、送信元に応答電文を返信するタイミングが延びることから、送信元からの次回電文送信も遅延する。その結果、通信量が低下することから、帯域を最大限利用することができない(帯域に無駄が生じる)という問題が発生する。
FIG. 12 is a diagram for explaining a problem due to a delay in timer processing. As shown in FIG. 12, when a delay occurs in the timer process of the
そこで、通信制御装置3は、従来は固定であったタイマ処理タスク52の実行優先度を装置負荷又は実際のタイマ誤差に応じて動的に変化させる。通信制御装置3は、高負荷状態又は誤差が大きい状態ではタイマ処理タスク52に高優先度を割り当てることで、タイマ処理の遅延を発生させない。また、不当にCPU資源を消費することのないように、通信制御装置3は、低負荷状態又は誤差が少ない状態ではタイマ処理タスク52に通常優先度を割り当てることで、タイマ処理タスク52の実行優先度が常に高い状態を回避する。
Therefore, the
具体的には、タイマ処理タスク52は、周期的に通信制御装置3の状況を取得する。監視周期は利用者で決定可能である。また、利用者は、通信制御装置3の状況として、装置負荷又はタイマ精度を選択できる。
Specifically, the
実行優先度の変更要因として装置負荷を用いる場合、タイマ制御プログラム5は、以下のいずれかの方法で実行優先度を動的に変更する。また、タイマ制御プログラム5は、装置負荷として、実行待ちタスク数を用いる。
(1)装置負荷が閾値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を周期的に固定値増加させる。ここで、タイムアウト処理タスクは、タイマ処理タスク52により起床され、タイムアウト処理を行うタスクである。
(2)装置負荷によって、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を一意に決定する。
When the apparatus load is used as the execution priority change factor, the
(1) While the device load exceeds the threshold, the execution priorities of the
(2) The execution priority of the
(1)の方法では、タイマ制御プログラム5は、実行待ちタスク数の閾値を利用者に設定させる。タイマ処理タスク52は、通信制御装置3の実行待ちタスク数を周期的に監視する。そして、タイマ処理タスク52は、実行待ちタスク数が閾値を超えている間、タイマ処理タスク52とタイムアウト処理タスクの実行優先度を増加させることで、高負荷状態におけるタイマ処理タスク52の動作遅延を抑止し、タイマ精度を向上させる。また、タイマ処理タスク52は、実行待ちタスク数が閾値を下回った場合、タイマ処理タスク52とタイムアウト処理タスクを通常優先度に戻すことで、CPU資源の不当な消費を抑止する。
In the method (1), the
装置内の実行待ちタスク数がCPUコア数を超えている場合、タスクの実行遅延が発生する可能性がある。このため、(2)の方法では、処理タスク52は、CPUコア数を超えた実行待ちタスク数により実行優先度を一意に決定する。実行待ちタスク数がCPUコア数を超えている場合、処理タスク52は、実行待ちタスク数をCPUコア数に1以上の負荷係数(例えば、2)を乗じた値まで、実行優先度の指定範囲で分割することで実行優先度の設定段階を求める。ここで、実行優先度の設定段階は、実行優先度を1増加させるための実行タスク数である。そして、処理タスク52は、実行優先度の設定段階から実行優先度を計算する。
When the number of tasks waiting to be executed in the apparatus exceeds the number of CPU cores, there is a possibility that task execution delay occurs. For this reason, in the method (2), the
すなわち、
実行優先度の設定段階=(CPUコア数×負荷係数−CPUコア数)/(実行優先度最大値−実行優先度通常値)
とすると、
実行優先度=(実行待ちタスク数−CPUコア数)/実行優先度の設定段階
となる。
That is,
Execution priority setting stage = (CPU core number × load coefficient−CPU core number) / (maximum execution priority−normal execution priority value)
Then,
Execution priority = (number of waiting tasks−number of CPU cores) / execution priority setting stage.
例えば、CPUコア数が4、負荷係数が2、実行優先度通常値が0、実行優先度最大値が20であるとすると、実行優先度の設定段階=(4×2−4)/(20−0)=0.2であり、実行優先度=(実行待ちタスク数−4)/0.2となる。図13は、実行待ちタスク数に基づく実行優先度を示す図である。例えば、実行待ちタスク数が5であると実行優先度=(5−4)/0.2=5であり、実行待ちタスク数が6であると実行優先度=(6−4)/0.2=10である。 For example, assuming that the number of CPU cores is 4, the load coefficient is 2, the normal execution priority value is 0, and the maximum execution priority value is 20, the execution priority setting stage = (4 × 2−4) / (20 −0) = 0.2, and execution priority = (number of tasks waiting to be executed−4) /0.2. FIG. 13 is a diagram illustrating the execution priority based on the number of tasks waiting to be executed. For example, when the number of tasks waiting for execution is 5, the execution priority = (5-4) /0.2=5, and when the number of tasks waiting for execution is 6, the execution priority = (6-4) / 0. 2 = 10.
実行優先度の変更要因としてタイマ精度を用いる場合、タイマ毎の許容誤差値をタイマ登録時にタイマ登録タスク51が設定する。許容誤差値は、指定タイマ値/タイムスライスで算出される指定スロット数で割った値で管理される。例えば、指定タイマ値が1000msec、許容誤差が200msec、タイムスライスが10msecの場合、1000(指定タイマ値)/10(タイムスライス)=100、200(許容誤差)/100=2msecとなる。したがって、当該タイマの1タイムスライスあたりの許容誤差は2msecとなる。
When timer accuracy is used as a change factor of execution priority, the
タイマトラック内には複数のタイマが存在し、それぞれ異なる許容誤差が設定されることがあるが、タイマ処理タスク52が評価する許容誤差値は1つのみであるため、タイマ登録タスク51は、登録済タイマ内の最小誤差をタイマ精度として採用する。なお、最小誤差として採用されているタイマがタイマキャンセルまたはタイムアウトした場合は、タイマ登録タスク51は、2番目に許容誤差が小さいタイマの許容誤差値を採用する。
There are a plurality of timers in the timer track, and different tolerances may be set for each timer. However, since the
タイマ制御プログラム5は、以下のいずれかの方法で実行優先度を動的に変更する。
(1)タイマ誤差が閾値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を周期的に固定値増加させる。
(2)タイマ誤差によって、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を一意に決定する。
The
(1) While the timer error exceeds the threshold, the execution priorities of the
(2) The execution priority of the
(1)の方法では、タイマ処理タスク52は、タイムスライス休止直前〜当該タイムスライスに対するタイムアウト処理後までの経過時間を監視する。そして、タイマ処理タスク52は、経過時間がタイムスライス+許容誤差値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を増加させる。したがって、タイマ処理タスク52は、高負荷状態におけるタイマ処理タスク52の動作遅延を抑止し、タイマ精度を向上させることができる。
In the method (1), the
(2)の方法では、タイマ処理タスク52は、経過時間がタイムスライスまでの状況では実行優先度を通常値とし、許容誤差と同じタイマ誤差が発生している状況では実行優先度を最大値とする。そして、タイマ処理タスク52は、その間を実行優先度の指定範囲で分割し、実行優先度を1増加させるためのタイマ誤差を実行優先度の設定段階として求める。そして、タイマ処理タスク52は、実行優先度の設定段階から実行優先度を計算する。
In the method (2), the
すなわち、
実行優先度の設定段階=1タイムスライスあたりの許容誤差/(実行優先度最大値−実行優先度通常値)
とすると、
実行優先度=(1タイムスライスあたりのタイマ誤差)/実行優先度の設定段階
となる。
That is,
Execution priority setting stage = tolerance per time slice / (maximum execution priority-normal execution priority)
Then,
Execution priority = (timer error per time slice) / execution priority setting stage.
例えば、指定タイマ値が1000msec、許容誤差が200msec、タイムスライスが10msec、1タイムスライスあたりの誤差が1.5msec(指定タイマ値の誤差が150msec)の場合、実行優先度の設定段階=2msec/20=0.1msec、実行優先度=タイマ誤差/0.1=15である。図14は、タイマ誤差に基づく実行優先度を示す図である。ここで、実行優先度通常値は0、実行優先度最大値は20である。例えば、1タイムスライス当りの誤差が0.1msecであると実行優先度=0.1/0.1=1である。 For example, when the specified timer value is 1000 msec, the allowable error is 200 msec, the time slice is 10 msec, and the error per time slice is 1.5 msec (the specified timer value error is 150 msec), the execution priority setting stage = 2 msec / 20 = 0.1 msec, execution priority = timer error / 0.1 = 15. FIG. 14 is a diagram illustrating execution priorities based on timer errors. Here, the execution priority normal value is 0, and the execution priority maximum value is 20. For example, if the error per time slice is 0.1 msec, the execution priority = 0.1 / 0.1 = 1.
実行優先度の変更要因として実行待ちタスク数とタイマ誤差のうちどちらを採用するかは、それぞれの利点及び欠点を踏まえて利用者が決定する。図15は、実行優先度の各変更要因の利点及び欠点を示す図である。 The user decides which of the number of tasks waiting for execution and the timer error to adopt as a change factor of the execution priority based on the advantages and disadvantages of each. FIG. 15 is a diagram illustrating advantages and disadvantages of each factor of changing execution priority.
図15に示すように、実行待ちタスク数には、タイマ誤差が発生する前の前兆(実行待ちタスク数の増加)を検知して予め誤差の発生を抑止することが可能であるという利点がある。一方、実行待ちタスク数には、タイマ誤差が発生していない状況でもタイマ処理タスク52の実行優先度を変更する場合があるため、CPU資源を不当に消費する場合が有るという欠点がある。
As shown in FIG. 15, the number of tasks waiting to be executed has an advantage that it is possible to detect an antecedent (an increase in the number of tasks waiting to be executed) before the occurrence of a timer error and to suppress the occurrence of errors in advance. . On the other hand, the number of tasks waiting for execution has a drawback that the
タイマ誤差には、タイマ誤差の発生を契機にタイマ処理タスク52の実行優先度を変更するため、CPU資源がタイマ誤差の解消に効率よく使用可能であるという利点がある。一方、タイマ誤差には、タイマ誤差の発生を契機にタイマ処理タスク52の実行優先度を変更するため、タイマ誤差発生を検知するまでのタイマ誤差を抑止不可であるという欠点がある。
The timer error has an advantage that the CPU resource can be efficiently used to eliminate the timer error because the execution priority of the
次に、タイマを利用する処理のフローについて図16及び図17を用いて説明する。図16は、コネクション単位にタイマを起動して利用する処理のフローを示すフローチャートである。ここでは、伝送制御タスク31がコネクションを確立する場合について説明する。
Next, a flow of processing using a timer will be described with reference to FIGS. 16 and 17. FIG. 16 is a flowchart showing a flow of processing for starting and using a timer for each connection. Here, a case where the
図16に示すように、伝送制御タスク31は、コネクション確立を依頼し(ステップS1)、コネクション確立を監視するタイマを起動する(ステップS2)。そして、伝送制御タスク31は、コネクション確立が完了したか否かを判定し(ステップS3)、完了した場合には、タイマを停止し(ステップS4)、コネクション確立成功処理を行う(ステップS5)。
As shown in FIG. 16, the
一方、コネクション確立が完了していない場合には、伝送制御タスク31は、監視タイマがタイムアウトしたか否かを判定し(ステップS6)、タイムアウトしていない場合には、ステップS3へ戻る。また、タイムアウトした場合には、伝送制御タスク31は、コネクション確立失敗処理を行う(ステップS7)。
On the other hand, if the connection establishment has not been completed, the
このように、伝送制御タスク31は、タイマを利用して、コネクション確立を監視することができる。
In this way, the
図17は、電文単位にタイマを起動して利用する処理のフローを示すフローチャートである。図17に示すように、電文制御タスク32は、電文を送信し(ステップS11)、応答電文の受信を監視するタイマを起動する(ステップS12)。そして、電文制御タスク32は、応答電文を受信したか否かを判定し(ステップS13)、受信した場合には、タイマを停止し(ステップS14)、電文送信成功処理を行う(ステップS15)。
FIG. 17 is a flowchart showing a flow of processing for starting and using a timer for each message. As shown in FIG. 17, the
一方、応答電文を受信していない場合には、電文制御タスク32は、監視タイマがタイムアウトしたか否かを判定し(ステップS16)、タイムアウトしていない場合には、ステップS13へ戻る。また、タイムアウトした場合には、電文制御タスク32は、電文送信失敗処理を行う(ステップS17)。
On the other hand, if the response message has not been received, the
このように、電文制御タスク32は、タイマを利用して、電文の送信を監視することができる。
As described above, the
次に、タイマ登録処理のフローについて説明する。図18は、タイマ登録処理のフローを示すフローチャートである。なお、ここでは、タイマスロット間の分割数Nを2とする。図18に示すように、タイマ登録タスク51は、タイマ登録時刻として現在時刻を取得し(ステップS21)、タイマ管理表53からタイマ処理タスク52の休止開始時刻を獲得する(ステップS22)。
Next, a timer registration process flow will be described. FIG. 18 is a flowchart showing the flow of the timer registration process. Here, the division number N between the timer slots is 2. As shown in FIG. 18, the
そして、タイマ登録タスク51は、タイマ登録時刻−休止開始時刻がタイムスライス/2未満であるか否かを判定する(ステップS23)。その結果、タイムスライス/2未満である場合には、タイマ登録タスク51は、カレントスロット+指定スロット数+1/2のタイマスロットにタイマ登録を行う(ステップS24)。一方、タイムスライス/2未満でない場合には、タイマ登録タスク51は、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録を行う(ステップS25)。
Then, the
そして、タイマ登録タスク51は、許容誤差順タイマキューにタイマ登録を行い(ステップS26)、タイマ登録要求で指定された許容誤差が登録タイマ内で最小の許容誤差であるか否かを判定する(ステップS27)。その結果、最小の許容誤差である場合には、当該タイマの許容誤差を許容タイマ誤差値とする(ステップS28)。ここで、許容誤差順タイマキューは、許容誤差順にソートされたタイマのキューであり、許容タイマ誤差値は、タイマ登録毎にタイマ誤差について指定される誤差である。
Then, the
このように、タイマ登録タスク51が、タイマ登録時刻−休止開始時刻とタイムスライス/2に基づいてタイマ登録を行うタイマスロットを特定することによって、タイマ誤差を少なくすることができる。
As described above, the
次に、タイマスロット間をN分割した場合のタイマ登録処理のフローについて説明する。図19は、タイマスロット間をN分割した場合のタイマ登録処理のフローを示すフローチャートである。図19に示すように、タイマ登録タスク51は、タイマ登録時刻として現在時刻を取得し(ステップS31)、タイマ管理表53からタイマ処理タスク52の休止開始時刻を獲得する(ステップS32)。
Next, a flow of timer registration processing when the timer slots are divided into N will be described. FIG. 19 is a flowchart showing the flow of the timer registration process when the timer slots are divided into N parts. As shown in FIG. 19, the
そして、タイマ登録タスク51は、タイムスライス/Nをスロット間タイムスライスに設定し(ステップS33)、現在時刻−休止開始時刻をタイムスライス経過時間に設定する(ステップS34)。そして、タイマ登録タスク51は、[タイムスライス経過時間/スロット間タイムスライス]/Nをスロット間登録位置に設定する(ステップS35)。ここで、[X]は、Xの小数点以下を切り上げた値である。そして、タイマ登録タスク51は、カレントスロット+指定スロット数+スロット間登録位置に設定する(ステップS36)。
Then, the
そして、タイマ登録タスク51は、許容誤差順タイマキューにタイマ登録を行い(ステップS37)、タイマ登録要求で指定された許容誤差が登録タイマ内で最小の許容誤差であるか否かを判定する(ステップS38)。その結果、最小の許容誤差である場合には、当該タイマの許容誤差を許容タイマ誤差値とする(ステップS39)。
Then, the
このように、タイマ登録タスク51が、タイムスライス経過時間とスロット間タイムスライスに基づいてタイマ登録を行うタイマスロットを特定することによって、タイマ誤差を少なくすることができる。
As described above, the
次に、タイマ処理のフローについて説明する。図20は、タイマ処理のフローを示すフローチャートである。タイマ処理タスク52は、現在時刻を休止開始時刻として記憶し(ステップS41)、カレントスロット+1の範囲内にタイマ登録済であるか否かを判定する(ステップS42)。
Next, the flow of timer processing will be described. FIG. 20 is a flowchart showing the flow of timer processing. The
その結果、タイマ処理タスク52は、タイマ登録済でない場合には、タイムスライスの間休止し(ステップS43)、タイマ登録済である場合には、スロット間タイマ処理を行う(ステップS44)。ここで、スロット間タイマ処理とは、タイマスロット間の分割により追加されたタイマスロットに登録されたタイマ要求の処理である。
As a result, if the timer has not been registered, the
そして、タイマ処理タスク52は、カレントスロットを遷移し(ステップS45)、遷移先のタイマスロットに登録されたタイマ要求のタイムアウト処理を行う(ステップS46)。そして、タイマ処理タスク52は、装置状況の監視間隔だけ経過したか否かを判定し(ステップS47)、経過していない場合には、ステップS41に戻る。
Then, the
一方、装置状況の監視間隔だけ経過した場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差を確認し(ステップS48)、実行優先度の変更モードを判定する(ステップS49)。その結果、増加モードである場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差が閾値以上であるか否かを判定する(ステップS50)。
On the other hand, when the device status monitoring interval has elapsed, the
その結果、タイマ処理タスク52は、閾値以上である場合には、実行優先度を固定値増加し(ステップS51)、閾値以上でない場合には、実行優先度をデフォルトに戻す(ステップS52)。一方、実行優先度の変更モードが一意決定モードである場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差から求めた実行優先度に変更する(ステップS53)。
As a result, the
図21は、スロット間タイマ処理のフローを示すフローチャートである。図21に示すように、タイマ処理タスク52は、スロット内位置を1に初期化し(ステップS61)、休止時間をタイムスライス/Nに初期化する(ステップS62)。そして、タイマ処理タスク52は、スロット内位置がNに到達したか否かを判定し(ステップS63)、Nに到達した場合には、休止時間だけスリープする(ステップS64)。
FIG. 21 is a flowchart showing the flow of the inter-slot timer process. As shown in FIG. 21, the
一方、スロット内位置がNに到達していない場合には、タイマ処理タスク52は、スロット内位置のタイマスロットにタイマ要求が有るか否かを判定し(ステップS65)、有る場合には、休止時間だけスリープする(ステップS66)。そして、タイマ処理タスク52は、タイマ要求についてタイムアウト処理を行い(ステップS67)、スロット内位置に1を加え(ステップS68)、ステップS62に戻る。
On the other hand, when the position in the slot has not reached N, the
一方、スロット内位置のタイマスロットにタイマ要求が無い場合には、タイマ処理タスク52は、休止時間にタイムスライス/Nを加える(ステップS69)。そして、タイマ処理タスク52は、スロット内位置に1を加え(ステップS70)、ステップS63に戻る。
On the other hand, if there is no timer request in the timer slot at the position in the slot, the
このように、タイマ処理タスク52は、スロット間タイマ処理を行うことによって、タイムスライスの間隔内に追加されたタイマスロットに登録されたタイマ要求を処理することができる。
As described above, the
次に、タイマ管理表53の詳細について説明する。図22は、タイマ管理表53の一例を示す図である。図22に示すように、タイマ管理表53には、未使用タイマキュー61と、タイマプール管理キュー62と、休止開始時刻63と、カレントスロット64と、タイマトラック65と、分割前タイマスロット数(M)66とが含まれる。また、タイマ管理表53には、スロット間分割数(N)67と、許容誤差値68と、負荷係数値69と、許容誤差順タイマキュー70と、1分以上タイマキュー71とが含まれる。
Next, details of the timer management table 53 will be described. FIG. 22 is a diagram illustrating an example of the timer management table 53. As shown in FIG. 22, the timer management table 53 includes an
未使用タイマキュー61は、未使用のタイマを管理するFIFO(First In First Out)キューである。ここで、タイマは、タイマ要求を格納するセルである。タイマプール管理キュー62は、タイマのセルプールを管理するFIFOキューである。休止開始時刻63は、タイマ処理タスク52が休止する直前に設定する時刻である。
The
カレントスロット64は、タイマスロットの現在の位置を示すポインタである。タイマトラック65は、タイマスロットの集合テーブルであり、M×N個のタイマスロットを含む。各タイマスロットは、タイムアウト処理されるタイマ要求が登録される領域である。タイマトラック65は、60秒のタイマスロットを含む。指定タイマ値が60秒未満のタイマ要求が対応するタイマスロットに登録される。分割前タイマスロット数66は、タイマスロット間が分割される前のタイマスロットの数である。スロット間分割数67は、タイマスロット間の分割数である。なお、図22に示すタイマ管理表53では、分割後のタイマスロットを識別する数を整数とするため、タイマスロットを識別する数がN倍されている。
The
許容誤差値68は、タイマ登録毎にタイマ誤差について指定される許容誤差のうち最小の値である。負荷係数値69は、装置毎に指定される装置負荷の許容値である。許容誤差順タイマキュー70は、許容誤差順にソートされたタイマのキューである。1分以上タイマキュー71は、指定タイマ値が60秒以上のタイマが一時的に登録されるキューである。
The
図23は、図22に示したタイマ管理表53を用いたタイマ登録処理の例を示す図である。図23は、カレントスロット64が1の状態で指定タイマ値が200msecのタイマ要求を登録する場合の処理を示す。また、スロット間分割数67=2である。
FIG. 23 is a diagram showing an example of timer registration processing using the timer management table 53 shown in FIG. FIG. 23 shows processing when registering a timer request with a specified timer value of 200 msec in the state where the
図23に示すように、タイマ登録処理を開始すると、タイマ登録タスク51は、未使用タイマキュー61から未使用タイマを獲得し(t1)、OS81から現在時刻をタイマ登録時刻として取得する(t2)。そして、タイマ登録タスク51は、休止開始時刻63を獲得し(t3)、タイマ登録時刻−休止開始時刻63とタイムスライス/2を比較する。
As shown in FIG. 23, when the timer registration process is started, the
その結果、タイマ登録時刻−休止開始時刻63がタイムスライス/2未満の場合には、タイマ登録タスク51は、(1+2+1/2)×2=7のタイマスロットにタイマ登録する(t4)。一方、タイマ登録時刻−休止開始時刻63がタイムスライス/2以上の場合には、タイマ登録タスク51は、(1+2+1)×2=8のタイマスロットにタイマ登録する(t5)。
As a result, when the timer registration time-
そして、タイマ登録タスク51は、必要に応じてタイマ誤差値68を更新するとともに、タイマ登録したタイマを許容誤差順タイマキュー70に登録し(t6)、タイマ登録処理を完了する。
Then, the
図24は、図22に示したタイマ管理表53を用いたタイマ処理の例を示す図である。図24は、カレントスロット64が6の状態を示す。また、スロット間分割数67=2である。図24に示すように、タイマ処理タスク52は、現在時刻を休止開始時刻63として取得し(t11)、休止開始時刻63を記憶する(t12)。
FIG. 24 is a diagram showing an example of timer processing using the timer management table 53 shown in FIG. FIG. 24 shows a state where the
そして、タイマ処理タスク52は、カレントスロット64とカレントスロット64+2のタイマスロットとの間にタイマ要求が登録されたタイマスロットがある場合には、スロット間タイマ処理を行う(t13)。一方、カレントスロット64とカレントスロット64+2のタイマスロットとの間にタイマ要求が登録されたタイマスロットがない場合には、タイマ処理タスク52は、タイムスライス休止を行う(t14)。
When there is a timer slot in which a timer request is registered between the
そして、タイマ処理タスク52は、カレントスロット64を2個進めるカレントスロット遷移を行う(t15)。図24では、カレントスロット64が6から8に遷移する。そして、タイマ処理タスク52は、8のタイマスロットに登録されたタイマ要求に関してタイムアウト処理タスク82にタイムアウト通知を行う(t16)。
Then, the
そして、タイマ処理タスク52は、実行優先度の変更要因としてタイマ精度を用いる場合には、現在時刻をタイマ処理完了時刻として取得し(t17)、実行優先度の変更要因として装置負荷を用いる場合には、負荷状況を獲得する(t18)。そして、タイマ処理タスク52は、負荷状況又はタイマ誤差から実行優先度の値を決定し(t19)、タイマ処理タスク52及びタイムアウト処理タスク82の実行優先度の変更をOS81に依頼する(t20)。
When the timer accuracy is used as the execution priority change factor, the
次に、タイマ制御プログラム5等のソフトウェアを実行する通信制御装置3のハードウェア構成について説明する。図25は、通信制御装置3のハードウェア構成を示す図である。図25に示すように、通信制御装置3は、CPU91と、HDD(Hard Disk Drive)92と、メモリ93と、LANインタフェース94とを有する。
Next, a hardware configuration of the
CPU91は、メモリ93からプログラムを読み出して実行する中央処理装置である。HDD92は、プログラムやデータを格納するディスク装置である。メモリ93は、プログラムやプログラムの実行途中結果などを記憶するRAM(Random Access Memory)である。LANインタフェース94は、通信制御装置3をLAN経由で情報処理システム2等に接続するためのインタフェースである。そして、通信制御装置3において実行されるタイマ制御プログラム5等は、HDD92に記憶され、メモリ93に読み出されてCPU91によって実行される。
The CPU 91 is a central processing unit that reads a program from the memory 93 and executes it. The HDD 92 is a disk device that stores programs and data. The memory 93 is a RAM (Random Access Memory) that stores a program and a program execution result. The LAN interface 94 is an interface for connecting the
上述してきたように、実施例では、タイマ制御プログラム5は、タイマスロット間をN分割してタイマスロットを追加する。そして、タイマ登録タスク51が、カレントスロットと指定タイマ値とタイムスライス経過時間とに基づいてタイムアウト処理を起床すべきタイマスロットをタイムスライス/Nの時間間隔のタイマスロットから特定してタイマ要求を登録する。そして、タイマ処理タスク52が、カレントスロットとカレントスロット+1のタイマスロットとの間にタイマ要求が登録されている場合には、スロット間タイマ処理を行う。一方、カレントスロットとカレントスロット+1のタイマスロットとの間にタイマ要求が登録されていない場合には、タイマ処理タスク52は、従来と同様にタイムスライスの間休止して次のタイマスロットに遷移する。したがって、タイマ制御プログラム5は、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることができる。
As described above, in the embodiment, the
また、実施例では、タイマ処理タスク52は、通信制御装置3の負荷状況又はタイマ精度に基づいてタイマ処理タスク52及びタイムアウト処理タスク82の実行優先度を動的に変更する。したがって、タイマ制御プログラム5は、通信制御装置3が高負荷の状態でも、タイマ精度の悪化を抑止することができる。
In the embodiment, the
また、実施例では、タイマ処理タスク52は、タイマ処理タスク52及びタイムアウト処理タスク82の実行優先度の増加量又は実行優先度の値を計算し、計算した実行優先度に変更する。したがって、タイマ制御プログラム5は、実行優先度を柔軟に変更することができる。
In the embodiment, the
また、実施例では、通信制御装置について説明したが、本発明はこれに限定されるものではなく、情報処理装置などプロセッサとメモリを備え、タイマを利用する他の装置にも同様に適用することができる。 In the embodiments, the communication control apparatus has been described. However, the present invention is not limited to this, and the present invention is similarly applied to other apparatuses that include a processor and a memory such as an information processing apparatus and use a timer. Can do.
また、実施例では、タイマスロット間をN個に等分割する場合について説明したが、本発明はこれに限定されるものではなく、タイマスロット間を異なる大きさにN分割する場合にも同様に適用することができる。 In the embodiment, the case where the timer slots are equally divided into N has been described. However, the present invention is not limited to this, and the same applies to the case where the timer slots are divided into N different sizes. Can be applied.
1,4 情報通信システム
2 情報処理システム
3 通信制御装置
5 タイマ制御プログラム
31,33 伝送制御タスク
32 電文制御タスク
51 タイマ登録タスク
52 タイマ処理タスク
53 タイマ管理表
61 未使用タイマキュー
62 タイマプール管理キュー
63 休止開始時刻
64 カレントスロット
65 タイマトラック
66 分割前タイマスロット数
67 スロット間分割数
68 許容誤差値
69 負荷係数値
70 許容誤差順タイマキュー
71 1分以上タイマキュー
81 OS
82 タイムアウト処理タスク
91 CPU
92 HDD
93 メモリ
94 LANインタフェース
1,4
82 Timeout processing task 91 CPU
92 HDD
93 Memory 94 LAN interface
Claims (6)
タイムスロット間をN(Nは2以上の整数)個に分割し、
前記複数のタイマスロットのうち現時点のタイマスロットを示すカレントスロットと、タイマの登録要求で指定されたタイマ値と、タイムスライスの時間分休止するタイムスライス休止の開始時刻から前記タイマの登録までの経過時間を示すタイムスライス経過時間とから、前記タイマのタイムアウト処理が起床されるタイマスロットを決定し、決定したタイマスロットにタイマ要求を登録し、
前記カレントスロットと該カレントスロットから前記タイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在する場合、該登録されたタイマスロットの位置に応じてタイムスライスP個分(Pは1以上N−1以下の整数)進めた位置に前記カレントスロットが遷移する
処理をコンピュータに実行させることを特徴とするタイマ制御プログラム。 In a timer control program that controls a timer using a plurality of timer slots,
The time slots are divided into N (N is an integer of 2 or more),
A current slot indicating a current timer slot among the plurality of timer slots, a timer value specified by a timer registration request, and a time slice pause start time from a time slice pause time to the timer registration From the time slice elapsed time indicating the time, determine the timer slot in which the timer timeout process is woken up, register the timer request in the determined timer slot,
If there is a timer slot to which a timer request is registered between the current slot and the timer slot that is the time slice after the current slot, P time slices corresponding to the position of the registered timer slot are present. (P is an integer of 1 or more and N-1 or less) A timer control program that causes a computer to execute a process in which the current slot transitions to an advanced position.
前記変更する処理は、前記算出する処理により算出された優先度に変更することを特徴とする請求項3に記載のタイマ制御プログラム。 Further causing the computer to execute a process of calculating the amount of increase in the priority or a process of calculating the priority using a predetermined calculation formula,
The timer control program according to claim 3, wherein the changing process is changed to the priority calculated by the calculating process.
コンピュータが、
タイムスロット間をN(Nは2以上の整数)個に分割し、
前記複数のタイマスロットのうち現時点のタイマスロットを示すカレントスロットと、タイマの登録要求で指定されたタイマ値と、タイムスライスの時間分休止するタイムスライス休止の開始時刻から前記タイマの登録までの経過時間を示すタイムスライス経過時間とから、前記タイマのタイムアウト処理が起床されるタイマスロットを決定し、決定したタイマスロットにタイマ要求を登録し、
前記カレントスロットと該カレントスロットから前記タイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在する場合、該登録されたタイマスロットの位置に応じてタイムスライスP個分(Pは1以上N−1以下の整数)進めた位置に前記カレントスロットが遷移する
処理を実行することを特徴とするタイマ制御方法。 In a timer control method for controlling a timer using a plurality of timer slots,
Computer
The time slots are divided into N (N is an integer of 2 or more),
A current slot indicating a current timer slot among the plurality of timer slots, a timer value specified by a timer registration request, and a time slice pause start time from a time slice pause time to the timer registration From the time slice elapsed time indicating the time, determine the timer slot in which the timer timeout process is woken up, register the timer request in the determined timer slot,
If there is a timer slot to which a timer request is registered between the current slot and the timer slot that is the time slice after the current slot, P time slices corresponding to the position of the registered timer slot are present. (P is an integer greater than or equal to 1 and less than or equal to N-1) A timer control method characterized by executing a process in which the current slot transitions to an advanced position.
前記プロセッサに、
複数のタイマスロットを用いてタイマの制御を行う処理を実行させる際に、タイムスロット間をN(Nは2以上の整数)個に分割し、
前記複数のタイマスロットのうち現時点のタイマスロットを示すカレントスロットと、タイマの登録要求で指定されたタイマ値と、タイムスライスの時間分休止するタイムスライス休止の開始時刻から前記タイマの登録までの経過時間を示すタイムスライス経過時間とから、前記タイマのタイムアウト処理が起床されるタイマスロットを決定し、決定したタイマスロットにタイマ要求を登録し、
前記カレントスロットと該カレントスロットから前記タイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在する場合、該登録されたタイマスロットの位置に応じてタイムスライスP個分(Pは1以上N−1以下の整数)進めた位置に前記カレントスロットが遷移する
処理を実行させることを特徴とする情報処理装置。 In an information processing apparatus having a memory and a processor connected to the memory,
In the processor,
When executing the process of controlling the timer using a plurality of timer slots, the time slots are divided into N (N is an integer of 2 or more),
A current slot indicating a current timer slot among the plurality of timer slots, a timer value specified by a timer registration request, and a time slice pause start time from a time slice pause time to the timer registration From the time slice elapsed time indicating the time, determine the timer slot in which the timer timeout process is woken up, register the timer request in the determined timer slot,
If there is a timer slot to which a timer request is registered between the current slot and the timer slot that is the time slice after the current slot, P time slices corresponding to the position of the registered timer slot are present. (P is an integer equal to or greater than 1 and equal to or less than N−1) An information processing apparatus that causes the current slot to transition to an advanced position.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2014231112A JP6341066B2 (en) | 2014-11-13 | 2014-11-13 | Timer control program, timer control method, and information processing apparatus |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2014231112A JP6341066B2 (en) | 2014-11-13 | 2014-11-13 | Timer control program, timer control method, and information processing apparatus |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2016095655A JP2016095655A (en) | 2016-05-26 |
| JP6341066B2 true JP6341066B2 (en) | 2018-06-13 |
Family
ID=56071861
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2014231112A Expired - Fee Related JP6341066B2 (en) | 2014-11-13 | 2014-11-13 | Timer control program, timer control method, and information processing apparatus |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6341066B2 (en) |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0295418U (en) * | 1989-01-17 | 1990-07-30 | ||
| JPH0594313A (en) * | 1991-10-01 | 1993-04-16 | Mitsubishi Electric Corp | Timer management method |
| JPH064175A (en) * | 1992-06-17 | 1994-01-14 | Nec Corp | Timer managing system |
| JPH07152588A (en) * | 1993-12-01 | 1995-06-16 | Toshiba Corp | Computer system task waiting time management device |
-
2014
- 2014-11-13 JP JP2014231112A patent/JP6341066B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2016095655A (en) | 2016-05-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8370846B2 (en) | Task execution device and method | |
| US20150295970A1 (en) | Method and device for augmenting and releasing capacity of computing resources in real-time stream computing system | |
| CN114710563B (en) | Cluster energy saving method and device | |
| CN111142788A (en) | Data migration method and device and computer readable storage medium | |
| CN105144102B (en) | Adaptive data synchronization | |
| US20150378782A1 (en) | Scheduling of tasks on idle processors without context switching | |
| CN105955809B (en) | Thread scheduling method and system | |
| JPWO2005106623A1 (en) | CPU clock control device, CPU clock control method, CPU clock control program, recording medium, and transmission medium | |
| WO2023193527A1 (en) | Thread execution method and apparatus, electronic device, and computer-readable storage medium | |
| CN114003367B (en) | Risk monitoring method, device, equipment and storage medium | |
| JP4490298B2 (en) | Processor power control apparatus and processor power control method | |
| JP5462529B2 (en) | Task allocation apparatus and task allocation method | |
| CN105357026B (en) | A resource information collection method and computing node | |
| US9612907B2 (en) | Power efficient distribution and execution of tasks upon hardware fault with multiple processors | |
| CN110806918A (en) | Virtual machine operation method and device based on deep learning neural network | |
| CN103200257A (en) | A node and its resource switching method in a high-availability cluster system | |
| US20180217875A1 (en) | Data processing system and data processing method | |
| JP6341066B2 (en) | Timer control program, timer control method, and information processing apparatus | |
| EP2905703A1 (en) | Parallel computer system, control method of parallel computer system, and computer-readable storage medium | |
| CN118227270B (en) | A virtual machine memory adjustment method, device, equipment and medium | |
| JP2008217628A (en) | Cpu power saving system and power saving method | |
| CN115269145B (en) | Heterogeneous multi-core scheduling method and device facing to offshore unmanned equipment | |
| CN117785403A (en) | Heartbeat task execution device for equipment, electronic equipment and storage medium | |
| CN113032098B (en) | Virtual machine scheduling method, device, equipment and readable storage medium | |
| CN116627584A (en) | Cloud virtual machine dormancy method and related equipment thereof |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170804 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20180309 |
|
| 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: 20180417 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180430 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 6341066 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |