WO2009153900A1 - 情報処理装置およびその周期タスク実行方法 - Google Patents

情報処理装置およびその周期タスク実行方法 Download PDF

Info

Publication number
WO2009153900A1
WO2009153900A1 PCT/JP2009/000563 JP2009000563W WO2009153900A1 WO 2009153900 A1 WO2009153900 A1 WO 2009153900A1 JP 2009000563 W JP2009000563 W JP 2009000563W WO 2009153900 A1 WO2009153900 A1 WO 2009153900A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
time
information processing
periodic
standby
Prior art date
Application number
PCT/JP2009/000563
Other languages
English (en)
French (fr)
Inventor
丸山龍也
山田勉
柳原徳久
米本伸治
岩城隆志
藤井洋
Original Assignee
株式会社日立産機システム
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 株式会社日立産機システム filed Critical 株式会社日立産機システム
Publication of WO2009153900A1 publication Critical patent/WO2009153900A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Definitions

  • the present invention relates to an information processing apparatus that executes a periodic task and an information processing control method using information processing software.
  • an operating system (hereinafter referred to as an OS) is operating as basic software that abstracts hardware on the computer and efficiently manages computer resources.
  • a unit of execution processing on these OSs is called a task, and a certain task operates to fulfill some function / purpose.
  • the multitasking OS operates multiple tasks and switches the tasks that operate according to its own scheduling function.
  • Such an element for switching tasks is called a scheduler.
  • the scheduler is activated by a clock interrupt generated at a constant period, and selects and activates a task to be executed next from a task group that can be executed by an evaluation index depending on the OS implementation.
  • an OS that performs scheduling in consideration of task time constraints as an evaluation index is referred to as a real-time OS.
  • the scheduler processing time is implemented so as to be as short as possible by doing only the minimum necessary. This is because the overhead (system maintenance load) due to the execution of the scheduler is minimized, the task execution time is lengthened, and the throughput of the entire system is improved.
  • the processing contents of the scheduler include a software timer update and a task queue update in addition to a scheduling function for selecting an execution task.
  • the length of the scheduler start cycle depends on the performance of hardware such as processors. Shortening the scheduler activation cycle has advantages such as an increase in the resolution of the software timer and an increase in the task switching per unit time, but the execution frequency of the scheduler increases and the throughput of the entire system decreases. When the start cycle is shortened to the same level as the scheduler processing time, the task execution time is almost zero, and the throughput is practically zero.
  • Patent Document 1 in order to activate a task at a certain target time, the corresponding task is activated at a timing when the scheduler is activated earlier than the target activation time.
  • the start timing is corrected with high resolution.
  • the game control process is started by interruption of the second clock using a second clock different from the clock used to start the scheduler.
  • the implementation of periodic execution by the current general-purpose OS or real-time OS is insufficient.
  • the length of the period depends on the resolution of the software timer, and the resolution depends on the start period of the scheduler. For this reason, the periodic processing cycle cannot be made shorter than the scheduler activation cycle.
  • the scheduler activation cycle depends on the execution time of the scheduling process depending on the performance of the processor.
  • the periodic processing is started due to the timeout of the software timer in the processing in the scheduler, so that the processing time of the scheduler causes a decrease in the periodic accuracy.
  • the scheduler processing time is implemented to be as short as possible, and in many cases it is not a problem for general purposes, but it may be a problem in a field that requires a high-speed and high-precision control cycle.
  • Patent Document 1 does not consider the start of periodic processing, and does not consider the length of the correction period by the resolution correction unit. While waiting by the resolution correction unit, other tasks cannot operate. Therefore, if the waiting period until the target activation time within the scheduling period is too long, the time during which other tasks cannot operate increases and the throughput of the entire system decreases. On the other hand, if the standby period is too short, the target activation time is set within the jitter of the scheduler processing time, and the periodic processing is activated after the scheduling processing ends, resulting in a decrease in periodic accuracy.
  • Patent Document 2 jitter (signal time lag) is generally present in the time until the start of control processing by interruption, as in the case of the scheduler, leading to a decrease in periodic accuracy. Further, neither Patent Document 1 nor Patent Document 2 considers the jitter of the processing time from the clock interruption until the task processing starts.
  • the task processing execution unit that executes periodic task processing, a timer that can generate an interrupt at a predetermined period, a correction unit that starts the task processing execution unit, and the correction unit
  • a periodic process registration unit for registering to start the correction unit from the timer interrupt in response to a request from the timer, a correction unit starting unit for starting the correction unit from the timer interrupt, and a time to the correction unit
  • the correction unit includes a standby period setting unit that periodically starts the correction unit and determines an initial standby period from each cycle start time, and an initial standby period when the task processing execution unit is first started.
  • a standby unit that starts the periodic processing of the task processing execution unit, and the next target waiting from the time and cycle after the standby unit waits Characterized in that it has a next target standby time setting unit for determining a time.
  • the standby period setting unit is characterized in that the correction unit is periodically driven and a value obtained by subtracting the period from the maximum value of the difference between the period activation times is set as the initial standby period.
  • next target standby time setting unit is characterized in that a time obtained by adding a cycle to the time after the standby unit waits is set as the next target standby time.
  • correction unit starting means is an interrupt handler starting unit.
  • correction unit starting means is a scheduler.
  • the information processing device includes a synchronization unit that can synchronize time between a plurality of information processing devices and a communication unit that can communicate information between the plurality of information processing devices, and the initial standby period obtained by each information processing device Are exchanged between the information processing devices using the communication unit, and the maximum initial standby period is set as the initial standby period of each information processing device, and each information processing device is simultaneously synchronized with the timing synchronized by the synchronization unit. It is characterized by an information processing apparatus system that executes periodic processing.
  • a task processing execution unit that executes periodic task processing, a timer that can generate an interrupt at a predetermined period, a task processing execution unit that is activated, a standby period setting unit, a next target standby time setting unit, and a standby
  • a correction processing unit that receives a request from the correction unit and registers to start the correction unit from the timer interrupt, and a correction that starts the correction unit from the timer interrupt.
  • the standby period setting unit of the correction unit periodically starts the correction unit and starts from the activation time of each cycle A standby period is determined, and the standby unit waits for an initial standby period when the task process execution unit is first activated by the correction unit, and before the next time the correction unit is started, After waiting until the next target standby time set by the next target standby time setting unit, the task processing execution unit starts the periodic processing.
  • the next target standby time setting unit sets the next target from the time and cycle after the standby unit waits. The standby time is determined.
  • the standby period setting unit periodically drives the correction unit and sets a value obtained by subtracting the period from the maximum difference between the activation times of each period as an initial standby period.
  • the next target standby time setting unit sets a time obtained by adding a cycle to the time after the standby unit has waited, as a next target standby time.
  • the correction unit starting means is an interrupt handler starting unit.
  • the correction unit starting means is a scheduler.
  • the information processing apparatus includes a synchronization unit that can synchronize time between a plurality of information processing devices, and a communication unit that can communicate information between the plurality of information processing devices,
  • the initial standby period obtained in each information processing apparatus is exchanged between the information processing apparatuses using the communication unit, and the maximum initial standby period among them is set as the initial standby period of each information processing apparatus.
  • the periodic processing is simultaneously executed at the timing synchronized by the synchronization unit.
  • the timer is set so as to generate an interrupt at a predetermined cycle, the jitter of the processing time from the generation of the interrupt to the activation of the interrupt handler activation unit is measured, and the first cycle At the time of execution of the process, it waits for the maximum value of the measured jitter and then executes the periodic process, and from the next time onwards, it waits until the time when the period is added to the previous periodic process start time before executing the periodic process.
  • the information processing device includes a synchronization unit that can synchronize time between the plurality of information processing devices, and a communication unit that can communicate information between the plurality of information processing devices,
  • the timer is set so as to generate an interrupt at a predetermined cycle, the jitter of the processing time from the generation of the interrupt to the activation of the interrupt handler activation unit is measured, and the maximum value of the jitter is set to another value.
  • Each information processing device is exchanged with an information processing device, and each information processing device waits at the time of execution of the first periodic processing for the maximum value among the exchanged jitters and then executes the periodic processing. It is characterized in that the cycle processing is executed after waiting until a time obtained by adding the cycle to the time.
  • the present invention can provide an information processing apparatus capable of executing periodic processing with high periodic accuracy and its periodic task execution method without being limited by the startup period of the scheduler.
  • the scheduler is not constrained by the timing at which the computers are synchronized, It is possible to provide an information processing apparatus system that can execute periodic processing with high accuracy.
  • Example 1 of this invention It is a block diagram which shows the software structure of Example 1 of this invention. It is a block diagram of the hardware constitutions of Example 1 of the present invention. It is a flowchart which shows the outline
  • Example 2 of this invention It is a block diagram which shows the software structure of Example 2 of this invention. It is a block diagram which shows the hardware constitutions of Example 2 of this invention. It is a flowchart which shows the preparation procedure of the periodic process execution by Example 2 of this invention. It is a flowchart which shows the execution procedure of the periodic process by Example 2 of this invention. It is a block diagram which shows the software structure of Example 3 of this invention. It is a block diagram of the hardware constitutions of Example 3 of the present invention.
  • DESCRIPTION OF SYMBOLS 100 ... Task process execution part, 101 ... Correction part, 102 ... Periodic process registration part, 103 ... Interrupt handler starting part, 104, 116 ... Timer, 105 ... Standby part, 106 ... Next target wait time setting part, 107 ... Standby period Setting unit, 108 ... periodic processing unit, 109 ... clock, 110 ... CPU, 111 ... RAM, 112 ... non-volatile storage medium, 113 ... interrupt controller, 114 ... clock oscillator, 115 ... bus, 117 ... computer, 120 ... scheduler, 130: synchronization unit, 131: communication unit, 140 ... LAN, 141 ... network
  • FIG. 1 is a block diagram illustrating a software configuration according to the first embodiment of the present invention.
  • the task process execution unit 100 is implemented as an application that executes a predetermined process and uses a function provided by the OS.
  • the task processing execution unit 100 includes a periodic processing unit 108 that executes a task at a predetermined cycle. The timing of each cycle in which the cycle processing unit 108 is executed is determined by the correction unit 101.
  • the correction unit 101 determines the timing of each cycle in which the task is executed by the cycle processing unit 108 in the task processing execution unit 100.
  • the correction unit 101 includes a standby unit 105, a next target setting unit 106, and a standby period setting unit 107.
  • the correction unit 101 requests the periodic process registration unit 102 to prepare for execution of the periodic process.
  • the correction unit 101 is connected to the clock 109. Examples of the implementation form of the correction unit 101 include an application, a library, middleware, a kernel, a kernel module, and a server process.
  • the next target standby time setting unit 106 sets a target standby time until the standby unit 105 continues to wait. After waiting until the target standby time set by the next target standby time setting unit 106, the standby unit 105 causes the cycle processing unit 108 to be executed.
  • the standby period setting unit 107 obtains an initial standby period necessary for setting the target standby time set by the next target setting unit 106.
  • the periodic process registration unit 102 receives a request from the correction unit 101 and prepares for periodic process execution. That is, the timer 104 is set so as to generate an interrupt at a specified cycle, and the interrupt handler starting unit 103 is set so that the correction unit 101 is started by the timer 104 interrupt.
  • An interrupt handler activation unit 103 that performs interrupt processing activates the correction unit 101 in response to an interrupt signal notified from the timer 104.
  • the interrupt handler activation unit 103 is implemented as a function included in the OS.
  • the timer 104 is a timer IC that generates an interrupt at a cycle specified by the cycle process registration unit 102.
  • the clock 109 provides the current time to the correction unit 101.
  • the expression form of the information to be provided may be anything that represents time. Therefore, not only the time but also the number of clocks may be used.
  • the clock 109 may be integrated with the timer 104.
  • FIG. 2 shows an embodiment of a computer system that implements a software configuration to which the present invention is applied.
  • the CPU 110 transfers the program from the nonvolatile storage medium 112 to the RAM 111 and executes it.
  • the OS and the software configuration shown in FIG. 1 can be applied.
  • the RAM 111 is a temporary storage area for the CPU 110 to operate, and stores an OS, an application program, and the like transferred from the nonvolatile storage medium 112.
  • the non-volatile storage medium 112 is an information storage medium, and is used for storing a program for operating the CPU 110 and storing a program execution result.
  • the interrupt controller 113 is connected to the peripheral device that can notify the interrupt signal through the interrupt signal, and notifies the CPU 110 of the interrupt signal in consideration of the priority order between the peripheral devices.
  • the interrupt controller 113 may be included in the CPU 110 and may not be connected to the bus 115.
  • the clock oscillator 114 generates a clock signal necessary for operating the CPU 110.
  • the bus 115 connects the CPU 110, the RAM 111, the nonvolatile storage medium 112, and the interrupt controller 113, respectively.
  • Examples of the bus 115 include a PCI bus, an ISA bus, a PCI express bus, a system bus, and a memory bus.
  • the CPU 110, RAM 111, nonvolatile storage medium 112, interrupt controller 113, clock oscillator 114, timer 104, and clock 109 may be connected in various forms, but the effects of the present invention are not lost.
  • the timer 116 is a timer IC that generates an interrupt at a predetermined cycle in order to start the scheduler of the OS.
  • FIG. 3 shows a flowchart of the execution procedure of the periodic process according to the present invention.
  • the task process execution unit 100 requests the correction unit 101 to prepare for periodic process execution (S001).
  • the standby period setting unit 107 obtains an initial standby period (S002).
  • the periodic processing unit 108 executes periodic processing (S003).
  • the correction unit 101 requests the periodic process registration unit 102 to prepare for execution of the periodic process (S010).
  • the periodic process registration unit 102 registers the correction unit 101 to be activated by the interruption of the timer 104 (S011).
  • the periodic process registration unit 102 sets the timer 104 to generate an interrupt signal at a period designated by the periodic processor 108 and starts the operation of the timer 104 (S012).
  • the timer 104 generates an interrupt when the designated period elapses (S013). With this interrupt, the interrupt handler activation unit 103 activates the correction unit 101 (S014).
  • the standby period setting unit 107 of the activated correction unit 101 acquires the current time from the clock 109 and stores it (S015).
  • the standby period setting unit 107 is activated again by the next timer 104 interruption, the current time is acquired from the clock 109 and stored (S016). Thereafter, the difference from the previously saved time is obtained, and the largest calculated value obtained so far is saved (S017). Next, it is checked whether or not the end condition is satisfied. If it is not satisfied, the procedure from S016 is repeated, and if it is satisfied, the procedure is ended (S018). A value obtained by subtracting the period from the maximum value of the difference obtained by these measurements is set as the initial standby period ⁇ (S019).
  • a value obtained by adding a predetermined value to the maximum value of the difference may be used as the initial standby period ⁇ .
  • the timing for obtaining the initial waiting period ⁇ by the preparation procedure of FIG. 4 can be executed when the task processing execution unit 100 requests the correction unit 101, or when the OS is idle, or periodically.
  • a specific example of periodic execution is a cron command in a UNIX (registered trademark) OS.
  • the jitter of the processing time from the occurrence of an interrupt to the activation of the interrupt handler may be measured separately, and the maximum value of the measured jitter may be adopted when the first periodic processing is executed.
  • Set the timer to generate an interrupt at a predetermined period measure the jitter of the processing time from the occurrence of the interrupt to the activation of the interrupt handler activation unit, and when the first periodic process is executed, the measured jitter maximum value It is possible to execute the periodic processing after waiting for a while, and from the next time onward, the periodic processing can be executed after waiting until a time obtained by adding the cycle to the previous periodic processing start time.
  • the procedure termination condition includes whether the timer 104 has been interrupted a predetermined number of times to calculate the difference, whether a predetermined time has elapsed, whether a predetermined program variable, register, or memory value has reached a predetermined value, etc. Can be mentioned.
  • the time expression in the clock 109 is the number of clocks
  • the operation time of the clock 109 exceeds the time that can be measured by the clock 109
  • the output is initialized and the current time may be smaller than the previous measurement value.
  • the difference calculation may be stopped, or a method of calculating the difference by adding the time that can be measured by the clock 109 in consideration of the initialization may be used.
  • the task processing execution unit 100 requests the correction unit 101 to start the periodic processing unit 108 (S020).
  • the correction unit 101 requests the periodic process registration unit 102 to set an interrupt handler (S021).
  • the periodic process registration unit 102 registers the correction unit 101 to be activated by the interruption of the timer 104 (S022).
  • the periodic process registration unit 102 sets the timer 104 to generate an interrupt signal at a period specified by the periodic processing unit 108, and starts the operation of the timer 104 (S023).
  • the timer 104 generates an interrupt when the designated period elapses (S024). With this interrupt, the interrupt handler activation unit 103 activates the correction unit 101 (S025).
  • the standby unit 105 of the activated correction unit 101 waits for the initial standby period ⁇ (S026). Thereafter, the next target standby time setting unit 106 obtains the next target standby time Tnext (S027). Then, the correction unit 101 activates the periodic processing unit 108 and executes periodic processing (S028). After the end of the periodic processing, it is checked whether the end condition is satisfied (S029). If the end condition is satisfied, the procedure is ended. If not established, the next timer 104 is waited for. The timer 104 generates an interrupt when the specified period elapses (S030). With this interrupt, the interrupt handler activation unit 103 activates the correction unit 101 (S031).
  • the standby unit 105 of the activated correction unit 101 waits until the next target standby time Tnext (S032). Thereafter, the next target standby time setting unit 106 obtains the next target standby time Tnext (S033). Then, the correction unit 101 activates the periodic processing unit 108 and executes periodic processing (S034). After that, the procedure from S029 is repeated.
  • Termination conditions include whether the timer 104 has been interrupted a predetermined number of times to calculate the difference, whether a predetermined time has elapsed, or whether a predetermined program variable, register, or memory value has reached a predetermined value. .
  • a dedicated API application programming interface
  • the argument includes a cycle and a pointer to the cycle processing unit 108.
  • the time period after which the periodic processing unit 108 is executed after the function call the event that is the start condition of the periodic processing unit 108, the maximum processing time per time of the periodic processing unit 108, and the like are used. It is done.
  • a predetermined value can be returned as a return value of the defined API. Examples of the contents of the predetermined value include errors such as success, cycle designation too short, too long, and other periodic processes are already registered and cannot be executed or cycle accuracy cannot be expected.
  • the following predetermined processing is executed.
  • a dialog notifying that the next target standby time Tnext has passed is displayed on the OS screen, recorded in a log, not performing periodic processing, and the current time after the next target standby time Tnext.
  • the periodic processing is continued with the time added to the period as the next target standby time, a display device such as an LED is attached to the computer 117, and notification is made to the outside.
  • FIG. 6 shows how to obtain the next target waiting time Tnext after the interruption of the timer 104.
  • the interrupt handler activation unit 103 activates the correction unit 101 by the interruption of the timer 104 (S040).
  • the correction unit determines whether the periodic process is the first time (S041). If it is the first time, it waits for the initial waiting period ⁇ (S042), and if it is not the first time, it waits until the next target waiting time Tnext (S043). After waiting, the current time is acquired from the clock 109, and the time obtained by adding the period to the current time is set as the next Tnext (S044).
  • step S051 when standby is started first (S050), the current time is read from the clock 109 (S051). It is checked whether or not the read current time is after the target standby time (S052). If it is not after the target standby time, step S051 is repeated, and if it is after the target standby time, the standby processing is terminated (S053).
  • FIG. 8 shows a second standby method using an empty loop.
  • An empty loop is implemented by a for statement in C language or the like.
  • the processing time for one empty loop is measured in advance (S060), and the necessary number of executions of the empty loop for the period up to the target standby time is obtained (S061).
  • an empty loop is executed for the obtained number of executions (S062).
  • the standby is ended (S063).
  • a signal can be output using an external IO during standby to confirm that the system is waiting.
  • the periodic processing unit 108 of the task processing execution unit 100 can be executed with the accuracy of the standby unit 105 and the period of the timer 104.
  • the interrupt of the timer 104 by the interrupt handler starting unit 103, it is possible to specify the period independently of the scheduler period of the OS, and because it does not involve the scheduler scheduling process, it has low jitter and low delay.
  • Periodic processing can be performed. Therefore, the execution time of other tasks can be increased as compared with the case where periodic processing is executed using a scheduler, and the throughput of the entire system can be improved.
  • FIG. 9 is a block diagram showing a second embodiment of the software configuration to which the present invention is applied.
  • the reference numerals used in the drawings are the same, the functions and elements described in the first embodiment are the same unless otherwise specified.
  • a scheduler 120 is provided instead of the interrupt handler activation unit 103 in FIG.
  • the scheduler 120 is activated by a clock interrupt generated at a fixed period, and selects and activates a task to be executed next from a task group that can be executed by an evaluation index depending on the OS implementation.
  • a group of executable tasks includes the correction unit 101.
  • FIG. 10 is a block diagram showing a system for implementing a software configuration to which the present invention is applied.
  • the outline of the execution procedure of the periodic processing according to the present invention is the same as FIG. 3 in the first embodiment.
  • the correction unit 101 requests the periodic process registration unit 102 to prepare for execution of the periodic process (S070).
  • the periodic processing registration unit 102 sets the scheduler 120 so that the periodic processing unit 108 is activated at a cycle designated by the periodic processing unit 108, which is an integral multiple of the activation cycle of the scheduler 120 (S071).
  • the designated period of the period processing unit 108 is N times the activation period of the scheduler 120 (S072).
  • the measured value I of the number of executions of the scheduler 120 is set to 0 (S073).
  • the measured value I is incremented by 1 (S074).
  • the correction unit 101 is activated (S076).
  • the activated correction unit 101 acquires the current time from the clock 109 and stores it (S077).
  • the current time is acquired from the clock 109 and stored (S078).
  • the difference from the previously saved time is obtained, and the largest calculated value obtained so far is saved (S079).
  • the termination conditions include whether the scheduler 120 has been activated a predetermined number of times, whether a predetermined time has elapsed, whether predetermined program variables, registers, and memory values have reached predetermined values.
  • the task processing execution unit 100 requests the correction unit 101 to start the periodic processing unit 108 (S090).
  • the correction unit 101 requests the periodic process registration unit 102 to start the correction unit 101 by the scheduler 120 (S091).
  • the periodic processing registration unit 102 sets the scheduler 120 so that the periodic processing unit 108 is activated at a cycle designated by the periodic processing unit 108, which is an integral multiple of the activation cycle of the scheduler 120 (S092).
  • the designated period of the period processing unit 108 is set to N times the activation period of the scheduler 120 (S093).
  • the measured value I of the number of executions of the scheduler 120 is set to 0 (S094).
  • the scheduler 120 is executed, the measured value I is incremented by 1 (S095).
  • the correction unit 101 is activated (S097).
  • the standby unit 105 of the activated correction unit 101 waits for the initial standby period ⁇ (S098). Thereafter, the next target standby time setting unit 106 obtains the next target standby time Tnext (S099). Then, the correction unit 101 activates the periodic processing unit 108 and executes periodic processing (S100). After the end of the periodic processing, it is checked whether an end condition is satisfied (S101), and if it is satisfied, the procedure is ended.
  • the startup procedure of the correction unit 101 by the scheduler 120 is the procedure from S093 to S097.
  • the scheduler 120 activates the correction unit 101 (S102).
  • the standby unit 105 of the activated correction unit 101 waits until the next target standby time Tnext (S103). Thereafter, the next target standby time setting unit 106 obtains the next target standby time Tnext (S104). Then, the correction unit 101 activates the periodic processing unit 108 and executes periodic processing (S105). After that, the procedure from S101 is repeated.
  • the termination conditions include whether the scheduler 120 has been activated a predetermined number of times, whether a predetermined time has elapsed, whether predetermined program variables, registers, and memory values have reached predetermined values.
  • the method for obtaining the next target standby time Tnext is the same as in FIG.
  • the periodic processing unit 108 of the task processing execution unit 100 can be executed with the accuracy of the standby unit 105 and the cycle of the scheduler 120.
  • FIG. 13 is a block diagram showing a third embodiment of the software configuration to which the present invention is applied.
  • the reference numerals used in the embodiments are the same, it means that the functions and elements described in the embodiments 1 and 2 are the same unless otherwise specified.
  • a synchronization unit 130 and a communication unit 131 are newly provided.
  • the synchronization unit 130 synchronizes timing with the synchronization units 130 of a plurality of computers having the software configuration of FIG.
  • Specific examples include NTP (Network Time Protocol), SNTP (Simple Network Time Protocol), GPS, and synchronization by the IEEE 1588 system.
  • the communication unit 131 is connected to a plurality of computers having the software configuration of FIG. 13 and transmits / receives information.
  • Specific examples of the communication unit 131 include Ethernet (registered trademark), TCP / IP, and wireless communication.
  • FIG. 14 is a block diagram showing a system for implementing a software configuration to which the present invention is applied.
  • the LAN 140 is a transceiver IC that implements a communication function with a network.
  • Ethernet registered trademark
  • the network 141 is connected to the computer 117 and other computers including the computer having the software configuration of FIG. 13, and performs predetermined information communication.
  • each correction unit 101 of a plurality of computers having the software configuration of FIG. 13 connected to the system shown in FIG.
  • the correction unit 101 uses the communication unit 131 to notify that the procedure of FIG.
  • the respective initial standby periods are exchanged through the communication unit 131, and the maximum value among the exchanged initial standby periods is determined as the final initial standby period.
  • the timing at which the periodic processing unit 108 of each computer is executed is synchronized by the synchronization unit 130, and the procedure of FIG. 5 is executed on each computer.
  • each computer synchronizes the periodic processing unit 108 of the task processing execution unit 100 with the accuracy of the standby unit 105 in each computer and the timer 104. Can be executed in cycles.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)

Abstract

 周期タスクの実行において、精度低下のない情報処理装置および制御方法を提供する。 タスク処理実行部と、タイマと、補正部と、周期処理登録部と、補正部起動手段と、時計とを有する情報処理装置において、補正部は各周期起動時刻から初期待機期間を決定し、補正部によるタスク処理実行部の初回起動時には初期待機期間待機し、次回以降の起動時には次期目標待機時刻まで待機してからタスク処理実行部の周期処理を起動し、待機後の時刻と周期から次期目標待機時刻を決定する。周期的割込みタイマにより初期待機期間待機し、その後現在時刻に周期を足した次期目標待機時刻を求めて周期処理を実行する。再びタイマ割込みで起動後に次期目標待機時刻まで待機し、次期目標待機時刻を再度計算してから周期処理を実行する。  

Description

情報処理装置およびその周期タスク実行方法
 本発明は、周期タスクを実行する情報処理装置及び情報処理ソフトウェアを用いた情報処理制御方法に関する。
 一般に計算機では、計算機上のハードウェアを抽象化し、計算機資源を効率よく管理する基本ソフトウェアとしてオペレーティングシステム(以下OSと称す)が稼動している。これらのOS上での実行処理の単位をタスクと呼び、ある一つのタスクは何らかの機能/目的を果たすために動作する。
 マルチタスクOSは複数のタスクを動作させ、自身の持つスケジューリング機能によって動作するタスクを適宜切り替える。このようなタスクの切り替えを行う要素をスケジューラと呼ぶ。通常、スケジューラは一定周期で発生するクロックの割り込みによって起動され、OSの実装に依存した評価指標によって実行可能なタスク群から、次に実行するタスクを選択し起動させる。特に、評価指標としてタスクの時間的な制約を考慮したスケジューリングを実行するOSをリアルタイムOSという。
 一般にスケジューラの処理時間は、必要最低限のことのみを行いなるべく短くなるように実装される。これは、スケジューラの実行によるオーバーヘッド(システム維持負荷)を最小化し、タスクの実行時間を長くしてシステム全体のスループットを向上させるためである。スケジューラの処理内容としては、実行タスクを選択するスケジューリング機能の他にソフトウェアタイマの更新やタスクキューの更新等が挙げられる。
 また、スケジューラの起動周期の長さはプロセッサ等のハードウェアの性能に依存する。スケジューラの起動周期を短くすると、ソフトウェアタイマの分解能が高まることや単位時間あたりのタスク切り替えの機会が増える等の利点はあるものの、スケジューラの実行頻度が高まりシステム全体でのスループットは低下する。起動周期をスケジューラの処理時間と同等程度まで短くした場合は、タスクの実行時間はほぼゼロとなり、事実上スループットはゼロとなる。
 逆に起動周期を長くした場合は、システム全体でのスループットは向上するが、ソフトウェアタイマの分解能が悪化することやタスク切り替えの機会が減少する等の短所があり、時間的制約を有するリアルタイムシステムには適さない。一般のOSでは、これらの状況を踏まえて適切なスケジューリング周期が設定される。
 周期的な処理を実行する場合、これらのスケジューラやスケジューラ実行時に更新されるソフトウェアタイマを用いる方法が一般的である。周期的な処理では、その周期の時間経過をソフトウェアタイマによって管理し、指定する時間が経過した場合に該当する処理を起動する。
 従来、特許文献1においては、ある目標時刻にタスクを起動するために、目標起動時刻よりも早く、スケジューラが起動するタイミングで該当するタスクを起動させ、その後、分解能補正部によって、スケジューリング周期よりも高い分解能で起動タイミングを補正する。また、特許文献2においては、スケジューラを起動するために用いるクロックとは別の第2のクロックを用いて、第2のクロックの割込みによって遊技制御処理を開始させている。
特許3734042号公報 特開2001-087523号公報
 しかしながら、モーションコントロールやサーボモータ制御といった高速、高精度な制御周期が必要となる分野においては、現状の汎用OSやリアルタイムOSによる周期実行の実装では不十分である。周期の長さは、ソフトウェアタイマの分解能に依存し、その分解能はスケジューラの起動周期に依存している。そのため、スケジューラの起動周期よりも周期的な処理の周期を短くすることはできない。さらにスケジューラの起動周期は、プロセッサの性能に依存したスケジューリング処理の実行時間に依存している。
 また、精度においても、スケジューラ内の処理でのソフトウェアタイマのタイムアウトによって、周期的な処理が開始されるため、スケジューラの処理時間が周期精度低下の原因となる。
 前述の通り、スケジューラの処理時間はなるべく短くなるように実装され、一般の用途では問題にならないことが多いが、高速、高精度な制御周期が必要なる分野では問題となることがある。また、スケジューラの処理時間が毎回一定であれば周期精度の観点からは望ましいが、ソフトウェアタイマの数が不定であることやタスクキューの更新処理の時間が不定である等の原因から、実際はスケジューラの処理時間は一定とはならない場合が多い。
 前述した従来例でも一定の対策は取られている。しかし例えば特許文献1では周期的な処理の起動は考慮されておらず、分解能補正部による補正期間の長さの考慮がなされていない。分解能補正部による待機中は他のタスクが動作することはできない。したがって、スケジューリング周期内における目標起動時刻までの待機期間が長すぎれば、他のタスクが動作できない時間が長くなりシステム全体のスループットが低下する。一方で、待機期間が短すぎればスケジューラの処理時間のジッタ内に目標起動時刻が設定されることとなり、スケジューリング処理終了後に周期的な処理を起動することとなり周期精度の低下を招く。特許文献2では、割込みによる制御処理の開始までの時間についてもスケジューラと同様にジッタ(信号の時間的ずれ)が存在するのが一般的であり、周期精度の低下を招く。また、特許文献1、特許文献2のいずれにおいても、クロックの割込みからタスクの処理が開始するまでの処理時間のジッタが考慮されていない。
 本発明は、情報処理装置において、周期的なタスク処理を実行するタスク処理実行部と、所定の周期で割込みを発生可能なタイマと、前記タスク処理実行部を起動する補正部と、前記補正部からの依頼を受けて前記タイマの割込みから前記補正部を起動するように登録する周期処理登録部と、前記タイマの割込みから前記補正部を起動する補正部起動手段と、時刻を前記補正部に提供する時計とを有し、前記補正部は、補正部を周期起動させ各周期起動時刻から初期待機期間を決定する待機期間設定部と、前記タスク処理実行部の初回起動時には初期待機期間のあいだ待機し、次回以降の起動時には次期目標待機時刻まで待機してから前記タスク処理実行部の周期処理を起動する待機部と、前記待機部が待機後の時刻と周期から次期目標待機時刻を決定する次期目標待機時刻設定部を有することを特徴とする。
 また、前記待機期間設定部は、前記補正部を周期駆動させ各周期起動時刻の差分の最大値から周期を引いた値を初期待機期間とすることを特徴とする。
 また、前記次期目標待機時刻設定部は、前記待機部が待機後の時刻に周期を足した時刻を次期目標待機時刻とすることを特徴とする。
 また、前記補正部起動手段を割込みハンドラ起動部としたことを特徴とする。
 また、前記補正部起動手段をスケジューラとしたことを特徴とする。
 また、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、各情報処理装置で求めた前記初期待機期間を前記通信部を用いて各情報処理装置間で交換し、そのうちの最大となる初期待機期間を各情報処理装置の初期待機期間とし、各情報処理装置は前記同期部で同期されたタイミングで同時に周期処理を実行する情報処理装置システムを特徴とする。
 さらに、周期的なタスク処理を実行するタスク処理実行部と、所定の周期で割込みを発生可能なタイマと、前記タスク処理実行部を起動するとともに待機期間設定部と次期目標待機時刻設定部と待機部とを有する補正部と、前記補正部からの依頼を受けて前記タイマの割込みから前記補正部を起動するように登録する周期処理登録部と、前記タイマの割込みから前記補正部を起動する補正部起動手段と、時刻を前記補正部に提供する時計とを有する情報処理装置の周期タスク実行方法において、前記補正部の待機期間設定部は前記補正部を周期起動させ各周期の起動時刻から初期待機期間を決定し、前記待機部は前記補正部による前記タスク処理実行部の初回起動時には初期待機期間のあいだ待機し、次回以降の前記補正部の起動時には前記次期目標待機時刻設定部が設定する次期目標待機時刻まで待機してから前記タスク処理実行部の周期処理を起動し、次期目標待機時刻設定部は前記待機部が待機後の時刻と周期から次期目標待機時刻を決定することを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、前記待機期間設定部は、前記補正部を周期駆動させ各周期の起動時刻の差分の最大値から周期を引いた値を初期待機期間とすることを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、前記次期目標待機時刻設定部は、前記待機部が待機後の時刻に周期を足した時刻を次期目標待機時刻とすることを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、前記補正部起動手段を割込みハンドラ起動部としたことを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、前記補正部起動手段をスケジューラとしたことを特徴とする。
 さらに、情報処理装置システムの周期タスク実行方法において、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、各情報処理装置で求めた前記初期待機期間を前記通信部を用いて各情報処理装置間で交換し、そのうちの最大となる初期待機期間を各情報処理装置の初期待機期間とし、各情報処理装置は前記同期部で同期されたタイミングで同時に周期処理を実行することを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、所定の周期で割込みを発生させるように前記タイマを設定し、割込み発生から割込みハンドラ起動部の起動までの処理時間のジッタを計測し、初回の周期処理の実行時には計測した前記ジッタの最大値の間待機してから周期処理を実行し、次回以降は前回の周期処理開始時点に周期を足した時刻まで待機してから周期処理を実行することを特徴とする。
 さらに、情報処理装置の周期タスク実行方法において、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、それぞれの情報処理装置で、所定の周期で割込みを発生させるように前記タイマを設定し、割込み発生から割込みハンドラ起動部の起動までの処理時間のジッタを計測して、前記ジッタの最大値を他の情報処理装置と交換し、各情報処理装置は交換された前記ジッタの中の最大値の間、初回の周期処理の実行時に待機してから周期処理を実行し、次回以降は前回の周期処理開始時点に周期を足した時刻まで待機してから周期処理を実行することを特徴とする。
 本発明はスケジューラの起動周期に制約されず、周期精度の高い周期処理を実行可能な情報処理装置およびその周期タスク実行方法を提供することができる。また、周期精度の高い周期処理を実行可能な情報処理システムを提供することができる。
 さらに、複数の計算機で構成され各計算機が通信手段で接続されて、各計算機の時刻を同期させる同期手段を有するシステムにおいて、各計算機が同期されたタイミングでスケジューラの起動周期に制約されず、周期精度の高い周期処理を実行することができる情報処理装置システムを提供することができる。
本発明の実施例1のソフトウェア構成を示すブロック図である。 本発明の実施例1のハードウェア構成のブロック図である。 本発明の実施例1による周期処理手順の概要を示すフローチャートである。 本発明の実施例1による周期処理実行の準備手順を示すフローチャートである。 本発明の実施例1による周期処理の実行手順を示すフローチャートである。 本発明の実施例1による次期目標待機時刻の求め方を示すフローチャートである。 本発明の実施例1による第1の待機方法を示すフローチャートである。 本発明の実施例1による第2の待機方法を示すフローチャートである。 本発明の実施例2のソフトウェア構成を示すブロック図である。 本発明の実施例2のハードウェア構成を示すブロック図である。 本発明の実施例2による周期処理実行の準備手順を示すフローチャートである。 本発明の実施例2による周期処理の実行手順を示すフローチャートである。 本発明の実施例3のソフトウェア構成を示すブロック図である。 本発明の実施例3のハードウェア構成のブロック図である。
符号の説明
 100… タスク処理実行部、101… 補正部、102… 周期処理登録部、103… 割込みハンドラ起動部、104、116…タイマ、105… 待機部、106… 次期目標待機時刻設定部、107… 待機期間設定部、108… 周期処理部、109…時計、110…CPU、111…RAM、112…不揮発性記憶媒体、113… 割込みコントローラ、114… クロック発振器、115…バス、117…計算機、120…スケジューラ、130…同期部、131…通信部、140… LAN、141… ネットワーク
 以下に、本発明の実施形態を図面に基づいて説明する。
 図1は、本発明の実施例1におけるソフトウェア構成を示すブロック図である。タスク処理実行部100は所定の処理を実行し、OSの提供する機能を用いるアプリケーションとして実装される。タスク処理実行部100は、タスクを所定の周期で実行する周期処理部108を有する。周期処理部108が実行される各周期のタイミングは、補正部101によって定められる。
 補正部101は、タスク処理実行部100内の周期処理部108でタスクが実行される各周期のタイミングを定める。補正部101は、待機部105、次期目標設定部106、待機期間設定部107から構成される。また、補正部101は周期処理登録部102へ周期処理実行の準備を依頼する。また、補正部101は時計109と接続する。補正部101の実装形態としては、アプリケーション、ライブラリ、ミドルウェア、カーネル、カーネルモジュール、サーバープロセス等が挙げられる。
 次期目標待機時刻設定部106は、待機部105が待機し続けるまでの目標待機時刻を設定する。待機部105は、次期目標待機時刻設定部106が設定する目標待機時刻まで待機した後、周期処理部108を実行させる。待機期間設定部107は、次期目標設定部106が設定する目標待機時刻の設定に必要な初期待機期間を求める。
 周期処理登録部102は補正部101の依頼を受けて周期処理実行を準備する。すなわち指定周期で割込みを発生するようにタイマ104を設定し、タイマ104の割込みによって補正部101が起動するように割込みハンドラ起動部103を設定する。割込み処理を行う割込みハンドラ起動部103は、タイマ104から通知された割込み信号によって補正部101を起動する。割込みハンドラ起動部103はOSに含まれる機能として実装される。タイマ104は、周期処理登録部102によって指定された周期で割込みを発生するタイマICである。
 時計109は、補正部101に対して現在時刻を提供する。提供する情報の表現形態は、時間を表すものであればよい。したがって、時刻だけでなく、クロック数等でも構わない。時計109は、タイマ104と一体となっていても構わない。
 図2は、本発明を適用したソフトウェア構成を実装する計算機システムの一実施例である。CPU110は、不揮発性記憶媒体112からプログラムをRAM111に転送して実行する。実行処理プログラムとしては、OSおよび図1に示されるソフトウェア構成を適用できる。
 RAM111は、CPU110が動作するための一時的な記憶領域であり、不揮発性記憶媒体112から転送したOS、アプリケーションプログラム等が格納される。不揮発性記憶媒体112は、情報の記憶媒体で、CPU110を動作させるためのプログラムの保存、プログラムの実行結果の保存に利用される。
 割込みコントローラ113は、割込み信号を通知可能な周辺デバイスと割込み信号を通じて接続し、周辺デバイス間の優先順位を考慮して、CPU110へ割込み信号を通知する。割込みコントローラ113はCPU110内に含まれていてもよく、バス115に接続されていなくてもよい。クロック発振器114は、CPU110を動作させるために必要なクロック信号を生成する。
 バス115は、CPU110、RAM111、不揮発性記憶媒体112、割込みコントローラ113をそれぞれ接続する。バス115としては、PCIバス、ISAバス、PCI Expressバス、システムバス、メモリバス等が例示される。バス規格によって、CPU110、RAM111、不揮発性記憶媒体112、割込みコントローラ113、クロック発振器114、タイマ104、時計109の接続形態はさまざまであるが、本発明の効果が失われるものではない。タイマ116は、OSのスケジューラを起動するために、所定の周期で割込みを発生するタイマICである。
 つぎに、本発明による周期処理の実行手順のフローチャートを図3に示す。はじめに、タスク処理実行部100は、周期処理実行の準備を補正部101に依頼する(S001)。次に待機期間設定部107が初期待機期間を求める(S002)。その後、周期処理部108は周期処理を実行する(S003)。
 次に、周期処理実行のための準備手順について図4のフローチャートにより説明する。補正部101は、周期処理登録部102に周期処理実行の準備を依頼する(S010)。次に周期処理登録部102は、タイマ104の割込みによって補正部101が起動するように登録する(S011)。続けて、周期処理登録部102は、周期処理部108の指定する周期で割込み信号を発生させるようにタイマ104を設定し、タイマ104の動作を開始させる(S012)。タイマ104は、指定周期が経過すると割込みを発生させる(S013)。この割込みによって、割込みハンドラ起動部103は、補正部101を起動させる(S014)。
 起動した補正部101の待機期間設定部107は現在の時刻を時計109から取得して保存する(S015)。次のタイマ104の割込みによって、再び待機期間設定部107が起動すると現在の時刻を時計109から取得して保存する(S016)。その後、前回保存した時刻との差分を求め、これまでに求めた計算値で最大のものを保存する(S017)。次に終了条件が成立したかをみて、成立していない場合はS016からの手順を繰り返し、成立していれば手順を終了する(S018)。これらの計測によって求められた差分の最大値から周期を引いた値を初期待機期間αとする(S019)。なお、これらの手順の中で計測できなかったより大きな差分が存在する可能性を考慮して、差分の最大値に所定の値を足した値を初期待機期間αとしてもよい。図4の準備手順によって初期待機期間αを求めるタイミングは、タスク処理実行部100が補正部101に依頼する時の他、OSのアイドル時に実行したり定期的に実行することができる。定期的実行の具体例として、UNIX(登録商標)系OSにおけるcronコマンドが挙げられる。
 初期待機期間αは、これと別に割込み発生から割込みハンドラ起動までの処理時間のジッタを計測し、初回の周期処理の実行時には計測した前記ジッタの最大値を採用しても良い。所定の周期で割込みを発生させるように前記タイマを設定し、割込み発生から割込みハンドラ起動部の起動までの処理時間のジッタを計測し、初回の周期処理の実行時には計測した前記ジッタの最大値の間待機してから周期処理を実行し、次回以降は前回の周期処理開始時点に周期を足した時刻まで待機してから周期処理を実行することができる。
 手順の終了条件としては、所定の回数タイマ104の割込みを発生させて差分を計算したか、所定の時間経過したか、所定のプログラム変数、レジスタ、メモリの値が所定の値になったか等が挙げられる。
 時計109における時刻表現がクロック数の場合は、時計109の動作時間が時計109の計測可能な時間を越えた場合は、出力が初期化されて前回の計測値よりも現在時刻が小さい場合がある。その場合は差分計算を中止し、あるいは初期化を考慮して時計109の計測可能な時間を足して差分を計算する方法を使用しても良い。
 次に、周期処理の実行手順を図5のフローチャートに示す。はじめに、タスク処理実行部100が補正部101に周期処理部108の開始を依頼する(S020)。次に補正部101は、周期処理登録部102に割込みハンドラの設定を依頼する(S021)。周期処理登録部102は、タイマ104の割込みによって補正部101が起動するように登録する(S022)。そして周期処理登録部102は、周期処理部108の指定する周期で割込み信号を発生させるようにタイマ104を設定し、タイマ104の動作を開始させる(S023)。タイマ104は、指定周期が経過すると割込みを発生させる(S024)。この割込みによって、割込みハンドラ起動部103は、補正部101を起動させる(S025)。
 起動した補正部101の待機部105は、初期待機期間α待機する(S026)。その後、次期目標待機時刻設定部106が次期目標待機時刻Tnextを求める(S027)。それから、補正部101は周期処理部108を起動し、周期的な処理を実行する(S028)。周期的な処理の終了後、終了条件が成立したかをみて(S029)、成立していれば手順を終了する。成立していない場合は次のタイマ104の割込みを待つ。タイマ104は、指定周期が経過すると割込みを発生させる(S030)。この割込みによって、割込みハンドラ起動部103は、補正部101を起動させる(S031)。起動した補正部101の待機部105は、次期目標待機時刻Tnextまで待機する(S032)。その後、次期目標待機時刻設定部106が次期目標待機時刻Tnextを求める(S033)。それから、補正部101は周期処理部108を起動し、周期的な処理を実行する(S034)。あとはS029からの手順を繰り返す。
 終了条件としては、所定の回数タイマ104の割込みを発生させて差分を計算したか、所定の時間経過したか、所定のプログラム変数、レジスタ、メモリの値が所定の値になったか等が挙げられる。
 タスク処理実行部100が補正部101に周期処理部108の開始を依頼する実装としては、専用のAPI(アプリケーションプログラミングインターフェース)を定義することができる。その場合、引数には周期、周期処理部108へのポインタが例示される。その他の引数として、関数呼出し後、どれくらいの期間で周期処理部108を実行するかという時間、周期処理部108の開始条件となる事象、周期処理部108の1回あたりの最大処理時間等が用いられる。また、定義されたAPIの戻り値として所定の値を返すことができる。所定の値の内容としては、成功、周期指定が短すぎる、長すぎる、すでに他に周期処理が登録されており実行不能あるいは周期精度が期待できない等のエラーが挙げられる。
 上記の事項手順において、補正部101が起動した時すでに次期目標待機時刻Tnextを過ぎていた場合は、以下の様な所定の処理を実行する。所定の処理の具体例として、OSの画面上に次期目標待機時刻Tnextを過ぎたことを知らせるダイアログを表示する、ログに記録する、周期処理を実行しない、次期目標待機時刻Tnextを過ぎた現在時刻に周期を足した時刻を次期目標待機時刻として周期処理を継続する、LED等の表示装置を計算機117に取り付け、外部へ通知する等が挙げられる。
 タイマ104の割込み発生後の次期目標待機時刻Tnextの求め方を図6に示す。はじめに、タイマ104の割込みによって割込みハンドラ起動部103が補正部101を起動する(S040)。次に、補正部は周期処理が初回かどうかを判断する(S041)。初回であれば、初期待機期間α待機し(S042)、初回でなければ、次期目標待機時刻Tnextまで待機する(S043)。待機後、時計109から現在時刻を取得し、その現在時刻に周期を足した時刻を次のTnextとする(S044)。
 次に、待機部105の二つの待機方法を図7、図8のフローチャートに示す。図7に示す第1の方法では、はじめに待機を開始すると(S050)、次に時計109から現在時刻を読み取る(S051)。読み取った現在時刻が目標待機時刻以降かどうかをみる(S052)。目標待機時刻以降でなければ手順S051を繰り返し、目標待機時刻以降であれば待機処理を終了する(S053)。
 また、図8に空ループを用いた第2の待機方法を示す。空ループはC言語等ではfor文によって実装される。事前に空ループの1回の処理時間を計測し(S060)、目標待機時刻までの期間分の空ループの必要な実行回数を求める(S061)。そして、求めた実行回数分空ループを実行する(S062)。実行回数分空ループを実行すると待機終了となる(S063)。図7、図8のいずれの方法においても、待機していることを確認するため待機中は外部IOを用いて信号を出力することができる。
 これらの構成をとることによって、タスク処理実行部100の周期処理部108は、待機部105の精度と、タイマ104の周期で実行することができる。割込みハンドラ起動部103によりタイマ104の割込みを用いることで、OSのスケジューラの周期とは独立して周期を指定することができ、且つ、スケジューラのスケジューリング処理を伴わないため、低ジッタ、低遅延で周期処理を実行することができる。したがって、スケジューラを用いて周期処理を実行する場合に比べて他のタスクの実行時間を増加させることができ、システム全体のスループットを向上することができる。
 図9は、本発明を適用したソフトウェア構成の実施例2を示すブロック図である。図に使用する符号が同一の場合は特に断りのない限り実施例1で説明した機能や要素と同一である。
 図1の割込みハンドラ起動部103に替えてスケジューラ120が設けられている。スケジューラ120は、一定周期で発生するクロックの割り込みによって起動され、OSの実装に依存した評価指標によって実行可能なタスク群から、次に実行するタスクを選択し起動させる。実行可能なタスク群には補正部101が含まれる。
 図10は、本発明を適用したソフトウェア構成を実装するシステムを示すブロック図である。本発明による周期処理の実行手順の概要は実施例1における図3と同様である。
 次に、周期処理実行のための準備手順について図11のフローチャートに示す。補正部101は、周期処理登録部102に周期処理実行の準備を依頼する(S070)。次に周期処理登録部102は、スケジューラ120の起動周期の整数倍である、周期処理部108の指定する周期で、周期処理部108が起動するようにスケジューラ120を設定する(S071)。周期処理部108の指定周期は、スケジューラ120の起動周期のN倍とする(S072)。スケジューラ120の実行回数の計測値Iを0とする(S073)。スケジューラ120が実行されると計測値Iを1増やす(S074)。次に、計測値IがNと等しいかどうかをみる(S075)。等しくなければ、S074からの手順を繰り返す。
 計測値IがNと等しければ、補正部101を起動する(S076)。起動した補正部101は現在の時刻を時計109から取得して保存する(S077)。次に、再び補正部101が起動すると現在の時刻を時計109から取得して保存する(S078)。その後、前回保存した時刻との差分を求め、これまでに求めた計算値で最大のものを保存する(S079)。終了条件が成立したかをみて(S080)、成立していない場合はS078からの手順を繰り返し、成立していれば手順を終了する。これらの計測によって求められた差分の最大値から周期を引いた値を初期待機期間αとする(S081)。終了条件としては、所定の回数スケジューラ120が起動したかや、所定の時間経過したか、所定のプログラム変数、レジスタ、メモリの値が所定の値になったか等が挙げられる。
 次に、周期処理の実行手順を図12に示す。はじめに、タスク処理実行部100が補正部101に周期処理部108の開始を依頼する(S090)。次に補正部101は、周期処理登録部102にスケジューラ120が補正部101を起動するように依頼する(S091)。次に周期処理登録部102は、スケジューラ120の起動周期の整数倍である、周期処理部108の指定する周期で、周期処理部108が起動するようにスケジューラ120を設定する(S092)。周期処理部108の指定周期は、スケジューラ120の起動周期のN倍とする(S093)。スケジューラ120の実行回数の計測値Iを0とする(S094)。スケジューラ120が実行されると計測値Iを1増やす(S095)。次に、計測値IがNと等しいかどうかをみる(S096)。等しくなければ、S095からの手順を繰り返す。
 計測値IがNと等しければ補正部101を起動する(S097)。起動した補正部101の待機部105は、初期待機期間α待機する(S098)。その後、次期目標待機時刻設定部106が次期目標待機時刻Tnextを求める(S099)。それから、補正部101は周期処理部108を起動し、周期的な処理を実行する(S100)。周期的な処理の終了後、終了条件が成立したかをみて(S101)、成立していれば手順を終了する。
 成立していない場合は次の補正部101の起動を待つ。スケジューラ120による補正部101の起動手順はS093~S097の手順である。スケジューラ120は、補正部101を起動させる(S102)。起動した補正部101の待機部105は、次期目標待機時刻Tnextまで待機する(S103)。その後、次期目標待機時刻設定部106が次期目標待機時刻Tnextを求める(S104)。それから、補正部101は周期処理部108を起動し、周期的な処理を実行する(S105)。あとはS101からの手順を繰り返す。終了条件としては、所定の回数スケジューラ120が起動したかや、所定の時間経過したか、所定のプログラム変数、レジスタ、メモリの値が所定の値になったか等が挙げられる。次期目標待機時刻Tnextの求め方は図6と同様である。
 以上の実施例によって、タスク処理実行部100の周期処理部108を、待機部105の精度と、スケジューラ120の周期で実行することができる。
 図13は、本発明を適用したソフトウェア構成の実施例3を示すブロック図である。実施例に使用する符号が同一の場合は、特に断りのない限り実施例1、実施例2で説明した機能や要素等と同一であることを意味する。図1に比較して、新たに同期部130、通信部131を備えている。
 同期部130は、図13のソフトウェア構成を有する複数の計算機の同期部130とのタイミングの同期をとる。具体例としてはNTP(Network Time Protocol)、SNTP(Simple Network Time Protocol)、GPS、IEEE1588方式による同期等が挙げられる。通信部131は、図13のソフトウェア構成を有する複数の計算機と接続し、情報を送受信する。通信部131の具体例としては、Ethernet(登録商標)、TCP/IP、無線通信等が挙げられる。
 図14は、本発明を適用したソフトウェア構成を実装するシステムを示すブロック図である。LAN140は、ネットワークとの通信機能を実装した送受信機ICである。LAN140の提供する通信規格としてEthernet(登録商標)等が例示される。ネットワーク141は、計算機117と図13のソフトウェア構成を有する計算機を含む他の計算機と接続し、所定の情報通信を行う。
 初期待機期間を求める手順は図4と同様であるが、初期待機期間を求める前に、図14に示すシステムにネットワーク141で接続された図13のソフトウェア構成を有する複数の計算機の各補正部101に、補正部101は通信部131を用いて、同様に図4の手順を実行するように通知する。各計算機において、各初期待機間が求められたら、通信部131を通じて、それぞれの初期待機期間を交換し、交換された初期待機期間の中の最大値を最終的な初期待機期間として決定する。それから、各計算機の周期処理部108を実行させるタイミングを、同期部130によって同期させ、各計算機で図5の手順を実行する。
 以上の実施例によって、複数の計算機において、同期部130によって同期されたタイミングで、各計算機はタスク処理実行部100の周期処理部108を、それぞれの計算機における待機部105の精度と、タイマ104の周期で実行することができる。
 
 
 

Claims (14)

  1.  周期的なタスク処理を実行するタスク処理実行部と、所定の周期で割込みを発生可能なタイマと、前記タスク処理実行部を起動する補正部と、前記補正部からの依頼を受けて前記タイマの割込みから前記補正部を起動するように登録する周期処理登録部と、前記タイマの割込みから前記補正部を起動する補正部起動手段と、時刻を前記補正部に提供する時計とを有し、
     前記補正部は、補正部を周期起動させ各周期起動時刻から初期待機期間を決定する待機期間設定部と、前記タスク処理実行部の初回起動時には初期待機期間のあいだ待機し、次回以降の起動時には次期目標待機時刻まで待機してから前記タスク処理実行部の周期処理を起動する待機部と、前記待機部が待機後の時刻と周期から次期目標待機時刻を決定する次期目標待機時刻設定部を有することを特徴とする情報処理装置。
  2.  請求項1記載の情報処理装置において、前記待機期間設定部は、前記補正部を周期駆動させ各周期起動時刻の差分の最大値から周期を引いた値を初期待機期間とすることを特徴とする情報処理装置。
  3.  請求項1または2に記載の情報処理装置において、前記次期目標待機時刻設定部は、前記待機部が待機後の時刻に周期を足した時刻を次期目標待機時刻とすることを特徴とする情報処理装置。
  4.  請求項1から請求項3に記載のうち1つの情報処理装置において、前記補正部起動手段を割込みハンドラ起動部としたことを特徴とする情報処理装置。
  5.  請求項1から請求項4に記載のうちの1つの情報処理装置において、前記補正部起動手段をスケジューラとしたことを特徴とする情報処理装置。
  6.  請求項1から請求項5に記載のうちの1つの情報処理装置において、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、各情報処理装置で求めた前記初期待機期間を前記通信部を用いて各情報処理装置間で交換し、そのうちの最大となる初期待機期間を各情報処理装置の初期待機期間とし、各情報処理装置は前記同期部で同期されたタイミングで同時に周期処理を実行することを特徴とする情報処理装置システム。
  7.  周期的なタスク処理を実行するタスク処理実行部と、所定の周期で割込みを発生可能なタイマと、前記タスク処理実行部を起動するとともに待機期間設定部と次期目標待機時刻設定部と待機部とを有する補正部と、前記補正部からの依頼を受けて前記タイマの割込みから前記補正部を起動するように登録する周期処理登録部と、前記タイマの割込みから前記補正部を起動する補正部起動手段と、時刻を前記補正部に提供する時計とを有する情報処理装置の周期タスク実行方法において、
     前記補正部の待機期間設定部は前記補正部を周期起動させ各周期の起動時刻から初期待機期間を決定し、前記待機部は前記補正部による前記タスク処理実行部の初回起動時には初期待機期間のあいだ待機し、次回以降の前記補正部の起動時には前記次期目標待機時刻設定部が設定する次期目標待機時刻まで待機してから前記タスク処理実行部の周期処理を起動し、次期目標待機時刻設定部は前記待機部が待機後の時刻と周期から次期目標待機時刻を決定することを特徴とする情報処理装置の周期タスク実行方法。
  8.  請求項7記載の情報処理装置の周期タスク実行方法において、前記待機期間設定部は、前記補正部を周期駆動させ各周期の起動時刻の差分の最大値から周期を引いた値を初期待機期間とすることを特徴とする情報処理装置の周期タスク実行方法。
  9.  請求項7または8に記載の情報処理装置の周期タスク実行方法において、前記次期目標待機時刻設定部は、前記待機部が待機後の時刻に周期を足した時刻を次期目標待機時刻とすることを特徴とする情報処理装置の周期タスク実行方法。
  10.  請求項7から請求項9に記載のうちの1つの情報処理装置の周期タスク実行方法において、前記補正部起動手段を割込みハンドラ起動部としたことを特徴とする情報処理装置の周期タスク実行方法。
  11.  請求項7から請求項9に記載のうちの1つの情報処理装置の周期タスク実行方法において、前記補正部起動手段をスケジューラとしたことを特徴とする情報処理装置の周辺タスク実行方法。
  12.  請求項7から請求項11に記載のうちの1つの情報処理装置の周期タスク実行方法において、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、各情報処理装置で求めた前記初期待機期間を前記通信部を用いて各情報処理装置間で交換し、そのうちの最大となる初期待機期間を各情報処理装置の初期待機期間とし、各情報処理装置は前記同期部で同期されたタイミングで同時に周期処理を実行することを特徴とする情報処理装置システムの周期タスク実行方法。
  13.  請求項10に記載の情報処理装置の周期タスク実行方法において、
     所定の周期で割込みを発生させるように前記タイマを設定し、割込み発生から割込みハンドラ起動部の起動までの処理時間のジッタを計測し、初回の周期処理の実行時には計測した前記ジッタの最大値の間待機してから周期処理を実行し、次回以降は前回の周期処理開始時点に周期を足した時刻まで待機してから周期処理を実行することを特徴とする情報処理装置の周期タスク実行方法。
  14.  請求項13に記載の情報処理装置の周期タスク実行方法において、前記情報処理装置は複数の情報処理装置間で時刻を同期できる同期部と、複数の情報処理装置間で情報を通信できる通信部とを備え、それぞれの情報処理装置で、所定の周期で割込みを発生させるように前記タイマを設定し、割込み発生から割込みハンドラ起動部の起動までの処理時間のジッタを計測して、前記ジッタの最大値を他の情報処理装置と交換し、各情報処理装置は交換された前記ジッタの中の最大値の間、初回の周期処理の実行時に待機してから周期処理を実行し、次回以降は前回の周期処理開始時点に周期を足した時刻まで待機してから周期処理を実行することを特徴とする情報処理装置システムの周期タスク実行方法。
PCT/JP2009/000563 2008-06-19 2009-02-13 情報処理装置およびその周期タスク実行方法 WO2009153900A1 (ja)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2008-160018 2008-06-19
JP2008160018A JP5101403B2 (ja) 2008-06-19 2008-06-19 情報処理装置およびその周期タスク実行方法

Publications (1)

Publication Number Publication Date
WO2009153900A1 true WO2009153900A1 (ja) 2009-12-23

Family

ID=41433827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/000563 WO2009153900A1 (ja) 2008-06-19 2009-02-13 情報処理装置およびその周期タスク実行方法

Country Status (2)

Country Link
JP (1) JP5101403B2 (ja)
WO (1) WO2009153900A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111837103A (zh) * 2018-03-20 2020-10-27 日立汽车系统株式会社 车辆控制装置及其控制方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05158577A (ja) * 1991-12-11 1993-06-25 Fujitsu Ltd タイマカウンタ事前計算方式
JPH05177567A (ja) * 1992-01-06 1993-07-20 Canon Inc ロボット制御装置
JPH06175982A (ja) * 1992-12-08 1994-06-24 Fujitsu Ltd マルチプロセッサシステムにおけるtod同期化制御方法
JPH09223026A (ja) * 1996-02-19 1997-08-26 Fuji Electric Co Ltd 時刻スケジューラの時間補正方法
JP3734042B2 (ja) * 1994-11-30 2006-01-11 ソニー株式会社 プロセス管理方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05158577A (ja) * 1991-12-11 1993-06-25 Fujitsu Ltd タイマカウンタ事前計算方式
JPH05177567A (ja) * 1992-01-06 1993-07-20 Canon Inc ロボット制御装置
JPH06175982A (ja) * 1992-12-08 1994-06-24 Fujitsu Ltd マルチプロセッサシステムにおけるtod同期化制御方法
JP3734042B2 (ja) * 1994-11-30 2006-01-11 ソニー株式会社 プロセス管理方法
JPH09223026A (ja) * 1996-02-19 1997-08-26 Fuji Electric Co Ltd 時刻スケジューラの時間補正方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111837103A (zh) * 2018-03-20 2020-10-27 日立汽车系统株式会社 车辆控制装置及其控制方法

Also Published As

Publication number Publication date
JP2010003030A (ja) 2010-01-07
JP5101403B2 (ja) 2012-12-19

Similar Documents

Publication Publication Date Title
JP4840455B2 (ja) フィールド制御システム
JP7394986B2 (ja) データパケットを送信する方法、及びこの方法を実施する装置
JP6359098B2 (ja) 分散リアルタイムシステムにおいて周期的なタスクの間で適時にデータを引き渡す方法
US20170078442A1 (en) Adaptive scheduling and orchestration in a networked environment
KR101636496B1 (ko) 신호 동기 시스템, 노드 동기 시스템, 신호 동기 방법, 및 노드 동기 방법
Puck et al. Distributed and synchronized setup towards real-time robotic control using ROS2 on Linux
Quinson et al. Parallel simulation of peer-to-peer systems
EP2551768A1 (en) Multi-core system and start-up method
JP5101403B2 (ja) 情報処理装置およびその周期タスク実行方法
JP2006349364A (ja) 時刻補正方法
Hladik et al. Adequacy between AUTOSAR OS specification and real-time scheduling theory
JP4961589B2 (ja) ネットワークシステムおよびスレーブ同期方法
Chen et al. A note on the period enforcer algorithm for self-suspending tasks
Maruyama et al. ARM-based SoC with loosely coupled type hardware RTOS for industrial network systems
Torfs et al. TDMA on commercial of-the-shelf hardware: Fact and fiction revealed
Kasparick et al. Measuring latencies of IEEE 11073 compliant service-oriented medical device stacks
EP1685485A1 (en) Task management system
Pérez et al. EDF scheduling for distributed systems built upon the IEEE 802.1 AS clock-A theoretical-practical comparison
Lakhani et al. Applying design patterns to improve the reliability of embedded systems through a process of architecture migration
Tijero et al. First steps towards an IEEE 802.1 AS clock for EDF scheduling in distributed real-time systems
Xu et al. Towards fault-tolerant real-time scheduling in the seL4 microkernel
JP6869447B1 (ja) 時刻同期装置、時刻同期システム、時刻同期方法及びプログラム
Peeck et al. Online latency monitoring of time-sensitive event chains in ROS2
Thibodeaux The specification and implementation of a model of computation
Pérez Tijero et al. First steps towards an IEEE 802.1 AS clock for EDF scheduling in distributed real-time systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09766348

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09766348

Country of ref document: EP

Kind code of ref document: A1