Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6341066B2 - Timer control program, timer control method, and information processing apparatus - Google Patents
[go: Go Back, main page]

JP6341066B2 - Timer control program, timer control method, and information processing apparatus - Google Patents

Timer control program, timer control method, and information processing apparatus Download PDF

Info

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
Application number
JP2014231112A
Other languages
Japanese (ja)
Other versions
JP2016095655A (en
Inventor
健司 水田
健司 水田
敦子 荻巣
敦子 荻巣
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2014231112A priority Critical patent/JP6341066B2/en
Publication of JP2016095655A publication Critical patent/JP2016095655A/en
Application granted granted Critical
Publication of JP6341066B2 publication Critical patent/JP6341066B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

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.

特開平7−200361号公報JP-A-7-200361

しかしながら、図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.

図1は、実施例に係る情報通信システムを説明するための図である。FIG. 1 is a diagram for explaining the information communication system according to the embodiment. 図2は、仮想帯域を実現する方法を説明するための図である。FIG. 2 is a diagram for explaining a method of realizing a virtual band. 図3は、実施例に係る通信制御装置で実行されるソフトウェアの構成を示す図である。FIG. 3 is a diagram illustrating a configuration of software executed by the communication control apparatus according to the embodiment. 図4は、タイマ登録を説明するための図である。FIG. 4 is a diagram for explaining timer registration. 図5は、タイマ処理を説明するための図である。FIG. 5 is a diagram for explaining timer processing. 図6は、タイムスライスを50msecとするタイマ制御方法と実施例に係るタイマ制御方法との相違を説明するための図である。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. 図7は、タイムスライス経過時間を特定する方法を説明するための図である。FIG. 7 is a diagram for explaining a method of specifying the time slice elapsed time. 図8は、タイマスロット間を4分割した場合のタイマ要求の登録位置を説明するための図である。FIG. 8 is a diagram for explaining the registration position of the timer request when the timer slot is divided into four. 図9は、タイマスロット間を4分割した場合のタイマ処理を説明するための図である。FIG. 9 is a diagram for explaining timer processing when the timer slots are divided into four. 図10は、タイムスライスを25msecとするタイマ制御方法と実施例に係るタイマ制御方法との相違を説明するための図である。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. 図11は、タイマ処理の遅延を説明するための図である。FIG. 11 is a diagram for explaining the delay of the timer process. 図12は、タイマ処理の遅延による問題を説明するための図である。FIG. 12 is a diagram for explaining a problem due to a delay in timer processing. 図13は、実行待ちタスク数に基づく実行優先度を示す図である。FIG. 13 is a diagram illustrating the execution priority based on the number of tasks waiting to be executed. 図14は、タイマ誤差に基づく実行優先度を示す図である。FIG. 14 is a diagram illustrating execution priorities based on timer errors. 図15は、実行優先度の各変更要因の利点及び欠点を示す図である。FIG. 15 is a diagram illustrating advantages and disadvantages of each factor of changing execution priority. 図16は、コネクション単位にタイマを起動して利用する処理のフローを示すフローチャートである。FIG. 16 is a flowchart showing a flow of processing for starting and using a timer for each connection. 図17は、電文単位にタイマを起動して利用する処理のフローを示すフローチャートである。FIG. 17 is a flowchart showing a flow of processing for starting and using a timer for each message. 図18は、タイマ登録処理のフローを示すフローチャートである。FIG. 18 is a flowchart showing the flow of the timer registration process. 図19は、タイマスロット間をN分割した場合のタイマ登録処理のフローを示すフローチャートである。FIG. 19 is a flowchart showing the flow of the timer registration process when the timer slots are divided into N parts. 図20は、タイマ処理のフローを示すフローチャートである。FIG. 20 is a flowchart showing the flow of timer processing. 図21は、スロット間タイマ処理のフローを示すフローチャートである。FIG. 21 is a flowchart showing the flow of the inter-slot timer process. 図22は、タイマ管理表の一例を示す図である。FIG. 22 is a diagram illustrating an example of a timer management table. 図23は、図22に示したタイマ管理表を用いたタイマ登録処理の例を示す図である。FIG. 23 is a diagram illustrating an example of timer registration processing using the timer management table illustrated in FIG. 図24は、図22に示したタイマ管理表を用いたタイマ処理の例を示す図である。24 is a diagram showing an example of timer processing using the timer management table shown in FIG. 図25は、通信制御装置のハードウェア構成を示す図である。FIG. 25 is a diagram illustrating a hardware configuration of the communication control device. 図26は、従来のタイマ制御を説明するための図である。FIG. 26 is a diagram for explaining conventional timer control. 図27は、図26で示したタイマ制御の問題点を説明するための図である。FIG. 27 is a diagram for explaining the problem of the timer control shown in FIG.

以下に、本願の開示するタイマ制御プログラム、タイマ制御方法及び情報処理装置の実施例を図面に基づいて詳細に説明する。なお、この実施例は開示の技術を限定するものではない。また、実施例では、主にタイムスライスが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 information communication system 1 includes an information processing system 2 and a communication control device 3 and communicates with another information communication system 4.

例えば、情報通信システム1は、金融機関の基幹システムであり、他の情報通信システム4は、他の金融機関のシステム、端末装置、ATM(Automated Teller Machine)等である。情報処理システム2と通信制御装置3との間は、例えば、LAN(Local Area Network)で接続され、情報通信システム1と他の情報通信システム4との間は、例えば、WAN(Wide Area Network)で接続される。   For example, the information communication system 1 is a basic system of a financial institution, and the other information communication system 4 is a system of another financial institution, a terminal device, an ATM (Automated Teller Machine), or the like. The information processing system 2 and the communication control device 3 are connected by, for example, a LAN (Local Area Network), and the information communication system 1 and the other information communication system 4 are, for example, a WAN (Wide Area Network). Connected with.

情報通信システム1は、他の情報通信システム4と通信する場合に、1つの通信で帯域を占有することのないように、帯域を制限することがある。この場合、情報通信システム1は、コネクション毎に仮想的な帯域を設けることで、それぞれの通信の品質を保っている。図1では、仮想的な帯域幅が大である場合、中である場合、小である場合が示されている。   When the information communication system 1 communicates with another information communication system 4, the information communication system 1 may limit the band so that one communication does not occupy the band. In this case, the information communication system 1 maintains the quality of each communication by providing a virtual band for each connection. FIG. 1 shows a case where the virtual bandwidth is large, medium, and small.

図2は、仮想帯域を実現する方法を説明するための図である。図2に示すように、通信制御装置3が、送信電文に対する応答電文を送信元に即座には応答せず、コネクション毎にタイマを利用して応答電文を規定時間内保持することで、単位時間当たりの電文量を制御する。このようなタイマの利用においては、コネクション毎にタイマが使用されるため、数千〜数万のオーダのタイマが使用される。   FIG. 2 is a diagram for explaining a method of realizing a virtual band. As shown in FIG. 2, the communication control device 3 does not immediately respond to the transmission message with a response message to the transmission message, but uses a timer for each connection to hold the response message within a specified time. Control the amount of messages per hit. In using such a timer, since a timer is used for each connection, timers on the order of thousands to tens of thousands are used.

次に、実施例に係る通信制御装置3で実行されるソフトウェアの構成について説明する。図3は、実施例に係る通信制御装置3で実行されるソフトウェアの構成を示す図である。通信制御装置3は、CPUとメモリを有し、図3に示すタスクをCPUで実行する。ここで、タスクとは、CPUで実行される実行単位であり、例えばプロセスである。   Next, a configuration of software executed by the communication control device 3 according to the embodiment will be described. FIG. 3 is a diagram illustrating a configuration of software executed by the communication control device 3 according to the embodiment. The communication control device 3 has a CPU and a memory, and executes the tasks shown in FIG. Here, a task is an execution unit executed by the CPU, and is, for example, a process.

図3に示すように、通信制御装置3で実行されるタスクには、伝送制御タスク31と、電文制御タスク32と、伝送制御タスク33と、タイマ登録タスク51と、タイマ処理タスク52とが含まれる。タイマ制御プログラム5は、タイマ制御を行うプログラムであり、タイマ登録タスク51と、タイマ処理タスク52と、タイマ管理表53により実現される。   As shown in FIG. 3, the tasks executed by the communication control device 3 include a transmission control task 31, a telegram control task 32, a transmission control task 33, a timer registration task 51, and a timer processing task 52. It is. The timer control program 5 is a program that performs timer control, and is realized by a timer registration task 51, a timer processing task 52, and a timer management table 53.

タイマ管理表53には、タイマ制御に用いられる情報が登録される。タイマ管理表53には、タイマ登録タスク51及びタイマ処理タスク52が使用する情報が登録される。タイマ管理表53は、メモリに記憶される。なお、タイマ管理表53の詳細については後述する。   Information used for timer control is registered in the timer management table 53. Information used by the timer registration task 51 and the timer processing task 52 is registered in the timer management table 53. The timer management table 53 is stored in the memory. Details of the timer management table 53 will be described later.

伝送制御タスク31は、情報処理システム2との通信を制御し、コネクションの確立等を行う。伝送制御タスク31は、例えば、コネクション確立を監視するためにコネクション単位にタイマ登録を要求する。   The transmission control task 31 controls communication with the information processing system 2 and establishes a connection. For example, the transmission control task 31 requests timer registration for each connection in order to monitor connection establishment.

電文制御タスク32は、情報処理システム2と情報通信システム4との間で送受信される電文を中継する。電文制御タスク32は、例えば、送信電文の応答を監視するために電文単位にタイマ登録を要求する。   The message control task 32 relays messages transmitted and received between the information processing system 2 and the information communication system 4. For example, the message control task 32 requests timer registration for each message in order to monitor the response of the transmitted message.

伝送制御タスク33は、情報通信システム4との通信を制御し、コネクションの確立等を行う。伝送制御タスク33は、例えば、コネクション確立を監視するためにコネクション単位にタイマ登録を要求する。   The transmission control task 33 controls communication with the information communication system 4 and establishes a connection. For example, the transmission control task 33 requests timer registration for each connection in order to monitor connection establishment.

タイマ登録タスク51は、タイマ登録が要求されると起動され、カレントスロットと指定タイマ値とタイムスライス経過時間に基づいて、登録が要求されたタイマのタイムアウト処理を起床すべきタイマスロットを特定する。そして、タイマ登録タスク51は、特定したタイマスロットにタイマを登録する。   The timer registration task 51 is activated when timer registration is requested, and specifies a timer slot to wake up the timeout processing of the timer for which registration is requested based on the current slot, the designated timer value, and the time slice elapsed time. Then, the timer registration task 51 registers a timer in the specified timer slot.

図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 timer control program 5 divides the timer slot into N. Therefore, if the original number of timer slots is M, the number of timer slots is M × N. In FIG. 4A, N = 2, the original timer slot is indicated by a black circle, and the timer slot added by division is indicated by a patterned circle. The 0 timer slot and the M timer slot represent the same timer slot.

タイマ登録タスク51は、タイマ登録を要求されると、タイムスライス経過時間がタイムスライスの1/2より小さい場合には、図4(b)に示すように、カレントスロット+指定スロット数+1/2のタイマスロットにタイマ登録する。図4(b)では、カレントスロットが1であり、タイムスライス経過時間が50msecより小さいので、200msecのタイマが3.5のタイマスロットに登録される。   When the timer registration task 51 is requested to register the timer, if the time slice elapsed time is smaller than 1/2 of the time slice, as shown in FIG. 4B, the current slot + the number of designated slots + 1/2 Register the timer in the timer slot. In FIG. 4B, since the current slot is 1 and the time slice elapsed time is less than 50 msec, a 200 msec timer is registered in the 3.5 timer slot.

一方、タイムスライス経過時間がタイムスライスの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 timer registration task 51 registers the timer in the current slot + the number of designated slots + 1 timer slots as shown in FIG. In FIG. 4C, since the current slot is 1 and the time slice elapsed time is 50 msec or more, a 200 msec timer is registered in 4 timer slots.

タイマ処理タスク52は、タイマ処理として、タイムスライスをN分割した時間に基づく可変の休止時間でカレントスロットを遷移させ、タイムアウト処理を行う。具体的には、タイマ処理タスク52は、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットがない場合には、カレントスロットと次の整数のタイマスロットとの差の時間を休止時間とする。そして、タイマ処理タスク52は、休止時間後に次の整数のタイマスロットにカレントスロットを遷移させる。   As a timer process, the timer process task 52 performs a timeout process by causing the current slot to transition with a variable pause time based on the time obtained by dividing the time slice into N parts. Specifically, the timer processing task 52 determines the difference between the current slot and the next integer timer slot when there is no timer registration between the current slot and the next integer timer slot. Let time be rest time. Then, the timer processing task 52 changes the current slot to the next integer timer slot after the pause time.

図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 timer processing task 52 pauses for 100 msec. Then, the timer processing task 52 shifts the current slot to a timer slot of 2 which is the next integer. That is, the timer processing task 52 advances N current slots at a time. When the current slot is 2 and there is no timer request in the 2.5 timer slot, the timer processing task 52 transitions the current slot to the next 3 timer slot which is the next integer after 100 msec pause.

一方、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットがある場合には、タイマ処理タスク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 timer processing task 52 determines the difference between the current slot and the first timer slot for which timer registration has been performed. Is the rest time. Then, the timer processing task 52 changes the current slot to the first timer slot in which the timer registration is performed after the pause time. As shown in FIG. 5B, when the current slot is 3, and there is a timer request in the 3.5 timer slot, the timer processing task 52 pauses for 50 msec. Then, the timer processing task 52 transitions the current slot to the timer slot of 3.5 which is the first timer slot in which the timer registration is performed, and performs a timeout process. That is, the timer processing task 52 advances one current slot at a time.

このように、タイマ処理タスク52は、カレントスロットと次の整数のタイマスロットの間にタイマ登録が行われたタイマスロットが有るか否かに基づいて休止時間を変更する。したがって、タイマ処理タスク52は、タイムスライスをN分の1にする場合のように常にタイマ処理タスクがN倍動作することを防ぐことができる。   In this way, the timer processing task 52 changes the pause time based on whether or not there is a timer slot for which timer registration has been performed between the current slot and the next integer timer slot. Therefore, the timer processing task 52 can always prevent the timer processing task from operating N times as in the case where the time slice is set to 1 / N.

図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 timer processing task 52 from operating twice.

図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 timer processing task 52 acquires and stores a pause start time X immediately before pause. The timer registration task 51 acquires a timer registration time Y at the time of timer registration. Then, the timer registration task 51 specifies the time slice elapsed time by calculating the difference Y−X between the timer registration time Y and the suspension start time X.

そして、タイマ登録タスク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 timer registration task 51 registers the timer in the current slot + the number of designated slots + 1/2 timer slots. The timer registration task 51 registers the timer in the current slot + the number of designated slots + 1 timer slots when the timer registration time Y−pause start time X ≧ time slice / 2.

図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 timer registration task 51 has a timer of current slot + number of designated slots + 1/4. Register the timer in the slot. Also, the timer registration task 51 registers the timer in the timer slot of the current slot + the number of designated slots + 2/4 when the elapsed time slice at the time of timer registration is time slice × 1/4 or more and less than time slice × 2/4. .

また、タイマ登録タスク51は、タイマ登録時のタイムスライス経過時間がタイムスライス×2/4以上タイムスライス×3/4未満の場合、カレントスロット+指定スロット数+3/4のタイマスロットにタイマ登録する。また、タイマ登録タスク51は、タイマ登録時のタイムスライス経過時間がタイムスライス×3/4以上タイムスライス未満の場合、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録する。   The timer registration task 51 registers the timer in the timer slot of the current slot + the number of designated slots + 3/4 when the time slice elapsed time at the time of timer registration is equal to or greater than time slice × 2/4 and less than time slice × 3/4. . In addition, when the elapsed time slice at the time of timer registration is equal to or greater than time slice × 3/4 and less than the time slice, the timer registration task 51 registers the timer in the current slot + number of designated slots + 1 timer slots.

カレントスロットの値が整数のとき、タイマ処理タスク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 timer processing task 52 pauses as follows. When a timer request exists in the timer slot of the current slot + 1/4, the timer processing task 52 pauses for time slice × 1/4, and when a timer request exists in the timer slot of the current slot + 2/4, Pause for slice x 2/4. In addition, when there is a timer request in the timer slot of the current slot +3/4, the timer processing task 52 pauses for time slice × 3/4, and enters the time slot of current slot + 1/4 to current slot + 3/4. If there is no timer request, pause for a time slice.

図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 timer processing task 52 pauses for the time slice and then advances four current slots. For example, as shown in FIG. 9B, when the current slot is 1, there is no timer slot in which a timer request exists between the timer slots 1 and 2, so that the timer processing task 52 is suspended for 100 msec. After that, the current slot is advanced by four. Similarly, when the current slot is 2, there is no timer slot for which a timer request exists between the timer slots 2 and 3, so that the timer processing task 52 pauses for 100 msec and then advances the current slot by 4 times. .

一方、カレントスロットとカレントスロット+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 timer processing task 52 specifies the latest timer registration position between the timer slots. For example, as shown in FIG. 9C, the timer processing task 52 specifies 3.25 as the timer registration position. Then, the timer processing task 52 pauses for time slice × 1/4 = 25 msec and then changes only one current slot to process the timer request registered in the 3.25 timer slot.

次に、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 timer processing task 52 determines the difference between the timer registration position 3.75 and the current slot position 3.25 as shown in FIG. Is paused for 50 msec multiplied by a time slice. Then, the timer processing task 52 pauses for 50 msec, transitions two current slots, and processes the timer request registered in the 3.75 timer slot.

そして、3.75と4のタイマスロットの間には、タイマ要求が存在しないため、タイマ処理タスク52は、図9(e)に示すように、25msecの間休止した後、カレントスロットを1個遷移させる。   Since there is no timer request between the 3.75 and 4 timer slots, the timer processing task 52 pauses for 25 msec as shown in FIG. Transition.

このように、タイマ処理タスク52は、カレントスロットとカレントスロットからタイムスライスだけ後のタイマスロットとの間に、タイマ要求が登録されたタイマスロットが存在するか否かを判定する。そして、タイマ処理タスク52は、タイマ要求が登録されたタイマスロットが存在する場合、登録されたタイマスロットの位置に応じてタイムスライスP個分進めた位置にカレントスロットを遷移させる。ここで、Pは1以上N−1以下の整数である。したがって、タイマ制御プログラム5は、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることができる。   As described above, the timer processing task 52 determines whether or not there is a timer slot in which a timer request is registered between the current slot and a timer slot that is a time slice after the current slot. Then, when there is a timer slot in which the timer request is registered, the timer processing task 52 changes the current slot to a position advanced by P time slices according to the position of the registered timer slot. Here, P is an integer of 1 to N-1. Therefore, the timer control program 5 can reduce the timer error due to the time slice elapsed time at the time of timer registration.

図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 timer processing task 52 from operating four times.

次に、タイマ処理の遅延について説明する。タイマ精度が求められる装置において、装置が高負荷状態になった場合、タイマ処理タスク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 timer processing task 52 is delayed. As a result, the delay time is added to the timer time, and the timer accuracy deteriorates.

図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 communication control device 3, the timing for returning a response message to the transmission source is extended, so that the next message transmission from the transmission source is also delayed. As a result, the amount of communication decreases, causing a problem that the bandwidth cannot be used to the maximum (the bandwidth is wasted).

そこで、通信制御装置3は、従来は固定であったタイマ処理タスク52の実行優先度を装置負荷又は実際のタイマ誤差に応じて動的に変化させる。通信制御装置3は、高負荷状態又は誤差が大きい状態ではタイマ処理タスク52に高優先度を割り当てることで、タイマ処理の遅延を発生させない。また、不当にCPU資源を消費することのないように、通信制御装置3は、低負荷状態又は誤差が少ない状態ではタイマ処理タスク52に通常優先度を割り当てることで、タイマ処理タスク52の実行優先度が常に高い状態を回避する。   Therefore, the communication control device 3 dynamically changes the execution priority of the timer processing task 52, which has been fixed in the past, according to the device load or the actual timer error. The communication control device 3 does not cause a delay in the timer processing by assigning a high priority to the timer processing task 52 in a high load state or a state where the error is large. Further, in order not to unduly consume CPU resources, the communication control device 3 assigns a normal priority to the timer processing task 52 in a low load state or a state with a small error so that the execution priority of the timer processing task 52 is given. Avoid situations where the degree is always high.

具体的には、タイマ処理タスク52は、周期的に通信制御装置3の状況を取得する。監視周期は利用者で決定可能である。また、利用者は、通信制御装置3の状況として、装置負荷又はタイマ精度を選択できる。   Specifically, the timer processing task 52 periodically acquires the status of the communication control device 3. The monitoring cycle can be determined by the user. Further, the user can select device load or timer accuracy as the status of the communication control device 3.

実行優先度の変更要因として装置負荷を用いる場合、タイマ制御プログラム5は、以下のいずれかの方法で実行優先度を動的に変更する。また、タイマ制御プログラム5は、装置負荷として、実行待ちタスク数を用いる。
(1)装置負荷が閾値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を周期的に固定値増加させる。ここで、タイムアウト処理タスクは、タイマ処理タスク52により起床され、タイムアウト処理を行うタスクである。
(2)装置負荷によって、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を一意に決定する。
When the apparatus load is used as the execution priority change factor, the timer control program 5 dynamically changes the execution priority by any of the following methods. The timer control program 5 uses the number of tasks waiting for execution as the device load.
(1) While the device load exceeds the threshold, the execution priorities of the timer processing task 52 and the timeout processing task are periodically increased by a fixed value. Here, the timeout process task is a task that is woken up by the timer process task 52 and performs the timeout process.
(2) The execution priority of the timer processing task 52 and the timeout processing task is uniquely determined according to the device load.

(1)の方法では、タイマ制御プログラム5は、実行待ちタスク数の閾値を利用者に設定させる。タイマ処理タスク52は、通信制御装置3の実行待ちタスク数を周期的に監視する。そして、タイマ処理タスク52は、実行待ちタスク数が閾値を超えている間、タイマ処理タスク52とタイムアウト処理タスクの実行優先度を増加させることで、高負荷状態におけるタイマ処理タスク52の動作遅延を抑止し、タイマ精度を向上させる。また、タイマ処理タスク52は、実行待ちタスク数が閾値を下回った場合、タイマ処理タスク52とタイムアウト処理タスクを通常優先度に戻すことで、CPU資源の不当な消費を抑止する。   In the method (1), the timer control program 5 causes the user to set a threshold value for the number of tasks waiting to be executed. The timer processing task 52 periodically monitors the number of tasks waiting for execution of the communication control device 3. Then, the timer processing task 52 increases the execution priority of the timer processing task 52 and the timeout processing task while the number of tasks waiting for execution exceeds the threshold, thereby reducing the operation delay of the timer processing task 52 in a high load state. Suppress and improve timer accuracy. In addition, when the number of tasks waiting for execution falls below the threshold, the timer processing task 52 returns the timer processing task 52 and the timeout processing task to the normal priority level, thereby suppressing unjustified consumption of CPU resources.

装置内の実行待ちタスク数が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 processing task 52 uniquely determines the execution priority based on the number of tasks waiting for execution exceeding the number of CPU cores. When the number of tasks waiting for execution exceeds the number of CPU cores, the processing task 52 can specify the execution priority range up to a value obtained by multiplying the number of tasks waiting for execution by the number of CPU cores by one or more load factors (for example, 2). The execution priority setting stage is obtained by dividing by. Here, the execution priority setting stage is the number of execution tasks for increasing the execution priority by one. Then, the processing task 52 calculates the execution priority from the execution priority setting stage.

すなわち、
実行優先度の設定段階=(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 timer registration task 51 sets an allowable error value for each timer at the time of timer registration. The allowable error value is managed by a value divided by the designated slot number calculated by the designated timer value / time slice. For example, when the specified timer value is 1000 msec, the allowable error is 200 msec, and the time slice is 10 msec, 1000 (specified timer value) / 10 (time slice) = 100, 200 (allowable error) / 100 = 2 msec. Therefore, the permissible error per time slice of the timer is 2 msec.

タイマトラック内には複数のタイマが存在し、それぞれ異なる許容誤差が設定されることがあるが、タイマ処理タスク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 timer processing task 52 evaluates only one tolerance, the timer registration task 51 is registered. The minimum error in the finished timer is adopted as the timer accuracy. When the timer employed as the minimum error is canceled or timed out, the timer registration task 51 employs the allowable error value of the timer having the second smallest allowable error.

タイマ制御プログラム5は、以下のいずれかの方法で実行優先度を動的に変更する。
(1)タイマ誤差が閾値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を周期的に固定値増加させる。
(2)タイマ誤差によって、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を一意に決定する。
The timer control program 5 dynamically changes the execution priority by any of the following methods.
(1) While the timer error exceeds the threshold, the execution priorities of the timer processing task 52 and the timeout processing task are periodically increased by a fixed value.
(2) The execution priority of the timer processing task 52 and the timeout processing task is uniquely determined by the timer error.

(1)の方法では、タイマ処理タスク52は、タイムスライス休止直前〜当該タイムスライスに対するタイムアウト処理後までの経過時間を監視する。そして、タイマ処理タスク52は、経過時間がタイムスライス+許容誤差値を超えている間、タイマ処理タスク52及びタイムアウト処理タスクの実行優先度を増加させる。したがって、タイマ処理タスク52は、高負荷状態におけるタイマ処理タスク52の動作遅延を抑止し、タイマ精度を向上させることができる。   In the method (1), the timer processing task 52 monitors the elapsed time from immediately before the time slice suspension to after the time-out processing for the time slice. Then, the timer processing task 52 increases the execution priority of the timer processing task 52 and the timeout processing task while the elapsed time exceeds the time slice + the allowable error value. Therefore, the timer processing task 52 can suppress the operation delay of the timer processing task 52 in a high load state and improve the timer accuracy.

(2)の方法では、タイマ処理タスク52は、経過時間がタイムスライスまでの状況では実行優先度を通常値とし、許容誤差と同じタイマ誤差が発生している状況では実行優先度を最大値とする。そして、タイマ処理タスク52は、その間を実行優先度の指定範囲で分割し、実行優先度を1増加させるためのタイマ誤差を実行優先度の設定段階として求める。そして、タイマ処理タスク52は、実行優先度の設定段階から実行優先度を計算する。   In the method (2), the timer processing task 52 sets the execution priority to the normal value when the elapsed time is up to the time slice, and sets the execution priority to the maximum value when the same timer error as the allowable error occurs. To do. Then, the timer processing task 52 divides the interval in the designated range of the execution priority, and obtains a timer error for increasing the execution priority by 1 as an execution priority setting stage. Then, the timer processing task 52 calculates the execution priority from the execution priority setting stage.

すなわち、
実行優先度の設定段階=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 CPU processing resources 52 may be unfairly consumed because the execution priority of the timer processing task 52 may be changed even in a situation where no timer error occurs.

タイマ誤差には、タイマ誤差の発生を契機にタイマ処理タスク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 timer processing task 52 is changed when the timer error occurs. On the other hand, the timer error has a disadvantage that the timer error until the timer error occurrence is detected cannot be suppressed because the execution priority of the timer processing task 52 is changed when the timer error occurs.

次に、タイマを利用する処理のフローについて図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 transmission control task 31 establishes a connection will be described.

図16に示すように、伝送制御タスク31は、コネクション確立を依頼し(ステップS1)、コネクション確立を監視するタイマを起動する(ステップS2)。そして、伝送制御タスク31は、コネクション確立が完了したか否かを判定し(ステップS3)、完了した場合には、タイマを停止し(ステップS4)、コネクション確立成功処理を行う(ステップS5)。   As shown in FIG. 16, the transmission control task 31 requests connection establishment (step S1), and starts a timer for monitoring connection establishment (step S2). Then, the transmission control task 31 determines whether or not the connection establishment is completed (step S3), and if completed, stops the timer (step S4) and performs a connection establishment success process (step S5).

一方、コネクション確立が完了していない場合には、伝送制御タスク31は、監視タイマがタイムアウトしたか否かを判定し(ステップS6)、タイムアウトしていない場合には、ステップS3へ戻る。また、タイムアウトした場合には、伝送制御タスク31は、コネクション確立失敗処理を行う(ステップS7)。   On the other hand, if the connection establishment has not been completed, the transmission control task 31 determines whether or not the monitoring timer has timed out (step S6), and if it has not timed out, returns to step S3. If the timeout has occurred, the transmission control task 31 performs a connection establishment failure process (step S7).

このように、伝送制御タスク31は、タイマを利用して、コネクション確立を監視することができる。   In this way, the transmission control task 31 can monitor connection establishment using a timer.

図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 message control task 32 transmits a message (step S11) and starts a timer that monitors reception of a response message (step S12). Then, the message control task 32 determines whether or not a response message has been received (step S13), and if received, stops the timer (step S14) and performs a message transmission success process (step S15).

一方、応答電文を受信していない場合には、電文制御タスク32は、監視タイマがタイムアウトしたか否かを判定し(ステップS16)、タイムアウトしていない場合には、ステップS13へ戻る。また、タイムアウトした場合には、電文制御タスク32は、電文送信失敗処理を行う(ステップS17)。   On the other hand, if the response message has not been received, the message control task 32 determines whether or not the monitoring timer has timed out (step S16), and if it has not timed out, returns to step S13. When the time-out occurs, the message control task 32 performs a message transmission failure process (step S17).

このように、電文制御タスク32は、タイマを利用して、電文の送信を監視することができる。   As described above, the message control task 32 can monitor the transmission of the message using the timer.

次に、タイマ登録処理のフローについて説明する。図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 timer registration task 51 acquires the current time as the timer registration time (step S21), and acquires the suspension start time of the timer processing task 52 from the timer management table 53 (step S22).

そして、タイマ登録タスク51は、タイマ登録時刻−休止開始時刻がタイムスライス/2未満であるか否かを判定する(ステップS23)。その結果、タイムスライス/2未満である場合には、タイマ登録タスク51は、カレントスロット+指定スロット数+1/2のタイマスロットにタイマ登録を行う(ステップS24)。一方、タイムスライス/2未満でない場合には、タイマ登録タスク51は、カレントスロット+指定スロット数+1のタイマスロットにタイマ登録を行う(ステップS25)。   Then, the timer registration task 51 determines whether or not the timer registration time-pause start time is less than time slice / 2 (step S23). As a result, if it is less than time slice / 2, the timer registration task 51 performs timer registration in the timer slot equal to the current slot + the number of designated slots + 1/2 (step S24). On the other hand, if it is not less than time slice / 2, the timer registration task 51 performs timer registration in the current slot + number of designated slots + 1 timer slot (step S25).

そして、タイマ登録タスク51は、許容誤差順タイマキューにタイマ登録を行い(ステップS26)、タイマ登録要求で指定された許容誤差が登録タイマ内で最小の許容誤差であるか否かを判定する(ステップS27)。その結果、最小の許容誤差である場合には、当該タイマの許容誤差を許容タイマ誤差値とする(ステップS28)。ここで、許容誤差順タイマキューは、許容誤差順にソートされたタイマのキューであり、許容タイマ誤差値は、タイマ登録毎にタイマ誤差について指定される誤差である。   Then, the timer registration task 51 performs timer registration in the allowable error order timer queue (step S26), and determines whether or not the allowable error specified by the timer registration request is the minimum allowable error in the registration timer ( Step S27). As a result, if it is the minimum allowable error, the allowable error of the timer is set as an allowable timer error value (step S28). Here, the permissible error order timer queue is a queue of timers sorted in the permissible error order, and the permissible timer error value is an error specified for the timer error for each timer registration.

このように、タイマ登録タスク51が、タイマ登録時刻−休止開始時刻とタイムスライス/2に基づいてタイマ登録を行うタイマスロットを特定することによって、タイマ誤差を少なくすることができる。   As described above, the timer registration task 51 can reduce the timer error by specifying the timer slot in which the timer registration is performed based on the timer registration time-pause start time and time slice / 2.

次に、タイマスロット間を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 timer registration task 51 acquires the current time as the timer registration time (step S31), and acquires the suspension start time of the timer processing task 52 from the timer management table 53 (step S32).

そして、タイマ登録タスク51は、タイムスライス/Nをスロット間タイムスライスに設定し(ステップS33)、現在時刻−休止開始時刻をタイムスライス経過時間に設定する(ステップS34)。そして、タイマ登録タスク51は、[タイムスライス経過時間/スロット間タイムスライス]/Nをスロット間登録位置に設定する(ステップS35)。ここで、[X]は、Xの小数点以下を切り上げた値である。そして、タイマ登録タスク51は、カレントスロット+指定スロット数+スロット間登録位置に設定する(ステップS36)。   Then, the timer registration task 51 sets the time slice / N as the time slot between slots (step S33), and sets the current time-pause start time as the time slice elapsed time (step S34). Then, the timer registration task 51 sets [time slice elapsed time / inter-slot time slice] / N to the inter-slot registration position (step S35). Here, [X] is a value obtained by rounding up the decimal part of X. Then, the timer registration task 51 sets the current slot + the number of designated slots + the inter-slot registration position (step S36).

そして、タイマ登録タスク51は、許容誤差順タイマキューにタイマ登録を行い(ステップS37)、タイマ登録要求で指定された許容誤差が登録タイマ内で最小の許容誤差であるか否かを判定する(ステップS38)。その結果、最小の許容誤差である場合には、当該タイマの許容誤差を許容タイマ誤差値とする(ステップS39)。   Then, the timer registration task 51 performs timer registration in the allowable error order timer queue (step S37), and determines whether or not the allowable error specified in the timer registration request is the minimum allowable error in the registration timer ( Step S38). As a result, when it is the minimum allowable error, the allowable error of the timer is set as an allowable timer error value (step S39).

このように、タイマ登録タスク51が、タイムスライス経過時間とスロット間タイムスライスに基づいてタイマ登録を行うタイマスロットを特定することによって、タイマ誤差を少なくすることができる。   As described above, the timer registration task 51 can reduce the timer error by specifying the timer slot in which the timer registration is performed based on the time slice elapsed time and the inter-slot time slice.

次に、タイマ処理のフローについて説明する。図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 timer processing task 52 stores the current time as the suspension start time (step S41), and determines whether or not the timer has been registered within the range of the current slot + 1 (step S42).

その結果、タイマ処理タスク52は、タイマ登録済でない場合には、タイムスライスの間休止し(ステップS43)、タイマ登録済である場合には、スロット間タイマ処理を行う(ステップS44)。ここで、スロット間タイマ処理とは、タイマスロット間の分割により追加されたタイマスロットに登録されたタイマ要求の処理である。   As a result, if the timer has not been registered, the timer processing task 52 pauses for a time slice (step S43), and if the timer has been registered, performs an interslot timer process (step S44). Here, the inter-slot timer process is a process of a timer request registered in a timer slot added by division between timer slots.

そして、タイマ処理タスク52は、カレントスロットを遷移し(ステップS45)、遷移先のタイマスロットに登録されたタイマ要求のタイムアウト処理を行う(ステップS46)。そして、タイマ処理タスク52は、装置状況の監視間隔だけ経過したか否かを判定し(ステップS47)、経過していない場合には、ステップS41に戻る。   Then, the timer processing task 52 transitions the current slot (step S45), and performs a timer request timeout process registered in the transition destination timer slot (step S46). Then, the timer processing task 52 determines whether or not the apparatus status monitoring interval has elapsed (step S47), and if not, returns to step S41.

一方、装置状況の監視間隔だけ経過した場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差を確認し(ステップS48)、実行優先度の変更モードを判定する(ステップS49)。その結果、増加モードである場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差が閾値以上であるか否かを判定する(ステップS50)。   On the other hand, when the device status monitoring interval has elapsed, the timer processing task 52 checks the load status or timer error (step S48), and determines the execution priority change mode (step S49). As a result, in the increase mode, the timer processing task 52 determines whether or not the load situation or the timer error is equal to or greater than a threshold (step S50).

その結果、タイマ処理タスク52は、閾値以上である場合には、実行優先度を固定値増加し(ステップS51)、閾値以上でない場合には、実行優先度をデフォルトに戻す(ステップS52)。一方、実行優先度の変更モードが一意決定モードである場合には、タイマ処理タスク52は、負荷状況又はタイマ誤差から求めた実行優先度に変更する(ステップS53)。   As a result, the timer processing task 52 increases the execution priority by a fixed value when it is equal to or greater than the threshold (step S51), and returns the execution priority to the default when it is not equal to or greater than the threshold (step S52). On the other hand, when the execution priority change mode is the unique determination mode, the timer processing task 52 changes the execution priority to the execution priority obtained from the load status or the timer error (step S53).

図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 timer processing task 52 initializes the in-slot position to 1 (step S61), and initializes the pause time to time slice / N (step S62). Then, the timer processing task 52 determines whether or not the in-slot position has reached N (step S63), and if it has reached N, sleeps for a pause time (step S64).

一方、スロット内位置がNに到達していない場合には、タイマ処理タスク52は、スロット内位置のタイマスロットにタイマ要求が有るか否かを判定し(ステップS65)、有る場合には、休止時間だけスリープする(ステップS66)。そして、タイマ処理タスク52は、タイマ要求についてタイムアウト処理を行い(ステップS67)、スロット内位置に1を加え(ステップS68)、ステップS62に戻る。   On the other hand, when the position in the slot has not reached N, the timer processing task 52 determines whether or not there is a timer request in the timer slot at the position in the slot (step S65). Sleep for time (step S66). The timer processing task 52 performs time-out processing for the timer request (step S67), adds 1 to the position in the slot (step S68), and returns to step S62.

一方、スロット内位置のタイマスロットにタイマ要求が無い場合には、タイマ処理タスク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 timer processing task 52 adds the time slice / N to the pause time (step S69). The timer processing task 52 adds 1 to the position in the slot (step S70), and returns to step S63.

このように、タイマ処理タスク52は、スロット間タイマ処理を行うことによって、タイムスライスの間隔内に追加されたタイマスロットに登録されたタイマ要求を処理することができる。   As described above, the timer processing task 52 can process the timer request registered in the timer slot added within the time slice interval by performing the inter-slot timer processing.

次に、タイマ管理表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 unused timer queue 61, a timer pool management queue 62, a suspension start time 63, a current slot 64, a timer track 65, the number of timer slots before division ( M) 66. The timer management table 53 includes an inter-slot division number (N) 67, an allowable error value 68, a load coefficient value 69, an allowable error order timer queue 70, and a timer queue 71 for one minute or longer.

未使用タイマキュー61は、未使用のタイマを管理するFIFO(First In First Out)キューである。ここで、タイマは、タイマ要求を格納するセルである。タイマプール管理キュー62は、タイマのセルプールを管理するFIFOキューである。休止開始時刻63は、タイマ処理タスク52が休止する直前に設定する時刻である。   The unused timer queue 61 is a FIFO (First In First Out) queue that manages unused timers. Here, the timer is a cell that stores a timer request. The timer pool management queue 62 is a FIFO queue for managing timer cell pools. The pause start time 63 is a time set immediately before the timer processing task 52 pauses.

カレントスロット64は、タイマスロットの現在の位置を示すポインタである。タイマトラック65は、タイマスロットの集合テーブルであり、M×N個のタイマスロットを含む。各タイマスロットは、タイムアウト処理されるタイマ要求が登録される領域である。タイマトラック65は、60秒のタイマスロットを含む。指定タイマ値が60秒未満のタイマ要求が対応するタイマスロットに登録される。分割前タイマスロット数66は、タイマスロット間が分割される前のタイマスロットの数である。スロット間分割数67は、タイマスロット間の分割数である。なお、図22に示すタイマ管理表53では、分割後のタイマスロットを識別する数を整数とするため、タイマスロットを識別する数がN倍されている。   The current slot 64 is a pointer indicating the current position of the timer slot. The timer track 65 is a set table of timer slots and includes M × N timer slots. Each timer slot is an area in which a timer request to be timed out is registered. The timer track 65 includes a 60 second timer slot. A timer request with a specified timer value less than 60 seconds is registered in the corresponding timer slot. The pre-division timer slot number 66 is the number of timer slots before division between timer slots. The slot division number 67 is the number of divisions between timer slots. In the timer management table 53 shown in FIG. 22, the number identifying the timer slot after division is an integer, so the number identifying the timer slot is multiplied by N.

許容誤差値68は、タイマ登録毎にタイマ誤差について指定される許容誤差のうち最小の値である。負荷係数値69は、装置毎に指定される装置負荷の許容値である。許容誤差順タイマキュー70は、許容誤差順にソートされたタイマのキューである。1分以上タイマキュー71は、指定タイマ値が60秒以上のタイマが一時的に登録されるキューである。   The allowable error value 68 is the minimum value among the allowable errors specified for the timer error for each timer registration. The load coefficient value 69 is an allowable value of the device load designated for each device. The allowable error order timer queue 70 is a queue of timers sorted in the allowable error order. The one-minute or more timer queue 71 is a queue in which timers having a specified timer value of 60 seconds or more are temporarily registered.

図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 current slot 64 is 1. Further, the number of divisions between slots is 67 = 2.

図23に示すように、タイマ登録処理を開始すると、タイマ登録タスク51は、未使用タイマキュー61から未使用タイマを獲得し(t1)、OS81から現在時刻をタイマ登録時刻として取得する(t2)。そして、タイマ登録タスク51は、休止開始時刻63を獲得し(t3)、タイマ登録時刻−休止開始時刻63とタイムスライス/2を比較する。   As shown in FIG. 23, when the timer registration process is started, the timer registration task 51 acquires an unused timer from the unused timer queue 61 (t1), and acquires the current time from the OS 81 as the timer registration time (t2). . Then, the timer registration task 51 acquires the suspension start time 63 (t3), and compares the timer registration time-pause start time 63 with the time slice / 2.

その結果、タイマ登録時刻−休止開始時刻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-pause start time 63 is less than time slice / 2, the timer registration task 51 registers the timer in the timer slot of (1 + 2 + 1/2) × 2 = 7 (t4). On the other hand, when the timer registration time-pause start time 63 is equal to or greater than time slice / 2, the timer registration task 51 registers the timer in the timer slot of (1 + 2 + 1) × 2 = 8 (t5).

そして、タイマ登録タスク51は、必要に応じてタイマ誤差値68を更新するとともに、タイマ登録したタイマを許容誤差順タイマキュー70に登録し(t6)、タイマ登録処理を完了する。   Then, the timer registration task 51 updates the timer error value 68 as necessary, registers the timer registered timer in the allowable error order timer queue 70 (t6), and completes the timer registration process.

図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 current slot 64 is six. Further, the number of divisions between slots is 67 = 2. As shown in FIG. 24, the timer processing task 52 acquires the current time as the suspension start time 63 (t11), and stores the suspension start time 63 (t12).

そして、タイマ処理タスク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 current slot 64 and the timer slot of the current slot 64 + 2, the timer processing task 52 performs inter-slot timer processing (t13). On the other hand, when there is no timer slot in which the timer request is registered between the current slot 64 and the timer slot of the current slot 64 + 2, the timer processing task 52 performs time slice suspension (t14).

そして、タイマ処理タスク52は、カレントスロット64を2個進めるカレントスロット遷移を行う(t15)。図24では、カレントスロット64が6から8に遷移する。そして、タイマ処理タスク52は、8のタイマスロットに登録されたタイマ要求に関してタイムアウト処理タスク82にタイムアウト通知を行う(t16)。   Then, the timer processing task 52 performs a current slot transition that advances the current slot 64 by two (t15). In FIG. 24, the current slot 64 transitions from 6 to 8. Then, the timer processing task 52 issues a timeout notification to the timeout processing task 82 regarding the timer request registered in the eight timer slots (t16).

そして、タイマ処理タスク52は、実行優先度の変更要因としてタイマ精度を用いる場合には、現在時刻をタイマ処理完了時刻として取得し(t17)、実行優先度の変更要因として装置負荷を用いる場合には、負荷状況を獲得する(t18)。そして、タイマ処理タスク52は、負荷状況又はタイマ誤差から実行優先度の値を決定し(t19)、タイマ処理タスク52及びタイムアウト処理タスク82の実行優先度の変更をOS81に依頼する(t20)。   When the timer accuracy is used as the execution priority change factor, the timer processing task 52 acquires the current time as the timer processing completion time (t17), and uses the apparatus load as the execution priority change factor. Acquires the load status (t18). Then, the timer processing task 52 determines the execution priority value from the load status or the timer error (t19), and requests the OS 81 to change the execution priority of the timer processing task 52 and the timeout processing task 82 (t20).

次に、タイマ制御プログラム5等のソフトウェアを実行する通信制御装置3のハードウェア構成について説明する。図25は、通信制御装置3のハードウェア構成を示す図である。図25に示すように、通信制御装置3は、CPU91と、HDD(Hard Disk Drive)92と、メモリ93と、LANインタフェース94とを有する。   Next, a hardware configuration of the communication control device 3 that executes software such as the timer control program 5 will be described. FIG. 25 is a diagram illustrating a hardware configuration of the communication control device 3. As illustrated in FIG. 25, the communication control device 3 includes a CPU 91, an HDD (Hard Disk Drive) 92, a memory 93, and a LAN interface 94.

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 communication control device 3 to the information processing system 2 or the like via a LAN. The timer control program 5 and the like executed in the communication control device 3 are stored in the HDD 92, read out to the memory 93, and executed by the CPU 91.

上述してきたように、実施例では、タイマ制御プログラム5は、タイマスロット間をN分割してタイマスロットを追加する。そして、タイマ登録タスク51が、カレントスロットと指定タイマ値とタイムスライス経過時間とに基づいてタイムアウト処理を起床すべきタイマスロットをタイムスライス/Nの時間間隔のタイマスロットから特定してタイマ要求を登録する。そして、タイマ処理タスク52が、カレントスロットとカレントスロット+1のタイマスロットとの間にタイマ要求が登録されている場合には、スロット間タイマ処理を行う。一方、カレントスロットとカレントスロット+1のタイマスロットとの間にタイマ要求が登録されていない場合には、タイマ処理タスク52は、従来と同様にタイムスライスの間休止して次のタイマスロットに遷移する。したがって、タイマ制御プログラム5は、タイマ登録時におけるタイムスライス経過時間に起因するタイマ誤差を少なくすることができる。   As described above, in the embodiment, the timer control program 5 divides the timer slot into N and adds the timer slot. Then, the timer registration task 51 registers the timer request by identifying the timer slot from which the time-out process should be woken up based on the current slot, the designated timer value, and the time slice elapsed time from the timer slots at the time slice / N time interval. To do. Then, when a timer request is registered between the current slot and the timer slot of current slot + 1, the timer processing task 52 performs inter-slot timer processing. On the other hand, when a timer request is not registered between the current slot and the timer slot of current slot + 1, the timer processing task 52 pauses for a time slice and transitions to the next timer slot as in the conventional case. . Therefore, the timer control program 5 can reduce the timer error due to the time slice elapsed time at the time of timer registration.

また、実施例では、タイマ処理タスク52は、通信制御装置3の負荷状況又はタイマ精度に基づいてタイマ処理タスク52及びタイムアウト処理タスク82の実行優先度を動的に変更する。したがって、タイマ制御プログラム5は、通信制御装置3が高負荷の状態でも、タイマ精度の悪化を抑止することができる。   In the embodiment, the timer processing task 52 dynamically changes the execution priority of the timer processing task 52 and the timeout processing task 82 based on the load status or timer accuracy of the communication control device 3. Therefore, the timer control program 5 can suppress deterioration of timer accuracy even when the communication control device 3 is in a high load state.

また、実施例では、タイマ処理タスク52は、タイマ処理タスク52及びタイムアウト処理タスク82の実行優先度の増加量又は実行優先度の値を計算し、計算した実行優先度に変更する。したがって、タイマ制御プログラム5は、実行優先度を柔軟に変更することができる。   In the embodiment, the timer processing task 52 calculates an increase in execution priority or a value of execution priority of the timer processing task 52 and the timeout processing task 82, and changes the calculated execution priority to the calculated execution priority. Therefore, the timer control program 5 can flexibly change the execution priority.

また、実施例では、通信制御装置について説明したが、本発明はこれに限定されるものではなく、情報処理装置などプロセッサとメモリを備え、タイマを利用する他の装置にも同様に適用することができる。   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 Information communication system 2 Information processing system 3 Communication control device 5 Timer control program 31, 33 Transmission control task 32 Message control task 51 Timer registration task 52 Timer processing task 53 Timer management table 61 Unused timer queue 62 Timer pool management queue 63 Pause start time 64 Current slot 65 Timer track 66 Number of timer slots before division 67 Number of divisions between slots 68 Permissible error value 69 Load factor value 70 Permissible error order timer queue 71 Timer queue 81 minutes or more 81 OS
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.
前記カレントスロットと該カレントスロットから前記タイムスライスだけ後のタイマスロットとの間に、タイマが登録されたタイマスロットが存在しない場合、タイムスライスN個分進めた位置に前記カレントスロットが遷移することを特徴とする請求項1に記載のタイマ制御プログラム。   If there is no timer slot in which a timer is registered between the current slot and the timer slot after the time slice from the current slot, the current slot transitions to a position advanced by N time slices. The timer control program according to claim 1, wherein: 前記タイマ要求が登録されたタイマスロットに遷移する処理又は前記タイムスライスだけ後のタイマスロットに遷移する処理の優先度を前記コンピュータの負荷状況又はタイマの誤差に基づいて変更する処理をさらに前記コンピュータに実行させることを特徴とする請求項2に記載のタイマ制御プログラム。   The computer further includes a process of changing the priority of the process of transitioning to the timer slot in which the timer request is registered or the process of transitioning to the timer slot after the time slice based on the load status of the computer or an error of the timer. The timer control program according to claim 2, wherein the timer control program is executed. 前記優先度の増加量を算出する処理又は前記優先度を所定の算出式を用いて算出する処理をさらに前記コンピュータに実行させ、
前記変更する処理は、前記算出する処理により算出された優先度に変更することを特徴とする請求項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.
JP2014231112A 2014-11-13 2014-11-13 Timer control program, timer control method, and information processing apparatus Expired - Fee Related JP6341066B2 (en)

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)

* Cited by examiner, † Cited by third party
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

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