JPH04137142A - Timer control system - Google Patents

Timer control system

Info

Publication number
JPH04137142A
JPH04137142A JP25945090A JP25945090A JPH04137142A JP H04137142 A JPH04137142 A JP H04137142A JP 25945090 A JP25945090 A JP 25945090A JP 25945090 A JP25945090 A JP 25945090A JP H04137142 A JPH04137142 A JP H04137142A
Authority
JP
Japan
Prior art keywords
time
timer
processing
control
clock
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP25945090A
Other languages
Japanese (ja)
Inventor
Naoto Konishi
小西 直人
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.)
PFU Ltd
Original Assignee
PFU 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 PFU Ltd filed Critical PFU Ltd
Priority to JP25945090A priority Critical patent/JPH04137142A/en
Publication of JPH04137142A publication Critical patent/JPH04137142A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the error by only updating the absolute time (called reference time) of a clock provided in a prescribed area of a memory at short time intervals to perform the interrupt handling of a timer service routine by fixed- time interruption. CONSTITUTION:Since the interruption handling of a timer service routine 2 is performed by only update of the reference time of a clock 4, its processing time is very short independently of the frequency in timer processing of a task. Therefore, the reference time Ts of the clock can be updated with a relatively high precision. Each of tasks A and B can perform the time control at intervals of an arbitrary short time when the update time interval of the clock 4, namely, the interruption time interval of a timer interruption 1 is sufficiently short; and even if the frequency in timer processing is increased, the check timing of the control time in the task is properly taken in accordance with the length of the time interval of time control to suppress the increase of the error of the control time.

Description

【発明の詳細な説明】 〔概 要] 計算機におけるタイマ処理を必要とするタスクのための
タイマ制御方式に関し。
[Detailed Description of the Invention] [Summary] This invention relates to a timer control method for tasks requiring timer processing in a computer.

プログラムのタイマ処理数によってタイマ処理の時間間
隔の大きさが制約を受けないタイマ制御方式を実現する
ことを目的とし システムの基準時間をタスクから参照可能に管理するタ
イマサービスルーチンを設け。
In order to realize a timer control method in which the size of the time interval of timer processing is not restricted by the number of timer processing in the program, a timer service routine is provided to manage the system reference time so that it can be referenced from tasks.

タイマ時間制御を必要とする処理を行うタスクは、その
処理ごとの要求時間を、システムの基準時間にタイマ時
間を加えた比較時間で待ち、タスクの実行中に所定のタ
イミングでシステムの基準時間と比較時間とを比較し、
システムの基準時間が当該比較時間を超えたとき要求時
間がきた°ものとして定められた処理を行うよう構成し
た。
A task that performs a process that requires timer time control waits for the required time for each process using a comparison time that is the system's standard time plus the timer time, and then compares it to the system's standard time at a predetermined timing during task execution. Compare with the comparison time,
The system is configured so that when the reference time of the system exceeds the comparison time, the requested time is assumed to have come and a predetermined process is performed.

〔産業上の利用分野〕[Industrial application field]

本発明は、計算機におけるタイマ処理を必要とするタス
クのためのタイマ制御方式に関する。
The present invention relates to a timer control method for tasks requiring timer processing in a computer.

要求時間に対して、一定時間割込みの繰り返しで精算し
て時間の制御を行うプログラムでは9時間制御の数が多
くなると、一定時間割込みの際の割込み処理における負
荷が増大する。本発明は時間制御数が増加しても割込み
処理の負荷が増大しないタイマ制御方式を提供する。
In a program that performs time control by calculating the required time by repeating interrupts for a certain period of time, when the number of nine-hour controls increases, the load on interrupt processing when interrupting for a certain period of time increases. The present invention provides a timer control method in which the load on interrupt processing does not increase even if the number of time controls increases.

〔従来の技術〕[Conventional technology]

第3図は、従来のタイマ制御方式の説明図である。 FIG. 3 is an explanatory diagram of a conventional timer control method.

第3図において、1は一定時間のタイマ割込みであり、
タイマに設定された一定時間が経過すると発生される。
In Fig. 3, 1 is a timer interrupt for a certain period of time,
Occurs when a certain period of time set in the timer has elapsed.

2は、タイマサービスルーチンであり、一定時間間隔の
タイマ割込み1に応してタイマ割込み処理を実行し5タ
スクの要求時間(すなわちタイマ時間)が到来したかど
うかを各タスク制御ブロックTCB上の制御情報を参照
してチエツクする。
2 is a timer service routine, which executes timer interrupt processing in response to timer interrupt 1 at fixed time intervals, and checks whether the required time (i.e., timer time) of the 5 tasks has arrived by controlling each task control block TCB. Check the information.

3は、タイマ処理を必要とするメインタスクが要求時間
ごとに子タスクを生成して用意するタスク制御ブロック
TCBIL  TCB2.  ・・・、TCBNであり
、それぞれの制御情報中にタイマ処理の要求時間T、、
T、、・・・、TNが設定されている。
3 is a task control block TCBIL TCB2.3 in which a main task that requires timer processing generates and prepares a child task at each requested time. ..., TCBN, and the required time T for timer processing is included in each control information.
T, ..., TN are set.

なお要求時間は相対時間形式で表わされ、タイマ割込み
の一定時間間@Trの任意倍数で指定される。またこれ
らのTCBI、TCB2.・・・、TCBNは、ポイン
タを用いてチェーン状にリンクされ、順に参照可能にさ
れる。
Note that the requested time is expressed in a relative time format and specified as an arbitrary multiple of the constant time interval @Tr of the timer interrupt. Moreover, these TCBI, TCB2. ..., TCBN are linked in a chain using pointers and can be referenced in sequence.

第4図は、第3図中の従来のタイマサービスルーチン2
の処理内容を示し、第5図は第3図の従来方式によるタ
イマ制御のタイミング図である。
FIG. 4 shows the conventional timer service routine 2 in FIG.
FIG. 5 is a timing diagram of timer control according to the conventional method shown in FIG. 3.

ここで第3図のタイマ割込みlに設定されるタイマ割込
み時間間隔をTAとし、TCBI、TCB2.・・・、
TCBNの各要求時間T、、T、、・・・T、を、T+
 =n+ TA 、T2 wfi2Ta 、−T i+
 = n NT Aとする。なおnl +  nt +
 ”・+  ”Nは任意の整数である。
Here, TA is the timer interrupt time interval set for timer interrupt l in FIG. 3, and TCBI, TCB2 . ...,
Let each request time T, ,T,...T, of TCBN be T+
=n+ TA , T2 wfi2Ta , -T i+
= n NT A. Note that nl + nt +
"・+"N is an arbitrary integer.

第3図に示すように、最初のタイマ割込みが発生したと
きの時間はT、であり、タイマサービスルーチン2は、
まずこの時間TrとTCB 1の要求時間T、とを比較
し、Ta≧T1であればTCBlへ実行要求情報をセッ
トし、またTA<Tであればそのままにして、それぞれ
次のTCB2の処理に移り、その要求時間T2を参照す
る。ここでもTA≧T2かどうかを調べ、TA≧T2で
あればTCB2に実行要求情報をセントし、また下Aく
T2であればそのままとして、それぞれ次のT、の処理
に移る。
As shown in FIG. 3, the time when the first timer interrupt occurs is T, and the timer service routine 2 is as follows:
First, compare this time Tr with the required time T of TCB 1, and if Ta≧T1, set the execution request information to TCBl, and if TA<T, leave it as is and proceed to the next TCB 2 process. The request time T2 is then referred to. Here too, it is checked whether TA≧T2, and if TA≧T2, the execution request information is sent to TCB2, and if it is lower than T2, it is left as is and the processing moves to the next T.

以後、TCBNまでの各TCBについて同様な処理を繰
り返し、TCBNの処理を終了したときタイマサービス
ルーチン2は、タイマ割込み時間間隔TAをセットして
終了する。
Thereafter, similar processing is repeated for each TCB up to TCBN, and when the processing of TCBN is completed, the timer service routine 2 sets the timer interrupt time interval TA and ends.

このときのタイマサービスルーチン2の割込み処理時間
をT、とすると3次のタイマ割込み発生時間は2T、+
T、となる。この2回目のタイマ割込みにより、タイマ
サービスルーチン2は前回と同様に各TCBの要求時間
をチエツクするがこのときの比較基準となる時間は2T
、であり。
If the interrupt processing time of timer service routine 2 at this time is T, then the tertiary timer interrupt generation time is 2T, +
It becomes T. Due to this second timer interrupt, timer service routine 2 checks the requested time of each TCB as before, but the time used as the comparison standard at this time is 2T.
, is.

Tmは無視される。したがってTCB 1では2TA≧
T、、TCB2では2TA≧T、、 ・、TCBNでは
2T、≧TNがチエツクされ、要求時間を経過したTC
Bにそれぞれ実行要求情報がセフ)される。このように
して全てのTCBの要求時間が経過するまでタイマ割込
みが繰り返され、各TCBの要求時間が順に検索されて
チエツクされる。
Tm is ignored. Therefore, in TCB 1, 2TA≧
T,, in TCB2, 2TA≧T,..., in TCBN, 2T,≧TN is checked, and the TC whose required time has elapsed
Execution request information is sent to B respectively. In this way, the timer interrupt is repeated until the required time of all TCBs has elapsed, and the required time of each TCB is searched and checked in turn.

タイマサービスルーチン2による各TCBの検索は、T
CB間に張られたポインタを用いて行われるため、タイ
マ処理の数が多いほど、したがってTCBの数が多くな
るほど割込み処理時間T。
The search for each TCB by timer service routine 2 is performed by T
Since the interrupt processing is performed using a pointer placed between CBs, the more timer processing is performed, and therefore the more TCBs are processed, the longer the interrupt processing time T becomes.

が長くなって比較の基準時間nTAと実際の時間nTa
 + (n  1)Tmとの差が大きくなり、−定時間
のタイマ割込みの時間間隔TAを小さくして細かい時間
制御を行う場合には、誤差が大きくなって不都合であっ
た。
becomes longer and the comparison reference time nTA and actual time nTa
+ (n 1) Tm becomes large, and when the time interval TA of - fixed-time timer interrupts is made small to perform fine time control, the error becomes large, which is inconvenient.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

このように従来のタイマ制御方式では、タイマ処理数が
増加すると割込み処理を行うタイマサービスルーチンの
負荷が増大し、短い時間間隔での時間制御が制約を受け
るため、プログラムの性能が低下するという問題があっ
た。
In this way, with conventional timer control methods, when the number of timer processes increases, the load on the timer service routine that handles interrupts increases, and time control over short time intervals is constrained, resulting in a decrease in program performance. was there.

本発明は、プログラムのタイマ処理数によってタイマ処
理の時間間隔の大きさが制約を受けないタイマ制御方式
を実現することを目的としている。
An object of the present invention is to realize a timer control method in which the size of the time interval of timer processing is not restricted by the number of timer processings of a program.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は、一定時間割込みによってタイマサービスルー
チンが行う割込み処理はメモリの所定の領域に設けた時
計の絶対時間(基準時間という)を短い時間間隔で更新
するだけにして、タスク内のタイマ処理の数とは無関係
に短時間で割込み処理ができるようにする。他方、タス
ク内のタイマ処理の時間制御については、それぞれのタ
イマ処理の相対時間で表わされている要求時間を時計の
基準時間に合わせて、絶対時間形式で表わして(比較時
間という)タスクがもち、タスクが実行中に適当なタイ
ミングで各比較時間と基準時間との比較を行って、比較
時間が経過したかどうかの判断を行い、基準時間を経過
した比較時間について対応するタイマ処理を行うように
したものである。
In the present invention, the interrupt processing performed by the timer service routine due to a fixed time interrupt is performed by simply updating the absolute time (referred to as reference time) of a clock provided in a predetermined area of memory at short time intervals, and the timer processing within the task is performed. To perform interrupt processing in a short time regardless of the number of interrupts. On the other hand, regarding time control of timer processing within a task, the required time expressed in relative time for each timer processing is expressed in absolute time format (referred to as comparison time) according to the reference time of the clock. Then, each comparison time is compared with the reference time at an appropriate timing while the task is being executed, it is determined whether the comparison time has elapsed, and the corresponding timer processing is performed for the comparison time after the reference time has elapsed. This is how it was done.

第1図は本発明の原理説明図である。FIG. 1 is a diagram explaining the principle of the present invention.

第1図において。In FIG.

1は、一定時間のタイマ割込みであり、比較的短い時間
間隔がセットされる。
1 is a timer interrupt of a fixed time, and a relatively short time interval is set.

2は タイマサービスルーチンであり、タイマ割込みが
あると時計(後述)の基準時間を更新する。
2 is a timer service routine, which updates the reference time of the clock (described later) when a timer interrupt occurs.

4は、基準時間T、を表示する時計であり、タイマサー
ビスルーチン2により更新される。
4 is a clock that displays a reference time T, which is updated by the timer service routine 2;

5は、タスクAであり、N個のタイマ処理のための各比
較時間T、、、T、□、・・・、TINをもち。
5 is a task A, which has comparison times T, , T, □, . . . , TIN for N timer processing.

定のタイミングで時計4の基準時間T、と各比較時間T
、、、 (i−L 2.・・・、N)とを比較して、基
準時間T、が比較時間Tliを超えた比較時間T3、の
タイマ処理を実行する。
The reference time T of the clock 4 and each comparison time T are set at a fixed timing.
.

6は、タスクBであり1M個のタイマ処理のための各比
較時間T21.  Tz□、・・・、Tzl、Iをもち
、タスクAと同様に一定のタイミングで時計4の基準時
間T、と各比較時間T□(j=1.2.・・・、M)と
を比較して、基準時間T、が比較時間T2.を超えた比
較時間のタイマ処理を実行する。
6 is task B and each comparison time T21.6 for 1M timer processing. Tz□, . . . , Tzl, I, and the reference time T of the clock 4 and each comparison time T In comparison, the reference time T is the comparison time T2. Executes timer processing for comparison times exceeding .

[作 用] 第1図に示すように、タイマサービスルーチン2の行う
割込み処理は1時計4の基準時間を更新するだけでよい
ので、タスクのタイマ処理数とは無関係に極く短い処理
時間で済ますことができる。
[Function] As shown in Fig. 1, the interrupt processing performed by the timer service routine 2 only requires updating the reference time of the clock 4, so the processing time is extremely short regardless of the number of timer processing of the task. I can do it.

またそのため時計の基準時間T、を、比較的高い精度で
更新することが可能となる。
Furthermore, it is therefore possible to update the reference time T of the clock with relatively high accuracy.

また各タスクA、 Bは2時計4の更新時間間隔つまり
タイマ割込みlの割込み時間間隔が十分に短ければ、任
意の細かな時間間隔で時間制御を行うことができ、また
タイマ処理数が多くなっても。
In addition, each task A and B can perform time control at arbitrary fine time intervals if the update time interval of 2 clocks 4, that is, the interrupt time interval of timer interrupt 1, is sufficiently short, and the number of timer processes can be increased. Even though.

タスク内での制御時間のチェンク、タイミングを時間制
御の時間間隔の大きさに応じて適切にとることにより、
制御時間の誤差が増加するのを抑制することができる。
By changing and timing the control time within a task appropriately according to the size of the time control time interval,
It is possible to suppress an increase in control time errors.

〔実施例〕〔Example〕

第2図は本発明実施例によるタイマサービスルーチンと
タスクのフローを示す。
FIG. 2 illustrates a timer service routine and task flow according to an embodiment of the present invention.

この実施例では1時計4の基準時間T、は、24時間表
示の時刻を9時間1分9秒で表わしたものであり、また
タイマ割込み1の時間間隔は10秒にセットされている
。タイマサービスルーチンは。
In this embodiment, the reference time T of clock 1 is expressed as 9 hours, 1 minute, and 9 seconds on a 24-hour clock, and the time interval of timer interrupt 1 is set to 10 seconds. Timer service routine.

タイマ割込み1が発生するごとにこの時計4の基準時間
T、を10秒単位(Δt)で進める更新を行い、更新後
、タイマ(図示せず)に“10秒”の割込み時間間隔を
セントして終了する。
Every time a timer interrupt 1 occurs, the reference time T of this clock 4 is updated in 10 second increments (Δt), and after the update, an interrupt time interval of "10 seconds" is set in a timer (not shown). and exit.

タスクA、タスクBはそれぞれタスク内で定められてい
る制御時間チエツクのタイミングで時計4の基準時間T
、を参照し、たとえばタスクAでは、比較時間T、、、
T、□、・・・、TINについてまずT11がタイムア
ツプ(T s≧T + + )となったかどうかをチエ
ツクし、タイムアツプしていればその対応するタイマ処
理の時間制御を行い、タイムアンプしていなければ(T
 s < T + + )次の比較時間TI2について
制御時間チエツクを行う、以下比較時間TINまでチエ
ツクして、タイムアツプしなかった比較時間があれば次
の制御時間チエツクのタイミングを待って再び同様な処
理を行う。全ての比較時間がタイムアツプしたときに処
理を終了すなお、タイマ内の比較時間をその細かさに応
してグループ化し、異なるタイミングでタイムアツプの
チエツクを行うようにしてもよい。
Task A and task B each check the reference time T of the clock 4 at the control time check timing determined within the task.
, and for example, in task A, the comparison time T, , ,
Regarding T, □, ..., TIN, first check whether T11 has timed up (Ts≧T + +), and if it has timed up, control the time of the corresponding timer processing and perform time amplification. If not (T
s < T + +) Check the control time for the next comparison time TI2. Check up to the comparison time TIN, and if there is a comparison time that did not time up, wait for the timing of the next control time check and repeat the same process. I do. Processing ends when all comparison times have timed up. Note that the comparison times in the timer may be grouped according to their fineness, and time-up checks may be performed at different timings.

(発明の効果〕 本発明によれば2特別なハードウェアを用いることなく
、任意の細かさの時間でタイマ処理を少ない誤差で実行
することが可能となる。
(Effects of the Invention) According to the present invention, it is possible to execute timer processing with arbitrary precision of time and with little error without using special hardware.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の原理説明図、第2図は本発明実施例の
フロー図、第3図は従来のタイマ制御方式の説明図、第
4図は第3図の従来方式のタイマサービスルーチンの処
理内容のフロー図、第5図は第3図の従来方式によるタ
イマ制御のタイミング図である。 第1図中。 1:タイマ割込み 2:タイマサービスルーチン 4:時計 5:タスクA 6:タスクB T、:基準時間 T、〜TIs、  TzI−Tz、:比較時間特許出願
人株式会社ピーエフニー
Fig. 1 is an explanatory diagram of the principle of the present invention, Fig. 2 is a flow diagram of an embodiment of the present invention, Fig. 3 is an explanatory diagram of a conventional timer control method, and Fig. 4 is a timer service routine of the conventional method shown in Fig. 3. FIG. 5 is a timing chart of timer control according to the conventional method shown in FIG. 3. In Figure 1. 1: Timer interrupt 2: Timer service routine 4: Clock 5: Task A 6: Task B T, : Reference time T, ~TIs, TzI-Tz, : Comparative time Patent applicant Pfn Co., Ltd.

Claims (1)

【特許請求の範囲】 システムの基準時間をタスクから参照可能に管理するタ
イマサービスルーチンを設け、 タイマ時間制御を必要とする処理を行うタスクは、その
処理ごとの要求時間を、システムの基準時間にタイマ時
間を加えた比較時間で待ち、タスクの実行中に所定のタ
イミングでシステムの基準時間と比較時間とを比較し、
システムの基準時間が当該比較時間を超えたとき要求時
間がきたものとして定められた処理を行うことを特徴と
するタイマ制御方式。
[Claims] A timer service routine is provided to manage the system reference time so that it can be referenced from tasks, and a task that performs a process that requires timer time control sets the required time for each process to the system reference time. Wait for the comparison time including the timer time, compare the system reference time and the comparison time at a predetermined timing during task execution,
A timer control method characterized in that when the reference time of the system exceeds the comparison time, the requested time is assumed to have come and predetermined processing is performed.
JP25945090A 1990-09-28 1990-09-28 Timer control system Pending JPH04137142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25945090A JPH04137142A (en) 1990-09-28 1990-09-28 Timer control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25945090A JPH04137142A (en) 1990-09-28 1990-09-28 Timer control system

Publications (1)

Publication Number Publication Date
JPH04137142A true JPH04137142A (en) 1992-05-12

Family

ID=17334245

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25945090A Pending JPH04137142A (en) 1990-09-28 1990-09-28 Timer control system

Country Status (1)

Country Link
JP (1) JPH04137142A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6025952A (en) * 1983-07-20 1985-02-08 Sumitomo Chem Co Ltd Production of optically active 2,2-dimethylcyclo-propane- 1-carboxylic acid derivative

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6025952A (en) * 1983-07-20 1985-02-08 Sumitomo Chem Co Ltd Production of optically active 2,2-dimethylcyclo-propane- 1-carboxylic acid derivative

Similar Documents

Publication Publication Date Title
US8650336B2 (en) Direct memory access (DMA) device with event mover that moves event from event calendar to expired event queue without management of central processing unit
JPH04137142A (en) Timer control system
EP3550431B1 (en) Timer implementation method and device
US20070198869A1 (en) Timer apparatus, timer processing method, and electronic apparatus
JPS6020845A (en) Job shop scheduling method using distributed processing system
CN116541470B (en) Synchronization method, device, equipment and medium of database read-only standby library
CN113360482B (en) SQL database-based online migration method
CN111562809B (en) Movement stability control method applied to four-stage driving
JPH10253778A (en) Time exchanging clock system
JPH01119804A (en) Scan time fixing system for programmable controller
JP2002318713A (en) Cpu occupancy time measuring method
JPH03204775A (en) Logical simulation method
JPH05274163A (en) Time control system for real-time os
JPH04192065A (en) Event type simulation system
Wu et al. Guaranteed intrusion removal from monitored distributed applications
JPH0283606A (en) Time correction system for real time system
JPH02311916A (en) Waiting time controller
JPH09185516A (en) Multitask priority control system
JPH05158710A (en) Timer managing system
JPS6329848A (en) Timing control method for computer system
JPH0540725A (en) Input and output controller
JPH0210438A (en) Management method for timer request
JPS6250904A (en) Executing period control method
JPH0212433A (en) Task management method for control program
Lee et al. A real-time kernel for distributed multi-robot systems