WO2024196401A1 - Co-operative scheduler with detection of task executing longer than an expected execution time without interrupting execution of the task - Google Patents
Co-operative scheduler with detection of task executing longer than an expected execution time without interrupting execution of the task Download PDFInfo
- Publication number
- WO2024196401A1 WO2024196401A1 PCT/US2023/033327 US2023033327W WO2024196401A1 WO 2024196401 A1 WO2024196401 A1 WO 2024196401A1 US 2023033327 W US2023033327 W US 2023033327W WO 2024196401 A1 WO2024196401 A1 WO 2024196401A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- task
- execution time
- timer
- circuit
- expected execution
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
- G06F9/4887—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
- G06F11/3419—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
Definitions
- the present disclosure relates to co-operative schedulers and, more particularly, to detection and recording of an “incorrect allocation of execution time” task overrun in a cooperative scheduler.
- a Deadman Timer or Watchdog Timer may provide a first line of defense for task overruns, i.e., task execution being stuck for some hardware module failure, infinite loops in the task, or other overruns without limitation.
- Task overruns due to software malfunctions despite validated allocation of execution time may be detected by DMT/WDT.
- an “incorrect allocation of execution time” task overrun is an issue with the allocation of execution time by the user and could be due to insufficient loop timeout values for hardware access in the tasks, incorrect baud rate setting, or incorrect synchronization between tasks, all of which are correctable features.
- a secondary timer may compute the execution time of the tasks because the primary timer is used by the co-operative scheduler to execute the tasks.
- a secondary timer may compute execution time of the tasks and subsequently detect task overruns, if any, by various means. To detect task overruns, the secondary timer may use an expected execution time for a particular task. This is taken as an input from the user through a parameter in the software application programming interface (API). This expected execution time is set as a period of the secondary timer.
- API software application programming interface
- a first method may use the interrupt mechanism on the secondary timer. If the task execution time exceeds this period, an interrupt is generated indicating a task overrun. Unfortunately, the interrupt mechanism may temporarily “block the execution” of the task, which is a fault as per the Annexure D in ISO 26262-Part 6 standard. Secondly, to have uninterrupted access to the CPU, the tasks themselves may disable the interrupts during execution of critical sections of the code (for example, while reading a value from an analog to digital converter (ADC)). Also, the factor by which the task overshoots the expected execution time cannot be accurately computed, due to any intermediate jump to the Interrupt Service Routine (ISR).
- ADC analog to digital converter
- a second method may configure a secondary hardware timer (if available) and configures its period to be equal to the "expected execution time" for the task. While a secondary timer is used in both this second method and the first method, a difference is that, in the first method an interrupt is generated once there is a timer overflow, and in this second method an interrupt is not generated but the timer overflow status is captured in the hardware register bit in the secondary timer module. Typically, interrupts are enabled so that upon a period match, an interrupt occurs and the corresponding interrupt service routine (ISR) is triggered to record the overflow. However, similar to the first method, this method blocks execution of the task. Because the interrupts partially block the execution of the code, this method is not feasible. Additionally, to alleviate the problem of interrupts partially blocking the execution of the code, the tasks themselves may disable the interrupts as part of execution of priority sections of the code. So if an overflow occurs during the execution of priority section of the code, the overflow event may be missed.
- ISR interrupt service routine
- a third method may use the secondary timer in a non-interrupt mode, and check the timer overflow interrupt flag in the interrupt status register once the task execution is completed. A set flag indicates a task overflow. However, the interrupt status register may have both read and write access. If the application task clears the secondary timer overflow interrupt flag in the interrupt status register, then the overflow status may be lost.
- a fourth method uses timer difference methodology to configure an additional hardware timer and configure its period to be equal to the "expected execution time" for the task.
- the timer is started and the timer value is recorded before and after the task execution. If the task execution continues after the rollover, the timer resets and starts counting from zero (0).
- the method does not differentiate between a simple difference between the two timer values and the difference after a rollover event. It may be difficult to differentiate between simple difference and difference after rollover, as both are positive values.
- an apparatus comprising: a co-operative scheduler of a task of an application; a timer circuit to detect a task of an application executing longer than an expected execution time for the task without interrupting execution of the task; and a record circuit to record that a task executing longer than an expected execution time has been detected by the timer circuit.
- a system comprising: a co-operative scheduler of tasks of an application; a timer circuit; a record circuit; a memory to store instructions to operate the co-operative scheduler, the timer circuit, and the record circuit; and a processor coupled to the memory to execute the instructions to cause: the co-operative scheduler to schedule tasks of an application; the timer circuit to detect a task of an application executing longer than an expected execution time for the task without interrupting execution of the task; and the record circuit to record that a task executing longer than an expected execution time has been detected by the timer circuit.
- Example co-operative schedulers that record an “incorrect allocation of execution time” task overrun when the task overruns its expected execution time, without interrupting execution of the task.
- Example co-operative schedulers may also notify the application defining the task of the “incorrect allocation of execution time” task overrun and provide to the application a correction factor for application to the expected execution time for tasks.
- FIGURE 1 shows a block diagram of a system for executing tasks of an application scheduled by a co-operative scheduler, a timer circuit and a record circuit for detecting and recording when a task executes for longer than an expected execution time.
- FIGURE 2 shows a more detailed block diagram of a system than shown in FIGURE 1 having a co-operative scheduler, a timer circuit, a record circuit, a correction circuit, and an application programming interface.
- FIGURE 3 shows a flow chart of operation of the systems shown in FIGURES 1 and 2.
- FIGURE 4 shows a block diagram of an alternative timer circuit.
- FIGURE 5 shows a flow chart of operation of a system having the timer circuit of FIGURE 4.
- FIGURE 6 shows a method for co-operatively scheduling tasks, detecting task overruns and recording the detected overruns. .
- FIGURE 7 shows a block diagram of a device having a co-operative scheduler, a timer circuit and a record circuit.
- FIGURE 8 shows a block diagram of a system having a processor, a memory, a cooperative scheduler, a timer circuit, and a record circuit.
- An aspect provides a co-operative scheduler that records an incorrect allocation of execution time task overrun without interrupting execution of the task.
- the co-operative scheduler determines when a task has executed for longer than an expected execution time, records that the task has executed for longer than expected, and notifies the application defining the task of an “incorrect allocation of execution time” task overrun without interrupting execution of the task.
- a co-operative scheduler provides to the application defining the task a correction factor for application to the expected execution time.
- the co-operative scheduler may have a correction circuit to correct the expected execution time by adding a correction factor based on the time the task executes after an incorrect allocation of execution time task overrun has been recorded.
- the co-operative scheduler may have a timer circuit to capture a run execution time of the task.
- An aspect identifies the incorrect expected execution time allocation and provides a correction factor if the expected execution time allocated time is less than the actual time of execution. Rather than interrupting a task executing longer than expected, the actual time of execution may be captured and then a correction factor may be applied statically in the form of an "increased expected execution time.”
- An aspect provides a method to detect incorrect allocation of execution time task overruns, record the detected overruns, and notify the user so the user can adjust the expected execution time of the task or modify the task implementation so that the execution time of the task will be within the expected execution time.
- a correction factor of a task overrun may be provided as information to the user. The correction factor may be applied by the user to revise the expected execution time and input the revised expected execution time using the same application programming interface (API) the user had initially used to input the expected execution time for the task. Alternatively, the user may revise the task for faster execution.
- API application programming interface
- a user initially inputs an expected execution time of 100 microseconds for a particular task using the API.
- the run execution time for a CPU to execute the task is 120 microseconds.
- the user is provided information that the task overran by 20 microseconds.
- the user may again use the same API to input a revised expected execution time of 120 microseconds for the task.
- a correction factor may be the actual execution time divided by the expected execution time.
- the correction factor may be multiplied by the original expected execution time to provide a revised expected execution time.
- the user may inspect the task to see where the extra 20 microseconds is being spent, and make suitable changes in the task so the CPU will be able to execute the task in less than 100 microseconds.
- aspects may be implemented as a feature in a co-operative scheduler to monitor the execution time of the tasks.
- Annexure D of Part 6 of the ISO 26262, 2018, standard describes “freedom from interference” for software elements (tasks) used in applications running on a CPU device that aspire for Functional Safety compliance. “Incorrect allocation of execution” is a fault in this annexure for the software elements (tasks).
- An aspect provides an update to the application defining a task running on a CPU device about task overruns for its allocated execution time. Detecting this task overrun may provide compliance with the ISO 26262 standard.
- task overruns may be identified and recorded by using a combination of a timer circuit and a record circuit.
- the “expected execution time” for every task is taken as a user input to the application defining the task running on a CPU device through an application programing interface (API).
- the timer circuit may be configured in a timer mode (e.g., interrupts disabled , or not enabled, as the feature may work without interrupts) with the “expected execution time” being input as a period of the timer.
- a timer of the timer circuit is started, e.g., by setting a start bit in a start register of the timer circuit via task monitoring software code of the co-operative scheduler or a correction circuit.
- a method is provided to inform the user that a particular task has exceeded its ’’expected execution time.”
- the time allocated for a task may be taken as an input from the user.
- the tasks may not be interrupted either by other tasks, or by interrupts. In such a scenario, a method to record task overruns, without interrupting the execution of the tasks, may allow more efficient execution of the application. This may be important when used in relation to a functional safety compliant co-operative scheduler.
- Embodiments provide circuits that may be implemented by instructions for execution by a processor, analog circuitry, digital circuitry, control logic, digital logic circuits programmed through hardware description language, application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), programmable logic devices (PLD), or any suitable combination thereof, whether in a unitary device or spread over several devices.
- Circuits may be implemented by instructions for execution by a processor through, for example, a function, application programming interface (API) call, script, program, compiled code, interpreted code, binary, executable, executable file, firmware, object file, container, assembly code, or object.
- circuits may be implemented by instructions stored in a non-transitory medium such as a memory that, when loaded and executed by a processor (or any other suitable process), cause the functionality of the circuits described herein.
- FIGURE 1 shows a block diagram of a system for executing tasks of an application scheduled by a co-operative scheduler 110, a timer circuit 120 and a record circuit 130 for detecting and recording when a task executes for longer than an expected execution time.
- the system also has an application 100, a correction circuit 140, and application programming interface 150, and a processor (CPU) 106.
- the application 100 may have several tasks 102i through 102n.
- the timer circuit 120 may detect an overrun of a task 102i through 102n of application 100 executing longer than an expected execution time for the task without interrupting execution of the task.
- the record circuit 130 may record that an overrun has been detected by the timer circuit 120.
- the correction circuit 140 may allow a user to correct or revise the expected execution time via a correction factor after an overrun has been detected.
- the correction circuit 140 may be a combination of hardware and software, purely hardware, or purely software, without limitation.
- a correction factor may be a time remaining to complete execution of a task after a rollover event, an execution run time for a task, or a multiplier of the originally entered expected execution time.
- the correction circuit 140 provides a correction factor to the user of the application through the application programming interface circuit 150.
- the user may also use the application programming interface circuit 150 to provide the expected execution time, whether revised by a correction factor or not, to the timer circuit 120.
- the user may provide an update at least partially responsive to the correction factor.
- the correction circuit 140 may correct the expected execution time by adding the time the task executes after an overrun has been detected to the expected execution time.
- FIGURE 2 shows a more detailed block diagram of several components shown in FIGURE 1 for detection of a task overrun.
- a co-operative scheduler 210 provides a task start indication and a task end indication to a correction circuit 240.
- the correction circuit 240 Upon receipt, respectively, the correction circuit 240 provides a corresponding start bit to the start register 228 in response to the task start indication and an end bit to the end register 229 of the timer circuit 220 in response to the task end indication.
- the correction circuit 240 also receives an expected execution time from a user via an application programming interface 250 and inputs the expected execution time into an expected execution time register 224 of the timer circuit 220.
- a timer circuit 220 has a time base generator 221, a timer 222, a timer counter register 223, an expected execution time register 224, start register 228, end register 229, and a comparator 225.
- the timer 222 acts as a controlled clock, responsive to the start register 228 and end register 229, and increments the timer counter register on a predetermined edge of a clock provided by time base generator 221.
- the time base generator 221 is part of a hardware module that provides the clock to count the timer 222, wherein the time base generator 221 may use clock signals available on the microcontroller including a system clock and other on-chip oscillator sources, as well as external clock inputs.
- a record circuit 230 may have a D flip flop, with Set and Reset inputs.
- the record circuit 230 may be formed of a configurable module, and have a configuration where the inputs can be controlled by software.
- the record circuit 230 may be hardware and provide S, R and D inputs 231, 232, 233, respectively, with software values 0, 0 and 1, respectively, as shown in FIGURE 2.
- a detection output 226 from the timer circuit 220 may be fed as the clock input 234 to the D flip flop of record circuit 230.
- a timer rollover may happen on various occasions. For example, when the timer counter register 223 reaches FFFF (hexadecimal), the timer counter register 223 may rollover to 0000 (hexadecimal).
- the expected execution time register 224 holds the expected execution time (e.g., 1234 (hexadecimal)
- the timer counter register 223 counts up from 0000 (hexadecimal) until it matches with the expected execution time register 224 (e.g., 1234 (hexadecimal)
- a comparator 225 signals a reset/trigger control 227 and the reset/trigger control 227 resets or rolls over the timer counter register 223 to 0000 (hexadecimal).
- the reset/trigger control 227 monitors the value in the timer counter register 223 and receives output signals of the comparator 225, and uses this information to note the value in the timer counter register 223 has rolled over to 0000 (hexadecimal) or to reset the value in the timer counter register 223. Whenever there is a rollover of the timer counter register 223 or a reset of the timer counter register 223, the reset/trigger control 227 may produce a pulse detection output 226, which is fed as a clock input 234 to the D flip flop of record circuit 230. This clock pulse latches the logic input that is fed at D input 233, which latched logic high which appears at Q output 235.
- This logical output can be directly read as a detection output bit from record register 236 available in the record circuit 230 once the task execution is completed.
- the rollover of the expected execution time register may be thus recorded in the record register 236 register while the task is executed without interruption. If there are two overflows, a watchdog reset may occur. Also, because the task execution is uninterrupted, the computation of its execution run time can be easily recorded, in both expected execution time register overflow and expected execution time register non-overflow scenarios.
- the correction factor in terms of excess time for the task may be provided to the user.
- the expected execution time can be corrected or in some cases suitable changes can be made in the implementation of the tasks to allow execution of the task to complete within the expected execution time.
- the detection output 226 may also be read from the record register 236 and be provided to the correction circuit 240.
- the correction circuit 240 may also read the run execution time from the timer counter register 223 of the timer circuit 220.
- the correction circuit 240 may calculate a correction factor and provide it to the user via the application programming interface 250.
- FIGURE 3 shows a flow chart for detection of a task overrun via the timer circuit shown in FIGURE 2.
- An expected execution time from the user is input 302 to the expected execution time register and the timer counter register is set to zero.
- the start register is checked 304 whether it has received a start bit indicating a task has started execution. If NO, return and again check 304 for the start bit. If YES, the end register is checked 306 whether it has received an end bit indicating the task has ended execution. If NO, the timer increments the timer counter register 308.
- the expected execution time in the expected execution time register is compared 310 with the value in the timer counter register to determine whether they are equal.
- a detection output is generated 312 by the reset/trigger control, the detection output is recorded 314, the value in the timer counter register is reset 315 to zero (0) by the reset/trigger control, and the process returns to again check 306 the end register. If NO, i.e., the expected execution time in the expected execution time register is not equal when compared 310 with the value in the timer counter register, the process returns to again check 306 the end register. If the end register is checked 306 and is determined, YES, the end register has received an end bit indicating the task has ended execution, then the process checks 316 whether a detection output is in the record register. If NO, the process ENDS.
- the correction circuit If YES, the correction circuit reads the run execution time from the timer counter register. The correction circuit then calculates 320 a correction factor in view of the expected execution time, the run execution time and the detection output in the record register indicating a rollover event. The correction circuit then communicates 322 the correction factor to the user via the application programming interface.
- FIGURE 4 shows an alternative timer circuit 420.
- This timer circuit 420 operates with a co-operative scheduler, an application programming interface, and a record circuit as shown in FIGURE 2, but not shown in FIGURE 4.
- Timer circuit 420 has a start register 428, an end register 429, a timer counter register 423, and an expected execution time register 424, similar to the timer circuit 220 shown in FIGURE 2.
- Timer circuit 420 also has a time base generator 421, similar to the timer circuit 220 shown in FIGURE 2.
- the time base generator 421 may provide a time base or clock for the rest of the timer circuit 420 using clock signals available on a microcontroller. This serves as the time base for the timer circuit 420 without depending on another on-chip timer circuit.
- Up to eight clock inputs may be available to the time base generator 421, including a system clock and other on-chip oscillator sources. Depending on the device, external clock inputs may also be available.
- a prescaler may divide the selected clock source to a suitable frequency for use by the timer circuit 420.
- the time base generator 421 may synchronize its operation with the selected clock source, subject to input timing restrictions or the circuit’s operating conditions. Setting a timer synchronize bit may enable synchronization of the time base with the clock input.
- a reset/trigger control 427 reads the expected execution time from the expected execution time register 424 and inputs that value into the timer counter register 423, which starts counting down from the expected execution time.
- the reset/trigger control 427 first inputs the expected execution time into the timer counter register 423 and the timer counter register 423 decrements the value in timer counter register 423 according to a clock signal from the time base generator 421 until it reaches zero (0).
- the reset/trigger control 427 receives that information from the timer counter register 423 and generates a detection output 426 indicating execution of the task has overrun the expected execution time.
- the detection output 426 may be sent to a record circuit as shown in FIGURE 2, but not shown in FIGURE 4.
- the reset/trigger control 427 rolls over the timer counter register 423 by again inputting the expected execution time from the expected execution time register 424 into the timer counter register 423, which again counts down toward zero (0).
- the timer circuit 420 stops decrementing, and the correction circuit 440 reads the countdown execution time from the timer counter register 423.
- the correction circuit 440 calculates a correction factor as being equal to the expected execution time minus the countdown execution time. In this case, the correction factor is the amount of time the task executed beyond the expected execution time.
- the correction circuit 440 may communicate the correction factor to a user via an application programming interface (no shown). If the record register 236 has not recorded a rollover of the expected execution time register, then a correction factor need not be calculated. Alternately, if the record register 236 has not recorded a rollover of the expected execution time register, the countdown execution time from the timer counter register 423 may be reported as available time not utilized by the task.
- FIGURE 5 shows a flow chart for detection of a task overrun via the timing circuit shown in FIGURE 4.
- An expected execution time from the user is input 502 in the expected execution time register.
- the expected execution time from the user is also input 503 in the timer counter register.
- the start register is checked 504 whether it has received a start bit indicating a task has started execution. If NO, return and again check 504 for the start bit. If YES, the end register is checked 506 whether it has received an end bit indicating the task has ended execution. If NO, the timer counter register is decremented 508 according to a clock signal from the time base generator. The value in the timer counter register is checked 510 whether it is equal to zero (0).
- a detection output is generated 512
- the detection output is recorded 514 by a record circuit
- the value in the timer counter register is reset 515 to the expected execution time obtained from the expected execution time register, and the process returns to again check 506 the end register. If NO 510, the value in the timer counter register is not equal to zero (0), the process returns to again check 506 the end register.
- the end register is checked 506 and is determined, YES, the end register has received an end bit indicating the task has ended execution, then the process checks 516 whether a detection output is in the record register. If NO, the process ENDS. If YES, the correction circuit reads the countdown execution time from the timer counter register. The correction circuit then calculates 520 a correction factor in view of the expected execution time, the countdown execution time and the detection output in the record register. The correction circuit then communicates 522 the correction factor to the user via the application programming interface.
- An alternative timer circuit may increment the timer counter register according to the time base generator before, during, and after a task is executing.
- the timer circuit may also roll over the value of the timer counter register to zero (0) when it reaches the estimated execution time and generates a detection output.
- the correction circuit may read the value of the timer counter register when the start bit is input in the start register.
- the correction circuit may again read the value of the timer counter register when an end bit is input in the end register.
- the correction circuit may check for a detection output indicating a rollover occurred during task execution. If a rollover is indicated by a detection output, the correction circuit may determine total execution time of the task equals expected execution time plus the difference between the timer counter register values at start and end.
- the correction circuit may determine the execution time of the task as equal to the difference between the timer counter register values at start and end.
- Safety mechanisms in the co-operative scheduler may provide a watchdog reset if the task takes at least twice the expected execution time.
- Identification of task overruns may be recorded in the background while the CPU 106 is busy executing tasks 102i through 102n. See FIGURE 1. Identification of task overruns (rollover events) may be recorded in software or hardware, indicating the task has overrun or not. Overruns may be recorded in hardware, with a detection output being set in a hardware register, wherein the detection output may be a binary bit (high or low) recorded in a register.
- the timer circuit 120 may identify task overruns (rollover events).
- the expected execution time may be loaded in an expected execution time register 224 (see FIGURE 2), either before or during execution of the task by the CPU 106. See FIGURE 1.
- a timer may be loaded with an expected execution time and the timer may countdown to zero (0) whereupon it may generate a rollover pulse indicating a task has executed for longer than the expected execution time.
- Examples may record task overflows in hardware, without software intervention to record the overflow.
- Hardware examples may measure the lapsed execution time by incrementing or decrementing the timer counter register, record the overflow (detection output), and subsequently store the detection output as a bit in a hardware record register. See FIGURE 2.
- the detection output 226 may be stored in hardware record register without CPU intervention and during the execution of the task. Examples may also have no external hardware connections (usage of external pins) to store the detection output in the hardware register.
- the signals may be routed internally and the status of the overflow may be captured or recorded as data in a memory (not shown). As shown in FIGURE 2, the detection output 226 of the timer circuit 220 is sent to the record circuit 230 and the Q output 235 of the record circuit 230 is available in the record register 236.
- Examples may also include software routines that are a part of a functional safety compliant co-operative scheduler, used in applications that run using these co-operative schedulers.
- the algorithms may avoid blocking of execution, deadlocks, livelocks, or incorrect allocation of execution time.
- Task execution monitoring may be done for individual tasks. After completion of execution of an individual task, it is determined whether the individual task has overrun its expected execution time. Overrun determinations may be made respectively for individual tasks as they complete execution.
- FIGURE 6 shows a flow chart for a method.
- a task of an application is detected 602 executing longer than an expected execution time for the task without interrupting execution of the task.
- the task executing longer than an expected execution time that has been detected is recorded 604.
- Alternative examples of the method may report to a user task overruns (rollover events) beyond an expected execution time for the task, thereby allowing a user to correct the expected execution time, using a correction factor.
- the user may adjust the expected execution time for a particular task using the correction factor, so that the issue of incorrect allocation of execution time may be resolved.
- Detection and correction of an expected execution time may include detecting extreme task overruns (e.g., stuck execution due to hardware failure, infinite loops in task) and mitigating the extreme task overruns by a watchdog timer or a dead man timer, which may still occur even after an expected execution time has been correctly allocated.
- a task overrun (rollover event) beyond an incorrectly allocated expected execution time for the task may be due to insufficient loop timeout, incorrect baud rate, or incorrect synchronization between software elements. These overrun causes may be correctable.
- a co-operative scheduler may use a basic timer (primary timer) to execute tasks periodically.
- An additional or secondary timer may monitor the task execution time and task overruns.
- the secondary timer may be a timer circuit used in timer mode.
- the expected execution time for the task may be input by a user as the period of this secondary timer.
- the expected execution time is the value in expected execution time register 224 against which a run execution time in the timer counter register 223 is compared.
- the run execution time in timer counter register 223 matches the expected execution time in expected execution time register 224, the time for the task is supposed to have lapsed, but the has not completed, since the end bit has not been stored in end register 229. For example, if the expected execution time of a particular task is 100 microseconds, this expected execution time may be set in the expected execution time register 224.
- the timer 222 is started by a start bit being input in the start register 228, the value in the timer counter register 223 is zero (0), and the timer 222 periodically increments the timer counter register
- the comparator 225 compares the run execution time in the timer counter register 223 with the expected execution time in the expected execution time register 224. If they are equal, the comparator 225 will generate a detection output 226 and the value in the timer counter register 223 is reset to zero (0) by the reset/trigger control 227. Until the timer 222 is stopped by an end bit being input in the end register 229, the timer counter register 223 rolls over and continues counting from zero (0) until the next match with the expected execution time in the expected execution time register 224 or an end bit is input in the end register 229. Safety mechanisms in the co-operative scheduler may provide a watchdog reset if the task executes for longer than twice the expected execution time, wherein the watchdog timeout may be configured for twice the expected execution time of the task.
- a timer may be loaded with a value corresponding to an expected execution time for a task and the timer may generate a rollover when the timer reaches “zero.”
- a detection output 226 from the timer circuit 220 may be captured or recorded by the record circuit 230.
- the pulse generated by the detection output 226 of the timer circuit 220 may be a pulse.
- the detection output 226 may be fed from the timer circuit 220 to the record circuit 230.
- the record circuit 230 may be configured as a D flip flop, with the detection output 226 fed to the clock input of the D flip flop, so that the pulse may generate a predetermined output of the D flip flop.
- the predetermined output of the D flip flop in response to a pulse output from the detection output 226 is a logic HIGH output.
- the output of the D flip flop is the opposite of the predetermined output, which in this example is a logic LOW output.
- the output of the D flip flop of the record circuit 230 i.e., Q output 235, may be captured in a bit of the record register 236 (see FIGURE 2), as shown in TABLE 1.
- the bit may be read to check for timer overflow, in turn indicating a task overrun (rollover event).
- the time base generator 221 may provide a time base or clock for the rest of the timer circuit 220 using clock signals available on a microcontroller. This serves as the time base for the timer circuit 220 without depending on another on-chip timer circuit.
- Up to eight clock inputs may be available to the time base generator 221, including a system clock and other on-chip oscillator sources. Depending on the device, external clock inputs may also be available.
- a prescaler may divide the selected clock source to a suitable frequency for use by the timer circuit 220.
- the time base generator 221 may synchronize its operation with the selected clock source, subject to input timing restrictions or the circuit’s operating conditions. Setting a timer synchronize bit may enable synchronization of the time base with the clock input.
- the timer circuit 220 may generate a detection output 226 when the value in timer counter register 223 is equal to expected execution time register 224, and a rollover of the timer counter register 223 may occur. Detection output 226 may be made available to other circuits as a synchronization source or to trigger another peripheral to take action in response to a rollover event. The detection output 226 may be separate from the timer circuit’s 220 devicelevel interrupts or other outputs. Timer circuit 220 may be a configuration of a capture compare pulse width modulation (CCP) circuit.
- CCP capture compare pulse width modulation
- the record circuit 230 may be configured as a clocked D latch with Set (S) 231 and Reset (R) 232.
- a detection output 226 may be a low to high pulse and may be captured by record circuit 230 as a bit saved in the record register 236 and may be output from the record circuit 230 as a Q output 235 to the correction circuit 240.
- the correction circuit 240 may provide a correction factor to the user and may receive an expected execution time through the application programming interface circuit 250.
- the correction circuit 240 may provide the expected execution time, a correction factor, or a value representing a combination of the expected execution time and the correction factor to the expected execution time register 224 of the timer circuit 220 from the user.
- the correction circuit 240 may store an expected execution time in the expected execution time register 224.
- the timer 222 is started by inputting a start bit in a start register 228 and when the run execution time of the task (stored in the timer counter register 223) matches its expected execution time (stored in the expected execution time register 224), there is a timer rollover triggered by reset/trigger control 227, because the expected execution time (stored in the expected execution time register 224) is the same as the run execution time (in the timer counter register 223).
- the reset/trigger control 227 generates a detection output 226, which creates the detection output 226 pulse. As shown in Table 1, when the bit of the record register 236 is “0,” the Q output 235 is low so as to indicate no rollover.
- the Q output 235 indicates a rollover.
- the detection output 226 is fed to the record circuit 230 in D Flip Flop configuration so that pulse is captured or recorded in the record register 236, and the record circuit 230 outputs a Q output 235 to the correction circuit 240.
- the bit stored in the record register 236 indicates a task execution overrun, if any.
- the execution of the task is not interrupted, and overruns if any, are captured or recorded.
- the run execution time may be read by the correction circuit 240 from the timer circuit 220.
- the correction circuit 240 may calculate a correction factor based on there being a Q output 235 and the value of the run execution time.
- the correction circuit 240 may report the correction factor to a user, through an application programming interface circuit 250, which indicates a task overrun has occurred.
- the user may correct the allocation of execution time, using a correction factor and input a revised expected execution time to the correction circuit 240 through the application programming interface circuit 250.
- the user may adjust the expected execution time for a particular task using the correction factor, so that the issue of “incorrect allocation of execution time” may be resolved.
- the correction factor may be reported to the user, so the user may decide whether to apply the correction factor.
- the correction factor may equal the total execution time minus the expected execution time, or the correction factor may be a time remaining to complete execution of a task after a rollover event, an execution run time for a task, or a multiple of the originally entered expected execution allocation.
- the user may use the correction factor to make changes in the task code to make sure the task execution falls within the expected execution time or use this correction factor to modify the expected execution time. Correction is not done dynamically during task execution run time. By making use of this correction factor, the issue with regard to “Incorrect Allocation of execution time” for a task can be resolved.
- aspects identify task overruns and provide a correction factor to the user so that the user may input adjustments so the tasks execute well within the expected execution time.
- the user of the application may resolve the issue of “incorrect allocation of execution time” when a correction factor is provided.
- the Q output 235 does not give any pulse, and the bit in the record register 236 is not SET. However, whenever the task exceeds the expected execution time, the execution is not interrupted, but the detection output 226 provides a pulse, which is captured by bit in the record register 236 of the record circuit 230 as Q output 235. Once the task execution is complete, the bit is checked for a detection output.
- the timer circuit, record circuit, correction circuit, scheduler circuit, and API circuit may each be implemented by instructions for execution by a processor, analog circuitry, digital circuitry, control logic, digital logic circuits programmed through hardware description language, application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), programmable logic devices (PLD), or any suitable combination thereof, whether in a unitary device or spread over several devices.
- the circuits may each be implemented by instructions for execution by a processor through, for example, a function, application programming interface (API) call, script, program, compiled code, interpreted code, binary, executable, executable file, firmware, object file, container, assembly code, or object.
- the circuits may each be implemented by instructions stored in a non-transitory medium such as a memory that, when loaded and executed by a processor (or any other suitable process), cause the functionality of the circuits, as described herein.
- FIGURE 7 shows a block diagram of a device, including: a co-operative scheduler 702; a timer circuit 704 to detect an overrun of a task of an application executing longer than an expected execution time for the task without interrupting execution of the task; and a record circuit 706 to record that an overrun has been detected by the timer circuit.
- FIGURE 8 shows a block diagram of a system, including: a co-operative scheduler 802 of tasks of an application; a timer circuit 804; a record circuit 806; a memory 810 to store instructions to operate the cooperative scheduler 802, the timer circuit 804, and the record circuit 806; and a processor 808 coupled to the memory 810 to execute the instructions to cause: the co-operative scheduler 802 to schedule tasks of an application; the timer circuit 804 to detect an overrun of a task of an application executing longer than an expected execution time for the task without interrupting execution of the task; and the record circuit 806 to record that an overrun has been detected by the timer circuit 804.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
Claims
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202380096152.3A CN120917428A (en) | 2023-03-21 | 2023-09-21 | Collaborative scheduler that detects execution of tasks longer than expected execution time without interrupting execution of tasks |
| DE112023006018.5T DE112023006018T5 (en) | 2023-03-21 | 2023-09-21 | COOPERATIVE SCHEDULER WITH DETECTION OF A TASK THAT RUNS LONGER THAN AN EXPECTED EXECUTION TIME WITHOUT INTERRUPTING THE EXECUTION OF THE TASK |
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| IN202311019603 | 2023-03-21 | ||
| IN202311019603 | 2023-03-21 | ||
| US18/470,508 | 2023-09-20 | ||
| US18/470,508 US20240320041A1 (en) | 2023-03-21 | 2023-09-20 | Co-Operative Scheduler with Detection of Task Executing Longer than an Expected Execution Time Without Interrupting Execution of the Task |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024196401A1 true WO2024196401A1 (en) | 2024-09-26 |
Family
ID=88416974
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/US2023/033327 Ceased WO2024196401A1 (en) | 2023-03-21 | 2023-09-21 | Co-operative scheduler with detection of task executing longer than an expected execution time without interrupting execution of the task |
Country Status (3)
| Country | Link |
|---|---|
| CN (1) | CN120917428A (en) |
| DE (1) | DE112023006018T5 (en) |
| WO (1) | WO2024196401A1 (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020138542A1 (en) * | 2001-02-13 | 2002-09-26 | International Business Machines Corporation | Scheduling optimization heuristic for execution time accumulating real-time systems |
| US20170083394A1 (en) * | 2014-05-11 | 2017-03-23 | Safetty Systems Ltd | A framework as well as method for developing time-triggered computer systems with multiple system modes |
| WO2022206130A1 (en) * | 2021-03-31 | 2022-10-06 | 荣耀终端有限公司 | Method for controlling limited time use of application, and electronic device |
-
2023
- 2023-09-21 WO PCT/US2023/033327 patent/WO2024196401A1/en not_active Ceased
- 2023-09-21 DE DE112023006018.5T patent/DE112023006018T5/en active Pending
- 2023-09-21 CN CN202380096152.3A patent/CN120917428A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020138542A1 (en) * | 2001-02-13 | 2002-09-26 | International Business Machines Corporation | Scheduling optimization heuristic for execution time accumulating real-time systems |
| US20170083394A1 (en) * | 2014-05-11 | 2017-03-23 | Safetty Systems Ltd | A framework as well as method for developing time-triggered computer systems with multiple system modes |
| WO2022206130A1 (en) * | 2021-03-31 | 2022-10-06 | 荣耀终端有限公司 | Method for controlling limited time use of application, and electronic device |
Non-Patent Citations (1)
| Title |
|---|
| HUGHES ZEMIAN M. ET AL: "Reducing the impact of task overruns in resource-constrained embedded systems in which a time-triggered software architecture is employed", TRANSACTIONS OF THE INSTITUTE OF MEASUREMENT AND CONTROL., vol. 30, no. 5, 1 December 2008 (2008-12-01), GB, pages 427 - 450, XP055854740, ISSN: 0142-3312, DOI: 10.1177/0142331207086183 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN120917428A (en) | 2025-11-07 |
| DE112023006018T5 (en) | 2026-01-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3719652B1 (en) | Hardware support for os-centric performance monitoring with data collection | |
| KR102028663B1 (en) | Apparatus and method for error detection | |
| US8015566B2 (en) | Attributing energy consumption to individual code threads in a data processing system | |
| US20240320041A1 (en) | Co-Operative Scheduler with Detection of Task Executing Longer than an Expected Execution Time Without Interrupting Execution of the Task | |
| CN109542599A (en) | A kind of embedded OS thread monitoring method | |
| WO2024196401A1 (en) | Co-operative scheduler with detection of task executing longer than an expected execution time without interrupting execution of the task | |
| KR20100010390A (en) | Microcomputer and method for controlling thereof | |
| US9513969B2 (en) | Method for the management of task execution in a computer system | |
| CN110990229A (en) | System information acquisition method and device | |
| US20080133975A1 (en) | Method for Running a Computer Program on a Computer System | |
| US20120185858A1 (en) | Processor operation monitoring system and monitoring method thereof | |
| CN104487950B (en) | The control of microprocessor | |
| US20090113255A1 (en) | Software Fault Detection Using Progress Tracker | |
| CN119226105A (en) | Method and device for determining operation time, storage medium and electronic device | |
| KR102158773B1 (en) | Pulse Width Modulator and method for PWM signal monitoring using the same | |
| US10884785B2 (en) | Precise accounting of processor time for multi-threaded time-critical applications | |
| JP2007026028A (en) | Device for detecting abnormality in microcomputer | |
| JP7825268B2 (en) | Task monitoring system and task monitoring program | |
| CN119597129B (en) | Reset circuit | |
| US11645140B2 (en) | Quantitative analysis and diagnostic coverage (DC) calculation of application-oriented safety measures in complex systems | |
| JP5375756B2 (en) | Time monitoring apparatus and method | |
| CN118981361A (en) | A task scheduling method, device, equipment and storage medium | |
| CN117743016A (en) | Detection method and device for execution time sequence abnormality of multi-core processor system | |
| JPH0581080A (en) | Microprocessor runaway monitoring device | |
| CN119883809A (en) | Task monitoring method and task monitoring device |
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: 23790442 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 202380096152.3 Country of ref document: CN |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 112023006018 Country of ref document: DE |
|
| WWP | Wipo information: published in national office |
Ref document number: 202380096152.3 Country of ref document: CN |
|
| WWP | Wipo information: published in national office |
Ref document number: 112023006018 Country of ref document: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 23790442 Country of ref document: EP Kind code of ref document: A1 |
