CN110968448B - Method for monitoring multi-task running state - Google Patents

Method for monitoring multi-task running state Download PDF

Info

Publication number
CN110968448B
CN110968448B CN201911216817.1A CN201911216817A CN110968448B CN 110968448 B CN110968448 B CN 110968448B CN 201911216817 A CN201911216817 A CN 201911216817A CN 110968448 B CN110968448 B CN 110968448B
Authority
CN
China
Prior art keywords
task
value
surv
feeding
monitoring
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.)
Active
Application number
CN201911216817.1A
Other languages
Chinese (zh)
Other versions
CN110968448A (en
Inventor
崔士军
聂萌
邵清华
王晓林
李永明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Integrated Electronic Systems Lab Co Ltd
Original Assignee
Integrated Electronic Systems Lab Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Integrated Electronic Systems Lab Co Ltd filed Critical Integrated Electronic Systems Lab Co Ltd
Priority to CN201911216817.1A priority Critical patent/CN110968448B/en
Publication of CN110968448A publication Critical patent/CN110968448A/en
Application granted granted Critical
Publication of CN110968448B publication Critical patent/CN110968448B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A method of monitoring a multitasking operating condition, the method comprising the steps of: defining a one-dimensional array of N Task elements as a global variable task_Surv [ N ]; (N is a positive integer and N > 1), in the initialization Task, performing an initialization value 0xFF operation on each element in the defined global variable array task_Surv; in the tasks which are continuously scheduled, only assigning 0xFF to one element task_Surv [ i ] in the global variable array task_Surv (i is a corresponding Task number and the value is any integer from 0 to N-1); the task scheduler schedules each task according to the priority order; a monitoring operation is added in the interrupt service routine, and when the interrupt is executed once, the task is monitored once.

Description

Method for monitoring multi-task running state
Technical Field
The invention relates to the technical field of task monitoring, in particular to a method for monitoring a multi-task running state.
Background
In the running process of the multi-task operating system, in order to ensure the reliable running of the system, the running state of each task is usually monitored, and abnormal conditions possibly caused in the running process of the task, such as 'running off', 'entering a dead loop', 'being abnormally suspended', etc., are reacted in time, and measures such as software reset or hardware reset are implemented, so that the system enters a normal running state after restarting.
The prior method is that the dog feeding function is added in a single task, or the dog feeding function is added in all tasks, the dog feeding function is simply met, but a good monitoring function cannot be achieved, and the dog feeding function can be restarted only if the task with the function is abnormal. Therefore, unified management of feeding dog operation is not facilitated, and the task name or task number of specific abnormality cannot be monitored, so that a certain difficulty is brought to code debugging.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for monitoring a multitasking operation state, and the embodiment of the present invention discloses the following technical solutions:
a method of monitoring a multitasking operating condition, the method comprising the steps of:
defining a one-dimensional array of N Task elements as a global variable task_Surv [ N ]; (N is a positive integer and N > 1)
In the initialization Task, performing an initialization value 0xFF operation on each element in the defined global variable array task_Surv;
in the tasks which are continuously scheduled, only assigning 0xFF to one element task_Surv [ i ] in the global variable array task_Surv (i is a corresponding Task number and the value is any integer from 0 to N-1);
the task scheduler schedules each task according to the priority order;
a monitoring operation is added in the interrupt service routine, and when the interrupt is executed once, the task is monitored once.
In a first possible implementation, the initializing task includes: initializing an array task_Surv, feeding dogs, creating and starting tasks, and starting interrupts.
In a second possible implementation, there are and only interrupt service routines that initialize tasks and add task monitoring functionality that can perform the feeding operation.
In a third possible implementation manner, adding a monitoring operation in the interrupt service routine includes performing a subtracting operation, a non-zero judgment, and a feeding dog operation on each element, and specifically includes the following steps:
judging whether the value of the array task_Surv [ i ] is nonzero after one subtracting operation, if not, the array Task is a normal Task, and carrying out dog feeding operation; (i is the corresponding task number, and the value is any integer from 0 to N-1)
If the numerical value is zero, judging that the system is an abnormal task, outputting a task number i value, stopping feeding the dog, and restarting the system.
In a fourth possible implementation manner, the method further includes interrupting the dog feeding operation when the interrupt service routine is abnormal, and restarting the system.
In a fifth possible implementation manner, when the task is an abnormal task, the method specifically includes:
the value of the task_Surv [ i ] is not assigned with the maximum value of 0xFF, and the subtracting operation is carried out until the value of the task_Surv [ i ] is reduced to 0, the value of i is output, the feeding of dogs is stopped, and the system is restarted;
in the case of a normal Task, the value of task_survivin [ i ] is written as a maximum value of 0xFF.
In a sixth possible implementation, the maximum value of 0xFF may be replaced with a WORD type assignment of 0xFFFF.
Therefore, the invention defines a plurality of tasks as a one-dimensional array as a global variable, and performs initialization processing, scheduling and monitoring on the one-dimensional array, when the tasks are abnormal, the task number i value can be output, and a plurality of tasks which are continuously scheduled can be monitored.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flow chart of a method for monitoring a multitasking operation state.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
As shown in fig. 1, a method for monitoring a multitasking operation state includes the steps of:
s1, defining a one-dimensional array of N Task elements as a global variable task_Surv [ N ]; (N is a positive integer and N > 1)
S2, in an initialization Task, performing an initial value 0xFF operation on each element in a defined global variable array task_Surv, wherein task_Surv [ i ] =0xFF;
s3, in the tasks which are continuously scheduled, assigning 0xFF operation is carried out on only one element task_Surv [ i ] in the global variable array task_Surv (i is a corresponding Task number and the value is any integer from 0 to N-1);
s4, scheduling each task by a task scheduler according to the priority order;
s5, adding monitoring operation in the interrupt service routine, and monitoring the task once when the interrupt is executed once. The interrupt time may be determined based on how urgent the task is to monitor.
The S2 initialization task at least comprises the following steps: initializing an array task_Surv, feeding dogs, creating and starting tasks, starting interrupts and the like.
Adding a feeding dog operation in the interrupt service routine in S5 includes: only the interrupt service routine that initializes the task and adds the task monitoring function can perform the feeding operation, and neither the other tasks nor the interrupt service routine can perform the feeding operation.
The monitoring operation is added in the interrupt service routine, which comprises the steps of subtracting one operation, non-zero judgment and feeding dog operation for each element, and specifically comprises the following steps:
judging whether the value of the array task_Surv [ i ] is nonzero after one subtracting operation, if not, the array Task is a normal Task, and carrying out dog feeding operation; (i is the corresponding task number, and the value is any integer from 0 to N-1)
If the numerical value is zero, judging that the system is an abnormal task, outputting a task number i value, stopping feeding the dog, and restarting the system.
The method specifically comprises the following steps when the task is an abnormal task: the value of task_Surv [ i ] is not assigned the maximum value of 0xFF, and the subtracting operation is carried out until the value of task_Surv [ i ] is reduced to 0, the value of i is output, feeding of dogs is stopped, and the system is restarted.
In the case of a normal Task, the value of task_survivin [ i ] is written as a maximum value of 0xFF.
The assignment of the task_Surv [ i ] can influence the judgment time, and if the real-time requirement is high, the assignment of the task_Surv [ i ] can be properly reduced. For tasks running regularly and periodically, for example, the tasks can be run only once a day, if the initial value of the task_Surv [ i ] is increased in the corresponding tasks, the data type of the tasks can be changed if the tasks are not enough, for example, the tasks are assigned with 0xFFFF by changing the data type to WORD type, and if the tasks are not reduced to 0 within the scheduling interval time, the tasks_Surv [ i ] can be guaranteed.
If the program abnormality causes that the interrupt service routine cannot be normally executed, the dog feeding operation cannot be continuously performed, and the system is restarted.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (5)

1. A method of monitoring a multitasking operating condition, the method comprising the steps of:
defining a one-dimensional array of N Task elements as a global variable task_Surv [ N ]; (N is a positive integer and N > 1)
In the initialization Task, performing an initialization value 0xFF operation on each element in the defined global variable array task_Surv;
in the tasks which are continuously scheduled, only assigning 0xFF to one element task_Surv [ i ] in the global variable array task_Surv (i is a corresponding Task number and the value is any integer from 0 to N-1);
the task scheduler schedules each task according to the priority order;
adding monitoring operation in the interrupt service routine, and monitoring the task once when the interrupt is executed once;
the monitoring operation is added in the interrupt service routine, which comprises the steps of subtracting one operation, non-zero judgment and feeding dog operation for each element, and specifically comprises the following steps:
judging whether the value of the array task_Surv [ i ] is nonzero after one subtracting operation, if not, the array Task is a normal Task, and carrying out dog feeding operation; (i is the corresponding task number, and the value is any integer from 0 to N-1)
If the numerical value is zero, judging that the system is an abnormal task, outputting a task number i value, stopping feeding the dog, and restarting the system;
the method specifically comprises the following steps when the task is an abnormal task:
the value of the task_Surv [ i ] is not assigned with the maximum value of 0xFF, and the subtracting operation is carried out until the value of the task_Surv [ i ] is reduced to 0, the value of i is output, the feeding of dogs is stopped, and the system is restarted;
in the case of a normal Task, the value of task_survivin [ i ] is written as a maximum value of 0xFF.
2. The method of claim 1, wherein the initializing task comprises: initializing an array task_Surv, feeding dogs, creating and starting tasks, and starting interrupts.
3. The method of claim 1, wherein only interrupt service routines that initialize tasks and add task monitoring functionality can perform the feeding operation.
4. The method of claim 1, further comprising interrupting the feeding dog operation when the interrupt service routine is abnormal, and restarting the system.
5. The method of claim 4 wherein the maximum value of 0xFF may be replaced with a WORD type assignment of 0xFFFF.
CN201911216817.1A 2019-12-03 2019-12-03 Method for monitoring multi-task running state Active CN110968448B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911216817.1A CN110968448B (en) 2019-12-03 2019-12-03 Method for monitoring multi-task running state

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911216817.1A CN110968448B (en) 2019-12-03 2019-12-03 Method for monitoring multi-task running state

Publications (2)

Publication Number Publication Date
CN110968448A CN110968448A (en) 2020-04-07
CN110968448B true CN110968448B (en) 2023-11-28

Family

ID=70032731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911216817.1A Active CN110968448B (en) 2019-12-03 2019-12-03 Method for monitoring multi-task running state

Country Status (1)

Country Link
CN (1) CN110968448B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416408A (en) * 2021-12-13 2022-04-29 飞腾信息技术有限公司 Interrupt processing method and device
CN114510495B (en) * 2022-04-21 2022-07-08 北京安华金和科技有限公司 Database service data consistency processing method and system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101937371A (en) * 2010-08-27 2011-01-05 北京星网锐捷网络技术有限公司 Method and device for monitoring task execution state in embedded system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786473A (en) * 2014-12-25 2016-07-20 阿里巴巴集团控股有限公司 Task management method and device of multi-task interface as well as terminal equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101937371A (en) * 2010-08-27 2011-01-05 北京星网锐捷网络技术有限公司 Method and device for monitoring task execution state in embedded system

Also Published As

Publication number Publication date
CN110968448A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
CN110968448B (en) Method for monitoring multi-task running state
US8230430B2 (en) Scheduling threads in a multiprocessor computer
CN109656782A (en) Visual scheduling monitoring method, device and server
CN101216798A (en) Periodic task reliability control method based on watchdog and timer
CN108536531B (en) Task scheduling and power management method based on single chip microcomputer
CN111580949B (en) Automatic regulating method for network packet receiving mode
CN110688206A (en) Timing task scheduling method and device, computer equipment and storage medium
CN113986500A (en) Task deterministic scheduling method and task diagnosis method in multi-task system
CN113268318A (en) Task scheduling method and distributed system
CN110688211B (en) Distributed job scheduling method
CN112286847A (en) Method, device and controller for improving response speed of system external interrupt
CN101937371A (en) Method and device for monitoring task execution state in embedded system
CN113296997A (en) Task monitoring method and device based on watchdog
US20030056123A1 (en) Power management method for hand-held information processing apparatus
JP2006227962A (en) System and method for monitoring application task
CN103678095A (en) Warning detection method
CN114661432A (en) Task scheduling method, device, equipment and storage medium
CN110633914A (en) Batch job scheduling processing method and device
CN114647540B (en) Embedded scheduler fault recovery method, embedded system and storage medium
US20170060666A1 (en) Controller capable of detecting factor at time of abnormality of pc function
JPH10269110A (en) Method for avoiding hang-up of computer system, and computer system using the same method
CN112578744B (en) Method and configuration tool for scheduling one or more control applications on an industrial controller
CN113656468B (en) Task flow triggering method and device based on NIFI
CN115237557A (en) Intelligent scheduling system and method based on configuration engine
CN116860264A (en) Method for solving automatic deployment of HMP architecture application program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant