Process processing method and apparatus, chip, electronic device, and storage medium

By introducing an independent chip on the host machine to automatically handle zombie processes, the problem of low efficiency in handling zombie processes within containers is solved, ensuring the stability of the host machine and the operation of business.

CN116360914BActive Publication Date: 2026-11-27CHINA MOBILE COMM LTD RES INST +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111626479.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2026-11-27
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

In existing technologies, the processing efficiency of zombie processes within containers is low, leading to increased resource consumption of host processes, affecting the operation of business programs and potentially damaging the system.

Method used

An independent chip is introduced on the host machine to automatically handle zombie processes in containers and clean up zombie process resources.

Benefits of technology

It improves the efficiency of zombie process handling, avoids excessive consumption of process resources, and ensures the stability of the host machine and the operation of business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116360914B_ABST
    Figure CN116360914B_ABST
Patent Text Reader

Abstract

The application discloses a process processing method and device, a chip, electronic equipment and a storage medium. The method comprises the following steps: a first chip of a first electronic equipment acquires first information of a first container from a second chip of the first electronic equipment, and acquires second information of the first container from an operating system of the first electronic equipment; the first chip determines that at least one zombie process has been generated in the first container by using the first information and the second information; and the at least one zombie process is cleaned up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular to a process processing method, apparatus, chip, electronic device and storage medium. Background Technology

[0002] For host machines deployed on core network cloud computing platforms or edge cloud platforms, multiple containers exist within the host machine for users to run business applications. Since containers are essentially composed of multiple processes (i.e., processes within the container) running on the host machine, these processes are reflected on the host machine; in other words, the processes within the container are processes running on the host machine. When users purchase containers on the host machine and run business applications on those containers, a large number of zombie processes may be generated within the containers, leading to an increase in zombie processes on the host machine. This not only consumes process resources on the host machine, affecting the operation of business applications, but may also damage the host machine's system.

[0003] In related technologies, there is a problem of low efficiency in handling zombie processes within containers. Summary of the Invention

[0004] To address the related technical issues, embodiments of this application provide a process processing method, apparatus, chip, electronic device, and storage medium.

[0005] The technical solution of this application embodiment is implemented as follows:

[0006] This application provides a process processing method applied to a first electronic device, including:

[0007] The first chip of the first electronic device obtains first information of the first container from the second chip of the first electronic device and obtains second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container.

[0008] The first chip uses the first information and the second information to determine that the first container has generated at least one zombie process;

[0009] The first chip cleans up the at least one zombie process.

[0010] In the above scheme, the first chip cleans up the at least one zombie process, including:

[0011] The first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process.

[0012] In the above scheme, the first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including:

[0013] For each of the at least one zombie processes, the first chip determines the parent process corresponding to each zombie process on the first electronic device, wherein the corresponding parent process is at least the process used to release the zombie process;

[0014] The first chip notifies the corresponding parent process to release the resources of the zombie process.

[0015] In the above scheme, if the corresponding parent process does not respond to the notification, the first chip notifies the first user-level process started by the kernel of the first electronic device to release the resources of the zombie process whose resources have not been released by the corresponding parent process.

[0016] In the above scheme, the first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including:

[0017] The first chip notifies at least one process on the first electronic device, which is responsible for releasing zombie processes, to release the resources of the at least one zombie process via a system call function.

[0018] In the above scheme, the first chip cleans up the at least one zombie process, including:

[0019] The first chip notifies the second electronic device that the first electronic device needs to release the resources of the at least one zombie process, so that the first electronic device receives an instruction and releases the resources of the at least one zombie process according to the instruction.

[0020] The method in the above scheme further includes:

[0021] The first chip monitors the number of processes running in the first electronic device;

[0022] When the number of monitored processes equals the number of processes indicated by the target parameter, the first chip adjusts the target parameter so that the number of monitored processes is less than the number of processes indicated by the target parameter.

[0023] The method in the above scheme further includes:

[0024] The first chip sends a third message to the second chip, the third message indicating that the at least one zombie process has been cleaned up.

[0025] This application embodiment also provides a process processing device, disposed on a first chip of a first electronic device, including:

[0026] The acquisition unit is configured to acquire first information of the first container from the second chip of the first electronic device and acquire second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container.

[0027] A determining unit is configured to determine, using the first information and the second information, that the first container has generated at least one zombie process;

[0028] A processing unit is used to clean up the at least one zombie process.

[0029] This application also provides a chip, including: a processor and an interface; wherein,

[0030] When the processor is used to run a computer program, it executes the steps of any one of the methods described in the first electronic device described above.

[0031] This application also provides an electronic device, characterized in that it includes: a processor and a memory for storing a computer program capable of running on the processor.

[0032] Wherein, when the processor is used to run the computer program, it executes the steps of any one of the methods described in the first electronic device described above.

[0033] This application embodiment also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of any of the methods described in the first electronic device above.

[0034] The process processing method, apparatus, chip, electronic device, and storage medium provided in this application embodiment involve a first chip of a first electronic device obtaining first information about a first container from a second chip of the same device, and obtaining second information about the first container from the operating system of the first electronic device. The first information represents at least one process allocated to the first container by the second chip, and the second information represents at least one process actually reclaimed by the first container. The first chip uses the first and second information to determine that at least one zombie process has been generated in the first container and cleans up the at least one zombie process. The solution provided in this application embodiment involves setting up an independent chip on the electronic device and using this independent chip to automatically process zombie processes in the electronic device's containers and reclaim the corresponding process resources. This improves the efficiency of processing zombie processes in containers. Attached Figure Description

[0035] Figure 1 This is a flowchart illustrating the process processing method of an embodiment of this application;

[0036] Figure 2 This is a schematic diagram illustrating the structure of the zombie process generated by the first container in an embodiment of this application.

[0037] Figure 3 This is a schematic diagram of the system architecture for handling zombie processes in an application embodiment of this application;

[0038] Figure 4 This is a flowchart illustrating the zombie process handling method in an application embodiment of this application;

[0039] Figure 5 This is a schematic diagram of the process processing device structure according to an embodiment of this application;

[0040] Figure 6 This is a schematic diagram of the chip structure in an embodiment of this application;

[0041] Figure 7 This is a schematic diagram of the electronic device structure according to an embodiment of this application. Detailed Implementation

[0042] The present application will now be described in further detail with reference to the accompanying drawings and embodiments.

[0043] For containers within a host machine, the operating system can create processes within the container to run the business applications running within it. When a process finishes execution, it terminates its lifecycle by calling a function (such as do_exit()) through the operating system.

[0044] When the parent process of a business application terminates before its child process, the child process is taken over by the init process (the first user-level process of the host operating system) and becomes its parent process. This is because before each parent process terminates, the host operating system scans all running processes in the system to determine if a child process of that parent process exists. If a child process exists, the operating system takes over the child process through the init process, and reclaims the process resources used by the child process after it terminates. In this case, no zombie processes are created within the container. Furthermore, when a child process calls a function to end its lifecycle, if the parent process releases the child process's resources and removes the child process from the process table, the child process will be in the EXIT_DEAD state, indicating that its lifecycle has ended, and no zombie processes are created.

[0045] However, if a child process of a business application terminates before its parent process, and the parent process does not reclaim the process resources occupied by the child process, the child process will be in the Exit_Zombie state, also known as a zombie state, and will remain in the process table. In other words, a zombie process is a process that has ended its lifecycle but still remains in the process table, and each zombie process leaves behind a data structure.

[0046] For the host machine, the total number of processes is finite, limited by the operating system kernel. As the number of zombie processes within a container increases, when the number of zombie processes generated by the container on the host machine reaches the total number of processes on the host machine, the operating system can no longer create new processes to run business applications, affecting the normal operation of the business. Furthermore, as the number of processes in a container increases, the phenomenon of a "fork bomb" can easily occur, consuming a large amount of process resources on the host machine and impacting the operation of the operating system.

[0047] In related technologies, dealing with zombie processes on a host machine typically requires manual searching by operations and maintenance personnel. The found zombie processes are then used to identify associated containers, and the zombie processes within those containers are processed to reclaim their corresponding process resources. This process is cumbersome and inefficient due to its manual nature.

[0048] Based on this, in various embodiments of this application, by introducing an independent chip on the host machine and using the independent chip to automatically clean up zombie processes generated by containers in electronic devices, the efficiency of handling zombie processes is improved.

[0049] This application provides a process processing method applied to a first electronic device, such as... Figure 1 As shown, it includes the following steps:

[0050] Step 101: The first chip of the first electronic device obtains the first information of the first container from the second chip of the first electronic device, and obtains the second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip for the first container, and the second information represents at least one process actually recycled by the first container.

[0051] Step 102: The first chip uses the first information and the second information to determine that the first container has generated at least one zombie process;

[0052] Step 103: The first chip cleans up the at least one zombie process.

[0053] The first electronic device includes a device capable of executing steps 101 to 103, such as the central processing unit (CPU) of a host machine; the operating system of the first electronic device may include Windows operating system, Linux operating system, etc.; the first chip may also be called a standalone chip; the second chip may include a business chip.

[0054] In practical applications, before step 101, before the first container on the first electronic device runs its service, it sends a hardware resource request to the first electronic device to request the first electronic device to allocate corresponding hardware resources for the first container. After receiving the hardware resource request sent by the first container, the first electronic device allocates corresponding hardware resources to the first container through the second chip, such as controller resources, arithmetic unit resources, and memory resources of the second chip.

[0055] Here, after allocating hardware resources to the first container, the second chip can record the allocated hardware resources. Simultaneously, the second chip can also determine first information allocated to the first container based on the allocated hardware resources. This first information may specifically include information such as the number of processes allocated.

[0056] In practical applications, during the operation of the first container, a large number of business-related processes will be generated within the first container. After each process finishes execution, it will terminate its own lifecycle by calling a function through the operating system of the first electronic device. At this time, the operating system of the first electronic device can reclaim the resources of the terminated process in real time and record the second information; the second information may specifically include the identifier of the terminated process (such as ID), the number of terminated processes, and other information.

[0057] In addition, during the operation of the first container, when a child process terminates its lifecycle by calling a function, it leaves a data structure in the process table. If the child process terminates before the parent process and no parent process reclaims the child process's resources, then the child process becomes a zombie process. In this case, as the number of zombie processes increases, the number of processes running on the first electronic device will also increase accordingly. If the number of processes running on the first electronic device reaches the maximum number of processes configured during the initialization of the first electronic device, then it will be impossible to create new processes on the first electronic device, that is, it will be impossible to create new processes in the first container, which will affect the operation of the first container's services.

[0058] Based on this, in one embodiment, the method may further include:

[0059] The first chip monitors the number of processes running in the first electronic device;

[0060] When the number of monitored processes equals the number of processes indicated by the target parameter, the first chip adjusts the target parameter so that the number of monitored processes is less than the number of processes indicated by the target parameter.

[0061] The target parameter can indicate the maximum number of processes running on the first electronic device.

[0062] In practical applications, the first chip can monitor the number of processes running by the first electronic device in real time. When the first chip determines that the number of processes running by the first electronic device has reached the value of the target parameter, it automatically adjusts the target parameter so that the number of processes running by the first electronic device is less than the maximum number of processes indicated by the target parameter.

[0063] For example, the first chip can monitor the number of processes running on the first electronic device in real time through the Linux operating system. If the number of processes running on the first electronic device reaches the maximum number of processes indicated by the target parameter (also known as pid_max tolerance), the target parameter is increased, for example, target parameter = target parameter * 1.5, so that the number of processes running on the first electronic device can be less than the maximum number of processes indicated by pid_max tolerance.

[0064] In this way, the operation of the first electronic device can be prevented from failing due to a sudden increase in the number of zombie processes in the first container, and damage to the operating system of the first electronic device can also be avoided, thus ensuring the stability of the first electronic device.

[0065] In practical applications, in step 101, when the first chip obtains relevant information about the first container, a time interval can be preset. Then, based on the preset time interval, the first information of the first container is obtained from the second chip of the first electronic device to determine at least one process allocated by the second chip to the first container. Specifically, the first information may include the number of allocated processes. The value of the time interval can be set as needed, and this embodiment does not limit this. Simultaneously, based on the preset time interval, the first chip can also obtain second information about the first container from the operating system of the first electronic device to determine at least one process actually recycled. Specifically, the second information may include the ID of each process and the number of recycled processes among the at least one recycled process.

[0066] Next, the first chip determines whether zombie processes have been generated in the first container based on the acquired first and second information. Specifically, the first chip can compare the number of processes allocated in the first information with the number of processes reclaimed in the second information. If the number of allocated processes equals the number of reclaimed processes, it means that no zombie processes have been generated in the first container. If the number of allocated processes is greater than the number of reclaimed processes, it means that at least one zombie process has been generated in the first container. In this case, the difference between the number of allocated processes and the number of reclaimed processes can characterize the number of zombie processes generated in the first container.

[0067] In practical applications, after determining that at least one zombie process has been generated in the first container, the first chip can obtain the process table corresponding to the first container and determine the ID of each zombie process among the at least one zombie process generated based on the status identifier of all processes in the process table, so as to clean up the generated zombie processes in the future.

[0068] For example, such as Figure 2 As shown, the first chip identifies processes with a status of Z as zombie processes based on the process status identifier in the process table, and at the same time, determines the ID of each zombie process.

[0069] In practical applications, during the process of cleaning up at least one zombie process, the first chip can first utilize the internal processes of the first electronic device to reclaim the process resources of each zombie process.

[0070] Specifically, in one embodiment, the first chip cleans up the at least one zombie process, including:

[0071] The first chip notifies the process on the first electronic device that is capable of releasing zombie processes (i.e., at least the process used to release zombie processes) to release the resources of the at least one zombie process.

[0072] Here, the first chip can send the ID of the generated zombie process to the process capable of releasing the zombie process. This allows the process capable of releasing the zombie process to reclaim the data structure of the generated zombie process based on its ID and release its resources, thus cleaning up the zombie process. After the cleanup is complete, the zombie process will be removed from the process table of the first container.

[0073] Specifically, in one embodiment, the first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including:

[0074] The first chip notifies at least one process on the first electronic device, which is responsible for releasing zombie processes, to release the resources of the at least one zombie process via a system call function.

[0075] In practical applications, the first chip can use the system call function of the operating system to send the ID of the generated zombie process to the process that can release the zombie process, so that the process that can release the zombie process can reclaim the data structure of the generated zombie process based on the zombie process ID and release the resources of the zombie process.

[0076] For example, in a Linux system, the first chip can use the system call function interface provided by the operating system kernel to send the ID of the generated zombie process to the process that can release the zombie process, so that the operating system kernel can use the corresponding function, such as waitpid(), to clean up the zombie process.

[0077] In practical applications, since zombie processes are processes that have not had their process resources reclaimed by the parent process, when cleaning up zombie processes, the first chip can notify the parent process to clean up the zombie processes and reclaim the corresponding process resources.

[0078] Based on this, in one embodiment, the first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including:

[0079] For each of the at least one zombie process, the first chip determines the parent process corresponding to each zombie process on the first electronic device; the corresponding parent process is at least the process used to release the zombie process;

[0080] The first chip notifies the corresponding parent process to release the resources of the zombie process.

[0081] In practical applications, the first chip, based on the ID of each zombie process among at least one generated zombie process and in conjunction with the process table of the first container, can determine the parent process of each zombie process; wherein, the process table at least contains the association between the ID of the zombie process and its corresponding parent process. Then, the first chip sends the ID of each zombie process to its corresponding parent process, and instructs the corresponding parent process to reclaim the data structure of the zombie process and release its resources.

[0082] However, in practical applications, when the first chip notifies the parent process of the zombie process, there may be a situation where the parent process does not respond. In this case, the resources of the zombie process cannot be released.

[0083] Based on this, in one embodiment, if the corresponding parent process does not respond to the notification, the first chip notifies the first user-level process started by the kernel of the first electronic device to release the resources of the zombie process whose resources have not been released by the corresponding parent process.

[0084] Here, after the first chip notifies the parent process of the zombie process, it can determine whether the parent process has responded to the notification by checking the process table of the first container. Specifically, the first chip uses the zombie process's ID to search for the corresponding zombie process in the process table of the first container. If the corresponding zombie process can be found, it means that the parent process has not released the zombie process's resources, and therefore cannot remove the zombie process from the process table after releasing the resources; that is, the parent process has not responded to the notification. If the corresponding zombie process cannot be found, it means that the parent process has released the zombie process's resources and removed the zombie process from the process table after releasing the resources; that is, the parent process has responded to the notification.

[0085] Specifically, situations where the parent process does not respond to the notification can include: the parent process has ended its lifecycle, or the parent process is unable to reclaim the resources of the zombie process.

[0086] At this time, the first chip can notify the first user-level process (e.g., the init process) started by the kernel in the operating system to release the resources of the zombie process.

[0087] For example, the first chip notifies the init process in the operating system of the zombie process's ID, so that the init process can reclaim the data structure of the zombie process in the process table and release the zombie process's resources.

[0088] In practical applications, under extreme circumstances, there may be situations where the first user-level process started by the kernel fails to release the resources of the zombie process and cannot reclaim the zombie process resources; in other words, there may be situations where the first user-level process started by the kernel does not respond to the notification.

[0089] Based on this, in one embodiment, the first chip cleans up at least one zombie process generated, including:

[0090] The first chip notifies the second electronic device that the first electronic device needs to release the resources of the at least one zombie process, so that the first electronic device receives an instruction and releases the resources of the at least one zombie process according to the instruction.

[0091] In practical applications, to clean up zombie processes, if the first chip can find the corresponding zombie process in the process table of the first container based on the zombie process's ID, it indicates that the first user-level process started by the kernel has not responded to the notification. In this case, the first chip can send the zombie process's ID to the second electronic device through the interface of the second electronic device; the second electronic device can be deployed with an operation and maintenance system, a monitoring system, etc. Through the system deployed on the second electronic device, relevant personnel can be prompted to intervene manually and send an instruction to the first electronic device to release the zombie process's resources. After receiving the instruction sent by the relevant personnel through the second electronic device, the first electronic device can release the zombie process's resources according to the instruction.

[0092] After the zombie processes are cleared, the first chip can also interact with the second chip to synchronize information.

[0093] Based on this, in one embodiment, the method may further include:

[0094] The first chip sends a third message to the second chip, the third message indicating that the at least one zombie process has been cleaned up.

[0095] In practical applications, the first chip can send third information to the second chip to inform it of the handling status of zombie processes. This information may include the number of zombie processes cleaned up and the resources released from those processes. In this way, the second chip can determine the current process and resource status of the first container in real time.

[0096] The process processing method provided in this application embodiment involves a first chip of a first electronic device obtaining first information about a first container from a second chip of the same device, and obtaining second information about the first container from the operating system of the first electronic device. The first information represents at least one process allocated to the first container by the second chip, and the second information represents at least one process actually reclaimed by the first container. The first chip uses the first and second information to determine that at least one zombie process has been generated in the first container, and then cleans up the at least one zombie process. The solution provided in this application embodiment sets up an independent chip on the electronic device and uses this independent chip to automatically process zombie processes in containers of the electronic device, reclaiming the corresponding process resources. This improves the efficiency of processing zombie processes in containers.

[0097] The present application will be further described in detail below with reference to application examples.

[0098] This application proposes a system architecture capable of automatically eliminating zombie processes in containers, deployed on a host machine (i.e., a first electronic device), such as... Figure 3 As shown, the system architecture specifically includes an independent chip (i.e., the first chip), a business chip (i.e., the second chip), and a container within the host machine (i.e., the first container); wherein, the independent chip may specifically include a monitoring and processing module and a hardware driver.

[0099] In the aforementioned system architecture, introducing a container zombie process handling device into a dedicated chip, compared to introducing it on the host machine's existing hardware (i.e., the application chip), can prevent security issues arising from software attacks on the original hardware. This is because, in practical applications, zombie processes within containers may be backdoor programs installed after an attack on the host machine's operating system. In this case, introducing the container zombie process handling device onto the host machine's existing hardware would affect the device's functionality, potentially failing to eliminate zombie processes within the container and thus posing a security risk to the host machine.

[0100] Specifically, the process of eliminating zombie processes in containers using a separate chip, such as... Figure 4 As shown, it includes the following steps:

[0101] Step 1: The container zombie process handling device on the independent chip obtains the process information allocated by the business chip;

[0102] The process information includes information such as the process resources allocated to the container and the number of processes; the container zombie process handling device is controlled by an independent hardware instruction set (e.g., RISC-V instruction set).

[0103] In practical applications, before a container on the host machine runs, it requests processor resources from the host machine's application chip to run the application processes within the container. Upon receiving the container's request, the application chip allocates corresponding processor resources to the container, specifically including controller resources, arithmetic unit resources, and memory resources on the application chip. Simultaneously, the application chip determines the process information allocated to the container based on the allocated processor resources.

[0104] Then, the container zombie process handling device will interact with the business chip to obtain the process information that the business chip has allocated to the container.

[0105] Step 2: The container on the host machine runs the business process within the container based on the allocated process information.

[0106] In practical applications, when the business process within the container ends, it will end its own lifecycle by calling a function and reclaim the corresponding process resources through the parent process. In this case, the operating system will remove the above process from the process table and accumulate and record the number of reclaimed processes, process IDs, and reclaimed resources.

[0107] Here, after the business subprocess ends its lifecycle by calling a function, it leaves a data structure in the process table. If the business subprocess terminates before the parent process, and the process resources corresponding to the subprocess cannot be reclaimed, the business subprocess will become a zombie process.

[0108] Step 3: The container zombie process handling device obtains the process information to be recycled from the operating system through the interface and determines whether there are zombie processes on the host machine;

[0109] Here, the container zombie process handling device can obtain the actual process information recycled by each container from the operating system through the container software interface in order to determine whether there are zombie processes in the container.

[0110] Specifically, the container zombie process handling device compares the actual number of reclaimed processes with the number of allocated processes. If the number of allocated processes is greater than the number of reclaimed processes, it determines that a zombie process has been generated within the container. If the number of allocated processes is equal to the number of reclaimed processes, it determines that no zombie process has been generated within the container.

[0111] In addition, for other business processes running on the host machine, the container zombie process handling device can obtain the actual process information of other business processes running on the host machine from the operating system through the host machine software interface, and compare it with the process information allocated from the business chip to other business processes running on the host machine to determine whether there are zombie processes in other business processes running on the host machine.

[0112] Step 4: After the container zombie process handling device determines the existence of zombie processes, it cleans up the zombie processes;

[0113] In practical applications, for zombie processes generated within a container, the container zombie process handling device uses the process state to search for processes with the process state of EXIT_ZOMBIE in the container's process table, i.e., zombie processes, and determines the process ID of the zombie process.

[0114] Next, the container zombie process handling device uses the container's process table and the zombie process's process ID to determine the corresponding parent process and releases the zombie process's resources through the parent process. If the corresponding parent process does not respond, the container zombie process handling device will release the zombie process's resources through the operating system's kernel init process (such as the systemd process). If the operating system's kernel init process also does not respond, the container zombie process handling device will notify an external system for manual intervention to release the zombie process's resources. This external system may specifically include monitoring systems, operation and maintenance systems, etc.

[0115] Similarly, the container zombie process handling device will also use the above method to clean up zombie processes generated by other business processes running on the host machine.

[0116] In practical applications, the container zombie process handling device will monitor the total number of processes running on the host machine in real time during the execution of steps 1 to 4 above. If the container zombie process handling device detects that the total number of processes running on the host machine has reached the initial maximum process limit of the operating system, it will adjust the maximum process limit of the operating system to prevent too many zombie processes on the host machine from affecting the operation of business processes on the host machine.

[0117] For example, in a Linux system, a container zombie process handling device can adjust the pid.max tolerance, such as pid.max = pid.max * 1.5, to adjust the maximum number of processes in the operating system; wherein the tolerance can indicate the maximum number of processes in the operating system.

[0118] Step 5: The container zombie process handling device interacts with the second chip to synchronize information.

[0119] Here, after the container zombie process handling device cleans up the zombie processes on the host machine, it sends information such as the number of zombie processes cleaned up and the resources reclaimed to the second chip to inform the second chip of the current process and resource status on the host machine.

[0120] In this application embodiment, by introducing a zombie process elimination device into a separate chip, the automated processing of zombie processes within containers is achieved, improving the processing efficiency of zombie processes within containers. Simultaneously, it can also eliminate the impact on the host operating system caused by excessive zombie processes generated in the container, ensuring the stability and availability of the host system.

[0121] Furthermore, by introducing a zombie process elimination device into a separate chip, compared to introducing it into the original hardware resources of the host machine, it is possible to reduce the consumption of process resources and hardware resources on the host machine, and avoid abnormal business operation due to insufficient resources on the host machine.

[0122] To implement the process processing method of this application embodiment, this application embodiment also provides a process processing device, disposed on a first chip of a first electronic device, such as... Figure 5 As shown, the device includes:

[0123] The acquisition unit 501 is used to acquire first information of the first container from the second chip of the first electronic device and acquire second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container.

[0124] Determining unit 502 is used to determine, using the first information and the second information, that the first container has generated at least one zombie process;

[0125] Processing unit 503 is used to clean up the at least one zombie process.

[0126] In one embodiment, the processing unit 503 is specifically used for:

[0127] The process on the first electronic device that is responsible for releasing the zombie process is notified to release the resources of the at least one zombie process.

[0128] In one embodiment, the processing unit 503 is specifically used for:

[0129] For each of the at least one zombie processes, determine the parent process corresponding to each zombie process on the first electronic device, wherein the corresponding parent process is at least the process used to release the zombie process;

[0130] The corresponding parent process is notified to release the resources of the zombie process.

[0131] In one embodiment, if the corresponding parent process does not respond to the notification, the first user-level process started by the kernel of the first electronic device is notified to release the resources of the zombie process whose resources have not been released by the corresponding parent process.

[0132] In one embodiment, the processing unit 503 is specifically used for:

[0133] The system call function notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process.

[0134] In one embodiment, the processing unit 503 is specifically configured to notify the second electronic device that the first electronic device needs to release the resources of the at least one zombie process, so that the first electronic device receives an instruction and releases the resources of the at least one zombie process according to the instruction.

[0135] In one embodiment, such as Figure 5 As shown, the device may further include: a monitoring unit 504; wherein, the monitoring unit 504 is used for:

[0136] Monitor the number of processes running on the first electronic device;

[0137] When the number of monitored processes equals the number of processes indicated by the target parameter, the target parameter is adjusted so that the number of monitored processes is less than the number of processes indicated by the target parameter.

[0138] In one embodiment, the processing unit 503 is further configured to:

[0139] A third message is sent to the second chip, indicating that the at least one zombie process has been cleaned up.

[0140] It should be noted that the functions of the acquisition unit 501, the determination unit 502, the processing unit 503, and the monitoring unit 504 are equivalent to the functions of the monitoring and processing module of the independent chip in the application embodiment.

[0141] In practical applications, the acquisition unit 501, the processing unit 503, and the monitoring unit 504 can be implemented by a processor in the process processing device combined with a communication interface; the determination unit 502 can be implemented by a processor in the process processing device.

[0142] It should be noted that the process processing device provided in the above embodiments is only illustrated by the division of the above-described program units. In practical applications, the above processing can be assigned to different program units as needed, that is, the internal structure of the device can be divided into different program units to complete all or part of the processing described above. In addition, the process processing device and the process processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0143] To implement the process processing method of the embodiments of this application, the embodiments of this application also provide a chip, such as... Figure 6 As shown, chip 600 includes:

[0144] Interface 601 is used for information exchange with the memory;

[0145] The processor 602 is connected to the interface 601 to enable information interaction with the memory, and is used to read the computer program stored in the memory through the interface 601, and execute the methods provided by one or more of the above technical solutions when running the computer program.

[0146] In practical applications, such as Figure 6 As shown, the chip 600 may further include a memory 603 for storing various types of data to support the operation of the chip 600. Examples of such data include any computer program used to operate on the chip 600.

[0147] Of course, researchers may also choose not to include a memory in the chip 600, depending on the chip design requirements, and instead store the computer program that can run on the processor 602 in the memory of the electronic device in which the chip 600 is located.

[0148] Specifically, when the chip 600 is used to implement the process processing method of the embodiments of this application, the processor 602 is used to perform the following operations:

[0149] First information of the first container is obtained from the second chip of the first electronic device, and second information of the first container is obtained from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container.

[0150] Using the first information and the second information, it is determined that the first container has generated at least one zombie process;

[0151] Clean up the at least one zombie process.

[0152] In one embodiment, the processor 602 is configured to perform the following operations:

[0153] The process on the first electronic device that is responsible for releasing the zombie process is notified to release the resources of the at least one zombie process.

[0154] In one embodiment, the processor 602 is configured to perform the following operations:

[0155] For each of the at least one zombie processes, determine the parent process corresponding to each zombie process on the first electronic device, wherein the corresponding parent process is at least the process used to release the zombie process;

[0156] The corresponding parent process is notified to release the resources of the zombie process.

[0157] In one embodiment, if the corresponding parent process does not respond to the notification, the processor 602 is configured to notify the first user-level process started by the kernel of the first electronic device to release the resources of the at least one zombie process.

[0158] In one embodiment, the processor 602 is configured to notify at least one process on the first electronic device, which is used to release zombie processes, to release the resources of the at least one zombie process via a system call function.

[0159] In one embodiment, the processor 602 is configured to notify a second electronic device that the first electronic device needs to release the resources of the at least one zombie process, so that the first electronic device receives an instruction and releases the resources of the at least one zombie process according to the instruction.

[0160] In one embodiment, the processor 602 is further configured to perform the following operations:

[0161] Monitor the number of processes running on the first electronic device;

[0162] When the number of monitored processes equals the number of processes indicated by the target parameter, the target parameter is adjusted so that the number of monitored processes is less than the number of processes indicated by the target parameter.

[0163] In one embodiment, the processor 602 is further configured to send third information to the second chip, the third information indicating that the at least one zombie process has been cleaned up.

[0164] It should be noted that the specific process by which the processor 602 performs the above operations is detailed in the process processing method embodiment of this application, and will not be repeated here.

[0165] Based on the hardware implementation of the above program modules, and in order to implement the process processing method of the embodiments of this application, the embodiments of this application also provide an electronic device, such as... Figure 7 As shown, the electronic device 700 includes:

[0166] The communication interface 701 enables interaction with other devices;

[0167] The processor 702 is connected to the communication interface 701 to enable interaction with other devices and to execute the methods provided by one or more of the above-mentioned technical solutions when running a computer program;

[0168] The computer program is stored in memory 703.

[0169] Specifically, the first chip of the electronic device 700 uses the processor 702 to obtain first information of the first container from the second chip of the electronic device 700, and obtains second information of the first container from the operating system of the electronic device. The first information represents at least one process allocated by the second chip for the first container, and the second information represents at least one process actually recycled by the first container.

[0170] The first chip uses the processor 702 to determine, using the first information and the second information, that the first container has generated at least one zombie process.

[0171] The first chip cleans up the at least one zombie process through the processor 702.

[0172] In one embodiment, the first chip performs the following operations via the processor 702:

[0173] The process on the electronic device that is responsible for releasing the zombie process is notified to release the resources of the at least one zombie process.

[0174] In one embodiment, the first chip, through the processor 702, executes:

[0175] For each of the at least one zombie processes, determine the parent process corresponding to each zombie process on the electronic device, wherein the corresponding parent process is at least the process used to release the zombie process;

[0176] The corresponding parent process is notified to release the resources of the zombie process.

[0177] In one embodiment, if the corresponding parent process does not respond to the notification, the first chip notifies the first user-level process started by the kernel of the electronic device through the processor 702 to release the resources of the zombie process whose resources have not been released by the corresponding parent process.

[0178] In one embodiment, the first chip executes the following via processor 702:

[0179] The system call function notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process.

[0180] In one embodiment, the first chip executes the following via processor 702:

[0181] The second electronic device is notified that the electronic device needs to release the resources of the at least one zombie process, so that the electronic device receives the instruction and releases the resources of the at least one zombie process according to the instruction.

[0182] In one embodiment, the first chip, via processor 702, further performs:

[0183] Monitor the number of processes running on the first electronic device;

[0184] When the number of monitored processes equals the number of processes indicated by the target parameter, the target parameter is adjusted so that the number of monitored processes is less than the number of processes indicated by the target parameter.

[0185] In one embodiment, the first chip, via processor 702, further performs:

[0186] A third message is sent to the second chip, indicating that the at least one zombie process has been cleaned up.

[0187] It should be noted that the specific processing procedures of the processor 702 and the communication interface 701 can be understood by referring to the above method.

[0188] Of course, in practical applications, the various components in the electronic device 700 are coupled together via a bus system 704. It is understood that the bus system 704 is used to achieve communication between these components. In addition to a data bus, the bus system 704 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 7 The general designated all buses as Bus System 704.

[0189] The memory 703 in this embodiment is used to store various types of data to support the operation of the electronic device 700. Examples of such data include any computer program used to operate on the electronic device 700.

[0190] The methods disclosed in the embodiments of this application can be applied to the processor 702, or implemented by the processor 702. The processor 702 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 702 or by instructions in the form of software. The processor 702 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 702 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in the memory 703. The processor 702 reads the information in the memory 703 and combines its hardware to complete the steps of the aforementioned method.

[0191] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.

[0192] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 603 storing a computer program, which can be executed by the processor 602 of the chip 600 to complete the steps described in the aforementioned process processing method; or, for example, a memory 703 storing a computer program, which can be executed by the processor 702 of the electronic device 700 to complete the steps described in the aforementioned process processing method. Computer-readable storage media can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage.

[0193] It should be noted that terms such as "first" and "second" are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0194] Furthermore, the technical solutions described in the embodiments of this application can be combined arbitrarily without conflict.

[0195] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application.

Claims

1. A process processing method, characterized in that, Applied to a first electronic device, including: The first chip of the first electronic device obtains first information of the first container from the second chip of the first electronic device and obtains second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container. The first chip uses the first information and the second information to determine that the first container has generated at least one zombie process; The first chip cleans up the at least one zombie process; The first information includes the number of allocated processes, and the second information includes the number of processes actually recycled. The first chip uses the first information and the second information to determine that the first container has generated at least one zombie process, including: the first chip determines that the first container has generated at least one zombie process by comparing the number of allocated processes with the number of processes actually recycled.

2. The method according to claim 1, characterized in that, The first chip cleans up the at least one zombie process, including: The first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process.

3. The method according to claim 2, characterized in that, The first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including: For each of the at least one zombie processes, the first chip determines the parent process corresponding to each zombie process on the first electronic device, wherein the corresponding parent process is at least the process used to release the zombie process; The first chip notifies the corresponding parent process to release the resources of the zombie process.

4. The method according to claim 3, characterized in that, If the corresponding parent process does not respond to the notification, the first chip notifies the first user-level process started by the kernel of the first electronic device to release the resources of the zombie process whose resources have not been released by the corresponding parent process.

5. The method according to claim 2, characterized in that, The first chip notifies at least one process on the first electronic device used to release zombie processes to release the resources of the at least one zombie process, including: The first chip notifies at least one process on the first electronic device, which is responsible for releasing zombie processes, to release the resources of the at least one zombie process via a system call function.

6. The method according to claim 1, characterized in that, The first chip cleans up the at least one zombie process, including: The first chip notifies the second electronic device that the first electronic device needs to release the resources of the at least one zombie process, so that the first electronic device receives an instruction and releases the resources of the at least one zombie process according to the instruction.

7. The method according to claim 1, characterized in that, The method further includes: The first chip monitors the number of processes running in the first electronic device; When the number of monitored processes equals the number of processes indicated by the target parameter, the first chip adjusts the target parameter so that the number of monitored processes is less than the number of processes indicated by the target parameter.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The first chip sends a third message to the second chip, the third message indicating that the at least one zombie process has been cleaned up.

9. A process processing apparatus, characterized in that, The first chip of the first electronic device is disposed thereon, including: The acquisition unit is configured to acquire first information of the first container from the second chip of the first electronic device and acquire second information of the first container from the operating system of the first electronic device. The first information represents at least one process allocated by the second chip to the first container, and the second information represents at least one process actually recycled by the first container. A determining unit is configured to determine, using the first information and the second information, that the first container has generated at least one zombie process; wherein, the first information includes: the number of allocated processes, and the second information includes: the number of processes actually recycled, and the determination that the first container has generated at least one zombie process using the first information and the second information includes: determining that the first container has generated at least one zombie process by comparing the number of allocated processes with the number of processes actually recycled. A processing unit is used to clean up the at least one zombie process.

10. A chip, characterized in that, include: Processor and communication interface; among which, When the processor is used to run a computer program, it performs the steps of the method according to any one of claims 1 to 8.

11. An electronic device, characterized in that, include: The processor and the memory used to store computer programs that can run on the processor. When the processor is used to run the computer program, it performs the steps of the method according to any one of claims 1 to 8.

12. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Process processing method, mobile terminal and computer readable storage medium

    CN107239332A