Process termination method, electronic device, and storage medium
By setting the process identifier to an invalid state in the target module of the artificial intelligence chip, the deadlock problem of process termination under multi-process parallelism is solved, realizing reliable termination of multi-process parallelism and efficient resource utilization.
Patent Information
- Application Number
- CN202511823589.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-12-05
AI Technical Summary
Existing technologies struggle to achieve reliable and deadlock-free process termination in multi-process parallel scenarios, resulting in AI chips being able to execute a single process serially, thus reducing resource utilization and processing efficiency.
By setting the process identifier within the target module to an invalid state, including the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue, it is ensured that the data packets and tasks of the target process are discarded during output, thus avoiding the influence of downstream states.
It achieves clean, efficient, convenient, and fast process termination in a multi-process parallel environment, avoids deadlock, supports multi-process parallelism, and ensures reliable termination of a single process.
Smart Images

Figure CN121255490B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence chip technology, and in particular to a process termination method, an electronic device, and a storage medium. Background Technology
[0002] Current AI chips, when dealing with multi-user scenarios, typically interleave tasks from different processes into a FIFO (First In First Out) queue in a job pool. They then terminate the target process by detecting and discarding the target process's tasks at the exit of the FIFO queue.
[0003] Because FIFO queues strictly follow the first-in, first-out principle, if a non-target process's task at the front of the queue cannot be executed due to a downstream hang, it will block the entire queue. This prevents the target process's task at the back from reaching the exit and thus from being discarded. This directly leads to the inability to complete the termination operation for the target process, resulting in a lockout. For security reasons, current AI chips can only execute a single process serially, and cannot achieve multi-process parallelism. Summary of the Invention
[0004] This invention provides a process termination method, an electronic device, and a storage medium to address the shortcomings of related technologies in terminating a single process in the context of multiple processes running in parallel.
[0005] This invention provides a process termination method, comprising:
[0006] Obtain the target process identifier;
[0007] The target module sets the state of data whose process identifier is the target process identifier to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The invalid data is discarded when it is output from the target module.
[0008] According to a process termination method provided by the present invention, the target module includes a command queue of a command processing engine, a submission module of a command dispatcher, and a job pool queue.
[0009] According to a process termination method provided by the present invention, the step of setting the state of data in the target module that is the process identifier of the target process identifier to be invalid includes:
[0010] Set the status of data packets in the command queue of the command processing engine whose process identifier is the target process identifier to invalid;
[0011] Set the status of the data packet whose process identifier is the target process identifier in the submission module of the command dispatcher to invalid, and set the status of the task whose process identifier is the target process identifier in the submission module to invalid;
[0012] Set the status of the task in the job pool queue whose process identifier is the target process identifier to invalid.
[0013] According to a process termination method provided by the present invention, setting the state of a data packet whose process identifier is the target process identifier in the command queue of the command processing engine to invalid includes:
[0014] If it is determined that the data packet in the command queue of the command processing engine is complete data, the status of the data packet in the command queue of the command processing engine whose process identifier is the target process identifier is set to invalid.
[0015] According to a process termination method provided by the present invention, determining that the data packet in the command queue of the command processing engine is complete data includes:
[0016] When the internal direct memory access is idle, the data packets in the command queue of the command processing engine are determined to be complete data.
[0017] A process termination method provided by the present invention further includes:
[0018] Receive the termination trigger signal;
[0019] The setting of the data whose process identifier within the target module is set to the target process identifier as invalid includes:
[0020] In response to the termination trigger signal, the status of the data whose process identifier is the target process identifier within the target module is set to invalid.
[0021] A process termination method provided by the present invention further includes:
[0022] If the target module outputs data in an invalid state, the data output by the target module is discarded.
[0023] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements any of the process termination methods described above.
[0024] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a process termination method as described above.
[0025] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the process termination methods described above.
[0026] The process termination method, electronic device, and storage medium provided by this invention only require setting the state of the data identified as the target process identifier within the target module to invalid to ensure that all processes terminate in various hardware components of the artificial intelligence chip, achieving clean, effective, convenient, and fast process termination. Furthermore, the state setting is not affected by the downstream state of the target module, and the process termination operation will not be suspended synchronously due to downstream suspension. Therefore, it can support multi-process parallelism and ensure reliable, deadlock-free process termination for a single process under the premise of multi-process parallelism. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in this invention or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart illustrating the process execution in related technologies.
[0029] Figure 2 This is one of the flowcharts of the process termination method provided by the present invention.
[0030] Figure 3 This is the second flowchart of the process termination method provided by the present invention.
[0031] Figure 4 This is a schematic diagram of the process termination device provided by the present invention.
[0032] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0034] With the rapid development of high-performance computing and artificial intelligence technologies, AI chips have become an indispensable basic computing power support for various industries. Here, AI chips can refer to GPUs (Graphics Processing Units), TPUs (Tensor Processing Units), NPUs (Neural Network Processing Units), DPUs (Deep Learning Processing Units), APUs (Accelerated Processing Units), and GPGPUs (General-Purpose computing on Graphics Processing Units), etc.
[0035] In typical scenarios where multiple users utilize AI chips, it's common for a user to need to terminate their submitted workflow midway. In such cases, the Command Processor (CP), the core control unit that issues tasks, needs to be able to quickly, independently, and cleanly terminate the specified process without affecting the normal operation of other users. Improper handling by the CP can easily lead to deadlocks between upstream and downstream modules, ultimately causing the entire AI chip to malfunction.
[0036] Figure 1 A flowchart illustrating the process execution in related technologies, such as... Figure 1 As shown, in current AI chip design architectures, after the CP (Processing Center) acquires the data packet (Pkt), it distributes it through the command queue (Cpe-cmd-fifo) of the Command Processor Engine (CPE) to the submission module (Cpd-sub) of the corresponding pipeline's Command Processor Dispatcher (CPD). Within the submission module of the Command Dispatcher, the split module divides the data packet into specific tasks. Data packets from different processes (e.g., ...) Figure 1 Data packets 1 from process 1 and 2 from process 2, after being split into tasks, will preempt the Round Robin (RR) module and be sent to the Jobpool queue (Jobpool-fifo) by the RR module. Therefore, within the Jobpool-fifo, tasks from different processes (e.g., ...) Figure 1 Task 1 of process 1 and Task 2 of process 2 are intertwined.
[0037] Currently, the implementation logic for terminating a process is as follows:
[0038] When process 1 needs to be terminated, CP monitors the exit point of the Jobpool-fifo. If the exit point is task 1 of process 1, task 1 is directly discharged and discarded. If the exit point is task 2 of process 2, it is normally passed to the downstream kernel for execution. This logic continues until the splitting module no longer splits any new data packets belonging to process 1. At this point, it is determined that the CP termination process has been completed.
[0039] However, this technical solution, which relies on judgment and discarding at the queue exit, has serious drawbacks in practical applications.
[0040] Specifically, when tasks of process 1 and process 2 are intertwined in the Jobpool-fifo, and the operation to terminate process 1 is in progress, if task 2 of process 2 is the exit point of the Jobpool-fifo, and the downstream module of the Jobpool is suspended for some reason and unable to receive new tasks, then task 2 at the exit point will not be able to be dispatched. Due to the first-in, first-out (FIFO) nature of the Jobpool-fifo, the blocking of task 2 will directly prevent all subsequent tasks (including task 1 of process 1 that needs to be discarded) from moving to the exit point.
[0041] This blockage can trigger a chain reaction: the process controller (CP) cannot continue to eject and discard task 1 of process 1, causing the CP to be unable to determine whether all task 1 has been processed, thus suspending the process termination operation within the CP and preventing its completion. To mitigate this risk, related technologies have been forced to compromise, namely, in the current AI chip architecture, only data packets of one process are allowed to be executed serially, and multi-process parallel processing is not supported, which greatly reduces the resource utilization and processing efficiency of AI chips.
[0042] Therefore, how to implement a reliable and deadlock-free process termination mechanism while ensuring multi-process parallelism is an urgent problem to be solved in this field.
[0043] Figure 2 This is one of the flowcharts illustrating the process termination method provided by this invention. For example... Figure 2 As shown, the execution entity of this method can be an artificial intelligence chip, such as the command processor (CP) within the artificial intelligence chip. The method includes:
[0044] Step 210: Obtain the target process identifier.
[0045] Here, the target process identifier is the identifier of the process that needs to be terminated. The identifier can be understood as a unique identifier for a process, such as a process ID. The target process identifier can be sent to the AI chip by a host connected to the AI chip. Here, the host can be a CPU (Central Processing Unit).
[0046] Step 220: Set the state of data whose process identifier is the target process identifier in the target module to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The data with an invalid state is discarded when it is output from the target module.
[0047] Specifically, if it is determined that the process whose process identifier is the target process identifier is to be terminated, data whose process identifier is the target process identifier can be found in the target module.
[0048] Here, the target module is used to cache at least one of the data packets and tasks of each process. It can be understood that the target module is a module in the AI chip that caches process-related data during process execution, and it is responsible for caching process data packets and splitting process data packets into tasks and distributing them.
[0049] In the target module, at least one of the data packets and tasks of each process is cached. Furthermore, the data packets and tasks cached in the target module carry corresponding process identifiers. Thus, by comparing the process identifiers carried by the data packets and tasks in the target module with the target process identifier obtained in step 210, the data whose process identifier is the target process identifier can be determined from the target module.
[0050] Specifically, this may include at least one of the following: a data packet whose process identifier is the target process identifier, or a task whose process identifier is the target process identifier. The data whose process identifier is the target process identifier is the data cached in the target module by the process that needs to be terminated.
[0051] For data whose process identifier is the target process identifier within the target module, the status of this data can be set to invalid. Specifically, a status bit can be set for cached data in the target module to indicate whether the data is valid or invalid. Therefore, when data whose process identifier is the target process identifier within the target module is determined to be invalid, its status bit can be set to invalid, thus indicating that the data is invalid.
[0052] Furthermore, whether the data is valid or invalid directly affects the target module's operation on the data when it is output from the target module. Specifically, if the data is valid, it is output normally from the target module and distributed to downstream modules; if the data is invalid, it is output from the target module and discarded, and is no longer distributed to downstream modules.
[0053] Therefore, once the state of the data identified by the process identifier within the target module is set to invalid, it means that all data of the process to be terminated within the target module will be discarded during output and will not be distributed to downstream modules, thus completing process termination. Furthermore, even if a downstream process subsequently suspends, causing output congestion in the target module, the invalidated data remains invalid because the state of the data within the target module remains unchanged. Once the target module resumes output and data distribution, the invalidated data will still be discarded during output. Therefore, the downstream state of the target module no longer affects the actual execution of process termination. Simply setting the state of the data identified by the process identifier within the target module to invalid is sufficient to complete process termination; the downstream state of the target module no longer needs to be considered.
[0054] In the method provided by this invention, simply setting the state of the data identified as the target process identifier within the target module to invalid is sufficient to ensure that all processes terminate in various hardware components of the artificial intelligence chip, achieving clean, effective, convenient, and fast process termination. Furthermore, the state setting is unaffected by the downstream state of the target module, and the process termination operation will not be suspended synchronously due to downstream suspension. Therefore, it can support multi-process parallelism and ensure reliable, deadlock-free process termination for a single process under the premise of multi-process parallelism.
[0055] Based on the above embodiments, the target module includes a command queue of the command processing engine, a submission module of the command dispatcher, and a job pool queue.
[0056] Specifically, in the AI chip architecture, the target module that caches at least one of the data packets and tasks of each process includes the command queue Cpe-cmd-fifo of the command processing engine, the submission module Cpd-sub of the command dispatcher, and the job pool queue Jobpool-fifo.
[0057] The command queue Cpe-cmd-fifo in the command processing engine is a queue that buffers data packets during the data packet distribution process. Cpe-cmd-fifo buffers data packets during distribution to prevent downstream hardware from being unable to receive packets due to busy conditions. Here, the downstream hardware of Cpe-cmd-fifo typically refers to the command dispatcher.
[0058] The command dispatcher's submission module Cpd-sub contains a splitting module. Cpd-sub can split a process's data packets into tasks through the splitting module. Furthermore, Cpd-sub can cache data packets waiting to be split, as well as tasks waiting to be dispatched after splitting.
[0059] The Jobpool-fifo queue is used to cache tasks waiting to be dispatched to the compute cores for execution.
[0060] In other words, before a process's task is dispatched to the computing core for execution, process-related data is cached in three target modules: the command queue Cpe-cmd-fifo of the command processing engine, the submission module Cpd-sub of the command dispatcher, and the job pool queue Jobpool-fifo. Specifically, the command queue Cpe-cmd-fifo of the command processing engine caches the process's data packets, the submission module Cpd-sub of the command dispatcher caches both the process's data packets and tasks, and the job pool queue Jobpool-fifo caches the process's tasks.
[0061] When terminating a process, the status of the data in the above three types of target modules that are identified as the target process identifier needs to be set to invalid. This ensures that the data of the process corresponding to the target process identifier can be completely invalidated, thereby ensuring that the process corresponding to the target process identifier can be terminated completely in one go.
[0062] Based on any of the above embodiments, step 220, setting the state of the data whose process identifier within the target module is the target process identifier as invalid, includes:
[0063] Set the status of data packets in the command queue of the command processing engine whose process identifier is the target process identifier to invalid;
[0064] Set the status of the data packet whose process identifier is the target process identifier in the submission module of the command dispatcher to invalid, and set the status of the task whose process identifier is the target process identifier in the submission module to invalid;
[0065] Set the status of the task in the job pool queue whose process identifier is the target process identifier to invalid.
[0066] Specifically, when it is determined that the process whose process identifier is the target process identifier is to be terminated, the status of the data whose process identifier is the target process identifier in the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue can be set to invalid.
[0067] Specifically, regarding the command queue of the command processing engine, which caches data packets of each process, the status of data packets in the command queue of the command processing engine whose process identifier is the target process identifier can be set to invalid.
[0068] For the command dispatcher's submission module, which caches unsplit data packets and split tasks waiting to be dispatched, it is necessary to set the status of data packets with process identifiers matching the target process identifier and tasks with process identifiers matching the target process identifier in the command dispatcher's submission module to invalid. Data packets with invalid status are not split in the command dispatcher's submission module and are directly discarded, and tasks with invalid status are not dispatched when output from the command dispatcher's submission module and are directly discarded.
[0069] For the job pool queue, which caches tasks from each process, the status of tasks in the job pool queue whose process identifier is the target process identifier can be set to invalid.
[0070] In this embodiment of the invention, the states of the data whose process identifier is the target process identifier in the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue are invalidated respectively, thereby ensuring that the data of the process corresponding to the target process identifier can be completely invalidated, and thus ensuring that the process corresponding to the target process identifier can be terminated completely at once.
[0071] Based on any of the above embodiments, in step 220, setting the state of the data packet whose process identifier is the target process identifier in the command queue of the command processing engine to be invalid includes:
[0072] If it is determined that the data packet in the command queue of the command processing engine is complete data, the status of the data packet in the command queue of the command processing engine whose process identifier is the target process identifier is set to invalid.
[0073] Specifically, for the command queue of the command processing engine, in order to ensure that a single state setting can invalidate all data packets of processes that have not yet been sent to the command dispatcher and are awaiting termination, before invalidating the state of data packets in the command queue of the command processing engine whose process identifier is the target process identifier, it is first necessary to determine whether the data packets in the command queue of the command processing engine are complete data.
[0074] Here, determining whether the data packets in the command queue of the command processing engine are complete specifically means determining whether the data packets cached in the command queue of the command processing engine are complete, and whether there are data packets that are being loaded but have not yet been fully cached.
[0075] Understandably, when terminating a process, the command queue of the command processing engine is first checked to see if the data packets in the command queue are complete. If it is determined that the data packets in the command queue are complete (i.e., the command queue has finished loading data packets), the data packets in the command queue whose process identifier is the target process identifier are set to invalid. However, if it is determined that the data packets in the command queue are incomplete (i.e., the command queue is loading data packets), the status setting is not performed until the command queue has finished loading data packets, and then the status setting is executed.
[0076] In this embodiment of the invention, when it is determined that the data packet in the command queue of the command processing engine is complete data, the invalidation setting of the state of the data packet whose process identifier is the target process identifier in the command queue of the command processing engine is triggered. This ensures that a single setting can cover all data packets corresponding to the target process identifier in the command queue of the command processing engine, avoid missing data packets that are being loaded, and thus ensure that the process corresponding to the target process identifier can be terminated completely at once.
[0077] Based on any of the above embodiments, in step 220, determining that the data packet in the command queue of the command processing engine is complete data includes:
[0078] When the internal direct memory access is idle, the data packets in the command queue of the command processing engine are determined to be complete data.
[0079] Specifically, Internal Direct Memory Access (IDMA) is a direct memory access DMA within an artificial intelligence chip. IDMA is used to load data packets from various processes into the command queue of the command processing engine.
[0080] Therefore, by observing the state of internal direct memory access (IDM), it can be determined whether the data packets in the command queue of the command processing engine are complete. Specifically, the state of IDM can be either idle or running. When IDM is in the running state, it may be loading data packets into the command queue of the command processing engine, and the data packets in the command queue may be incomplete at this time. When IDM is in the idle state, it is not running; the action of loading data packets into the command queue by IDM has been completed, and the data packets in the command queue of the command processing engine are complete at this time.
[0081] Based on this, when terminating a process, the command queue of the command processing engine can wait for the internal direct memory access to enter an idle state, that is, to determine that the data packets in the command queue of the command processing engine are complete data. At this time, the status of the data packets in the command queue of the command processing engine whose process identifier is the target process identifier is set to invalid.
[0082] Based on any of the above embodiments, the process termination method further includes:
[0083] Receive the termination trigger signal;
[0084] Accordingly, in step 220, setting the data whose process identifier within the target module is set to the target process identifier as invalid includes:
[0085] In response to the termination trigger signal, the status of the data whose process identifier is the target process identifier within the target module is set to invalid.
[0086] Specifically, the host can trigger the termination of the AI chip's execution process by sending a termination trigger signal. Correspondingly, the AI chip can receive the termination trigger signal and obtain the target process identifier.
[0087] Furthermore, when the AI chip receives a termination trigger signal, it can respond to the termination trigger signal by setting the state of the data with the process identifier of the target process identifier in the target module to invalid, thereby terminating the process corresponding to the target process identifier.
[0088] Based on any of the above embodiments, the process termination method further includes:
[0089] If the target module outputs data in an invalid state, the data output by the target module is discarded.
[0090] Specifically, for the target module, during normal operation, it sequentially outputs data from each process according to a first-in, first-out (FIFO) mechanism. Furthermore, while outputting data, the target module monitors the status of the output data. If the output data is valid, it outputs the data normally and distributes it to downstream modules; if the output data is invalid, it discards the data and does not distribute it to downstream modules.
[0091] Based on any of the above embodiments Figure 3 This is the second flowchart illustrating the process termination method provided by this invention. For example... Figure 3 As shown, a process termination method may include the following steps:
[0092] First, receive the target process identifier and termination trigger signal.
[0093] Subsequently, the target process identifier and termination trigger signal are synchronized to the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue.
[0094] Upon receiving a termination trigger signal, the system waits for internal direct memory access to become idle. Once idle, it searches the command queue of the command processing engine for a data packet whose process identifier matches the target process identifier, and sets the packet's status to invalid. For example, the command queue of the command processing engine may contain n+1 data packets, designated as data packet 0 to data packet n. Each data packet has a corresponding status indicator tab, which displays the packet's status (valid-flag) and process identifier. The valid-flag indicates whether the data packet is valid; valid-flag=1 indicates a valid data packet, and valid-flag=0 indicates an invalid data packet. Setting the status of the data packet whose process identifier matches the target process identifier can be achieved by setting the valid-flag value to 0 in each row of the status indicator tab where the process identifier matches the target process identifier.
[0095] When outputting a data packet from the command queue of the command processing engine, the value of the valid-flag in the status indicator tab corresponding to the data packet is checked. If valid-flag=0, the data packet is determined to be invalid, and the data packet is discarded directly without being passed to the submission module of the command dispatcher.
[0096] In some embodiments, the command dispatcher's submission module may cache only one data packet or not cache any data packets at any given time. Therefore, it can be determined whether the command dispatcher's submission module contains a data packet. If so, it can be further determined whether the data packet contained in the command dispatcher's submission module and the task's process identifier are the target process identifier.
[0097] If the process identifier of a data packet in the command dispatcher's submission module matches the target process identifier, it means that the data packet to be split by the splitting module in the command dispatcher's submission module corresponds to the data packet of the target process identifier. The status of this data packet can be set to invalid. The splitting module will check the status of the input data packets; for data packets with an invalid status, the splitting module will discard them directly without performing task splitting. Furthermore, for the split tasks, if there is a task with a process identifier matching the target process identifier, the status of the split task can be set to invalid, and the task will be discarded when it is output from the command dispatcher's submission module, without being passed to the work pool queue.
[0098] If the command dispatcher's submission module does not contain data packets, it is determined that there are no process data packets and tasks in the command dispatcher's submission module, and the command dispatcher's submission module can be left unprocessed.
[0099] Next, the tasks in the job pool queue are checked. For example, the job pool queue may contain m+1 tasks, designated as task 0 to task m. Each task also has a corresponding status indicator tab, which displays the task's status (valid-flag) and process identifier. The valid-flag indicates whether the task is valid; valid-flag=1 indicates a valid task, and valid-flag=0 indicates an invalid task. The task whose process identifier matches the target process identifier is set to invalid. Specifically, this can be achieved by setting the valid-flag to 0 in each row of the status indicator tab where the process identifier matches the target process identifier.
[0100] When outputting a task from the job pool queue, check the value of the valid-flag in the status indicator tab corresponding to the task. If valid-flag=0, the task is determined to be invalid, the task is discarded directly, and the data packet is not sent to the computing core.
[0101] In the method provided in this embodiment of the invention, simply setting the status of the data in the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue that is identified as the target process identifier to invalid ensures that all processes terminate in various hardware components of the artificial intelligence chip, achieving clean, effective, convenient, and fast process termination. Furthermore, the status setting is unaffected by downstream status and will not cause the process termination operation to be suspended synchronously due to downstream suspension. Therefore, it can support multi-process parallelism and ensure reliable, deadlock-free process termination for a single process under the premise of multi-process parallelism.
[0102] The process termination device provided by the present invention is described below. The process termination device described below and the process termination method described above can be referred to in correspondence.
[0103] Figure 4 This is a schematic diagram of the process termination device provided by the present invention. Figure 4 As shown, the device includes:
[0104] Acquisition unit 410 is used to acquire the target process identifier;
[0105] Setting unit 420 is used to set the state of data whose process identifier is the target process identifier in the target module to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The data whose state is invalid is discarded when it is output from the target module.
[0106] In the apparatus provided in this embodiment of the invention, simply setting the state of the data identified as the target process identifier within the target module to invalid is sufficient to ensure that all processes terminate in various hardware components of the artificial intelligence chip, achieving clean, effective, convenient, and fast process termination. Furthermore, the state setting is unaffected by the downstream state of the target module, and the process termination operation will not be suspended synchronously due to downstream suspension. Therefore, it can support multi-process parallelism and ensure reliable, deadlock-free process termination for a single process under the premise of multi-process parallelism.
[0107] Based on any of the above embodiments, the target module includes a command queue of the command processing engine, a submission module of the command dispatcher, and a job pool queue.
[0108] Based on any of the above embodiments, the setting unit is specifically used for:
[0109] Set the status of data packets in the command queue of the command processing engine whose process identifier is the target process identifier to invalid;
[0110] Set the status of the data packet whose process identifier is the target process identifier in the submission module of the command dispatcher to invalid, and set the status of the task whose process identifier is the target process identifier in the submission module to invalid;
[0111] Set the status of the task in the job pool queue whose process identifier is the target process identifier to invalid.
[0112] Based on any of the above embodiments, the setting unit is specifically used for:
[0113] If it is determined that the data packet in the command queue of the command processing engine is complete data, the status of the data packet in the command queue of the command processing engine whose process identifier is the target process identifier is set to invalid.
[0114] Based on any of the above embodiments, the setting unit is specifically used for:
[0115] When the internal direct memory access is idle, the data packets in the command queue of the command processing engine are determined to be complete data.
[0116] Based on any of the above embodiments, the acquisition unit is further configured to:
[0117] Receive the termination trigger signal;
[0118] The setting unit is specifically used for:
[0119] In response to the termination trigger signal, the status of the data whose process identifier is the target process identifier within the target module is set to invalid.
[0120] Based on any of the above embodiments, the device further includes a discarding unit, which is used for:
[0121] If the target module outputs data in an invalid state, the data output by the target module is discarded.
[0122] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a process termination method, which includes:
[0123] Obtain the target process identifier;
[0124] The target module sets the state of data whose process identifier is the target process identifier to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The invalid data is discarded when it is output from the target module.
[0125] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to related technologies, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0126] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer being able to execute the process termination methods provided by the above methods, the method comprising:
[0127] Obtain the target process identifier;
[0128] The target module sets the state of data whose process identifier is the target process identifier to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The invalid data is discarded when it is output from the target module.
[0129] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the process termination methods provided by the methods described above, the method comprising:
[0130] Obtain the target process identifier;
[0131] The target module sets the state of data whose process identifier is the target process identifier to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The invalid data is discarded when it is output from the target module.
[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for terminating a process, characterized in that, include: Obtain the target process identifier; The data whose process identifier is set to the target process identifier within the target module is set to invalid. The target module is used to cache at least one of the data packets and tasks of each process. The invalid data is discarded when it is output from the target module. The target module includes the command queue of the command processing engine, the submission module of the command dispatcher, and the job pool queue; The setting of the data whose process identifier within the target module is set to the target process identifier as invalid includes: Set the status of data packets in the command queue of the command processing engine whose process identifier is the target process identifier to invalid; Set the status of the data packet whose process identifier is the target process identifier in the submission module of the command dispatcher to invalid, and set the status of the task whose process identifier is the target process identifier in the submission module to invalid; Set the status of the task in the job pool queue whose process identifier is the target process identifier to invalid.
2. The process termination method according to claim 1, characterized in that, Setting the state of data packets in the command queue of the command processing engine whose process identifier is the target process identifier to be invalid includes: If it is determined that the data packet in the command queue of the command processing engine is complete data, the status of the data packet in the command queue of the command processing engine whose process identifier is the target process identifier is set to invalid.
3. The process termination method according to claim 2, characterized in that, Determining that the data packets in the command queue of the command processing engine are complete data includes: When the internal direct memory access is idle, the data packets in the command queue of the command processing engine are determined to be complete data.
4. The process termination method according to any one of claims 1 to 3, characterized in that, Also includes: Receive the termination trigger signal; The setting of the data whose process identifier within the target module is set to the target process identifier as invalid includes: In response to the termination trigger signal, the status of the data whose process identifier is the target process identifier within the target module is set to invalid.
5. The process termination method according to any one of claims 1 to 3, characterized in that, Also includes: If the target module outputs data in an invalid state, the data output by the target module is discarded.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the process termination method as described in any one of claims 1 to 5.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the process termination method as described in any one of claims 1 to 5.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the process termination method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Network resource display method and device, electronic equipment and storage medium
CN115237532A
Queue processing method and device, server, electronic equipment and storage medium
CN116149559A