Thread anomaly checking and processing system and method for electricity utilization information acquisition terminal
By implementing thread monitoring, data collection, exception analysis and processing modules in the power consumption information acquisition terminal, the problem that traditional exception handling methods are difficult to deal with exceptions in multi-threaded environments is solved, and the reliability and stability of the system are improved.
Patent Information
- Application Number
- CN202510391669.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-04-29
AI Technical Summary
Traditional exception handling methods are difficult to effectively deal with complex exceptions in multi-threaded environments, resulting in exceptions not being discovered for a long time, which leads to more serious problems and affects the reliability and stability of the system.
Through the thread monitoring module periodically scans the thread's running status, the data collection and storage module collect and store thread's running status information and exception status information. The exception analysis module uses event-driven analysis algorithm to check the thread's interactive event sequence, locates the exception type and root cause, and the exception processing module immediately sends out a warning signal, and automatically starts the corresponding strategy based on the exception type and severity.
It improves the reliability and stability of the operation of the power consumption information collection terminal, promptly detects and deals with abnormalities, and prevents the abnormalities from being discovered for a long time, which leads to more serious problems.
Smart Images

Figure CN119902950A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power consumption information collection terminals. More specifically, the present invention discloses a thread abnormality detection and processing system and method for power consumption information collection terminals. Background Art
[0002] The electricity consumption information collection terminal is a device or system used in fields such as data collection and transmission. The multi-threaded electricity consumption information collection terminal is a data concentration device that can handle multiple thread tasks at the same time. It can centrally collect, process and transmit data from multiple data sources to achieve efficient data aggregation and management.
[0003] With the continuous evolution of power consumption information collection terminal technology, multi-threaded programming has been widely used in various power consumption information collection terminals as a key means to improve system performance and resource utilization. In a multi-threaded environment, due to the complex relationship between threads such as concurrent execution and resource sharing, a series of abnormal conditions are easily caused. For example, thread deadlock will cause threads to wait for resources, causing the entire system to stagnate; resource competition conflicts may cause data access errors and affect system stability; data inconsistency may cause data integrity to be destroyed, thereby affecting the accuracy of the system.
[0004] Traditional exception handling methods are mostly designed based on single-threaded environments, and it is difficult to effectively deal with complex exceptions in multi-threaded environments. In terms of exception detection, traditional methods often fail to capture exceptions in a timely and accurate manner, causing exceptions to remain undetected for a long time, which in turn leads to more serious problems. In terms of exception handling efficiency, traditional methods also have obvious shortcomings, which may lead to frequent problems such as system crashes, data loss, or program running errors, seriously affecting the reliability and stability of the system. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to provide a thread anomaly inspection and processing system and method for an electricity consumption information collection terminal, which periodically scans the thread running status through a thread monitoring module; collects and stores the thread running status information and abnormal status information through a data collection and storage module; uses an event-driven analysis algorithm through an abnormality analysis module to check the thread interaction event sequence and locate the abnormality type and root cause; immediately issues a warning signal through an abnormality handling module, and then automatically starts a corresponding strategy according to the abnormality type and severity; thereby improving the reliability and stability of the operation of the electricity consumption information collection terminal.
[0006] In order to achieve the above-mentioned object, the first aspect of the present invention provides a thread abnormality detection and processing system for a power consumption information collection terminal, the system comprising: Thread monitoring module, data collection and storage module, exception analysis module and exception handling module; The thread monitoring module is used to monitor each thread in real time to obtain running status information, and transmit the running status information to the data collection and storage module; The data collection and storage module is used to receive and store the operation status information; The abnormality analysis module retrieves the running status information of each thread from the data collection and storage module, analyzes and obtains abnormal status information, and transmits the abnormal status information to the abnormality handling module; The exception handling module is used to output exception warning information according to the exception status information, and / or start a dynamic repair strategy according to the exception status information.
[0007] In this solution, the thread monitoring module is specifically used for: Scan the thread status according to a preset time period to obtain the running status information; The running status information at least includes the startup time, running time, resource occupancy ratio and current instruction code.
[0008] In this solution, the abnormality analysis module is specifically used for: Adopt an event-driven analysis strategy to analyze the interaction event sequence between threads; According to the interaction event sequence, the event pattern of the standard multi-thread interaction rule is compared, and abnormal state information is output.
[0009] In this solution, the exception handling module specifically includes: The abnormal warning module is used to issue an abnormal warning signal through the human-computer interaction interface according to the abnormal state information; The dynamic repair module is used to select a corresponding repair strategy according to the abnormal state information and adjust the running state of the abnormal thread.
[0010] A second aspect of the present invention further provides a thread anomaly detection and processing method for a power consumption information collection terminal, which is applied to any of the above-mentioned thread anomaly detection and processing systems for a power consumption information collection terminal, and the method comprises: Get the first thread number information; Determine a first duration threshold and a first resource proportion threshold according to the first thread number information; Obtaining first duration information and first resource ratio information; Determining first abnormality level information according to the first resource proportion information and the first resource proportion threshold; Determining first abnormal coding information according to the first duration information and the first duration threshold; Thread repair is performed according to the first exception level information and the first exception coding information.
[0011] In this solution, the first duration threshold and the first resource proportion threshold are determined according to the first thread number information, specifically: Obtaining thread attribute information according to the first thread number information; According to the thread attribute information, searching and obtaining a first duration threshold; According to the thread attribute information, searching and obtaining first storage space information and first operation information; Obtaining first resource information; A first resource proportion threshold is determined according to the first resource information, the first storage space information and the first operation information.
[0012] In this solution, the first abnormal level information is determined according to the first resource proportion information and the first resource proportion threshold, specifically: Determine whether the first resource proportion information exceeds the first resource proportion threshold; If not, setting the first abnormal level information to a preset first reference level; If yes, then calculating the difference between the first resource proportion information and the first resource proportion threshold to obtain a first resource proportion difference; Calculating a ratio of the first resource proportion difference to the first resource proportion threshold to obtain a first difference ratio; First abnormality level information is obtained according to the first difference ratio.
[0013] In this solution, the first abnormal coding information is determined according to the first duration information and the first duration threshold, specifically: Determining whether the first duration information exceeds the first duration threshold; If not, setting the first abnormal coding information as a preset first reference code; If yes, then calculating the difference between the first duration information and the first duration threshold to obtain a first duration difference; Calculating a ratio of the first duration difference to the first duration threshold to obtain a second difference ratio; According to the second difference ratio, first abnormal coding information is obtained.
[0014] In this solution, the thread repair is performed according to the first exception level information and the first exception coding information, specifically: Determining a repair mode according to the first abnormality level information and the first abnormality coding information; When it is determined that the repair mode is a short lock conflict mode; Obtaining thread attribute information according to the first thread number information; According to the thread attribute information, an automatic retry mechanism is used to repair the thread; When it is determined that the repair mode is a data consistency error mode; Obtain backup data according to the first thread number information; According to the backup data, a recovery mechanism is used to repair the thread.
[0015] In this solution, the repair mode is determined according to the first abnormality level information and the first abnormality coding information, specifically: Determining whether the first abnormal coding information is within a preset first abnormal coding range; If yes, setting the repair mode to a short lock conflict mode; If not, determining whether the first abnormality level information exceeds a preset first abnormality level threshold; If so, the repair mode is set to a data consistency error mode.
[0016] The purpose of the present invention is to provide a thread anomaly inspection and processing system and method for an electricity consumption information collection terminal, which periodically scans the thread running status through a thread monitoring module; collects and stores the thread running status information and abnormal status information through a data collection and storage module; uses an event-driven analysis algorithm through an abnormality analysis module to check the thread interaction event sequence and locate the abnormality type and root cause; immediately issues a warning signal through an abnormality handling module, and then automatically starts a corresponding strategy according to the abnormality type and severity; thereby improving the reliability and stability of the operation of the electricity consumption information collection terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and should not be regarded as limiting the scope.
[0018] Figure 1 A structural schematic diagram of a thread abnormality detection and processing system for an electricity consumption information collection terminal is shown; Figure 2 A schematic diagram showing the structure of an exception handling module provided by an embodiment of the present invention is shown; Figure 3 A flow chart showing a thread abnormality checking and processing method for an electricity consumption information collection terminal is shown; Figure 4 A flowchart of thread repair provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] Unless otherwise defined, all terms (including technical and scientific terms) used in the embodiments of the present invention have the same meanings as commonly understood by those skilled in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having meanings consistent with their meanings in the context of the relevant technology, and should not be interpreted in an idealized or extremely formal sense, unless the embodiments of the present invention are explicitly defined in this way.
[0021] The words "first", "second" and similar words used in the embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Words such as "one", "an" or "the" and similar words do not indicate a quantity limitation, but indicate the existence of at least one. Similarly, words such as "include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The steps before or after the method of the embodiment of the present invention are not necessarily carried out in order. On the contrary, various steps can be processed in reverse order or simultaneously. At the same time, other operations can also be added to these processes, or a step or several steps can be removed from these processes.
[0022] Please refer to Figure 1 , Figure 1 The present invention shows a structural schematic diagram of a thread anomaly detection and processing system for an electricity consumption information collection terminal.
[0023] like Figure 1 As shown, the first aspect of the present invention discloses the thread anomaly detection and processing system for the power consumption information collection terminal, and the system includes: Thread monitoring module 101, data collection and storage module 102, exception analysis module 103 and exception handling module 104; The thread monitoring module is used to monitor each thread in real time to obtain running status information, and transmit the running status information to the data collection and storage module; The data collection and storage module is used to receive and store the operation status information; The abnormality analysis module retrieves the running status information of each thread from the data collection and storage module, analyzes and obtains abnormal status information, and transmits the abnormal status information to the abnormality handling module; The exception handling module is used to output exception warning information according to the exception status information, and / or start a dynamic repair strategy according to the exception status information.
[0024] It should be noted that the thread monitoring module is responsible for real-time monitoring of each thread running in the system, recording the thread start time, running time, current execution instructions, resource occupancy and other data. These detailed information provides a basis for a comprehensive understanding of the running status of the thread, and helps to determine whether the thread is in a normal running state in subsequent analysis. During the abnormality inspection process, the data collection and storage module collects various types of data related to the abnormality, such as thread status data, system environment data (such as CPU usage, memory usage, etc.), program code fragment information, etc.; and then stores the collected data in a specific abnormal data repository to facilitate subsequent in-depth analysis of the fault. The abnormality analysis module retrieves the running status information of each thread from the data collection and storage module, and analyzes each thread to obtain abnormal status information. In some embodiments, once the existence and type of the abnormality are determined, the abnormality handling module will immediately issue a warning signal and send an abnormality notification to the relevant system module according to the preset notification mechanism. In some embodiments, after the abnormality type is determined, the corresponding repair strategy will be automatically started according to the abnormality type and severity.
[0025] According to an embodiment of the present invention, the thread monitoring module is specifically used for: Scan the thread status according to a preset time period to obtain the running status information; The running status information at least includes the startup time, running time, resource occupancy ratio and current instruction code.
[0026] It should be noted that the thread monitoring module periodically scans the thread status, records the thread start time, running time, currently executed instructions (indicated by instruction code), resource usage and other data, and promptly detects possible abnormal thread signs. For example, if a time threshold is set, when a thread is unresponsive for a long time (exceeding the preset time threshold), it may mean that the thread is abnormal; at the same time, pay attention to resource usage. If the resource usage is too high and continues to grow, it also indicates that the thread may be abnormal, so as to detect the problem as soon as possible and start the subsequent processing process.
[0027] According to an embodiment of the present invention, the abnormality analysis module is specifically used for: Adopt an event-driven analysis strategy to analyze the interaction event sequence between threads; According to the interaction event sequence, the event pattern of the standard multi-thread interaction rule is compared, and abnormal state information is output.
[0028] It should be noted that an event-driven analysis algorithm is used to analyze the interaction event sequence between threads. By checking whether there are event patterns that violate normal multi-threaded interaction rules, such as inappropriate lock acquisition and release sequences, illegal resource access operations, etc., the exception type can be accurately determined and the root cause of the exception can be found. For example, it can be determined whether a deadlock causes a thread to become unresponsive, or whether an illegal memory access causes a program crash, which provides an important basis for taking targeted treatment measures later.
[0029] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of an exception handling module provided by an embodiment of the present invention is shown.
[0030] According to an embodiment of the present invention, the exception handling module specifically includes: The abnormal warning module 201 is used to send an abnormal warning signal through the human-computer interaction interface according to the abnormal state information; The dynamic repair module 202 is used to select a corresponding repair strategy according to the abnormal state information and adjust the running state of the abnormal thread.
[0031] It should be noted that the abnormal warning module sends out a warning signal through the human-computer interaction interface according to the type of abnormality. The notification contains key information such as the abnormality type, the thread identification and the severity, so that the user interface, logging module, upper-level application and other related parties can be informed of the abnormal situation in a timely manner so as to respond quickly. For example, after receiving the notification, the user interface can display the abnormal prompt to the user, and the logging module can record detailed abnormal information to provide clues for subsequent investigation. The dynamic repair module starts the corresponding repair strategy according to the type and severity of the abnormality; for minor resource competition abnormalities, such as short lock conflicts, an automatic retry mechanism is used to suspend the conflicting thread and re-acquire resources after a delay; for serious abnormalities, such as data consistency errors, restore from data backup or use data consistency algorithm to repair data according to the preset strategy to ensure the correctness and integrity of program data.
[0032] Please refer to Figure 3 , Figure 3 A flow chart of a thread anomaly detection and processing method for an electricity consumption information collection terminal is shown.
[0033] like Figure 3 As shown, the second aspect of the present invention discloses a thread abnormality detection and processing method for a power consumption information collection terminal, the method comprising: S302, obtaining first thread number information; S304: Determine a first duration threshold and a first resource proportion threshold according to the first thread number information; S306, obtaining first duration information and first resource proportion information; S308: determining first abnormality level information according to the first resource proportion information and the first resource proportion threshold; S310, determining first abnormal coding information according to the first duration information and the first duration threshold; S312: Perform thread repair according to the first exception level information and the first exception code information.
[0034] It should be noted that the first thread number information is the unique identification code of the first thread; the first duration threshold is the maximum allowed execution duration configured for the first thread by the electricity information collection terminal; the first resource proportion threshold is the maximum allowed resource proportion value configured for the first thread by the electricity information collection terminal; the first duration information is the running duration of the first thread; the first resource proportion information is the resource usage proportion of the first thread, including storage capacity and computing power; the first exception level information is used to indicate the classification of abnormal severity; the first exception coding information is a number used to indicate the type of exception.
[0035] In this embodiment, according to the preset thread monitoring order, thread monitoring is performed in sequence according to the thread number of each thread. First, since the maximum allowed running time set for each thread is different from the required resources, the first duration threshold and the first resource proportion threshold of the thread are determined according to the first thread number information; then, through thread monitoring, the first duration information and the first resource proportion information corresponding to the thread are obtained. Then, according to the size relationship between the first resource proportion information and the first resource proportion threshold, the first abnormal level information is determined according to the preset abnormal level corresponding table; then, according to the size relationship between the first duration information and the first duration threshold, the first abnormal coding information is determined according to the preset abnormal coding corresponding table. Finally, according to the first abnormal level information and the first abnormal coding information, a repair mode is determined to repair the abnormal thread.
[0036] In the embodiment of the present invention, the first duration threshold and the first resource proportion threshold are determined according to the first thread number information, specifically: Obtaining thread attribute information according to the first thread number information; According to the thread attribute information, searching and obtaining a first duration threshold; According to the thread attribute information, searching and obtaining first storage space information and first operation information; Obtaining first resource information; A first resource proportion threshold is determined according to the first resource information, the first storage space information and the first operation information.
[0037] It should be noted that the thread attribute information is the attribute parameters configured by the power consumption information collection terminal for the thread, including at least thread start time, thread priority, maximum running time, running variable storage space or number of instruction operations; the first storage space information is the storage space allocated for thread operation; the first operation information is the number of instructions required to execute for the thread to complete operation; the first resource information is the storage resources and computing power resources provided by the power consumption information collection terminal for thread operation.
[0038] This embodiment provides a process for obtaining a first duration threshold and a first resource ratio threshold. First, according to the first thread number information, the thread attribute information of the corresponding thread is searched and obtained; then, according to the maximum running time in the thread attribute information, the first duration threshold is determined. Then, according to the running variable storage space and the number of instruction operations in the thread attribute information, the first storage space information and the first operation information are confirmed. Finally, combined with the storage resources and computing power resources provided by the power consumption information collection terminal for the thread operation, the maximum resource ratio required for the thread operation, that is, the first resource ratio threshold, is calculated.
[0039] In the embodiment of the present invention, the first abnormality level information is determined according to the first resource proportion information and the first resource proportion threshold, specifically: Determine whether the first resource proportion information exceeds the first resource proportion threshold; If not, setting the first abnormal level information to a preset first reference level; If yes, then calculating the difference between the first resource proportion information and the first resource proportion threshold to obtain a first resource proportion difference; Calculating a ratio of the first resource proportion difference to the first resource proportion threshold to obtain a first difference ratio; First abnormality level information is obtained according to the first difference ratio.
[0040] It should be noted that, in the present embodiment, a configuration process of the first exception level information is provided. First, determine whether the first resource proportion information exceeds the first resource proportion threshold; if not, it means that the resources used during the thread operation are within the set range, that is, the resource proportion of the thread is in normal condition. At this time, the first exception level information is set to the preset first reference level; if so, it means that the resources used during the thread operation exceed the set range, that is, there is an exception. At this time, the difference between the first resource proportion information and the first resource proportion threshold is calculated to obtain the first resource proportion difference. Then, the ratio of the first resource proportion difference to the first resource proportion threshold is calculated to obtain the first difference ratio; according to the first difference ratio, the preset exception level correspondence table is searched to obtain the first exception level information.
[0041] In the embodiment of the present invention, determining the first abnormal coding information according to the first duration information and the first duration threshold is specifically: Determining whether the first duration information exceeds the first duration threshold; If not, setting the first abnormal coding information as a preset first reference code; If yes, then calculating the difference between the first duration information and the first duration threshold to obtain a first duration difference; Calculating a ratio of the first duration difference to the first duration threshold to obtain a second difference ratio; According to the second difference ratio, first abnormal coding information is obtained.
[0042] It should be noted that, in the present embodiment, a configuration process of the first abnormal coding information is provided. First, determine whether the first duration information exceeds the first duration threshold; if not, it means that the running duration of the thread is within the set range, that is, the duration of the thread is in a normal state. At this time, the first abnormal coding information is set to the preset first reference code; if so, it means that the running duration of the thread exceeds the set range, that is, there is an abnormality. At this time, the difference between the first duration information and the first duration threshold is calculated to obtain the first duration difference. Then, the ratio of the first duration difference to the first duration threshold is calculated to obtain the second difference ratio; according to the second difference ratio, the preset abnormal coding correspondence table is searched to obtain the first abnormal coding information.
[0043] Please refer to Figure 4 , Figure 4 A flowchart of thread repair provided by an embodiment of the present invention is shown.
[0044] In the embodiment of the present invention, Figure 4 As shown, the thread repair is performed according to the first exception level information and the first exception coding information, specifically: S402, determining a repair mode according to the first abnormality level information and the first abnormality code information; S404, when it is determined that the repair mode is a short lock conflict mode; S406, obtaining thread attribute information according to the first thread number information; S408, using an automatic retry mechanism to repair the thread according to the thread attribute information; S410, when it is determined that the repair mode is a data consistency error mode; S412, obtaining backup data according to the first thread number information; S414: Repair the thread using a recovery mechanism based on the backup data.
[0045] It should be noted that, first, the repair mode for exception repair is determined based on the first exception level information and the first exception coding information. When the repair mode is the short lock conflict mode, it means that the thread is in a slight resource competition exception; at this time, the retry priority is set according to the thread start time or thread priority of the thread attribute information to start the automatic retry mechanism and repair the thread. When the repair mode is the data consistency error mode, it means that the thread is in a serious exception, such as data inconsistency problems in database operations; at this time, the data is restored from the data backup or the data consistency algorithm is used to repair the data to ensure the correctness and integrity of the program data.
[0046] In the embodiment of the present invention, determining the repair mode according to the first exception level information and the first exception coding information is specifically: Determining whether the first abnormal coding information is within a preset first abnormal coding range; If yes, setting the repair mode to a short lock conflict mode; If not, determining whether the first abnormality level information exceeds a preset first abnormality level threshold; If so, the repair mode is set to a data consistency error mode.
[0047] It should be noted that, in this embodiment, if the first exception coding information is within the preset first exception coding range, it means that there is a slight timeout in the thread operation, which can be considered as a short lock conflict between threads. If the first exception coding information exceeds the preset first exception coding range, it is determined whether the first exception level information exceeds the preset first exception level threshold; if so, it indicates that there is abnormal resource occupation caused by inconsistent data verification, and at this time, the repair mode is set to data consistency error mode.
[0048] It is worth mentioning that it also includes: When determining to perform thread repair; The warning information is displayed through the human-computer interaction interface, including at least the first thread number information, the first duration information and the first resource proportion information.
[0049] It should be noted that once an abnormality occurs in the thread operation, an early warning signal is transmitted immediately, and an early warning notification is issued through human-computer interaction. The notification contains key information such as the abnormality type, the thread identification and severity, so that the user interface, logging module, upper-layer application and other related parties can know the abnormal situation in time so as to respond quickly. For example, after receiving the notification, the user interface can display the abnormal prompt to the user, and the logging module can record detailed abnormal information.
[0050] It is worth mentioning that it also includes: When it is determined that the first abnormality level information exceeds a preset second abnormality level threshold; Display the repair plan through the human-computer interaction interface; Determining whether a first operation instruction is received; If yes, repair the process according to the first operation instruction; If not, re-activate the electrical information collection terminal.
[0051] It should be noted that when the first abnormal level information exceeds the preset second abnormal level threshold, it means that the power consumption information collection terminal has an error that affects the continued operation of the power consumption information collection terminal, such as a freeze, an infinite loop, etc. At this time, an executable repair plan is displayed through the human-computer interaction interface. If a first operation instruction for specifying a repair plan is received through the human-computer interaction interface, the thread repair is performed according to the formulated repair plan; otherwise, the power consumption information collection terminal is reactivated to ensure that the power consumption information collection terminal is re-operated.
[0052] In summary, the purpose of the present invention is to provide a thread anomaly inspection and processing system and method for an electricity consumption information collection terminal, which periodically scans the thread running status through a thread monitoring module; collects and stores the thread running status information and abnormal status information through a data collection and storage module; uses an event-driven analysis algorithm through an abnormality analysis module to check the thread interaction event sequence and locate the abnormality type and root cause; immediately issues a warning signal through an abnormality handling module, and then automatically starts a corresponding strategy according to the abnormality type and severity; thereby improving the reliability and stability of the operation of the electricity consumption information collection terminal.
[0053] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0054] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0055] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A thread anomaly detection and processing system for a power consumption information collection terminal, characterized in that: The system comprises: Thread monitoring module, data collection and storage module, exception analysis module and exception handling module; The thread monitoring module is used to monitor each thread in real time to obtain running status information, and transmit the running status information to the data collection and storage module; The data collection and storage module is used to receive and store the operation status information; The abnormality analysis module retrieves the running status information of each thread from the data collection and storage module, analyzes and obtains abnormal status information, and transmits the abnormal status information to the abnormality handling module; The exception handling module is used to output exception warning information according to the exception status information, and / or start a dynamic repair strategy according to the exception status information.
2. The thread anomaly detection and processing system for the power consumption information collection terminal according to claim 1 is characterized in that: The thread monitoring module is specifically used for: Scan the thread status according to a preset time period to obtain the running status information; The running status information at least includes the startup time, running time, resource occupancy ratio and current instruction code.
3. The thread abnormality detection and processing system for the power consumption information collection terminal according to claim 1 is characterized in that: The abnormality analysis module is specifically used for: Adopt an event-driven analysis strategy to analyze the interaction event sequence between threads; According to the interaction event sequence, the event pattern of the standard multi-thread interaction rule is compared, and abnormal state information is output.
4. The thread anomaly detection and processing system for the power consumption information collection terminal according to claim 1, characterized in that: The exception handling module specifically includes: The abnormal warning module is used to issue an abnormal warning signal through the human-computer interaction interface according to the abnormal state information; The dynamic repair module is used to select a corresponding repair strategy according to the abnormal state information and adjust the running state of the abnormal thread.
5. A thread anomaly detection and processing method for a power consumption information collection terminal, applied to a thread anomaly detection and processing system for a power consumption information collection terminal as claimed in any one of claims 1 to 4, characterized in that: Specifically include: Get the first thread number information; Determine a first duration threshold and a first resource proportion threshold according to the first thread number information; Obtaining first duration information and first resource ratio information; Determining first abnormality level information according to the first resource proportion information and the first resource proportion threshold; Determining first abnormal coding information according to the first duration information and the first duration threshold; Thread repair is performed according to the first exception level information and the first exception coding information.
6. The thread abnormality detection and processing method for the power consumption information collection terminal according to claim 5 is characterized in that: The determining of the first duration threshold and the first resource proportion threshold according to the first thread number information is specifically: Obtaining thread attribute information according to the first thread number information; According to the thread attribute information, searching and obtaining a first duration threshold; According to the thread attribute information, searching and obtaining first storage space information and first operation information; Obtaining first resource information; A first resource proportion threshold is determined according to the first resource information, the first storage space information and the first operation information.
7. The thread abnormality detection and processing method for the power consumption information collection terminal according to claim 5 is characterized in that: The determining of the first abnormality level information according to the first resource proportion information and the first resource proportion threshold is specifically: Determine whether the first resource proportion information exceeds the first resource proportion threshold; If not, setting the first abnormal level information to a preset first reference level; If yes, then calculating the difference between the first resource proportion information and the first resource proportion threshold to obtain a first resource proportion difference; Calculating a ratio of the first resource proportion difference to the first resource proportion threshold to obtain a first difference ratio; First abnormality level information is obtained according to the first difference ratio.
8. The thread abnormality detection and processing method for the power consumption information collection terminal according to claim 5 is characterized in that: The determining the first abnormal coding information according to the first duration information and the first duration threshold is specifically: Determining whether the first duration information exceeds the first duration threshold; If not, setting the first abnormal coding information as a preset first reference code; If yes, then calculating the difference between the first duration information and the first duration threshold to obtain a first duration difference; Calculating a ratio of the first duration difference to the first duration threshold to obtain a second difference ratio; According to the second difference ratio, first abnormal coding information is obtained.
9. The thread abnormality detection and processing method for the power consumption information collection terminal according to claim 5, characterized in that: The performing thread repair according to the first exception level information and the first exception coding information is specifically: Determining a repair mode according to the first abnormality level information and the first abnormality coding information; When it is determined that the repair mode is a short lock conflict mode; Obtaining thread attribute information according to the first thread number information; According to the thread attribute information, an automatic retry mechanism is used to repair the thread; When it is determined that the repair mode is a data consistency error mode; Obtain backup data according to the first thread number information; According to the backup data, a recovery mechanism is used to repair the thread.
10. The thread abnormality detection and processing method for the power consumption information collection terminal according to claim 9, characterized in that: The determining of the repair mode according to the first abnormality level information and the first abnormality coding information is specifically: Determining whether the first abnormal coding information is within a preset first abnormal coding range; If yes, setting the repair mode to a short lock conflict mode; If not, determining whether the first abnormality level information exceeds a preset first abnormality level threshold; If so, the repair mode is set to a data consistency error mode.
Citation Information
Patent Citations
Method and device for detecting thread state, electronic equipment and medium
CN117149482A