Synchronous task execution method and device, equipment and medium

By simulating the synchronization mechanism of synchronous tasks in software and scheduling the task queue, the problem of multi-process deadlock was solved, and the orderly execution of tasks and efficient utilization of equipment were achieved.

CN121255489AActive Publication Date: 2026-01-02SHANGHAI BIREN TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511813084.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-01-02
Estimated Expiration
2045-12-04

AI Technical Summary

Technical Problem

In existing technologies, synchronization primitives share the same channel on hardware, which can lead to deadlocks between processes when multiple processes use the device simultaneously, causing device blocking.

Method used

By simulating the synchronization mechanism of synchronous tasks in software, tasks in each task queue are scheduled to be executed in the order expected by the user process. In the software simulation, task queues that do not meet the execution conditions are switched in real time to avoid deadlock.

Benefits of technology

This ensures that each task is executed in the order expected by the user process, avoiding deadlocks when multiple processes use the device simultaneously, and improving the efficiency and reliability of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255489A_ABST
    Figure CN121255489A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a synchronous task execution method and device, equipment and a medium, and the method comprises the steps: receiving a task queue set submitted by a plurality of user processes; obtaining a first execution task from a first task queue in the task queue set; under the condition that the first execution task is a synchronization task, simulating the first execution task based on a software language, and realizing a synchronization mechanism corresponding to the first execution task; and based on the synchronization mechanism and the scheduling rule, executing the execution task in the task queue set. The tasks in the task queues are scheduled through the synchronization mechanism corresponding to the software simulation synchronization task, so that the tasks are sequentially executed according to the expected sequence of the user process, the software executes the synchronization task, meanwhile, the task queues which do not meet the execution condition are switched in real time according to the scheduling rule in software simulation, and the execution efficiency is improved. And continuous waiting is avoided, and deadlock between the processes is further avoided when the multiple processes use the equipment at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device and medium for synchronous task execution. Background Technology

[0002] For general-purpose computing acceleration devices, many synchronization primitives are provided to ensure that multiple process tasks can be executed in a specific order or access shared resources. However, these synchronization primitives often share the same channel in the hardware, which can lead to deadlock between processes when multiple processes use the device at the same time, causing device blocking. Summary of the Invention

[0003] This invention provides a method, apparatus, device, and medium for executing synchronous tasks, addressing the shortcomings of existing technologies where synchronization primitives often share the same channel in hardware, leading to deadlocks between processes when multiple processes use the device simultaneously. It implements a software simulation of the synchronization mechanism corresponding to the synchronous task to schedule tasks in each task queue, ensuring that each task is executed sequentially according to the user process's expected order. This achieves software execution of synchronous tasks. Furthermore, in the software simulation, task queues that do not meet the execution conditions are switched in real time according to scheduling rules, avoiding indefinite waiting and further preventing deadlocks between processes when multiple processes use the device simultaneously.

[0004] This invention provides a synchronous task execution method applied to a scheduler, comprising the following steps: Receives a collection of tasks submitted by multiple user processes; Obtain the first task to execute from the first task queue in the set of task queues; When the first execution task is a synchronous task, the first execution task is simulated based on a software language to implement the synchronization mechanism corresponding to the first execution task. Based on the synchronization mechanism and scheduling rules, the tasks in the task queue set are executed; wherein, the scheduling rules are used to switch the task queues in the task queue set.

[0005] According to a synchronous task execution method provided by the present invention, the step of executing the execution task in the task queue set based on the synchronization mechanism and scheduling rules includes: determining a first execution condition corresponding to the first execution task based on the synchronization mechanism; and executing the execution task in the task queue set based on the first execution condition and the scheduling rules.

[0006] According to a synchronous task execution method provided by the present invention, the step of executing the execution tasks in the task queue set based on the first execution condition and the scheduling rule includes: if the first execution condition is met in the scheduler, determining a scheduling strategy as a sequential execution strategy from the scheduling rule; executing the next execution task of the first execution task in the first task queue based on the sequential execution strategy; if the first execution condition is not met in the scheduler, determining a switching strategy as the scheduling rule from the scheduling rule; switching the first task queue to a second task queue in the task queue set based on the switching strategy; and if the second execution task in the second task queue is a synchronous task, executing the execution tasks in the task queue set based on the execution result of the second execution task.

[0007] According to a synchronous task execution method provided by the present invention, the step of executing the execution task in the task queue set based on the execution result of the second execution task includes: determining a target task queue based on the execution result of the second execution task; if the current execution task in the target task queue is a synchronous task, sequentially traversing all task queues in the task queue set based on the execution result of the current execution task; and executing the execution task in the first task queue when the scheduler re-rotates to the first task queue.

[0008] According to a synchronous task execution method provided by the present invention, after obtaining a first execution task from a first task queue in the task queue set, the method further includes: parsing the first execution task to obtain a format corresponding to the first execution task; determining the task type of the first execution task based on the format corresponding to the first execution task; the task type includes the synchronous task and the asynchronous task.

[0009] According to a synchronous task execution method provided by the present invention, the method further includes: when the first execution task is an asynchronous task, sending the first execution task to hardware, wherein the hardware is used to execute the first execution task.

[0010] According to a synchronous task execution method provided by the present invention, the step of simulating the first execution task based on a software language to implement the synchronization mechanism corresponding to the first execution task includes: encapsulating the first execution task based on the software language to simulate the execution unit corresponding to the first execution task; and determining the synchronization mechanism corresponding to the first execution task based on the dependency relationship of the execution unit and the shared resource type of the execution unit.

[0011] The present invention also provides a synchronous task execution device, comprising: The receiving module is used to receive a collection of task queues submitted by multiple user processes; The acquisition module is used to acquire the first task to be executed from the first task queue in the task queue set; The simulation module is used to simulate the first execution task based on a software language when the first execution task is a synchronous task, so as to implement the synchronization mechanism corresponding to the first execution task. The scheduling module executes tasks in the task queue set based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch task queues in the task queue set.

[0012] 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 executes the computer program to implement the synchronous task execution method as described above.

[0013] 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 the synchronous task execution method as described above.

[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the synchronous task execution method as described above.

[0015] The present invention provides a method, apparatus, device, and medium for executing synchronous tasks. It receives a set of task queues submitted by multiple user processes; obtains a first execution task from a first task queue in the task queue set; if the first execution task is a synchronous task, it simulates the first execution task based on a software language to implement the synchronization mechanism corresponding to the first execution task; and executes the execution tasks in the first task queue based on the synchronization mechanism and scheduling rules. The scheduling rules are used to switch the first task queue to a second task queue in the task queue set. In this way, the software simulates the synchronization mechanism corresponding to the synchronous task to schedule tasks in each task queue, ensuring that each task is executed sequentially according to the user process's expected order, thus achieving software execution of synchronous tasks. Simultaneously, in the software simulation, task queues that do not meet the execution conditions are switched in real time according to the scheduling rules, avoiding indefinite waiting and further preventing deadlocks between processes when multiple processes use the device simultaneously. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 This is a schematic diagram of the structure of the multi-process deadlock generation principle provided by existing technology.

[0018] Figure 2 This is one of the flowcharts illustrating the synchronous task execution method provided by the present invention.

[0019] Figure 3 This is the second flowchart of the synchronous task execution method provided by the present invention.

[0020] Figure 4 This is a schematic diagram of the system structure for implementing the synchronous scheduling task method provided by the present invention.

[0021] Figure 5 This is a schematic diagram of the synchronous task execution device provided by the present invention.

[0022] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0023] 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.

[0024] The following uses the synchronization primitives of pass and non-zero pass (NZ-PASS) as examples to describe the process of multi-process deadlock.

[0025] Figure 1 This is a structural diagram illustrating the principle of multi-process deadlock generation provided by existing technology, such as... Figure 1As shown, it includes: a first process 101, a second process 102, a third process 103, a fourth process 104, a first hardware command queue descriptor (HCQD) 105, a second hardware command queue descriptor 106, a first pipe (PIPE) interface 107, and a second pipe (PIPE) interface 108. Specifically, the first process sends the first non-zero execution pass primitive, NZ-PASS0, to the first pipe (PIPE) interface through the first hardware command queue descriptor. At this time, the shared space is 0, therefore the first pipe (PIPE) interface is blocked. The second process sends the second execution pass primitive, PASS1, to the first pipe (PIPE) interface through the first hardware command queue descriptor. At this time, the first pipe (PIPE) interface is blocked, therefore PASS1 cannot execute. The third process sends the second non-zero execution pass primitive, NZ-PASS1, to the second pipe (PIPE) interface through the second hardware command queue descriptor. At this time, the shared space is 0, therefore the second pipe (PIPE) interface is blocked. The fourth process sends the first execution pass primitive, PASS0, to the second pipe (PIPE) interface through the second hardware command queue descriptor. At this time, the second pipe (PIPE) interface is blocked, therefore PASS0 cannot execute. Figure 1 It can be seen that NZ-PASS0 depends on PASS0, PASS0 depends on NZ-PASS1, NZ-PASS1 depends on PASS1, and PASS1 depends on NZ-PASS0, which creates a deadlock loop.

[0026] In summary, general-purpose computing acceleration devices provide many synchronization primitives to ensure that multiple process tasks can execute in a specific order or access shared resources. However, these synchronization primitives often share the same channel in the hardware, which can lead to deadlocks between processes when multiple processes use the device at the same time.

[0027] To address the aforementioned problems, this invention provides a method for executing synchronous tasks. This method receives multiple execution tasks submitted by a user process. When the first execution task among these tasks is a synchronous task, it simulates the first task using a software language to implement the corresponding synchronization mechanism. Based on the synchronization mechanism and scheduling rules, it schedules the first execution task. The scheduling rules are used to switch synchronous tasks that do not meet the execution conditions. Thus, by simulating the synchronization mechanism corresponding to the synchronous tasks in software to schedule tasks in each task queue, the methods ensure that each task is executed sequentially according to the user process's expected order, achieving software execution of synchronous tasks. Simultaneously, the software simulation switches task queues that do not meet the execution conditions in real time according to the scheduling rules, avoiding indefinite waiting and further preventing deadlocks between processes when multiple processes use the device simultaneously.

[0028] The following is combined Figures 2-5 The present invention describes a synchronous task execution method suitable for all synchronous task executions. The execution subject of this method can be an electronic device or a synchronous task execution device installed in the electronic device. The synchronous task execution device can be implemented by software, hardware, or a combination of both.

[0029] Figure 2 This is one of the flowcharts illustrating the synchronous task execution method provided by the present invention, such as... Figure 2 As shown, this method is applied to the scheduler and includes the following: Step 201: Receive a collection of task queues submitted by multiple user processes.

[0030] Here, a user process refers to an independent execution unit that runs in the user space of the operating system and is initiated by the user or created by an application.

[0031] It should be noted that each task queue includes multiple tasks to be executed, which can be synchronous or asynchronous.

[0032] Here, the scheduler can be obtained by a kernel-driven thread.

[0033] It should be noted that the synchronous task execution method is implemented by the kernel driver, and the upper-layer software does not need to be aware of it or make any changes to run normally. Therefore, it has good compatibility with existing software stacks and does not restrict the user's multi-process usage, which is very user-friendly.

[0034] Step 202: Obtain the first task to be executed from the first task queue in the task queue set.

[0035] Here, the first task to be executed can include synchronous tasks and asynchronous tasks.

[0036] Step 203: When the first execution task is a synchronous task, simulate the first execution task based on the software language to implement the synchronization mechanism corresponding to the first execution task.

[0037] It should be noted that when the first task to be executed is a synchronous task, the scheduler will remove the first task and use a software language to simulate the first task to be executed.

[0038] Here, synchronization tasks are specific tasks used in parallel computing, multi-process / thread collaboration, and hardware device interaction scenarios to coordinate the execution order, resource access permissions, or data consistency of multiple execution units (processes, threads, hardware modules). Their core objective is to eliminate execution chaos (such as data races and disordered sequences) in concurrent environments, ensuring that each execution unit proceeds in an orderly manner according to preset logic. Application areas include chip verification, parallel computing of graphics processing units (GPUs), and smart card communication.

[0039] Here, the synchronization mechanism can be understood as a complete solution for implementing synchronization tasks, that is, transforming abstract synchronization tasks into feasible, reusable, and error-free coordination behaviors. Its essence includes synchronization primitives, execution rules, and scenario adaptation.

[0040] Optionally, a synchronization mechanism can be automatically generated by a script, or the dependency relationships and shared resource types of the synchronization task can be analyzed to determine the synchronization mechanism.

[0041] For example, the step of simulating the first execution task based on the software language to implement the synchronization mechanism corresponding to the first execution task includes: encapsulating the first execution task based on the software language to simulate the execution unit corresponding to the first execution task; and determining the synchronization mechanism corresponding to the first execution task based on the dependency relationship of the execution unit and the shared resource type of the execution unit.

[0042] Here, based on the selected software language, the logic code, input parameters, output results, execution dependencies, etc. of the first execution task are encapsulated into modular independent units.

[0043] Here, the execution unit can be a virtual execution carrier for the first execution task, such as a thread.

[0044] Here, dependency refers to the logical relationship between multiple execution units regarding the order of task execution. For example, sequential dependency: execution unit B can only start after execution unit A has completed.

[0045] Here, shared resource type refers to software resources that are accessed by multiple execution units during operation.

[0046] In this embodiment of the invention, the synchronization mechanism of the synchronization task is simulated by software to realize the software scheduling of the synchronization task, thereby avoiding the process deadlock state in the hardware and thus preventing device blockage.

[0047] Step 204: Based on the synchronization mechanism and scheduling rules, execute the tasks in the task queue set.

[0048] The scheduling rules are used to switch between task queues in the task queue set.

[0049] Here, the scheduling rules are used to determine whether to switch task queues based on the execution conditions and results of synchronous tasks.

[0050] Furthermore, the step of executing the task in the task queue set based on the synchronization mechanism and scheduling rules includes: determining the first execution condition corresponding to the first execution task based on the synchronization mechanism; and executing the task in the task queue set based on the first execution condition and the scheduling rules.

[0051] Here, the first execution condition can be understood as the execution result of the first execution task. For example, when executing the synchronization task of NZ-pass0, the required execution condition is that the shared quantity is not zero. When the shared quantity is zero, NZ-pass0 cannot be executed.

[0052] Here, the scheduling rules can include various scheduling strategies, such as switching strategies and sequential execution strategies.

[0053] Specifically, after determining the execution conditions corresponding to the synchronization task based on the synchronization mechanism, the execution tasks in the task queue are executed according to the execution conditions and scheduling rules.

[0054] Optionally, the tasks in the task queue can be executed directly, or the synchronous task can be executed after the tasks in the task queue have been completed.

[0055] In this embodiment of the invention, execution tasks in the task queue are executed by means of execution conditions and scheduling rules, thereby avoiding blocking in the software.

[0056] For example, executing the task in the task queue set based on the first execution condition and the scheduling rule includes: if the first execution condition is met in the scheduler, determining a scheduling strategy as a sequential execution strategy from the scheduling rule; executing the next execution task of the first execution task in the first task queue based on the sequential execution strategy; if the first execution condition is not met in the scheduler, determining a switching strategy from the scheduling rule based on the scheduling rule; switching the first task queue to a second task queue in the task queue set based on the switching strategy; and if the second execution task in the second task queue is a synchronous task, executing the task in the task queue set based on the execution result of the second execution task.

[0057] Here, the scheduler can be a thread created by the kernel driver. In addition, the kernel driver can create multiple threads to process and execute tasks in parallel.

[0058] Specifically, if the first execution condition is met in the scheduler, the next execution task of the first execution task in the first task queue is executed. If the first execution condition is not met in the scheduler, the first task queue is switched to the second task queue in the task queue set, and the second execution task in the second task queue is executed.

[0059] It should be noted that after switching to the second task queue, the task type of the second execution task in the second task queue needs to be re-determined, and different processing is performed according to the task type. If the task type is a synchronous task, the behavior of a synchronous task is simulated in the scheduler using software language; if the task type is an asynchronous task, the second execution task is uploaded to the hardware.

[0060] Here, tasks in the task queue set can be executed based on the execution result of the second task; or tasks in the task queue set can be executed based on the execution result of the third task queue.

[0061] In this embodiment of the invention, different scheduling strategies are determined from the scheduling rules by whether there are execution conditions in the scheduler. Based on the scheduling strategy, the next task to be executed is determined, so as to avoid the synchronous task being unable to release resources and causing blockage.

[0062] Furthermore, the step of executing the tasks in the task queue set based on the execution result of the second task includes: determining a target task queue based on the execution result of the second task; if the current task in the target task queue is a synchronous task, sequentially traversing all task queues in the task queue set based on the execution result of the current task; and executing the tasks in the first task queue if the scheduler reverts to the first task queue.

[0063] Specifically, the second task is a synchronous task. Its behavior is simulated using software, and the task is executed. If the second task succeeds, subsequent tasks in the second task queue (the target task queue) are executed. If the second task fails, the process switches to the third task queue (the target task queue). The type of the current task in the third queue is then determined. If it's a synchronous task, its behavior is simulated using software, and the task is executed. If successful, tasks in the third queue continue; otherwise, the process switches to the fourth task queue. This continues until all task queues have been traversed, at which point the process returns to executing tasks in the first task queue. If the current task is asynchronous, its type is sent to the hardware for execution.

[0064] It should be noted that traversing all task queues does not mean that all tasks in the task queues must be executed successfully. When an execution fails, the task is switched to the next task queue, and so on, traversing all task queues in a repeated loop.

[0065] It should be noted that if an asynchronous task is encountered in the task queue, it will be sent to the hardware for execution.

[0066] In this embodiment of the invention, by determining the task type of the second execution task, different processing is performed according to the task type. For synchronous tasks, the task is directly discarded and the synchronous behavior of the task is simulated. For asynchronous tasks, the task is submitted to hardware for execution to avoid deadlock due to synchronization primitives when multiple processes use the device at the same time.

[0067] In this embodiment of the invention, a set of task queues submitted by multiple user processes is received. When the task to be executed is a synchronous task, the synchronous task is simulated using a software language to obtain the corresponding synchronization mechanism. Based on the synchronization mechanism and scheduling rules, the synchronous task is scheduled. The scheduling rules are used to switch task queues that do not meet the execution conditions. Thus, the software simulates the synchronization mechanism corresponding to the synchronous task to schedule tasks in each task queue, ensuring that each task is executed sequentially according to the user process's expected order. This achieves software execution of synchronous tasks. Simultaneously, in the software simulation, synchronous tasks that do not meet the execution conditions are switched in real-time according to the scheduling rules, avoiding indefinite waiting and further preventing deadlocks between processes when multiple processes use the device simultaneously.

[0068] Figure 3 This is the second flowchart of the synchronous task execution method provided by the present invention, as shown below. Figure 3 As shown, it includes: Step 201: Receive a collection of task queues submitted by multiple user processes.

[0069] Step 202: Obtain the first task to be executed from the first task queue in the task queue set.

[0070] Step 301: Parse the first execution task among the multiple execution tasks to obtain the format corresponding to the first execution task.

[0071] Step 302: Determine the task type of the first execution task based on the format corresponding to the first execution task.

[0072] The task types include synchronous tasks and asynchronous tasks.

[0073] It should be noted that synchronous and asynchronous tasks have their own corresponding formats, and the task type to be executed is determined according to the format.

[0074] Optionally, the format of the task execution may include interface characteristics, synchronous component calls, execution status, etc. during task execution.

[0075] Here, the task type can be determined based on the correspondence between the format and the task type.

[0076] In this embodiment of the invention, the task type of the task is determined according to the inherent format of the task, thereby improving the accuracy of task type determination and providing a reliable basis for subsequent task processing.

[0077] Step 203: When the first execution task is a synchronous task, simulate the first execution task based on the software language to implement the synchronization mechanism corresponding to the first execution task.

[0078] Step 204: Based on the synchronization mechanism and scheduling rules, execute the tasks in the task queue set.

[0079] In another embodiment, if the first execution task is an asynchronous task, the first execution task is sent to the hardware.

[0080] The hardware is used to execute the first execution task.

[0081] Here, after the asynchronous task is sent to the hardware, the thread loops to process the next task to be executed.

[0082] In this embodiment of the invention, a user process submits a task set. The scheduler receives the task set, and its unpacking module parses the task set, classifying the tasks into synchronous and asynchronous tasks. These tasks are then handed over to the scheduler's scheduling module. Upon receiving the tasks, the scheduler module processes them differently based on their type. Synchronous tasks are discarded, and the scheduler simulates their synchronous behavior. Asynchronous tasks are submitted to the hardware execution scheduler for cyclical processing of the next task. In this way, the scheduler processes all tasks submitted by the user process in parallel. Then, it simulates the behavior of the synchronous task, achieving the same semantics as the hardware synchronization primitives, ensuring the correctness of synchronization. Since the synchronization primitives are no longer submitted to the hardware, multiple processes using the device simultaneously will not deadlock due to the synchronization primitives.

[0083] Figure 4 This is a schematic diagram of the system architecture for implementing the synchronous scheduling task method provided by the present invention, as shown below. Figure 4As shown, the system includes a first user queue 401, a second user queue 402, a third user queue 403, a fourth user queue 404, a scheduler 405, a first hardware 406, and a second hardware 407. Specifically, the first user queue sends a first non-zero execution pass primitive (NZ-pass0) to the scheduler, the second user queue sends a second execution pass primitive (PASS1) to the scheduler, the third user queue sends a second non-zero execution pass primitive (NZ-PASS1) to the scheduler, and the fourth user queue sends a first execution pass primitive (PASS0) to the scheduler. The unpacking module in the scheduler parses the NZ-pass0, PASS1, NZ-PASS1, and PASS0 execution tasks submitted by each user queue, determines the task type corresponding to each execution task, and if it is a synchronous task, the scheduling module in the scheduler directly removes the synchronous task and simulates the synchronous task in software; if it is an asynchronous task, it is submitted to the hardware for execution, and the scheduler processes the next task in a loop.

[0084] In this embodiment of the invention, the scheduler processes all tasks submitted by user processes in parallel. The scheduler removes synchronous tasks from the task set and then simulates the behavior of those synchronous tasks to achieve the same semantics as the hardware synchronization primitives, ensuring the correctness of synchronization. Since the synchronization primitives corresponding to synchronous tasks are no longer submitted to the hardware, multiple processes will not deadlock due to synchronization primitives when using the device simultaneously.

[0085] It is implemented by the kernel driver, so the upper-layer software does not need to be aware of it or make any changes to run it normally. Therefore, it has good compatibility with existing software stacks and does not need to restrict the user's multi-process usage, which is very user-friendly.

[0086] The synchronous task execution device provided by the present invention is described below. The synchronous task execution device described below and the synchronous task execution method described above can be referred to in correspondence.

[0087] Figure 5 This is a schematic diagram of the structure of the synchronous task execution device provided by the present invention, as shown below. Figure 5 As shown, the device includes the following: The receiving module 510 is used to receive a set of task queues submitted by multiple user processes; The acquisition module 520 is used to acquire a first task to be executed from the first task queue in the task queue set; Simulation module 530 is used to simulate the first execution task based on a software language when the first execution task is a synchronous task, so as to realize the synchronization mechanism corresponding to the first execution task. The scheduling module 540 is used to execute tasks in the task queue set based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch task queues in the task queue set.

[0088] In another embodiment, the scheduling module 540 is specifically used to: determine the first execution condition corresponding to the first execution task based on the synchronization mechanism; and execute the execution task in the task queue set based on the first execution condition and the scheduling rule.

[0089] In another embodiment, the scheduling module 540 is further configured to: determine a sequential execution strategy from the scheduling rules when the first execution condition is met in the scheduler; execute the next execution task of the first execution task in the first task queue based on the sequential execution strategy; determine a switching strategy from the scheduling rules when the first execution condition is not met in the scheduler; switch the first task queue to the second task queue in the task queue set based on the switching strategy; and execute the execution task in the task queue set based on the execution result of the second execution task when the second execution task in the second task queue is a synchronous task.

[0090] In another embodiment, the scheduling module 540 is further configured to: determine a target task queue based on the execution result of the second task; if the current task in the target task queue is a synchronous task, sequentially traverse all task queues in the task queue set based on the execution result of the current task; and execute the task in the first task queue if the scheduler rotates to the first task queue again.

[0091] In another embodiment, after obtaining the first execution task from the first task queue in the task queue set, the synchronous task execution device further includes a type determination module, which is configured to: parse the first execution task to obtain a format corresponding to the first execution task; determine the task type of the first execution task based on the format corresponding to the first execution task; the task type includes the synchronous task and the asynchronous task.

[0092] In another embodiment, the synchronous task execution device further includes a sending module, specifically used to: send the first execution task to hardware when the first execution task is an asynchronous task, wherein the hardware is used to execute the first execution task.

[0093] In another embodiment, the simulation module 530 is specifically used to: encapsulate the first execution task based on the software language, and simulate the execution unit corresponding to the first execution task; and determine the synchronization mechanism corresponding to the first execution task based on the dependency relationship of the execution unit and the shared resource type of the execution unit.

[0094] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a synchronous task execution method. This method includes: receiving a set of task queues submitted by multiple user processes; obtaining a first execution task from a first task queue in the task queue set; if the first execution task is a synchronous task, simulating the first execution task based on a software language to implement a synchronization mechanism corresponding to the first execution task; and executing the execution tasks in the task queue set based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch task queues in the task queue set.

[0095] Furthermore, the logical instructions in the aforementioned memory 630 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, in essence, or the part that contributes to the prior art, or a part 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.

[0096] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the synchronous task execution method provided by the above methods. The method includes: receiving a set of task queues submitted by multiple user processes; obtaining a first execution task from a first task queue in the set of task queues; simulating the first execution task based on a software language to implement a synchronization mechanism corresponding to the first execution task when the first execution task is a synchronous task; and executing the execution task in the set of task queues based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch the task queues in the set of task queues.

[0097] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a synchronous task execution method provided by the above methods. The method includes: receiving a set of task queues submitted by multiple user processes; obtaining a first execution task from a first task queue in the set of task queues; if the first execution task is a synchronous task, simulating the first execution task based on a software language to implement a synchronization mechanism corresponding to the first execution task; and executing the execution task in the set of task queues based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch task queues in the set of task queues.

[0098] 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.

[0099] 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 part that contributes to the prior art, can be embodied in the form of a software product. 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.

[0100] 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 synchronous task execution, characterized in that, Applied to the scheduler, including: Receives a collection of tasks submitted by multiple user processes; Obtain the first task to execute from the first task queue in the set of task queues; When the first execution task is a synchronous task, the first execution task is simulated based on a software language to implement the synchronization mechanism corresponding to the first execution task. Based on the synchronization mechanism and scheduling rules, the tasks in the task queue set are executed; wherein, the scheduling rules are used to switch the task queues in the task queue set.

2. The synchronous task execution method according to claim 1, characterized in that, The execution of tasks in the task queue set based on the synchronization mechanism and scheduling rules includes: Based on the synchronization mechanism, the first execution condition corresponding to the first execution task is determined; Based on the first execution condition and the scheduling rule, the execution tasks in the task queue set are executed.

3. The synchronous task execution method according to claim 2, characterized in that, The step of executing tasks in the task queue set based on the first execution condition and the scheduling rule includes: If the first execution condition is met in the scheduler, the scheduling strategy is determined to be a sequential execution strategy from the scheduling rules; Based on the sequential execution strategy, the next execution task in the first task queue is executed; If the first execution condition is not met in the scheduler, the scheduling policy is determined to be a switching policy from the scheduling rules; Based on the switching strategy, the first task queue is switched to the second task queue in the task queue set; If the second execution task in the second task queue is a synchronous task, the execution tasks in the task queue set are executed based on the execution result of the second execution task.

4. The synchronous task execution method according to claim 3, characterized in that, The step of executing the tasks in the task queue set based on the execution result of the second execution task includes: Based on the execution result of the second task, determine the target task queue; If the currently executing task in the target task queue is a synchronous task, all task queues in the task queue set are traversed sequentially based on the execution result of the currently executing task. If the scheduler returns to the first task queue, the tasks in the first task queue will be executed.

5. The synchronous task execution method according to any one of claims 1 to 4, characterized in that, After retrieving the first task to be executed from the first task queue in the task queue set, the method further includes: The first execution task is parsed to obtain the format corresponding to the first execution task; Based on the format corresponding to the first execution task, the task type of the first execution task is determined; the task type includes synchronous tasks and asynchronous tasks.

6. The synchronous task execution method according to any one of claims 1 to 4, characterized in that, Also includes: If the first execution task is an asynchronous task, the first execution task is sent to the hardware, which is used to execute the first execution task.

7. The synchronous task execution method according to any one of claims 1 to 4, characterized in that, The synchronization mechanism based on simulating the first execution task using a software language to implement the first execution task includes: Based on the software language, the first execution task is encapsulated to simulate the execution unit corresponding to the first execution task; Based on the dependencies of the execution units and the types of shared resources of the execution units, the synchronization mechanism corresponding to the first execution task is determined.

8. A synchronous task execution device, characterized in that, include: The receiving module is used to receive a collection of task queues submitted by multiple user processes; The acquisition module is used to acquire the first task to be executed from the first task queue in the task queue set; The simulation module is used to simulate the first execution task based on a software language when the first execution task is a synchronous task, so as to implement the synchronization mechanism corresponding to the first execution task. The scheduling module executes tasks in the task queue set based on the synchronization mechanism and scheduling rules; wherein the scheduling rules are used to switch task queues in the task queue set.

9. 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 synchronous task execution method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the synchronous task execution method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A test system and method for program deadlock defects of a distributed system

    CN108959098A

  • Deadlock detection method and device

    CN113360290A

  • Information synchronization method, system and equipment of embedded training simulator and medium

    CN120263801A

  • Multi-task scheduling method, system and equipment based on resource queue management and medium

    CN121029354A

  • Queue Management for Scalable Input / Output Virtualization (SIOV) Devices

    US20250224982A1