Process processing method and device

By identifying processes that need to be restored and restarting the operating system when specific conditions are met, the problem of undifferentiated restart of the task suspend detection function in the Linux kernel is solved, and the reliability and security of the system are improved.

CN119847689APending Publication Date: 2025-04-18HENAN KUNLUN TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411888827.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the Linux kernel, the task suspend detection function will restart the system indiscriminately when detecting a D-state process, resulting in a reduced security of system operation and the reliability of the system cannot be guaranteed.

Method used

By identifying processes that need to recover the operating system, detect target processes in the operating system that are in a sleep-free state, and restart the operating system when certain conditions are met (such as processes in the recovery process list or duration exceeding the recovery time threshold) to improve system reliability.

Benefits of technology

It realizes finer granular monitoring of processes, avoids indiscriminate system restarts, reduces unnecessary restarts and business interruption times, and improves system reliability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847689A_ABST
    Figure CN119847689A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a process processing method and device.The method comprises the steps that a target process in a non-interruptible sleep state in an operating system is detected, and when it is determined that the target process is a process in a recovery process list, and / or the target process is a process in the recovery process list; when it is determined that the duration of the target process in the non-interruptible sleep state exceeds a recovery time threshold, restarting the operating system; wherein the recovery process list is used for storing processes of which the operating system needs to be recovered after interruption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computers, and in particular to a process processing method and device. Background Art

[0002] In a system running on the Linux kernel, a process may enter an uninterruptible sleep state (also known as the D state) while waiting for certain events (such as I / O operations). A process in the uninterruptible sleep state cannot respond to signals and therefore cannot be killed or interrupted.

[0003] The Linux kernel provides a task hang detection function, which is used to detect and record the process information in the D state for a long time, and trigger a system restart when a D state process is detected. Although the task hang detection function can identify and respond to system-level problems, the task hang detection function indiscriminately restarts the system for D state processes, which reduces the security of system operation and cannot ensure the reliable operation of the system. Summary of the invention

[0004] In view of the above problems, the embodiments of the present application are proposed. The embodiments of the present application provide a process processing method and device, which improves the reliability of system operation by identifying the process that needs to restore the operating system.

[0005] According to one aspect of an embodiment of the present application, a process processing method is provided, including:

[0006] Detect target processes in the operating system that are in an uninterruptible sleep state;

[0007] When it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restart the operating system; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

[0008] In this technical solution, the process can be monitored in a targeted and more fine-grained manner, thereby enhancing the monitoring and recovery of uninterruptible sleeping processes, thereby avoiding indiscriminate system restarts based on detected D-state processes, and reducing unnecessary restarts and business interruption time.

[0009] In an optional implementation manner, when determining that the target process is a process in the recovery process list and / or determining that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restarting the operating system includes:

[0010] In the case where it is determined that the target process is a process in the recovery process list, obtaining a recovery time threshold corresponding to the target process in the recovery process list; wherein the recovery process list also includes a recovery time threshold corresponding to each process;

[0011] If it is determined that the duration exceeds a recovery time threshold corresponding to the target process, restart the operating system.

[0012] In this technical solution, the recovery time threshold of each process in the recovery process list can be customized, which can further refine the monitoring granularity of the process, thereby ensuring that the process can be monitored more accurately and unnecessary restart time can be reduced while ensuring the safe operation of the operating system.

[0013] In an optional implementation manner, when determining that the target process is a process in the recovery process list and / or determining that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restarting the operating system includes:

[0014] When it is determined that the target process is a process in the recovery process list, obtaining a historical number of recovery times of the target process in the recovery process list;

[0015] When it is determined that the number of historical restorations is greater than a preset number threshold, and / or when it is determined that the duration exceeds the restoration time threshold, the operating system is restarted.

[0016] In this technical solution, by judging the number of historical recovery times and / or duration, it is determined whether to trigger an operating system restart, which can avoid erroneously triggering a system restart due to the D state of a non-critical process, thereby reducing unnecessary service interruptions.

[0017] In an optional implementation manner, after detecting the target process in the operating system that is in an uninterruptible sleep state, the method further includes:

[0018] Detecting whether the target process is a preset monitoring process;

[0019] When it is detected that the target process is the preset monitoring process, the duration of the target process in the uninterruptible sleep state is counted, and the recovery process list is obtained, and when it is determined that the target process is a process in the recovery process list and / or it is determined that the duration exceeds the recovery time threshold, the operating system is restarted.

[0020] In this technical solution, by judging the preset monitoring process of the target process, the process that needs to be restored and monitored can be quickly identified from the D state process, so that a quick response can be made when the key process is in the D state for a long time.

[0021] In an optional implementation manner, the detecting whether the target process is a preset monitoring process includes:

[0022] In the case where it is determined that the target process is a process in the monitoring process list, determining that the target process is the preset monitoring process;

[0023] or

[0024] In the case where it is detected that the target process carries a monitoring identifier, the target process is determined to be the preset monitoring process.

[0025] In this technical solution, by configuring the preset monitoring process through monitoring identification and monitoring process list, flexible configuration of the preset monitoring process can be achieved to meet different business needs and operating environments.

[0026] In an optional implementation manner, the method further includes:

[0027] Detecting whether the operating system process recovery function is enabled;

[0028] If it is detected that the process recovery function is turned on, the operating system is restarted when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold.

[0029] In this technical solution, by setting a recovery switch, flexible configuration of the embodiment of the present application can be achieved, thereby adjusting the recovery strategy according to different business requirements and operating environments.

[0030] In an optional implementation manner, the method further includes:

[0031] When it is determined that the time during which the target process is continuously in the uninterruptible sleep state does not exceed the recovery time threshold, or when it is detected that the process recovery function is not turned on, or when it is detected that the target process does not belong to the processes in the recovery process list, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0032] In this technical solution, when the target process does not meet the process recovery conditions, an input can be used to analyze the reason why the target process is in an uninterruptible sleep state, thereby providing a judgment basis for the safe operation of the operating system.

[0033] In an optional implementation manner, after restarting the operating system, the method further includes:

[0034] Outputting the stack information and call stack information of the operating system to obtain the relevant stack information;

[0035] Output the process information of the resource holding process of the target shared resource that the target process is waiting to access and the resource holding identifier held by the resource holding process; wherein the resource holding identifier includes a mutex lock and a semaphore for the target shared resource.

[0036] In this technical solution, more complete process context related information can be recorded, and system faults can be analyzed and located more accurately.

[0037] In an optional implementation manner, the outputting the resource holding identifier held by the resource holding process of the target shared resource includes:

[0038] Check whether the identification output function is turned on;

[0039] When it is detected that the identification output function is turned on, the resource holding identification is output.

[0040] In this technical solution, the printing method of the mutex lock and the semaphore can be set more flexibly, so as to adapt to different business requirements and operating environments.

[0041] In an optional implementation manner, the method further includes:

[0042] When it is detected that the target process has not been scheduled and has not exceeded the alarm upper limit threshold, if it is determined that the target process does not belong to the preset monitoring process, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0043] In this technical solution, when the target process does not belong to the preset monitoring process, more complete process context-related information can be recorded by outputting process information, process logs and call stack information, thereby assisting staff in analyzing the D state process.

[0044] In an optional implementation manner, the method further includes:

[0045] Counting the number of times the target process meets the process recovery condition within a preset time period;

[0046] When it is determined that the number of restoration times meets the alarm threshold, alarm information for the target process is generated according to the process importance of the target process.

[0047] In this technical solution, alarm monitoring can be performed on D-state processes with a high recovery frequency, thereby further ensuring the stable operation of the system.

[0048] According to another aspect of an embodiment of the present application, a process processing device is provided, including:

[0049] A detection unit, used for detecting a target process in an uninterruptible sleep state in an operating system;

[0050] A system recovery unit is used to restart the operating system when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

[0051] In the above implementation, the process can be monitored in a targeted and more fine-grained manner, thereby enhancing the monitoring and recovery of uninterruptible sleeping processes, thereby avoiding indiscriminate system restart based on the detected D-state processes, and reducing unnecessary restarts and business interruption time.

[0052] According to another aspect of the embodiments of the present application, a computer device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the process processing method described above.

[0053] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the process processing method described above are implemented.

[0054] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program / instruction, which implements the steps of the process processing method described above when executed by a processor.

[0055] As will be described in detail below, after the embodiment of the present application detects a target process in an uninterruptible sleep state in the system, if it is determined that the target process is a process in the recovery process list, and / or it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, then the operating system restart can be triggered; wherein the recovery process list is used to store processes that need to restore the operating system after interruption.

[0056] In the above implementation, after detecting the target process in the uninterruptible sleep state, the system is restored when it is determined that the target process meets the recovery conditions by restoring the process list and / or the duration of the target process in the D state. This allows for targeted and more fine-grained monitoring of the process, thereby enhancing the monitoring and recovery of the uninterruptible sleep process, and further avoiding indiscriminate system restart based on the detected D state process, thereby reducing unnecessary restarts and business interruption time.

[0057] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0059] Figure 1 It is a flowchart illustrating a process processing method according to an embodiment of the present application.

[0060] Figure 2 It is a structural diagram illustrating a process processing system according to an embodiment of the present application.

[0061] Figure 3 is a flowchart illustrating another process processing method according to an embodiment of the present application.

[0062] Figure 4 It is a block diagram illustrating a process processing device according to an embodiment of the present application.

[0063] Figure 5 It is a hardware block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the present application more obvious, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.

[0065] In order to make the purpose, technical solution and advantages of the present application more obvious, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.

[0066] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0067] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0068] Before going into detail, the terms involved in the embodiments of the present application are explained as follows:

[0069] Hung Task: Usually refers to a process or thread that cannot continue to execute for some reason and remains in an unfinished state for a long time. This may cause system resources to be occupied and affect the normal operation of other tasks.

[0070] Non-Interruptible Sleep (NIS) processes are those that are waiting for certain resources (such as I / O operations) or events to be completed, and this waiting state cannot be interrupted by signals. When using the ps command to view the process, the state of the non-interruptible sleep process is displayed as D, so it is also called the D state process.

[0071] Semaphore: A mechanism for synchronizing and controlling access to shared resources between processes. It can be used to solve some classic problems in concurrent programming, such as mutual exclusion, synchronization, and resource sharing.

[0072] Mutex: A synchronization primitive used to implement mutually exclusive access to shared resources. It ensures that only one thread can access a specific resource at any time, thus avoiding race conditions and data inconsistency problems.

[0073] For processes in the uninterruptible sleep state (hereinafter referred to as D-state processes), they are usually marked as "uninterruptible". At this time, the operating system will block any interrupt signals (such as semaphore interrupts, timer interrupts, etc.) to wake up the process, so it cannot be killed or interrupted. D-state processes are usually related to kernel-level operations, and the kernel handles these operations without interference from higher priority processes. This mechanism ensures the stability and reliability of the system during critical operations. However, if a process waits indefinitely in the uninterruptible sleep state, it may cause the entire system to become unresponsive, so in practical applications, the use of uninterruptible sleep states needs to be carefully managed.

[0074] Based on the above research, the present application provides a process processing method. In an embodiment of the present application, after detecting a target process in an uninterruptible sleep state in the system, if it is determined that the target process is a process in a recovery process list, and / or it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, the operating system can be restarted; wherein the recovery process list is used to store processes that need to restore the operating system after interruption.

[0075] In the above implementation, after detecting the target process in the uninterruptible sleep state, the system is restored when it is determined that the target process meets the recovery conditions by restoring the process list and / or the duration of the target process in the D state. This allows for targeted and more fine-grained monitoring of the process, thereby enhancing the monitoring and recovery of the uninterruptible sleep process, and further avoiding indiscriminate system restart based on the detected D state process, thereby reducing unnecessary restarts and business interruption time.

[0076] To facilitate understanding of this embodiment, a process processing method disclosed in the embodiment of the present application is first introduced in detail. The execution subject of the process processing method provided in the embodiment of the present application is generally an electronic device with certain computing capabilities. In some possible implementations, the process processing method can be implemented by a processor calling a computer-readable instruction stored in a memory.

[0077] Reference Figure 1 FIG. 1 is a flowchart of a process processing method provided in an embodiment of the present application, the method comprising steps S101 to S102, wherein:

[0078] S101, detecting a target process in an uninterruptible sleep state in an operating system.

[0079] In the embodiment of the present application, the process in the uninterruptible sleep TASK_UNINTERRUPTIBLE state (i.e., D state) in the operating system is periodically detected through the task hanging (Hung Task) detection function, and then the detected process is determined as the target process. For example, when there is a deadlock scenario in the kernel code flow or the user kernel module, the process may be in the D state for a long time and cannot be awakened. At this time, the process is the target process.

[0080] Here, the task suspension detection function is used to detect and record the process information that is in the D state for a long time. The specific implementation process is described as follows:

[0081] When the system starts, a timer is initialized. The timer is triggered at a certain interval to traverse all processes in the operating system. For each process, check whether it is in an uninterruptible sleep state. If so, the process is determined to be the target process.

[0082] S102. When it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restart the operating system; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

[0083] In an embodiment of the present application, after detecting a target process in the D state, the duration of the target process in the D state can be counted, and a list of recovery processes can also be obtained. Here, if it is determined that the duration is greater than the recovery time threshold, and / or it is determined that the target process is in the recovery process list, the operating system can be restarted.

[0084] Here, the processes in the recovery process list can be specified by user configuration, and then the recovery process list is stored as a file in a specified folder. If the processes in the recovery process list are captured by D state monitoring, they can be restored by resetting the operating system.

[0085] If hung_task_panic is configured in the task hang detection function, when it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, the operating system panic is directly triggered, thereby recovering and restarting the operating system.

[0086] The above steps will be described in detail below in conjunction with specific implementation methods.

[0087] In an embodiment of the present application, first, a target process in an uninterruptible sleep state (i.e., D state) in the operating system is periodically detected through a kernel task suspension mechanism, and then, it is detected whether the target process is a preset monitoring process; and when it is detected that the target process is the preset monitoring process, the duration of the target process in the uninterruptible sleep state is counted, and a recovery process list is obtained, and when it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration exceeds a recovery time threshold, it is determined that the target process meets the process recovery condition, and at this time, the operating system restart is triggered to restore the operating system.

[0088] In an embodiment of the present application, at least one process to be monitored (ie, a preset monitoring process) may be pre-set; wherein the preset monitoring process may be manually set by relevant technical personnel, or may be automatically set according to actual needs.

[0089] For example, a process monitoring list can be set, wherein the processes in the process monitoring list are preset monitoring processes. For another example, a preset monitoring process can be automatically determined from multiple processes based on multi-dimensional parameters; wherein the multi-dimensional parameters include at least one of the following parameters: process type, time that the process is in D state, size of system resources occupied by the process, importance of the process, number of times the process is restored, and other parameters.

[0090] After determining that the target process is the preset monitoring process, it is possible to determine whether the target process meets the process recovery condition in the manner described in step S102. If it is determined that the process recovery condition is met, the operating system is restarted.

[0091] In an optional implementation, the above step of detecting whether the target process is a preset monitoring process may adopt any one of the following methods:

[0092] Method 1:

[0093] When it is determined that the target process is a process in the monitoring process list, the target process is determined to be the preset monitoring process.

[0094] In an embodiment of the present application, a monitoring process list can be pre-set, wherein the processes in the monitoring process list are processes to be monitored. Here, the processes to be monitored in the monitoring process list can be specified by user configuration, and the monitoring process list is stored as a file in a specified folder.

[0095] After detecting the target process in the D state, the monitoring process list can be obtained from the designated folder, and the detected target process can be compared with each process to be monitored in the monitoring process list. If the target process is determined to be the process to be monitored in the monitoring process list according to the comparison result, the target process is determined to be the preset monitoring process.

[0096] Method 2:

[0097] In the case where it is detected that the target process carries a monitoring identifier, the target process is determined to be the preset monitoring process.

[0098] It can be seen from the above description that the preset monitoring process can be automatically determined from multiple processes according to the multi-dimensional parameters. For the determined preset monitoring process, a monitoring flag can be set to indicate that the process is the preset monitoring process.

[0099] Based on this, after the target process is detected, it can be detected whether the target process carries a monitoring identifier. If it is detected that the target process carries a monitoring identifier, the target process is determined to be a preset monitoring process.

[0100] In the embodiment of the present application, in addition to automatically marking the monitoring mark for the process through multi-dimensional parameters, the monitoring mark can also be set for the process through user configuration. Here, the setting method of the monitoring mark is not specifically limited, and it is subject to what can be implemented.

[0101] In the embodiment of the present application, whether the target process is the preset monitoring process can be determined only through method one, or whether the target process is the preset monitoring process can be determined only through method two.

[0102] The above implementation can quickly identify the process that needs to be restored from the D state process, so that a quick response can be made when the key process is in the D state for a long time. By configuring the preset monitoring process through the monitoring identification and the monitoring process list, the preset monitoring process can be flexibly configured to meet different business needs and operating environments.

[0103] After determining that the target process is a preset monitoring process, if the target process is determined to be a process in the recovery process list, and / or it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, then output fault analysis information and restart the operating system. The fault analysis information includes resource holding information for indicating the target shared resource that the target process is waiting to access and / or related stack information of the target process. The reason for the system restart and / or the reason why the target process is in the uninterruptible sleep state can be determined through the fault analysis information.

[0104] Here, the resource holding information is used to indicate the resource holding process of the target shared resource and the resource holding identifier held by the resource holding process. The resource holding identifier is the identifier of the target shared resource held by the resource holding process. For example, the resource holding identifier can be a mutex and / or semaphore for the target shared resource. The relevant stack information of the target process includes the stack information and call stack information of the operating system.

[0105] In an optional implementation, the above step triggers the restart of the operating system when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold. Exemplarily, any one of the following implementations may be adopted:

[0106] Implementation method 1:

[0107] After detecting the target process in the D state, the duration of the target process in the uninterruptible sleep state can be counted. If it is determined that the duration exceeds the recovery time threshold, the operating system is restarted; wherein, the user can determine the specific duration of the recovery time threshold according to actual needs (for example, the default is 120s), and the user can store the recovery time threshold as a file in a specified folder. Here, the specific duration of the recovery time threshold is not specifically limited.

[0108] Implementation method 2:

[0109] After detecting the target process in the D state, it can be determined whether the target process is a process in the recovery process list; if it is determined to be yes, the operating system is restarted.

[0110] Implementation method three:

[0111] After detecting the target process in the D state, the duration of the target process in the uninterruptible sleep state can be counted. If it is determined that the duration exceeds the recovery time threshold, it is determined whether the target process is a process in the recovery process list; if it is determined that it is, the operating system is restarted; for example, if it is determined that the duration exceeds 120s and the target process is a process in the recovery process list, the operating system is restarted.

[0112] Implementation method 4:

[0113] When it is determined that the target process is a process in the recovery process list, a recovery time threshold corresponding to the target process is obtained in the recovery process list; wherein the recovery process list also includes a recovery time threshold corresponding to each process; when it is determined that the duration exceeds the recovery time threshold corresponding to the target process, restart the operating system.

[0114] After detecting the target process in the D state, it can be determined whether the target process is a process in the recovery process list; if it is determined that the target process is a process in the recovery process list; then the recovery time threshold matching the target process is determined. Here, each process in the recovery process list corresponds to a recovery time threshold; then, it can be determined whether the target process exceeds the corresponding recovery time threshold. If it is determined that it exceeds the corresponding recovery time threshold, it is determined that the target process meets the process recovery condition, and at this time, the operating system can be restarted.

[0115] In this technical solution, the recovery time threshold of each process in the recovery process list can be customized, which can further refine the monitoring granularity of the process, thereby ensuring that the process can be monitored more accurately and unnecessary restart time can be reduced while ensuring the safe operation of the operating system.

[0116] Implementation method five:

[0117] When it is determined that the target process is a process in the recovery process list, the historical recovery times of the target process are obtained in the recovery process list; when it is determined that the historical recovery times are greater than a preset times threshold, and / or when it is determined that the duration exceeds the recovery time threshold, restart the operating system.

[0118] After detecting the target process in the D state, it can be determined whether the target process is a process in the recovery process list; wherein, if it is determined that the target process is a process in the recovery process list; the historical recovery number of the target process can be determined in the process recovery list. The historical recovery number is used to indicate the number of times the target process has triggered system recovery at historical moments. If it is detected that the historical recovery number is greater than a preset number threshold, and / or it is determined that the duration exceeds the recovery time threshold, the operating system restart can be triggered. Specifically, if it is detected that the historical recovery number is less than the preset number threshold when the duration exceeds the recovery time threshold, a recovery confirmation message can be generated to the user; wherein, after detecting the message sent by the user to confirm the restart of the operating system, the operating system is restarted.

[0119] Here, it should be noted that whether to restart the triggering operating system can be determined by any one of the above-mentioned implementation modes 1 to 5.

[0120] The above implementation can avoid misoperation of non-critical processes. By setting the duration exceeding the recovery time threshold and / or the process in the recovery list to trigger the system reset, it is possible to avoid the system restart caused by the D state of non-critical processes, thereby reducing unnecessary service interruptions.

[0121] Based on the above implementation, the method further includes the following steps:

[0122] First, detect whether the operating system process recovery function is enabled;

[0123] Secondly, if it is detected that the process recovery function is turned on, the operating system is restarted when it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold.

[0124] In the embodiment of the present application, a recovery switch function is pre-set, wherein the recovery switch function is stored as a file in a specified folder. When the recovery switch is turned on, the system process recovery function is turned on, and when the recovery switch is turned off, the system process recovery function is turned off.

[0125] Here, before or after the above step S102, it can be detected whether the recovery switch is turned on. If it is detected that the recovery switch is turned on, the operating system is restarted and the fault analysis information is output.

[0126] For example, if it is calculated that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, and the target process is determined to be a process in the recovery process list, it can be determined whether the recovery switch is turned on; if it is determined that the recovery switch is turned on, the operating system is restarted.

[0127] By setting the recovery switch, the embodiment of the present application can be flexibly configured, thereby adjusting the recovery strategy according to different business requirements and operating environments.

[0128] Based on the above implementation, the method further includes the following steps:

[0129] When it is determined that the duration for which the target process is continuously in the uninterruptible sleep state does not exceed the recovery time threshold, or, it is detected that the process recovery function is not turned on, or, it is detected that the target process does not belong to the processes in the recovery process list, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0130] In the embodiment of the present application, the following situations will trigger the output of the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the system:

[0131] If it is determined that the duration of the target process being in the uninterruptible sleep state continuously does not exceed the recovery time threshold, the above information is output;

[0132] If it is determined that the target process does not belong to the processes in the recovery process list, the above information is output;

[0133] If it is determined that the target process is a process in the recovery process list, and / or it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, but it is determined that the recovery switch is turned off, the above information is output.

[0134] In an embodiment of the present application, a process in an uninterruptible sleep state (i.e., D state) is periodically monitored in a system by a kernel task suspension mechanism. At the moment when each monitoring time arrives, all processes in the system are started to be traversed, and the current process is judged to be a D state process, wherein, if it is judged that no, the next process is continued to be traversed, and if it is judged that yes, it is continued to be judged whether the process is scheduled. If it is judged that scheduling has occurred, the next process is continued to be traversed, and if it is judged that scheduling has not occurred, it is continued to be judged whether it exceeds the alarm upper limit threshold. If it is judged that the alarm upper limit is exceeded, the next process is continued to be traversed, and if it is judged that the alarm upper limit is not exceeded, the alarm log (i.e., process log) and the process information of the resource holding process of the target shared resource are output.

[0135] Next, continue to determine whether the target process is a preset monitoring process; if it is determined to be a preset monitoring process, determine whether the target process meets the process recovery condition through the above step S102; otherwise output the system call stack information and continue to traverse the next process.

[0136] Next, it can be determined whether the duration of the target process in the D state is greater than the recovery time threshold. If it is determined to be no, the next process is traversed; otherwise, it is determined whether the target process is in the recovery process list. If it is determined to be no, the next process is traversed; otherwise, it is determined whether the recovery switch is turned on. If it is determined to be no, the next process is traversed; otherwise, the fault analysis information of the operating system is output and the operating system is restarted.

[0137] At this point, it can be determined that when it is determined that the duration of the target process being in an uninterruptible sleep state continuously does not exceed the recovery time threshold, or, it is detected that the process recovery function is not turned on, or, it is detected that the target process does not belong to the process in the recovery process list, at least one of the process log of the target process, the process information of the resource holding process of the target shared resource, and the system call stack information is output.

[0138] In this technical solution, when the target process does not meet the process recovery conditions, an input can be used to analyze the reason why the target process is in an uninterruptible sleep state, thereby providing a judgment basis for the safe operation of the operating system.

[0139] In the embodiment of the present application, after restarting the operating system, the following steps are exemplarily included:

[0140] Outputting stack information and call stack information of the operating system;

[0141] Output the process information of the resource holding process of the target shared resource and the resource holding identifier held by the resource holding process; wherein the resource holding identifier includes a mutex lock and a semaphore for the target shared resource.

[0142] In an embodiment of the present application, stack information and CPU backtrace information (i.e., call stack information) can be output when it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold, and when it is determined that the process recovery function of the operating system is turned on.

[0143] Next, it can be determined whether the output conditions of the process information and the resource holding identifier are met; if it is determined that the output conditions of the process information and the resource holding identifier are met, the process information of the resource holding process of the target shared resource and the resource holding identifier are output, wherein the resource holding identifier can be a mutex lock and semaphore for the target shared resource.

[0144] Through the above processing method, more complete process context related information can be recorded, and system faults can be analyzed and located more accurately.

[0145] Based on the above implementation, outputting the resource holding identifier held by the resource holding process of the target shared resource exemplarily includes the following steps:

[0146] First, check whether the identification output function is turned on;

[0147] Secondly, when it is detected that the identification output function is turned on, the resource holding identification is output.

[0148] In an embodiment of the present application, after outputting the stack information and call stack information of the system, it is possible to detect whether the identification output function is turned on.

[0149] Here, a cmdline configuration item hungtask_debug can be added, where the configuration item can be stored as a file in a specified folder. When the configuration item is set to on, it indicates that the identification output function is turned on. That is, if hungtask_debug = on, it indicates that the identification output function is turned on. At this time, the holding information of the mutex lock (mutex lock) or semaphore (semaphore) that the D state process (target process) is waiting for is printed.

[0150] Through this processing method, the printing method of mutex locks and semaphores can be set more flexibly, so as to adapt to different business needs and operating environments.

[0151] In an embodiment of the present application, the method further includes the following steps:

[0152] When it is detected that the target process has not been scheduled and has not exceeded the alarm upper limit threshold, if it is determined that the target process does not belong to the preset monitoring process, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0153] In an embodiment of the present application, a process in an uninterruptible sleep state (i.e., D state) is periodically monitored in a system by a kernel task suspension mechanism. At the moment when each monitoring time arrives, all processes in the system are started to be traversed, and the current process is judged to be a D state process, wherein, if it is judged that no, the next process is continued to be traversed, and if it is judged that yes, it is continued to be judged whether the process is scheduled. If it is judged that scheduling has occurred, the next process is continued to be traversed, and if it is judged that scheduling has not occurred, it is continued to be judged whether it exceeds the alarm upper limit. If it is judged that the alarm upper limit is exceeded, the next process is continued to be traversed, and if it is judged that the alarm upper limit threshold is not exceeded, the alarm log (i.e., process log) and the process information of the resource holding process of the target shared resource are output.

[0154] Next, continue to determine whether the target process is a preset monitoring process; if it is determined to be a preset monitoring process, continue to execute the above step S102; otherwise, output the system call stack information and continue to traverse the next process.

[0155] In the above implementation, when the target process does not belong to the preset monitoring process, more complete process context-related information can be recorded by outputting process information, process log and call stack information, thereby assisting staff in analyzing the D state process.

[0156] In an embodiment of the present application, the method further includes the following steps:

[0157] First, count the number of times the target process meets the process recovery condition within a preset time period;

[0158] Secondly, when it is determined that the number of restoration times meets the alarm threshold, alarm information for the target process is generated according to the process importance of the target process.

[0159] In the embodiment of the present application, the target process meeting the process recovery condition can be understood as the target process being a process in the recovery process list, and / or the duration of the target process being in the uninterruptible sleep state exceeds the recovery time threshold. For each target process, the number of times the target process meets the process recovery condition within the target continuous period can be counted. For example, the number of times the target process meets the process recovery condition continuously within a week can be counted.

[0160] If it is determined that the number of recovery times is greater than the alarm threshold, an alarm message may be generated according to the process importance of the target process.

[0161] Here, the process importance of the target process may be the process priority of the target process, or may be an important label pre-set for the target process. For example, the important label may be information such as “general”, “relatively important”, or “very important”.

[0162] In specific implementation, an alarm template that matches the importance of the process can be determined; wherein the information content of the alarm information contained in different alarm templates is different. Here, the corresponding alarm template can be set according to actual needs. After the alarm template is determined, the information content of the alarm information in the alarm template is determined, so as to obtain the alarm information for the target process. For example, the alarm information may include at least one of the following: number of recovery times, process type, process recovery time, process recovery reason and other information.

[0163] Through the above processing method, alarm monitoring can be performed on D-state processes with a high recovery frequency, thereby further ensuring the stable operation of the system.

[0164] From the above description, it can be seen that the embodiment of the present application, based on the hungtask detection function, can perform a more fine-grained division of the D state process, so as to restart the operating system after detecting the target process that meets the process recovery conditions, thereby ensuring more reliable operation of the operating system; at the same time, the embodiment of the present application can also record more complete process context-related information, which is more conducive to the analysis and location of operating system failures.

[0165] The following will be combined Figures 2 to 4 The process handling method is further described.

[0166] like Figure 2 The figure below is the structural diagram of the process processing system. Figure 2As shown, the process processing system includes user state and kernel state. In the embodiment of the present application, in the kernel state, on the basis of the hungtask detection function of Linux, the holding situation of the system resources of the process mutex (mutual exclusion lock) and semaphore (semaphore) is increased and recorded. When the process is determined to be a process in the monitoring process list and the recovery process list, the mutex (mutual exclusion lock) and semaphore (semaphore) waiting for the process, as well as the holder information are all printed. In the kernel state, an independent kernel module hungtask_monitor.ko is set, and a configuration interface is provided in the user state. Among them, the hungtask-monitor system service is used to load / unload the hungtask_monitor.ko kernel module. Relevant information about the Hungtask mechanism can be provided through the / sys / kernel / debug / hungtask / * directory, for example, the monitoring process list, the recovery process list, the recovery time threshold, and the process recovery function can be stored as files in this directory.

[0167] For example, when a deadlock scenario exists in the kernel code flow or the user kernel module, the process may be in the D state for a long time and cannot be awakened. At this time, the D state process is monitored and recovered through the kernel hungtask mechanism. In order to enhance the localizability, the hungtask-monitor service is started on the current operating system, and the monitoring process list monitor_tak_list, the recovery process list recovery_task_list, the recovery switch recovery_filter_enabled and the recovery time threshold recovery_timeout_minutes are configured.

[0168] The monitoring process list is configured with the required processes, and the recovery process list is the processes to be recovered in the monitoring process list. When the processes in the recovery process list are captured by the D state monitoring, the operating system will be restored by triggering the panic protection mechanism, and the stack information and CPU call stack information of the processes in the monitoring process list (i.e. the required processes) will be output. At the same time, information records are added to the operations of semaphores and mutexes to record the mutexes (mutex locks) and semaphores (semaphores) that the processes are waiting for.

[0169] like Figure 3 The flowchart shown is another process processing method. Figure 3 As shown, the method specifically comprises the following steps:

[0170] S1: Start the hungtask-monitor service;

[0171] S2: Configure the monitoring process list, recovery process list and recovery switch;

[0172] S3: Determine whether the next inspection time has arrived; if so, execute step S4; otherwise, execute step S17;

[0173] S4: traverse all processes;

[0174] S5: Determine whether the polling of the process is completed; if it is, return to step S3; otherwise, execute step S6;

[0175] S6: Determine whether the process is in the D state; if it is, execute step S7; otherwise, execute step S4;

[0176] S7: Determine whether the process is scheduled; if it is determined that it is not, execute step S8; otherwise, execute step S4; wherein, the process is scheduled can be understood as the process in which the target process is awakened from the D state and assigned to a processor (such as a central processing unit CPU) for operation;

[0177] S8: Determine whether the process exceeds the alarm upper threshold; if it is judged to be no, execute step S9; otherwise execute step S4; wherein, the alarm upper threshold is the critical threshold for monitoring the process. If the process is detected to be in the D state and the number of times that scheduling has not occurred does not exceed the alarm upper threshold, it is determined that the process can continue to be monitored; if the process is detected to be in the D state and the number of times that scheduling has not occurred exceeds the alarm upper threshold, it is determined that the process does not need to be monitored anymore, and the next process can be traversed.

[0178] S9: Output the alarm log and the process information of the resource holding process of the target shared resource;

[0179] S10: Determine whether the process is in the monitoring process list; if it is, execute step S11; otherwise, execute step S4;

[0180] S11: Determine whether the duration of the process being in the D state is greater than the recovery time threshold; if it is determined to be yes, execute step S12; otherwise, execute step S4;

[0181] S12: Determine whether the process is in the recovery process list and whether the recovery switch is turned on; if it is determined to be yes, execute step S13; otherwise, execute step S4;

[0182] S13: Print stack information and call stack information;

[0183] S14: Determine whether the identification output function is turned on; if it is, execute step S15; otherwise, execute step S16;

[0184] S15: Print the mutex and semaphore that the process is waiting for, as well as the holder information;

[0185] S16: The operating system recovers through panic;

[0186] S17: Enter the sleep waiting state and return to execute step S3.

[0187] Compared with the related art, the technical solution of the embodiment of the present application has the following advantages:

[0188] (1) Reduce unnecessary restarts and business interruption time. By extending the hung_task mechanism, it is possible to quickly respond when a critical process is in the D state for a long time, and restore services by resetting the operating system, thereby reducing operating system downtime and improving overall stability.

[0189] (2) Flexible configuration management. Users can flexibly define the recovery process list and monitoring process list, as well as the D state recovery time threshold through the configuration file, so that the recovery strategy can be adjusted according to different business needs and operating environments.

[0190] (3) Avoid misoperation of non-critical processes. Since only processes in the recovery list will trigger the operating system reset, this avoids the operating system restart caused by the D state of non-critical processes, reducing unnecessary service interruptions.

[0191] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0192] Based on the same inventive concept, the embodiment of the present application also provides a process processing device corresponding to the process processing. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned process processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0193] Reference Figure 4 FIG. 4 is a schematic diagram of a process processing device provided in an embodiment of the present application, wherein the device comprises: a detection unit 41 and a system recovery unit 42; wherein:

[0194] A detection unit 41, used for detecting a target process in an uninterruptible sleep state in the operating system;

[0195] The system recovery unit 42 is used to restart the operating system when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds the recovery time threshold; wherein the recovery process list is used to store processes that need to restore the operating system after interruption.

[0196] In a possible implementation manner, the system recovery unit is further configured to:

[0197] In the case where it is determined that the target process is a process in the recovery process list, obtaining a recovery time threshold corresponding to the target process in the recovery process list; wherein the recovery process list also includes a recovery time threshold corresponding to each process;

[0198] If it is determined that the duration exceeds a recovery time threshold corresponding to the target process, restart the operating system.

[0199] In a possible implementation manner, the system recovery unit is further configured to:

[0200] When it is determined that the target process is a process in the recovery process list, obtaining a historical number of recovery times of the target process in the recovery process list;

[0201] When it is determined that the number of historical restorations is greater than a preset number threshold, and / or when it is determined that the duration exceeds the restoration time threshold, the operating system is restarted.

[0202] In a possible implementation manner, the device is further used for:

[0203] Detecting whether the target process is a preset monitoring process;

[0204] When it is detected that the target process is the preset monitoring process, the duration of the target process in the uninterruptible sleep state is counted, and the recovery process list is obtained, and when it is determined that the target process is a process in the recovery process list and / or it is determined that the duration exceeds the recovery time threshold, the operating system is restarted.

[0205] In a possible implementation manner, the device is further used for:

[0206] In the case where it is determined that the target process is a process in the monitoring process list, determining that the target process is the preset monitoring process;

[0207] or

[0208] In the case where it is detected that the target process carries a monitoring identifier, the target process is determined to be the preset monitoring process.

[0209] In a possible implementation manner, the device is further used for:

[0210] Detecting whether the operating system process recovery function is enabled;

[0211] If it is detected that the process recovery function is turned on, the operating system is restarted when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold.

[0212] In a possible implementation manner, the device is further used for:

[0213] When it is determined that the time during which the target process is continuously in the uninterruptible sleep state does not exceed the recovery time threshold, or when it is detected that the process recovery function is not turned on, or when it is detected that the target process does not belong to the processes in the recovery process list, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0214] In a possible implementation manner, the device is further used for:

[0215] After restarting the operating system, outputting stack information and call stack information of the operating system;

[0216] Output the process information of the resource holding process of the target shared resource that the target process is waiting to access and the resource holding identifier held by the resource holding process; wherein the resource holding identifier includes a mutex lock and a semaphore for the target shared resource.

[0217] In a possible implementation manner, the system recovery unit is further configured to:

[0218] Check whether the identification output function is turned on;

[0219] When it is detected that the identification output function is turned on, the resource holding identification is output.

[0220] In a possible implementation manner, the device is further used for:

[0221] When it is detected that the target process has not been scheduled and has not exceeded the alarm upper limit threshold, if it is determined that the target process does not belong to the preset monitoring process, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

[0222] In a possible implementation manner, the device is further used for:

[0223] Counting the number of times the target process meets the process recovery condition within a preset time period;

[0224] When it is determined that the number of restoration times meets the alarm threshold, alarm information for the target process is generated according to the process importance of the target process.

[0225] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0226] Corresponds to Figure 1 The process processing method in the present application embodiment also provides an electronic device 500, such as Figure 5 FIG. 5 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, including:

[0227] Processor 51, memory 52, and bus 53; memory 52 is used to store execution instructions, including memory 521 and external memory 522; memory 521 here is also called internal memory, which is used to temporarily store operation data in processor 51 and data exchanged with external memory 522 such as hard disk. Processor 51 exchanges data with external memory 522 through memory 521. When the electronic device 500 is running, the processor 51 communicates with the memory 52 through bus 53, so that the processor 51 executes the following instructions:

[0228] Detect target processes in the operating system that are in an uninterruptible sleep state;

[0229] When it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restart the operating system; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

[0230] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0231] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.

[0232] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.

[0233] It should also be noted that in the system and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0234] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the techniques of the teachings defined by the appended claims. Furthermore, the scope of the claims of this application is not limited to the specific aspects of the processes, machines, manufactures, compositions, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions, means, methods, or actions within their scope.

[0235] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0236] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A process processing method, characterized in that: include: Detect target processes in the operating system that are in an uninterruptible sleep state; When it is determined that the target process is a process in the recovery process list, and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold, restart the operating system; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

2. The method according to claim 1, characterized in that The step of restarting the operating system when determining that the target process is a process in the recovery process list and / or determining that the duration of the target process being in the uninterruptible sleep state exceeds a recovery time threshold includes: In the case where it is determined that the target process is a process in the recovery process list, obtaining a recovery time threshold corresponding to the target process in the recovery process list; wherein the recovery process list also includes a recovery time threshold corresponding to each process; If it is determined that the duration exceeds a recovery time threshold corresponding to the target process, restart the operating system.

3. The method according to claim 1, characterized in that The step of restarting the operating system when determining that the target process is a process in the recovery process list and / or determining that the duration of the target process being in the uninterruptible sleep state exceeds a recovery time threshold includes: When it is determined that the target process is a process in the recovery process list, obtaining a historical number of recovery times of the target process in the recovery process list; When it is determined that the number of historical restorations is greater than a preset number threshold, and / or when it is determined that the duration exceeds the restoration time threshold, the operating system is restarted.

4. The method according to claim 1, characterized in that: After detecting the target process in the operating system that is in an uninterruptible sleep state, the method further includes: Detecting whether the target process is a preset monitoring process; When it is detected that the target process is the preset monitoring process, the duration of the target process in the uninterruptible sleep state is counted, and the recovery process list is obtained, and when it is determined that the target process is a process in the recovery process list and / or it is determined that the duration exceeds the recovery time threshold, the operating system is restarted.

5. The method according to claim 4, characterized in that The detecting whether the target process is a preset monitoring process includes: In the case where it is determined that the target process is a process in the monitoring process list, determining that the target process is the preset monitoring process; or In the case where it is detected that the target process carries a monitoring identifier, the target process is determined to be the preset monitoring process.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Detecting whether the operating system process recovery function is enabled; If it is detected that the process recovery function is turned on, the operating system is restarted when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold.

7. The method according to claim 6, characterized in that The method further comprises: When it is determined that the time during which the target process is continuously in the uninterruptible sleep state does not exceed the recovery time threshold, or when it is detected that the process recovery function is not turned on, or when it is detected that the target process does not belong to the processes in the recovery process list, at least one of the following is output: the process log of the target process, the process information of the resource holding process of the target shared resource that the target process is waiting to access, and the call stack information of the operating system.

8. The method according to any one of claims 1 to 7, characterized in that After restarting the operating system, the method further includes: Outputting stack information and call stack information of the operating system; Output the process information of the resource holding process of the target shared resource that the target process is waiting to access and the resource holding identifier held by the resource holding process; wherein the resource holding identifier includes a mutex lock and a semaphore for the target shared resource.

9. The method according to claim 8, characterized in that The outputting of the resource holding identifier held by the resource holding process of the target shared resource includes: Check whether the identification output function is turned on; When it is detected that the identification output function is turned on, the resource holding identification is output.

10. A process processing device, characterized in that: include: A detection unit, used for detecting a target process in an uninterruptible sleep state in an operating system; A system recovery unit is used to restart the operating system when it is determined that the target process is a process in the recovery process list and / or when it is determined that the duration of the target process in the uninterruptible sleep state exceeds a recovery time threshold; wherein the recovery process list is used to store processes for which the operating system needs to be restored after an interruption.

Citation Information

Cited By

  • Method for acquiring process-uninterruptible sleep state blocking information and electronic equipment

    CN122285311A