Real-time process management method and device, electronic equipment and storage medium

By periodically monitoring the continuous runtime of real-time processes and intervening when the Hung Task detection mechanism is triggered, the system freeze problem caused by high-priority processes occupying CPU is solved, realizing preventive protection and automated processing of the system, reducing downtime risk and maintenance costs.

CN121636286APending Publication Date: 2026-03-10GUOKE FOUNDATION STONE (CHONGQING) SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In nuclear isolation or resource-constrained environments, high-priority real-time processes may continuously occupy the CPU, causing system response to stagnate or even freeze. Existing technologies make it difficult to effectively intervene before the system freezes.

Method used

By periodically monitoring the continuous runtime of real-time processes, a monitoring list is created, and when the Hung Task detection mechanism is triggered, exit or priority reduction operations are performed, combined with cgroups for resource limitation.

Benefits of technology

It enables real-time monitoring of excessive CPU usage, allowing for early identification of potential problem processes, reducing the risk of system downtime, and lowering maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121636286A_ABST
    Figure CN121636286A_ABST
Patent Text Reader

Abstract

The invention relates to a real-time process management method and device, electronic equipment and a storage medium. The method comprises the following steps: periodically obtaining continuous running time of a real-time process in a running state; if the continuous running time exceeds a first preset threshold value, adding an identifier corresponding to the real-time process to a monitoring list; when the Hung Task detection mechanism is triggered, executing an exit operation or a priority reduction operation on the real-time processes in the monitoring list; according to the method, CPU occupancy time monitoring of a real-time process is combined with a Hung Task detection mechanism, a set of complete preventive protection system is constructed, and the abnormal process can be actively intervened before the system is completely stiff, so that the system downtime risk is effectively reduced, and the operation and maintenance cost is remarkably reduced through automatic processing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of operating system kernel, and particularly relates to a real-time process management method and device, electronic equipment and storage medium. BACKGROUND

[0002] In a real-time operating system (such as real-time Linux), a real-time process (such as a process adopting a SCHED_FIFO scheduling policy) has a high scheduling priority, which can ensure that a critical task is responded in time while meeting the real-time requirement. However, in a kernel isolation or resource-limited environment, a high-priority real-time process may not be scheduled out in time due to continuous occupation of CPU, resulting in that other tasks (including system tasks) cannot obtain CPU time, and further causing system response stagnation or even complete deadlocks.

[0003] In the related art, a Linux kernel limits CPU occupation time of a real-time process through a / proc / sys / kernel / sched_rt_runtime_us parameter, but in some configurations (such as being set to -1 to represent no limit) or in a kernel isolation scenario, the limitation may be ineffective. In addition, the system usually relies on kernel logs for post-analysis, which causes problem discovery to lag behind and low operational efficiency.

[0004] Therefore, there is an urgent need for a preventive technical solution that can dynamically monitor the running state of a real-time process and actively intervene before the system enters a complete deadlock. SUMMARY

[0005] To overcome the problems in the related art, the present disclosure provides a real-time process management method and device, electronic equipment and storage medium.

[0006] According to a first aspect of an embodiment of the present disclosure, a real-time process management method is provided, comprising: periodically acquiring a continuous running time of a real-time process in a running state; if the continuous running time exceeds a first preset threshold, adding an identifier of the corresponding real-time process to a monitoring list; and when a Hung Task detection mechanism is triggered, performing an exit operation or a priority reduction operation on the real-time process in the monitoring list.

[0007] In some embodiments, the acquiring of the continuous running time of the real-time process in the running state comprises: acquiring a last switching time stamp of the real-time process and a current system time stamp; and calculating a difference between the current system time stamp and the last switching time stamp as the continuous running time.

[0008] In some embodiments, the method further comprises: registering a callback function to the Hung Task detection mechanism; and performing an exit operation or a priority reduction operation on the real-time process in the monitoring list when the Hung Task detection mechanism triggers, comprising: performing the exit operation or the priority reduction operation on the real-time process in the monitoring list by executing the callback function when the Hung Task detection mechanism triggers.

[0009] In some embodiments, the Hung Task detection mechanism triggers when a duration of a process in an uninterruptible sleep state exceeds a second preset threshold; and the second preset threshold is greater than the first preset threshold.

[0010] In some embodiments, the performing the exit operation or the priority reduction operation on the real-time process in the monitoring list comprises any of the following: sending a SIGSEGV signal to the real-time process in the monitoring list to make the real-time process exit; adjusting a scheduling policy of the real-time process in the monitoring list from a real-time scheduling class to a non-real-time scheduling class, and / or reducing a static priority value of the real-time process.

[0011] In some embodiments, the method further comprises: removing the identification of the corresponding real-time process from the monitoring list when the real-time process in the monitoring list has exited, or is no longer in a running state, or a duration of running time falls below the first preset threshold.

[0012] In some embodiments, the method further comprises: adding the real-time process to a preset control group to limit a CPU resource usage share of the real-time process by the control group when the real-time process is added to the monitoring list and the number of times of performing the exit operation or the priority reduction operation reaches a preset number of times.

[0013] According to a second aspect of the embodiments of the present disclosure, a management apparatus of a real-time process is provided, comprising: a running time acquisition module configured to periodically acquire a duration of running time of a real-time process in a running state; a threshold comparison module configured to add an identification of the corresponding real-time process to a monitoring list when the duration of running time exceeds a first preset threshold; and an exception handling module configured to perform an exit operation or a priority reduction operation on the real-time process in the monitoring list when a Hung Task detection mechanism triggers.

[0014] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: a processor; a memory configured to store executable instructions of the processor; and the processor configured to read the executable instructions from the memory and execute the instructions to implement the management method of the real-time process provided by the first aspect of the present disclosure.

[0015] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the real-time process management method provided in the first aspect of the present disclosure.

[0016] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: by periodically detecting the continuous running time of real-time processes, real-time monitoring of excessive CPU usage can be achieved, thereby enabling the early identification of potential problematic processes and recording them in a monitoring list; based on this, combined with the Hung Task detection mechanism, once the mechanism is triggered, processes in the list are automatically exited or downgraded in priority. This system forms a complete preventive protection scheme, which can proactively intervene in abnormal processes before the system completely crashes, thereby effectively reducing the risk of system downtime and reducing operation and maintenance costs through automated processing.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0019] FIG. 1 This is a flowchart illustrating a real-time process management method according to an exemplary embodiment.

[0020] FIG. 2 This is a flowchart illustrating another method for managing real-time processes according to an exemplary embodiment.

[0021] FIG. 3 This is a block diagram illustrating a real-time process management device according to an exemplary embodiment.

[0022] FIG. 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0023] The exemplary embodiments will now be described in detail with reference to the accompanying drawings.

[0024] It should be noted that the relevant embodiments and accompanying drawings are only for describing and illustrating exemplary embodiments provided by this disclosure, and not all embodiments of this disclosure, nor should this disclosure be understood to be limited to the relevant exemplary embodiments.

[0025] It should be noted that the terms "first," "second," etc., used in this disclosure are only used to distinguish different steps, devices, or modules. These terms do not represent any specific technical meaning, nor do they indicate any order or interdependence between them.

[0026] It should be noted that the terms “a,” “a plurality of,” and “at least one” used in this disclosure are illustrative rather than restrictive. Unless otherwise expressly indicated in the context, they should be understood as “one or more.”

[0027] It should be noted that the term "and / or" used in this disclosure is used to describe the relationship between related objects, and generally indicates that there are at least three relationships. For example, A and / or B can at least indicate: the existence of A alone, the existence of both A and B, and the existence of B alone.

[0028] It should be noted that the various steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Unless otherwise specified, the scope of this disclosure is not limited by the order in which the steps are described in the relevant embodiments.

[0029] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.

[0030] Explanation of technical terms RT Linux: refers to the Real-Time Linux operating system.

[0031] sched_rt_runtime_us is a scheduling parameter in the Linux kernel used to limit the maximum CPU time that all real-time processes can occupy within a unit of time.

[0032] SCHED_FIFO is a real-time scheduling strategy in Linux systems. It belongs to the static priority scheduling class (RT scheduling class). The priority range is usually 1-99, with higher values ​​indicating higher priority.

[0033] Hung Task: This is a kernel mechanism used to detect long-term blocked tasks. It monitors tasks that are in an uninterruptible sleep state (TASK_UNINTERRUPTIBLE, also known as the D state) for extended periods. Tasks in this state do not respond to signals, and if this continues for too long, it can easily lead to system deadlock or overall performance degradation.

[0034] Exemplary method FIG. 1This is a flowchart illustrating a real-time process management method according to an exemplary embodiment, such as... FIG. 1 As shown, the execution entity of the real-time process management method is the real-time operating system kernel, which includes the following steps.

[0035] In step S110, the continuous running time of the real-time process in the running state is periodically acquired.

[0036] Specifically, the kernel of a real-time operating system periodically traverses all real-time processes in the running state (TASK_RUNNING) and obtains their continuous runtime. It should be noted that this embodiment only monitors real-time processes and does not involve the monitoring of ordinary processes. Real-time processes and ordinary processes can be distinguished by scheduling policies. For example, in a real-time Linux system, real-time processes typically use the SCHED_FIFO real-time scheduling policy.

[0037] In some embodiments, step S110 includes: obtaining the last switching timestamp and the current system timestamp of the real-time process; calculating the difference between the current system timestamp and the last switching timestamp as the continuous running time.

[0038] Furthermore, for each real-time process in the TASK_RUNNING state, the timestamp of when it was last scheduled off the CPU (i.e., the last switch time) is first obtained, followed by the current system timestamp. Finally, by calculating the difference between the two, the time that the process continuously occupies the CPU in the current scheduling cycle is obtained.

[0039] In step S120, if the continuous running time exceeds a first preset threshold, the identifier of the corresponding real-time process is added to the monitoring list.

[0040] Specifically, the continuous running time calculated in step S110 is compared with a preset first threshold (e.g., 300 seconds). When the continuous running time of a real-time process exceeds this threshold, the system determines that the process has a risk of abnormally occupying the CPU, and then adds the process identifier (such as process PID) to a special monitoring list (also known as a monitoring chain).

[0041] In some embodiments, the method further includes: removing the identifier of the corresponding real-time process from the monitoring list if the real-time process in the monitoring list has exited, is no longer running, or its continuous running time has fallen below the first preset threshold.

[0042] Furthermore, the system continuously tracks the status of real-time processes listed in the monitoring list. When any of the following occurs: 1) the process has exited or terminated normally; 2) the process exists but is no longer running; 3) the process's continuous running time, after recalculation, falls below a first preset threshold, the system immediately removes the corresponding process identifier from the monitoring list. This dynamic maintenance mechanism ensures that the monitoring list always accurately reflects real-time processes with abnormal resource usage risks, avoiding resource waste caused by monitoring ineffective processes and preventing incorrect handling of processes that have recovered.

[0043] In step S130, when the Hung Task detection mechanism is triggered, an exit operation or a priority reduction operation is performed on the real-time processes in the monitoring list.

[0044] Specifically, the system establishes a collaborative working relationship with the kernel's existing HungTask detection mechanism. When this HungTask detection mechanism is triggered, the system will immediately perform corresponding intervention operations on all real-time processes recorded in the monitoring list, including but not limited to measures such as forcibly terminating processes or reducing their scheduling priority.

[0045] In some embodiments, the method further includes: registering a callback function with the Hung Task detection mechanism; step S130 includes: when the Hung Task detection mechanism is triggered, executing the callback function to perform an exit operation or a priority reduction operation on the real-time processes in the monitoring list.

[0046] Furthermore, a callback function (e.g., `trace_sched_process_hang`) is pre-registered with the kernel's Hung Task detection mechanism, defining specific exception handling operations within this function. When the Hung Task detection mechanism is triggered, the system calls back this function, thereby performing exception handling on all real-time processes in the monitoring list, including the aforementioned exit and priority reduction operations. Optionally, the system can also record signal sending details and other processing logs in the kernel log (dmesg) for subsequent diagnostic analysis and system behavior review.

[0047] In some embodiments, the triggering condition for the Hung Task detection mechanism is: detecting that the duration of a process in an uninterruptible sleep state exceeds a second preset threshold; wherein the second preset threshold is greater than the first preset threshold.

[0048] Furthermore, the Hung Task detection mechanism monitors all processes in the system that are in an uninterruptible sleep state (including real-time processes and normal processes). The Hung Task detection mechanism will be triggered when any process remains in this state for a period exceeding a second preset threshold (e.g., 600 seconds). It should be noted that, to ensure the preventative effect of this disclosure is achieved, the second preset threshold is set to be greater than the first preset threshold.

[0049] In some embodiments, performing an exit operation or a priority reduction operation on the real-time process in the monitoring list includes any of the following methods: sending a SIGSEGV signal to the real-time process in the monitoring list to cause the real-time process to exit; adjusting the scheduling policy of the real-time process in the monitoring list from a real-time scheduling class to a non-real-time scheduling class; and / or reducing the static priority value of the real-time process.

[0050] Furthermore, this embodiment provides two optional exception handling methods. First, the kernel can send a SIGSEGV signal to all real-time processes in the monitoring list. This signal will trigger a segmentation fault and forcibly terminate the process. This method can immediately release the occupied CPU resources, effectively preventing the abnormal process from causing further impact on the system, and is suitable for emergency scenarios requiring rapid interruption of process execution. Second, the scheduling policy of all real-time processes in the monitoring list can be adjusted from a real-time scheduling class (such as SCHED_FIFO) to a non-real-time scheduling class (such as SCHED_NORMAL), or their static priority values ​​can be reduced accordingly. This method does not immediately terminate the process, but limits CPU resource consumption by reducing its scheduling priority. This alleviates system resource pressure and maintains service continuity to a certain extent, making it suitable for scenarios with high requirements for process survival. These two handling methods together constitute a flexible and reliable system protection mechanism.

[0051] In some embodiments, the method further includes: if the number of times the real-time process is added to the monitoring list and performs an exit operation or a priority reduction operation reaches a preset number, then the real-time process is added to a preset control group to limit the CPU resource usage share of the real-time process through the control group.

[0052] Furthermore, when the system detects that a real-time process is repeatedly added to the monitoring list due to continuous CPU timeouts, and the cumulative number of times it is forcibly terminated or its priority is reduced reaches a preset number, the system will automatically add the process to a preset control group (cgroups) for management. Through the cgroups mechanism, the system can impose hard limits on the process's CPU resource usage at the kernel level, for example, limiting its maximum usage time on a single CPU core from 100% to 50%. This approach transforms temporary process termination or priority adjustment into long-term, structured resource quota management, effectively preventing processes with persistent anomalies from repeating their abnormal behavior each time they are processed and rescheduled, thus establishing a deeper level of system protection.

[0053] The real-time process management method provided in this embodiment achieves real-time monitoring of excessive CPU usage by periodically detecting the continuous running time of real-time processes. Based on this, the system can identify and record processes that may cause system problems before a Hung Task state occurs, forming an effective preventative protection mechanism. Simultaneously, it organically integrates with existing Hung Task detection mechanisms, triggering unified callbacks at the system level to automate the handling of abnormal processes. In terms of processing methods, it supports multiple strategies such as forced exit and dynamic priority degradation of scheduling, balancing system security and operational flexibility. Furthermore, it can be linked with resource control mechanisms such as cgroups to implement persistent resource restrictions on processes that repeatedly violate regulations, forming a deeper level of system protection. This disclosure is applicable to application scenarios with high real-time requirements, such as industrial control real-time systems and 5G base stations. The entire process is automated, significantly reducing the risk of system downtime, effectively improving system reliability and stability, and substantially reducing operation and maintenance costs.

[0054] To more clearly illustrate the specific implementation of this disclosure, a detailed description will now be given using real-time Linux as an example. FIG. 2 This is a flowchart illustrating another method for managing real-time processes according to an exemplary embodiment, such as... FIG. 2 As shown, it includes the following steps: Step 1: Real-time process identification and status judgment The Linux system first checks the scheduling policy of each process to confirm whether it is the SCHED_FIFO real-time scheduling policy. For processes using this scheduling policy, it further checks whether their current state is TASK_RUNNING, thereby filtering out the real-time processes that need to be monitored.

[0055] Step 2: Continuous running time detection and threshold comparison For the identified real-time process, the system calculates its continuous running time (last_switch_time) and compares this value with a preset first threshold (max_runtime_ns) to determine whether the process has continuously occupied the CPU and timed out.

[0056] Step 3: Dynamic Management of Monitoring List When the last_switch_time of a real-time process exceeds max_runtime_ns, the system adds its identifier to the monitoring list. At the same time, the system continuously monitors the process status in the list. If a process is no longer in the TASK_RUNNING state or its last_switch_time falls below the threshold, it is removed from the monitoring list to ensure the accuracy of the monitoring target.

[0057] Step 4: Process in conjunction with the Hung Task detection mechanism The system registers a callback function `trace_sched_process_hang` with the Hung Task detection mechanism. When the Hung Task detection mechanism is triggered, this callback function is executed automatically, sending a SIGSEGV signal to all real-time processes recorded in the monitoring list to forcibly terminate the abnormal processes.

[0058] Step 5: Exception Handling and Logging During the exception handling process, the system synchronously records detailed processing logs to dmesg, forming a complete audit trail record and providing a reliable basis for system operation and maintenance.

[0059] Step Six: Proceed to the next monitoring cycle and begin continuous cyclic monitoring. After completing all monitoring and processing steps for the current cycle, the system will not stop running. Instead, it will automatically enter the next monitoring cycle at preset time intervals and repeat all the processes from steps one to five above.

[0060] In summary, this disclosure forms a complete preventative protection system by combining periodic detection and judgment with dynamic list management and the triggering conditions of the existing Hung Task detection mechanism. It can proactively intervene in abnormal real-time processes before the system becomes completely frozen, reducing the risk of system downtime. At the same time, the automated processing mechanism effectively reduces operation and maintenance costs.

[0061] Exemplary apparatus FIG. 3 This is a block diagram illustrating a real-time process management device according to an exemplary embodiment. (Refer to...) FIG. 3 The device 300 includes a runtime acquisition module 310, a threshold comparison module 320, and an anomaly handling module 330.

[0062] The runtime acquisition module 310 is used to periodically acquire the continuous runtime of real-time processes that are in a running state; The threshold comparison module 320 is used to add the identifier of the corresponding real-time process to the monitoring list if the continuous running time exceeds a first preset threshold. The exception handling module 330 is used to perform an exit operation or a priority reduction operation on the real-time processes in the monitoring list when the Hung Task detection mechanism is triggered.

[0063] In some embodiments, the runtime acquisition module 310 is specifically used for: Obtain the last switching timestamp and the current system timestamp of the real-time process; The difference between the current system timestamp and the last switching timestamp is calculated as the continuous running time.

[0064] In some embodiments, the apparatus further includes a function registration module 340; The function registration module 340 is used to register callback functions with the Hung Task detection mechanism; The exception handling module 330 is specifically used for: When the Hung Task detection mechanism is triggered, the callback function is executed to perform an exit operation or a priority reduction operation on the real-time processes in the monitoring list.

[0065] In some embodiments, the triggering condition for the Hung Task detection mechanism is: The duration of a process in an uninterruptible sleep state is detected to exceed a second preset threshold. Wherein, the second preset threshold is greater than the first preset threshold.

[0066] In some embodiments, the exception handling module 330 is specifically used in any of the following ways: Send a SIGSEGV signal to the real-time process in the monitoring list to cause the real-time process to exit; Adjust the scheduling strategy of the real-time processes in the monitoring list from real-time scheduling class to non-real-time scheduling class, and / or reduce the static priority value of the real-time processes.

[0067] In some embodiments, the threshold comparison module 320 is further configured to: If a real-time process in the monitoring list has exited, is no longer running, or its continuous running time falls below the first preset threshold, the identifier of the corresponding real-time process will be removed from the monitoring list.

[0068] In some embodiments, the exception handling module 330 is further configured to: If the number of times the real-time process is added to the monitoring list and performs an exit operation or a priority reduction operation reaches a preset number, then the real-time process is added to a preset control group to limit the CPU resource usage share of the real-time process through the control group.

[0069] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and corresponding beneficial effects of the real-time process management device described above can be found in the corresponding process in the aforementioned method example, and will not be repeated here.

[0070] Exemplary electronic device FIG. 4 This is a block diagram illustrating an electronic device 400 according to an exemplary embodiment. The electronic device 400 may be a vehicle controller, an in-vehicle terminal, an in-vehicle computer, or other types of electronic devices.

[0071] Reference FIG. 4 The electronic device 400 may include at least one processor 410 and a memory 420. The processor 410 can execute instructions stored in the memory 420. The processor 410 is communicatively connected to the memory 420 via a data bus. In addition to the memory 420, the processor 410 can also be communicatively connected to an input device 430, an output device 440, and a communication device 450 via the data bus.

[0072] Processor 410 can be any conventional processor, such as a commercially available CPU. Processors may also include graphics processing units (GPUs), field-programmable gate arrays (FPGAs), systems-on-chips (SoCs), application-specific integrated circuits (ASICs), or combinations thereof.

[0073] The memory 420 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0074] In this embodiment of the present disclosure, the memory 420 stores executable instructions, and the processor 410 can read the executable instructions from the memory 420 and execute the instructions to implement all or part of the steps of the real-time process management method described in any of the exemplary embodiments above.

[0075] Exemplary computer-readable storage medium In addition to the methods and apparatus described above, exemplary embodiments of this disclosure may also be a computer program product or a computer-readable storage medium storing the computer program product. The computer product includes computer program instructions that can be executed by a processor to perform all or part of the steps described in any of the methods in the exemplary embodiments described above.

[0076] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. These programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages, and scripting languages ​​(e.g., Python). The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0077] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media include: static random access memory (SRAM) having one or more electrically connected wires; electrically erasable programmable read-only memory (EEPROM); erasable programmable read-only memory (EPROM); programmable read-only memory (PROM); read-only memory (ROM); magnetic storage; flash memory; magnetic disk or optical disk; or any suitable combination thereof.

[0078] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of this disclosure. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0079] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A method of managing real-time processes, characterized by, The method comprises: periodically acquiring a continuous running time of a real-time process in a running state; if the continuous running time exceeds a first preset threshold, adding an identifier of the corresponding real-time process to a monitoring list; when a Hung Task detection mechanism is triggered, performing an exit operation or a priority reduction operation on the real-time process in the monitoring list.

2. The management method of real-time processes according to claim 1, characterized in that, The acquisition of the continuous running time of the real-time process in the running state comprises: acquiring a last switching time stamp of the real-time process and a current system time stamp; calculating a difference between the current system time stamp and the last switching time stamp as the continuous running time.

3. The management method of real-time processes according to claim 1, characterized in that, The method further comprises: registering a callback function to the Hung Task detection mechanism; The execution of the exit operation or the priority reduction operation on the real-time process in the monitoring list when the Hung Task detection mechanism is triggered comprises: when the Hung Task detection mechanism is triggered, performing the exit operation or the priority reduction operation on the real-time process in the monitoring list by executing the callback function.

4. The management method of real-time processes according to claim 3, characterized in that, The triggering condition of the Hung Task detection mechanism is: detecting that a process in an uninterruptible sleep state has a continuous duration exceeding a second preset threshold; wherein the second preset threshold is greater than the first preset threshold.

5. The management method of real-time processes according to claim 1, characterized in that, The execution of the exit operation or the priority reduction operation on the real-time process in the monitoring list comprises any of the following: sending a SIGSEGV signal to the real-time process in the monitoring list to make the real-time process exit; adjusting a scheduling policy of the real-time process in the monitoring list from a real-time scheduling class to a non-real-time scheduling class, and / or reducing a static priority value of the real-time process.

6. The method of claim 1-5, wherein, The method further comprises: if the real-time process in the monitoring list has exited, or is no longer in the running state, or the continuous running time falls below the first preset threshold, removing the identifier of the corresponding real-time process from the monitoring list.

7. The method of claim 1-5, wherein, The method further comprises: if the real-time process is added to the monitoring list and the number of times of performing the exit operation or the priority reduction operation reaches a preset number of times, adding the real-time process to a preset control group to limit a CPU resource usage share of the real-time process through the control group.

8. A management apparatus of a real-time process, characterized by comprising: The method comprises: a running time acquisition module, configured to periodically acquire a continuous running time of a real-time process in a running state; a threshold comparison module, configured to, if the continuous running time exceeds a first preset threshold, add an identifier of the corresponding real-time process to a monitoring list; an exception handling module, configured to, when a Hung Task detection mechanism is triggered, perform an exit operation or a priority reduction operation on the real-time process in the monitoring list.

9. An electronic device, comprising: The method comprises: a processor; a memory for storing executable instructions of the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the real-time process management method in any of claims 1-7.

10. A computer-readable storage medium having stored thereon computer program instructions, wherein, The program instructions are executed by the processor to implement the steps of the real-time process management method in any of claims 1-7.