Virtual machine task processing method and device, equipment and storage medium

By using asynchronous communication and interaction through a three-tiered resource pool structure, the problem of low hardware resource utilization caused by virtual machine task scheduling is solved, thereby improving system throughput and processing efficiency.

CN121879999APending Publication Date: 2026-04-17MOORE THREADS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MOORE THREADS TECH CO LTD
Filing Date
2025-12-30
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In a virtualized environment, virtual machine task scheduling uses synchronous or blocking mechanisms, which prevents hardware encoders or decoders from running at full load continuously, resulting in low hardware resource utilization.

Method used

A three-tier resource pool structure is adopted. Virtual machine tasks are stored in the first-tier resource pool, read by the host machine and stored in the second-tier resource pool, and then distributed to the third-tier resource pool for processing by the hardware processing core, realizing asynchronous communication and interaction and reducing task waiting time.

Benefits of technology

It improves system throughput and hardware utilization, and optimizes virtual machine task processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121879999A_ABST
    Figure CN121879999A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual machine task processing method and device, equipment and a storage medium, and belongs to the field of virtual machines. The method comprises the following steps: reading tasks from a first-level resource pool corresponding to at least one virtual machine and storing the tasks in a second-level resource pool corresponding to a host machine; the first-level resource pool corresponding to the target virtual machine is used for storing tasks generated by the target virtual machine, the target virtual machine is any one of the at least one virtual machine, and the at least one virtual machine shares resources of the host machine; the tasks stored in the second-level resource pool are distributed to a third-level resource pool corresponding to at least one hardware processing core; the three-level resource pool corresponding to the target processing core is used for storing a task to be processed by the target processing core, and the target processing core is any one of the at least one hardware processing core; and based on the target processing core, processing tasks stored in the three-level resource pool corresponding to the target processing core. According to the method, the hardware resource utilization rate of virtual machine operation can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of virtual machines, and in particular to a virtual machine task processing method, apparatus, device, and storage medium. Background Technology

[0002] The integration of GPU (Graphics Processing Unit) virtualization technology with video encoding and decoding has become an important research direction in cloud computing and multimedia. Through GPU virtualization technology, the GPU resources of a single physical server can be shared by multiple virtual machines (guests), significantly improving hardware utilization.

[0003] In related technologies, for the sharing and scheduling of video encoding and decoding resources in a virtualized environment, each virtual machine submits encoding and decoding tasks to the host through a virtualization interface. The host sorts and schedules the tasks and assigns them to hardware encoders or decoders. After processing, the results are returned to the host, and then the host returns them to the virtual machines, thus enabling multiple virtual machines to share and access hardware encoding and decoding resources.

[0004] However, in related technologies, task scheduling employs synchronous or blocking mechanisms, requiring the host machine to wait for each task to complete before processing the next. During the process of the virtual machine submitting tasks to the host machine, and the host machine allocating tasks to hardware encoders or decoders, waiting or queue backlogs may occur, preventing the hardware encoders or decoders from continuously operating at full capacity and resulting in low hardware resource utilization. Summary of the Invention

[0005] This application provides a virtual machine task processing method, apparatus, device, and storage medium, which can improve the utilization rate of hardware resources for virtual machine operation.

[0006] According to one aspect of this application, a virtual machine task processing method is provided, the method being executed by a computer device, the computer device including at least one hardware processing core; the method includes: Tasks are read from the primary resource pools corresponding to at least one virtual machine and stored in the secondary resource pool corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, wherein the target virtual machine is any one of the at least one virtual machines, and the at least one virtual machine shares the resources of the host machine; The tasks stored in the secondary resource pool are distributed to the tertiary resource pools corresponding to the at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, wherein the target processing core is any one of the at least one hardware processing core. Based on the target processing core, the tasks stored in the three-level resource pool corresponding to the target processing core are processed.

[0007] According to one aspect of this application, a virtual machine task processing apparatus is provided, applied to a computer device, the computer device including at least one hardware processing core; the apparatus includes: The reading module is used to read tasks from the primary resource pools corresponding to at least one virtual machine and store them in the secondary resource pools corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, wherein the target virtual machine is any one of the at least one virtual machine, and the at least one virtual machine shares the resources of the host machine; The distribution module is used to distribute the tasks stored in the secondary resource pool to the tertiary resource pools corresponding to the at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, wherein the target processing core is any one of the at least one hardware processing core; The processing module is used to process the tasks stored in the third-level resource pool corresponding to the target processing core, based on the target processing core.

[0008] According to one aspect of this application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the virtual machine task processing method described above.

[0009] According to one aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, the computer program being loaded and executed by a processor to implement the virtual machine task processing method described above.

[0010] According to one aspect of this application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein a processor retrieves the computer instructions from the computer-readable storage medium, causing the processor to load and execute them to implement the virtual machine task processing method described above.

[0011] The beneficial effects of the technical solutions provided in this application include at least the following:

[0012] A three-tier resource pool structure is provided. The first-tier resource pool stores tasks generated by virtual machines (VMs), the second-tier resource pool stores tasks read by the host machine from the first-tier resource pool, and the third-tier resource pool stores tasks awaiting processing by the hardware processing cores. During VM task processing, VMs can store generated tasks in their own first-tier resource pool. Both VMs and the host machine can read and write data to the first-tier resource pool. The host machine reads tasks generated by VMs from the first-tier resource pool and places them into the second-tier resource pool. Subsequently, the host machine can distribute the tasks stored in the second-tier resource pool to the third-tier resource pool, where they are processed by the corresponding hardware processing cores. This three-tier resource pool structure enables asynchronous communication and interaction between VM task submission, host task scheduling, and hardware processing core task processing, reducing waiting time for task submission, scheduling, and processing, improving system throughput efficiency, and optimizing hardware utilization during VM operations. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a schematic diagram of a computer device provided in one embodiment of this application.

[0015] Figure 2 This is a flowchart of a virtual machine task processing method provided in one embodiment of this application.

[0016] Figure 3 This is a schematic diagram of a virtual machine task processing method provided in one embodiment of this application.

[0017] Figure 4 This is a flowchart of a virtual machine task processing method provided in one embodiment of this application.

[0018] Figure 5 This is a flowchart of a virtual machine task processing method provided in one embodiment of this application.

[0019] Figure 6 This is a schematic diagram of a virtual machine task processing device provided in one embodiment of this application.

[0020] Figure 7 This is a structural block diagram of an electronic device provided in one embodiment of this application.

[0021] Figure 8 This is a schematic diagram of the structure of a server provided in one embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0023] First, some terms used in the embodiments of this application will be introduced: A virtual machine (guest) is a computer system simulated by software, running in a virtualized environment on a host machine. Inside the virtual machine, it runs its own operating system and applications, behaving identically to a physical machine, but its actual computing and storage resources are dynamically allocated by the host machine. In other words, a virtual machine is an isolated runtime environment created on top of a host machine using virtualization technology. Each virtual machine has its own independent virtual hardware configuration and operating system instance, capable of executing various applications as if running on a real physical machine. In video encoding and decoding scenarios, the virtual machine generates encoding and decoding tasks that require hardware processing and submits these tasks to the host machine.

[0024] The host machine is the operating system and virtualization layer that runs directly on the physical device. It is responsible for managing and scheduling resource requests from all virtual machines and allocating underlying hardware resources such as computing, storage, and graphics cards. In GPU virtualization technology, the host machine acts as a resource intermediary—receiving GPU tasks (such as video encoding and decoding) from various virtual machines and coordinating their allocation to the underlying physical GPU hardware. Since multiple virtual machines may compete for GPU resources simultaneously, the host machine's scheduling strategy directly affects hardware utilization and processing efficiency.

[0025] The hardware processing core refers to the hardware computing unit inside the physical device, such as an encoder or decoder. The hardware processing core is responsible for video encoding and decoding calculations. Due to the limited computing power of the hardware processing core, if tasks submitted by multiple virtual machines accumulate under high load, the hardware processing core may not be able to run at full capacity continuously (i.e., tasks may wait or queue), resulting in lower-than-ideal utilization. Optimizing task scheduling to reduce queue backlog and improve core continuous workload is one of the core challenges of GPU virtualization technology.

[0026] In GPU virtualization and video encoding / decoding scenarios, the host machine needs to coordinate the shared access of multiple virtual machines to the physical GPU and efficiently allocate video encoding / decoding tasks to the actual hardware encoder / decoder units. In related technologies, virtual machines submit encoding / decoding task requests to the host machine through specific virtual device interfaces, but these requests need to be scheduled and routed by the host machine before they can actually reach the hardware processing core. It is evident that the host machine is a key intermediate layer connecting virtual machines and the hardware processing core.

[0027] Figure 1A structural block diagram of a computer device provided in an exemplary embodiment of this application is shown. The computer device includes at least one of the following: a terminal 110 and a server 140.

[0028] Terminal 110 includes a first memory and a first processor. The first memory stores a virtual machine task processing program; the virtual machine task processing program is invoked and executed by the first processor to implement the virtual machine task processing method provided in this application. The first memory may include, but is not limited to, the following: Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM).

[0029] The first processor can consist of one or more integrated circuit chips. Optionally, the first processor can be a general-purpose processor, such as a central processing unit (CPU) or a network processor (NP). Optionally, the first processor can implement the virtual machine task processing method provided in this application by running programs or code.

[0030] Optionally, the terminal device type includes at least one of the following: computer, smartphone, smartwatch, in-vehicle terminal, wearable device, smart TV, tablet computer, e-book reader, MP3 player, MP4 player, laptop computer, and desktop computer. The following embodiments use a computer as an example.

[0031] Server 140 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Optionally, server 140 includes a second memory and a second processor. The second memory stores a virtual machine task processing program; the virtual machine task processing program is called by the second processor to implement the virtual machine task processing method provided in this application. Optionally, the second memory may include, but is not limited to, the following: RAM, ROM, PROM, EPROM, and EEPROM. Optionally, the second processor may be a general-purpose processor, such as a CPU or NP.

[0032] For example, a computer device runs a virtual machine and a host machine. The host machine can receive tasks generated by the virtual machine and assign them to the hardware processing core of the computer device for processing.

[0033] In one alternative embodiment, the virtual machine, the host machine, and the hardware processing core can be hosted on the same computer device. For example, both the virtual machine and the host machine run on a first server, and the hardware processing core can be the encoder and decoder of the first server. Alternatively, the computer device can be a terminal; for example, both the virtual machine and the host machine run on a first terminal, and the hardware processing core can be the encoder and decoder of the first terminal. The following description uses the computer device as a server as an example only.

[0034] In another alternative embodiment, the virtual machine, the host machine, and the hardware processing core can be hosted on different computer devices. For example, when the computer devices are a server cluster consisting of multiple servers, the virtual machine, the host machine, and the hardware processing core can be hosted on different servers.

[0035] For example, virtual machines are hosted by a first group of servers, which includes at least one server, and each server in the first group of servers can run at least one virtual machine.

[0036] The hardware processing core is provided by a second group of servers, which includes at least one server, and each server in the second group of servers can provide at least one hardware processing core.

[0037] The second server runs a host machine. The second server can be any server in the first group of servers, or any server in the second group of servers, or a server independent of the first group of servers and the second group of servers.

[0038] The second server can communicate with the first group of servers to read tasks generated by virtual machines on the first group of servers. The second server can also communicate with the second group of servers to schedule the hardware processing cores on the second group of servers.

[0039] Figure 2 A flowchart of a virtual machine task processing method provided in an exemplary embodiment of this application is shown, in which the method is applied... Figure 1 The computer device shown is used as an example to illustrate that the method includes: Step 210: Read tasks from the primary resource pool corresponding to at least one virtual machine and store them in the secondary resource pool corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, the target virtual machine is any one of the at least one virtual machine, and the at least one virtual machine shares the resources of the host machine.

[0040] For example, a virtual machine can correspond to one primary resource pool or multiple primary resource pools. Each primary resource pool for a virtual machine is used to store the tasks generated by that virtual machine. Secondary resource pools are used to store tasks read from at least one primary resource pool.

[0041] This embodiment illustrates the scenario where the virtual machine, host machine, and hardware processing core are all hosted on a single computer device; however, as mentioned above, the virtual machine, host machine, and hardware processing core can also be hosted on different computer devices (such as a server cluster of a virtualization platform). The method is executed by the computer device, or the method is executed by the host machine running on the computer device.

[0042] The computer device runs at least one virtual machine, or at least two virtual machines. For example, such as Figure 3 As shown, a computer device can run N virtual machines, where N is a positive integer.

[0043] The computer device includes at least one hardware processing core, or the computer device is provided with at least two hardware processing cores. Optionally, the hardware processing core includes at least one of an encoder and a decoder, and the number of each type of hardware processing core can be at least one. For example, such as Figure 3 As shown, the computer device is equipped with M decoders and H encoders, where M and H are positive integers.

[0044] Each virtual machine (VM) has a primary resource pool, meaning the number of primary resource pools equals the number of VMs. The primary resource pool corresponding to a VM stores the tasks (or "encoding / decoding tasks") generated by that VM. For example... Figure 3 As shown, corresponding primary resource pools are set for N virtual machines. Virtual machine 1 corresponds to primary resource pool 1, virtual machine 2 corresponds to primary resource pool 2, ..., virtual machine N corresponds to primary resource pool N.

[0045] Each hardware processing core has a three-tier resource pool; that is, the number of three-tier resource pools equals the number of hardware processing cores. The three-tier resource pool corresponding to each hardware processing core is used to store the tasks to be processed by that hardware processing core. For example, ... Figure 3 As shown, three-level resource pools are set up for each of the M decoders, with decoder 1 corresponding to three-level resource pool 1, decoder 2 corresponding to three-level resource pool 2, ..., decoder M corresponding to three-level resource pool M; three-level resource pools are set up for each of the H encoders, with encoder 1 corresponding to three-level resource pool (1+M), encoder 2 corresponding to three-level resource pool (2+M), ..., encoder H corresponding to three-level resource pool (M+H).

[0046] There is one secondary resource pool. The host machine will store the tasks read from the primary resource pool into this secondary resource pool.

[0047] Alternatively, there can be multiple secondary resource pools. Different secondary resource pools can be used to store different types of tasks. For example, encoding tasks can have one encoding secondary resource pool, and decoding tasks can have one decoding secondary resource pool. Furthermore, multiple secondary resource pools can be set up according to task priority, with first-priority tasks placed in first-priority secondary resource pools, and second-priority tasks placed in second-priority secondary resource pools. Alternatively, different secondary resource pools can be assigned priorities. Tasks read by the host from the first-priority resource pools can be stored according to the priorities of the secondary resource pools. If a higher-priority secondary resource pool is not full, the read tasks will be stored in that higher-priority secondary resource pool.

[0048] In one alternative embodiment, a virtual machine may correspond to at least two primary resource pools.

[0049] For example, at least two different primary resource pools can be set up for each virtual machine according to task type, with each resource pool used to store tasks of one task type. For instance, if a primary resource pool is set up for encoding tasks and a primary resource pool for decoding tasks, then a virtual machine can correspond to one primary encoding resource pool and one primary decoding resource pool.

[0050] For example, based on task importance, at least two different primary resource pools can be set up for each virtual machine, with each resource pool used to store tasks of a certain importance level. For instance, the importance level can be divided into three levels, with each level corresponding to a primary resource pool, so a virtual machine can have three primary resource pools.

[0051] Similarly, a hardware processing core can also correspond to at least one level 3 resource pool. For example, different level 3 resource pools can be divided according to task priority; for instance, a hardware processing core can correspond to two level 3 resource pools: one for high-priority tasks and one for low-priority tasks. Alternatively, different level 3 resource pools can be divided according to task processing difficulty; for instance, a hardware processing core can correspond to two level 3 resource pools: one for time-consuming tasks and one for time-consuming tasks.

[0052] Correspondingly, when a virtual machine corresponds to multiple primary resource pools, the host machine can determine the first resource information for task reading according to the classification method of multiple primary resource pools; when a hardware processing core corresponds to multiple tertiary resource pools, the host machine can determine the second resource information for task distribution according to the classification method of multiple tertiary resource pools.

[0053] It's important to note that the Level 1 resource pool is a resource pool bound to the virtual machine. A Level 1 resource pool is created for a virtual machine when it runs on the computer. When the virtual machine stops running, its corresponding Level 1 resource pool still exists; alternatively, the Level 1 resource pool can be deleted when the virtual machine stops running, and a new Level 1 resource pool will be created for the virtual machine the next time it starts running. The Level 3 resource pool is a resource pool permanently allocated to hardware processing cores. If a new hardware processing core is added to the computer, a new Level 3 resource pool is created for the new core; if some hardware processing cores are removed from the computer, some Level 3 resource pools are deleted accordingly.

[0054] In one alternative embodiment, the primary and tertiary resource pools can also be dynamically configured. For example, a primary resource pool is created for a virtual machine when it generates a task; if there are no tasks in the primary resource pool and the duration exceeds a duration threshold, the primary resource pool is deleted. The creation and deletion of primary resource pools can be sent by the virtual machine to the host machine via notification messages. The host machine can store a list of primary resource pools. The host machine can update the list of primary resource pools based on the notification messages to retrieve tasks from the primary resource pools.

[0055] Similarly, when there are tasks assigned to the hardware processing core, a three-level resource pool is created for the hardware processing core. If there are no tasks in the three-level resource pool and the duration is longer than the duration threshold, the three-level resource pool for that hardware processing core is deleted.

[0056] By dynamically configuring primary and tertiary resource pools, the capacity of these pools can be adjusted in real-time based on the dynamic load of virtual machines and hardware processing cores. For example, when a virtual machine is under high load, it can proactively create a larger primary resource pool, move tasks from the original pool to the new one, and delete the original pool, thus dynamically expanding the primary resource pool. Alternatively, when the host machine allocates many tasks to a hardware processing core, a larger tertiary resource pool can be created to accommodate its pending tasks. Virtual machines without tasks and hardware processing cores without pending tasks do not require resource pool creation, improving storage space utilization.

[0057] Assuming each virtual machine corresponds to a primary resource pool, for example, the i-th virtual machine corresponds to the i-th primary resource pool, then the i-th primary resource pool is used to store tasks generated by the i-th virtual machine. When the i-th virtual machine generates a task, it immediately stores the task in the i-th primary resource pool. For example, when the target virtual machine generates a second task, it stores the second task in the primary resource pool corresponding to the target virtual machine. The virtual machine's act of placing tasks into the primary resource pool in real time is asynchronous; the storage of tasks and task processing are performed asynchronously. The virtual machine does not need to wait for the processing result of the previous task when storing the currently generated task. Similarly, the storage of tasks by the virtual machine into the primary resource pool and the reading of tasks from the primary resource pool by the host machine are also performed asynchronously, and these actions do not interfere with each other.

[0058] It should be noted that virtual machines can read and write data (read and write tasks) to the primary resource pool, and the host machine can also read and write data (read and write tasks) to the primary resource pool. The host machine can directly read the tasks stored in the primary resource pool through the communication interface without the virtual machine reporting the tasks to the host machine.

[0059] It should be noted that when the host machine reads a task from the primary resource pool and stores it in the secondary resource pool, the task is deleted from the primary resource pool and added to the secondary resource pool. For example, if a primary resource pool currently contains task A and task B, and the host machine reads task A from that primary resource pool and stores it in the secondary resource pool, task A is deleted from the primary resource pool, leaving only task B in the primary resource pool, while task A is newly added to the secondary resource pool.

[0060] Step 220: Distribute the tasks stored in the secondary resource pool to the tertiary resource pools corresponding to at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, which is any one of the at least one hardware processing core.

[0061] For example, tasks stored in the secondary resource pool are distributed to at least one tertiary resource pool; a hardware processing core may correspond to one tertiary resource pool or multiple tertiary resource pools, and the tertiary resource pool corresponding to each hardware processing core is used to store the tasks to be processed by that hardware processing core.

[0062] After the host machine reads a task from the primary resource pool, it stores the task in the secondary resource pool. Then, the host machine can distribute the task from the secondary resource pool to the tertiary resource pool so that the corresponding hardware processing core in the tertiary resource pool can process the task.

[0063] In an optional embodiment, if there are tasks to be assigned in the secondary resource pool, steps 210 and 220 can be performed simultaneously. That is, the host machine reading tasks from the primary resource pool and the host machine distributing tasks to the tertiary resource pool can occur simultaneously without affecting each other. For example, the host machine can run two programs: the first program is responsible for reading tasks from the primary resource pool, and the second program is responsible for distributing tasks from the secondary resource pool to the tertiary resource pool. The two programs run independently without affecting each other.

[0064] Optionally, the secondary resource pool can use a queue to store tasks. Tasks read from the primary resource pool are stored at the tail of the queue, and tasks are retrieved from the head of the queue and distributed to the tertiary resource pool. That is, tasks that enter the secondary resource pool first will be distributed to the tertiary resource pool first. The order of tasks in the queue can depend on the order in which the host machine reads tasks from the primary resource pool; that is, tasks read first will be allocated to the tertiary resource pool first.

[0065] Alternatively, whenever a new task is read into the secondary resource pool, the host machine can reorder all tasks in the secondary resource pool and distribute them according to the sorted order.

[0066] It should be noted that the host machine can read and write data to the level 3 resource pool (read and write tasks), and the hardware processing core can read data from the level 3 resource pool (read tasks). The host machine can directly write tasks to the level 3 resource pool through the communication interface.

[0067] It should be noted that when the host machine distributes a task from the secondary resource pool to the tertiary resource pool, the task is deleted from the secondary resource pool and added to the tertiary resource pool. For example, if the secondary resource pool currently contains task A and task B, and the host machine distributes task A from the secondary resource pool to a tertiary resource pool, task A is deleted from the secondary resource pool, leaving only task B in the secondary resource pool, while task A is newly added to the tertiary resource pool.

[0068] For example, taking a hardware processing core corresponding to a three-level resource pool as an example, the j-th hardware processing core corresponds to the j-th three-level resource pool. The j-th three-level resource pool is used to store tasks to be processed by the j-th hardware processing core. The host machine can distribute tasks to the j-th three-level resource pool in real time without needing to confirm the working status of the j-th hardware processing core. That is, regardless of the working status of the j-th hardware processing core, and regardless of whether the j-th hardware processing core has completed its previous task, the host machine can distribute tasks to the j-th three-level resource pool. The host machine's task distribution behavior and the hardware processing core's task processing behavior are executed asynchronously and do not affect each other.

[0069] Step 230: Based on the target processing core, process the tasks stored in the third-level resource pool corresponding to the target processing core.

[0070] For example, each hardware processing core has its own three-level resource pool. When there are tasks in the three-level resource pool, the hardware processing core will read the tasks from the corresponding three-level resource pool and process them.

[0071] After processing is complete, the processing result is sent to the host machine or virtual machine in the form of an asynchronous notification. For any task stored in the three-level resource pool corresponding to the target processing core, an asynchronous result notification is sent to both the host machine and the virtual machine corresponding to the task, based on the target processing core. The asynchronous result notification is used to provide feedback on the processing result of the task. The asynchronous result notification includes at least one of a first asynchronous notification and a second asynchronous notification.

[0072] For example, the first task generated by the i-th virtual machine is assigned to the j-th level 3 resource pool corresponding to the j-th hardware processing core. The computer device sends a first asynchronous notification to the host machine through the j-th hardware processing core, indicating the processing result of the first task; then the host machine can receive the first asynchronous notification sent by the j-th hardware processing core, which indicates the processing result of the first task. Alternatively, the computer device sends a second asynchronous notification to the i-th virtual machine through the j-th hardware processing core, indicating the processing result of the first task; the j-th hardware processing core also sends a second asynchronous notification to the i-th virtual machine, indicating the processing result of the first task.

[0073] It's important to note that task reading, distribution, processing, and result notification are all performed asynchronously and do not interfere with each other. The host machine does not need to wait for processing results to execute the next task reading and distribution, improving processing efficiency and hardware utilization.

[0074] Furthermore, the multiple hardware processing cores do not interfere with each other. When there are tasks in multiple level 3 resource pools, the multiple hardware processing cores can run and process the tasks in their respective level 3 resource pools simultaneously.

[0075] For example, the three-level resource pool can store tasks in the form of a queue. Tasks that enter the three-level resource pool first will be processed by the hardware processing core first, and tasks that enter the three-level resource pool later will be processed later. The host machine stores newly distributed tasks at the tail of the queue of the three-level resource pool, and the hardware processing core retrieves tasks from the head of the queue of the three-level resource pool for processing. That is, tasks that enter the three-level resource pool first will be processed first.

[0076] For example, the hardware processing core can process tasks in the three-level resource pool sequentially. After the nth task in the j-th three-level resource pool is completed, the j-th hardware processing core is used to process the (n+1)-th task stored in the j-th three-level resource pool, where n is a positive integer.

[0077] In summary, the method provided in this application provides a three-level resource pool structure. The first-level resource pool stores tasks generated by the virtual machine, the second-level resource pool stores tasks read from the first-level resource pool by the host machine, and the third-level resource pool stores tasks to be processed by the hardware processing cores. Specifically, there is at least one first-level resource pool, with each virtual machine having its own corresponding first-level resource pool; there is one second-level resource pool; and there is at least one third-level resource pool, with each hardware processing core having its own corresponding third-level resource pool. During virtual machine task processing, the virtual machine can store generated tasks to be processed in its own first-level resource pool. Both the virtual machine and the host machine can read and write data to the first-level resource pool. The host machine reads tasks generated by the virtual machine from the first-level resource pool and places them into the second-level resource pool. Subsequently, the host machine can distribute the tasks stored in the second-level resource pool to the third-level resource pool for processing by the corresponding hardware processing cores. This three-level resource pool structure enables asynchronous communication and interaction between virtual machine task submission, host machine task scheduling, and hardware processing core task processing, reducing the waiting time for task submission, scheduling, and processing, improving system throughput and hardware utilization, and optimizing virtual machine task processing efficiency.

[0078] For example, if a secondary resource pool is used to schedule tasks from at least one primary resource pool, the host machine can use the first resource information and / or the second resource information to schedule the tasks generated by the virtual machine.

[0079] Figure 4 A flowchart of a virtual machine task processing method provided in an exemplary embodiment of this application is shown, in which the method is applied... Figure 1 The computer devices shown are illustrated as examples, based on Figure 2 In the illustrated embodiment, step 210 includes step 211, and / or step 220 includes step 221.

[0080] Step 211: Read the task from at least one primary resource pool according to the first resource information and store it in the secondary resource pool.

[0081] The first resource information includes at least one of the following: the order of at least one primary resource pool, the length of the task queue in the primary resource pool, the weight of at least one primary resource pool, and the priority of the tasks in the primary resource pool.

[0082] In one alternative embodiment, the host machine can read tasks from the primary resource pool and store them in the secondary resource pool based on any of the following first resource information.

[0083] (1) In accordance with the order of at least one primary resource pool, read tasks from at least one primary resource pool and store them in the secondary resource pool.

[0084] For example, multiple primary resource pools can have their own numbers. For instance, N primary resource pools can be numbered sequentially from 1 to N. The order of at least one primary resource pool can be sorted according to their numbers, for example, reading tasks sequentially from number 1 to N.

[0085] (2) Based on the task queue length in at least one primary resource pool, prioritize reading the task in the primary resource pool with the longest task queue and store it in the secondary resource pool.

[0086] The host machine can read the length of the task queue in each primary resource pool in real time and prioritize reading tasks from the primary resource pool with the longest task queue to the secondary resource pool. This avoids the primary resource pool becoming overloaded due to too many tasks, preventing newly generated tasks from being stored in the primary resource pool.

[0087] (3) Based on the weight of at least one primary resource pool, prioritize reading the tasks in the primary resource pool with the highest weight and store them in the secondary resource pool.

[0088] Multiple primary resource pools can have their own weights, and the weight of a primary resource pool can also be the weight of the virtual machine corresponding to that pool. A virtual machine with higher importance can have a higher weight in its primary resource pool. Therefore, the host machine can prioritize reading tasks from the primary resource pool with the higher weight.

[0089] (4) Based on the priority of tasks in at least one primary resource pool, the highest priority task is read from at least one primary resource pool and stored in the secondary resource pool.

[0090] Multiple tasks within the same primary resource pool can also have their own priorities. The host machine can prioritize reading higher-priority tasks from the primary resource pool.

[0091] (5) Based on the task queue length in at least one primary resource pool, the weight of at least one primary resource pool, and the priority of tasks in at least one primary resource pool, determine the task score of each task in the primary resource pool, and prioritize reading the task with the highest task score from the primary resource pool and storing it in the secondary resource pool.

[0092] For example, the host machine can also calculate the task score for each task based on the task queue length, resource pool weight, and task priority, prioritizing tasks with longer queue lengths, larger resource pool weights, and higher task priorities. For instance, the task score can be equal to the sum of the queue length, weight, and priority, or it can be equal to the product of the queue length, weight, and priority.

[0093] (6) Determine the resource pool score of each primary resource pool based on the task queue length in at least one primary resource pool and the weight of at least one primary resource pool. Prioritize reading tasks from the primary resource pool with the highest resource pool score and storing them in the secondary resource pool.

[0094] The host machine can also calculate the resource pool score based on the task queue length and resource pool weight, and prioritize reading tasks from the first-level resource pool with the highest resource pool score. The resource pool score can be equal to the sum of the task queue length and the weight, or it can be equal to the product of the task queue length and the weight.

[0095] For example, the resource pool score of each primary resource pool is determined based on the task queue length in at least one primary resource pool and the weight of at least one primary resource pool. The highest priority task is read from the primary resource pool with the highest resource pool score and stored in the secondary resource pool.

[0096] The host machine can also first determine the primary resource pool that needs to be read based on the resource pool score, and then read the higher priority tasks according to the task priority of each task in the resource pool.

[0097] Step 221: Based on the second resource information, the task type of the tasks stored in the second-level resource pool, and the core type of at least one hardware processing core, distribute the tasks stored in the second-level resource pool to at least one third-level resource pool.

[0098] The second resource information includes at least one of the following: the order of at least one tertiary resource pool, the task queue length in the tertiary resource pool, the weight of at least one tertiary resource pool, the priority of tasks in the secondary resource pool, the historical task completion status of at least one tertiary resource pool, and the load status of at least one hardware processing core. The task types stored in the secondary resource pool may include at least one of encoding tasks and decoding tasks. The core type of at least one hardware processing core may include at least one of encoder and decoder.

[0099] In one optional embodiment, the host machine can select at least one candidate tertiary resource pool from at least one tertiary resource pool based on the task type of the tasks stored in the secondary resource pool and the core type of at least one hardware processing core; and distribute the tasks stored in the secondary resource pool to at least one candidate tertiary resource pool according to the second resource information.

[0100] For example, for any task stored in the secondary resource pool, if the task type is an encoding task, the host machine selects at least one first processing core with the core type of encoder from at least one hardware processing core; and determines the tertiary resource pool corresponding to at least one first processing core as a candidate tertiary resource pool.

[0101] For example, for any task stored in the secondary resource pool, if the task type is a decoding task, at least one secondary processing core with the core type of decoder is selected from at least one hardware processing core; the tertiary resource pool corresponding to at least one secondary processing core is determined as a candidate tertiary resource pool.

[0102] That is, the encoding tasks in the secondary resource pool are distributed to the tertiary resource pool corresponding to the encoder; and / or, the decoding tasks in the secondary resource pool are distributed to the tertiary resource pool corresponding to the decoder; the tasks include at least one of the encoding tasks and the decoding tasks, and the hardware processing core includes at least one of the encoder and the decoder.

[0103] For example, different hardware processing cores can be used to process different tasks. The host machine needs to distribute the tasks in the secondary resource pool to the tertiary resource pool of the hardware processing core that can process the task, based on the task type. For example, tasks include encoding tasks and decoding tasks, and hardware processing cores include encoders and decoders; the host machine needs to distribute encoding tasks to the tertiary resource pool corresponding to the encoder and decoding tasks to the tertiary resource pool corresponding to the decoder.

[0104] Furthermore, the host machine determines the tertiary resource pool to be distributed from at least one candidate tertiary resource pool based on the second resource information; and distributes the task to the tertiary resource pool to be distributed. The tertiary resource pool to be distributed is the tertiary resource pool corresponding to the target hardware processing core selected by the host machine for processing the task. The host machine retrieves the task from the secondary resource pool and distributes it to the tertiary resource pool to be distributed.

[0105] In one alternative embodiment, the host machine may determine the three-tier resource pool to be distributed in the following manner.

[0106] (1) Based on the order of at least one level 3 resource pool, the candidate level 3 resource pool that appears first in the order is determined as the level 3 resource pool to be distributed.

[0107] Similar to the primary resource pool, the tertiary resource pools can also have their own numbers. For example, M tertiary resource pools can be numbered sequentially from 1 to M, and the order of at least one tertiary resource pool can be sorted according to their numbers, for example, tasks can be distributed sequentially according to their numbers from 1 to M.

[0108] (2) Based on the task queue length in at least one level 3 resource pool, the candidate level 3 resource pool with the shortest task queue is determined as the level 3 resource pool to be distributed.

[0109] The host machine can read the length of the task queue in each level 3 resource pool in real time, and prioritize distributing tasks to the level 3 resource pool with the shortest task queue to balance the load of each hardware processing core.

[0110] (3) Based on the weight of at least one candidate level 3 resource pool, the candidate level 3 resource pool with the highest weight is determined as the level 3 resource pool to be distributed.

[0111] Multiple tier-3 resource pools can each have their own weights, and the weight of a tier-3 resource pool can also be the weight of the corresponding hardware processing core. Hardware processing cores with higher importance can have higher weights in their tier-3 resource pools; or, hardware processing cores with stronger computing power can have higher weights in their tier-3 resource pools. The host machine can then prioritize distributing tasks to tier-3 resource pools with higher weights.

[0112] (4) Based on the load of the hardware processing cores corresponding to at least one candidate level 3 resource pool, the candidate level 3 resource pool corresponding to the hardware processing core with the smallest load is determined as the level 3 resource pool to be distributed.

[0113] The host machine can also monitor the load of each hardware processing core in real time and prioritize distributing tasks to the three-level resource pool corresponding to the hardware processing core with the lowest load.

[0114] (5) Call the machine learning model to process the second resource information, the task type of the tasks stored in the second-level resource pool and the core type of at least one hardware processing core to obtain the task distribution strategy in the second-level resource pool; determine the third-level resource pool to be distributed according to the distribution strategy. The host machine can also use machine learning models to determine the distribution strategy; according to the distribution strategy, the tasks stored in the secondary resource pool are distributed to at least one tertiary resource pool.

[0115] The host machine calls a machine learning model to process the second resource information, the task types of the tasks stored in the second-level resource pool, and the core type of at least one hardware processing core to obtain the task distribution strategy in the second-level resource pool; and distributes the tasks stored in the second-level resource pool to at least one third-level resource pool according to the distribution strategy.

[0116] The distribution strategy includes at least one of the following: the distribution order of tasks in the secondary resource pool, the tertiary resource pool required for each task, the distribution timing of each task, the task splitting method, and the tertiary resource pool required for sub-tasks.

[0117] For example, the host machine can also store a machine learning model, and use the machine learning model to output a task distribution strategy based on at least one of the following: the task queue length in the tertiary resource pool, the weight of at least one tertiary resource pool, the priority of tasks in the secondary resource pool, the historical task completion status of at least one tertiary resource pool, the load status of at least one hardware processing core, the task type of tasks stored in the secondary resource pool, and the core type of at least one hardware processing core.

[0118] When the host machine needs to distribute the current task, it can use a machine learning model to output the distribution strategy for the current task. The distribution strategy output by the machine learning model includes the identifier of the three-level resource pool to be distributed for the task.

[0119] The host machine can also distribute multiple tasks at once. For example, it can distribute a preset number of tasks at once, and use a machine learning model to output a distribution strategy for this group of tasks. The distribution strategy output by the machine learning model includes the identifiers of the three-level resource pools to which each task in the group should be distributed, the distribution order of the tasks in the group, and the distribution timing of each task in the group. Furthermore, the host machine can also distribute all tasks in a second-level resource pool at once, and use a machine learning model to output a distribution strategy for all tasks in the current second-level resource pool.

[0120] Optionally, when a task needs to be split into multiple subtasks for execution, the machine learning model can also output the splitting result of the task (the multiple subtasks obtained from the split) and the three-level resource pool to which each subtask needs to be distributed.

[0121] Taking the use of a machine learning model to predict the distribution strategy for the current task as an example, the machine learning model can be trained in the following way.

[0122] Obtain training samples, which may include input and output data. Input data includes task information for the sample task, the task queue lengths corresponding to the M tertiary resource pools, task processing records for the M tertiary resource pools over the past hour (e.g., task queue status per minute for each tertiary resource pool, processing time for each task, and processing result for each task), and the weights of the M tertiary resource pools. Output data may include a first identifier for each of the M tertiary resource pools.

[0123] Initialize the machine learning model by inputting sample input data into the model to obtain a predicted output. The predicted output includes a predicted label. Calculate the loss value between the predicted label and the first label in the sample output data, and use the loss value to train the machine learning model until convergence. This enables the machine learning model to output labels for the three-level resource pool based on the input data, and the output labels can indicate the three-level resource pool that the current task needs to allocate.

[0124] Furthermore, the task generation status of virtual machines can be recorded to obtain the task generation curve of the primary resource pool, and the task processing status of hardware processing cores can be recorded to obtain the task processing curve of the tertiary resource pool. The loss between the task generation curve and the task processing curve is calculated, and a machine learning model is trained based on the loss. The distribution strategy output by the machine learning model is then guided to ensure that the task generation curve closely matches the task processing curve.

[0125] For example, after initial training of the machine learning model based on training samples, the machine learning model is used to process virtual machine task distribution. The total number of tasks generated by all virtual machines per minute within a preset time period is recorded to obtain a task generation curve. For example, the task generation curve may include: N virtual machines generated a total of 100 tasks in the first minute, 50 tasks in the second minute, 80 tasks in the third minute, and so on. The total number of tasks processed by all hardware processing cores per minute within a preset time period is recorded to obtain a task processing curve. For example, the task processing curve may include: M hardware processing cores processed a total of 200 tasks in the first minute, 10 tasks in the second minute, 80 tasks in the third minute, and so on. The loss between the task generation curve and the task processing curve is calculated, and the machine learning model is trained based on the loss until convergence. Optionally, the loss value of the number of tasks at the same moment on the task generation curve and the task processing curve is calculated, and the machine learning model is trained based on the loss value until convergence. In an optional embodiment, the loss based on training samples and the loss based on the task generation curve and the task processing curve can be used alternately to train the machine learning model.

[0126] In one alternative embodiment, the host machine can prioritize the distribution of the highest priority task in the secondary resource pool to at least one tertiary resource pool based on the priority of the tasks in the secondary resource pool.

[0127] For tasks stored in the secondary resource pool, the host machine can also select higher-priority tasks for priority distribution to ensure that high-priority tasks are processed first.

[0128] Step 230: Based on the target processing core, process the tasks stored in the third-level resource pool corresponding to the target processing core.

[0129] For example, the target processing core can be any one or more hardware processing cores. A hardware processing core can process tasks in its corresponding three-level resource pool sequentially. Optionally, multiple hardware processing cores can run simultaneously, processing tasks in their respective three-level resource pools at the same time, thereby improving the operating efficiency of the hardware processing cores.

[0130] In summary, the method provided in this application provides a three-level resource pool structure. The first-level resource pool stores tasks generated by the virtual machine, the second-level resource pool stores tasks read from the first-level resource pool by the host machine, and the third-level resource pool stores tasks to be processed by the hardware processing cores. Specifically, there is at least one first-level resource pool, with each virtual machine having its own corresponding first-level resource pool; there is one second-level resource pool; and there is at least one third-level resource pool, with each hardware processing core having its own corresponding third-level resource pool. During virtual machine task processing, the virtual machine can store generated tasks to be processed in its own first-level resource pool. Both the virtual machine and the host machine can read and write data to the first-level resource pool. The host machine reads tasks generated by the virtual machine from the first-level resource pool and places them into the second-level resource pool. Subsequently, the host machine can distribute the tasks stored in the second-level resource pool to the third-level resource pool for processing by the corresponding hardware processing cores. This three-level resource pool structure enables asynchronous communication and interaction between virtual machine task submission, host machine task scheduling, and hardware processing core task processing, reducing the waiting time for task submission, scheduling, and processing, improving system throughput and hardware utilization, and optimizing virtual machine task processing efficiency.

[0131] The method provided in this application, by constructing a three-level resource pool (guest task pool → host scheduling pool → hardware processing core pool) and employing an asynchronous communication mechanism, effectively eliminates the synchronous waiting links between guest and host or host and hardware scheduling in related technologies, fundamentally avoiding hardware processing core idling. This allows the physical codec core to run at almost full load continuously, significantly improving hardware resource utilization and reducing hardware idle time.

[0132] The method provided in this application establishes a task pool for each virtual machine on the guest side, and performs unified asynchronous capture and priority scheduling on the host side. The tasks are then distributed to multiple hardware processing core pools, enabling the system to dynamically respond to multiple guest and multiple task inputs, thereby expanding the system's throughput. This achieves higher task throughput in scenarios with multiple guests, multiple video streams, and multi-core encoding / decoding hardware concurrency.

[0133] The method provided in this application employs a non-blocking read / write / asynchronous queue approach for tasks between the guest pool and the host pool, and between the host pool and the hardware pool. The host is only responsible for task dispatching and does not block or wait for hardware or guest status, thereby reducing scheduling overhead. Through the asynchronous pooling mechanism, I / O blocking or task waiting links between the guest and the host, and between the host and the hardware pool, are effectively reduced, thereby improving overall processing efficiency.

[0134] The method provided in this application introduces a scheduling mechanism in the host-side resource pool. Based on the guest pool status and the number of tasks in the hardware processing core pool (e.g., the number of idle hardware units, queue depth), it evaluates the optimal allocation target and prioritizes assignment to the currently most idle core pool. By monitoring the load status of the hardware processing core pool, task queue depth, and guest task pool status in real time, tasks can be dynamically allocated to the most idle or most suitable hardware processing core, thereby improving resource utilization and response speed.

[0135] The method provided in this application decouples the communication and task dispatch mechanisms between the guest, host, and hardware processing core pools. The host scheduler acts only as a bridge for task dispatch and does not need to wait synchronously, thus making the scheduling overhead grow more slowly with the expansion of the system. After adopting a three-level resource pool structure and asynchronous mechanism, it can better adapt to scenarios with a significant increase in the number of guests, task streams, and hardware processing cores, achieving scalability without significantly increasing the scheduling bottleneck.

[0136] The method provided in this application establishes a guest task pool interface in the host-side resource pool and supports a priority / weight mechanism. The host scheduler can allocate resources based on the guest task pool status and weight strategy, thereby achieving fair or preferential resource allocation. In virtualized multi-user scenarios, it can allocate hardware resources to different guests more fairly, improving the perceived quality of service for users.

[0137] For example, a secondary resource pool is used to cache tasks from at least one primary resource pool.

[0138] Figure 5 A flowchart of a virtual machine task processing method provided in an exemplary embodiment of this application is shown, in which the method is applied... Figure 1 The computer devices shown are illustrated as examples, based on Figure 2 In the illustrated embodiment, step 210 includes step 212, and / or step 220 includes step 222.

[0139] Step 212: Read tasks from at least one primary resource pool and cache them in the secondary resource pool according to the order of the primary resource pools.

[0140] The secondary resource pool is used as a buffer queue to cache tasks generated by at least one virtual machine and distributes the cached tasks to the tertiary resource pool in sequence.

[0141] For example, the secondary resource pool may not have scheduling capabilities. The host machine can read tasks sequentially from multiple primary resource pools in a round-robin manner and cache them at the tail of the buffer queue of the secondary resource pool. At the same time, the host machine also distributes the tasks at the head of the buffer queue to multiple tertiary resource pools in a round-robin manner.

[0142] Step 222: Distribute the cached tasks in the secondary resource pool to at least one tertiary resource pool in the order of at least one tertiary resource pool.

[0143] Step 230: Based on the target processing core, process the tasks stored in the third-level resource pool corresponding to the target processing core.

[0144] In summary, the method provided in this application provides a three-level resource pool structure. The first-level resource pool stores tasks generated by the virtual machine, the second-level resource pool stores tasks read from the first-level resource pool by the host machine, and the third-level resource pool stores tasks to be processed by the hardware processing cores. Specifically, there is at least one first-level resource pool, with each virtual machine having its own corresponding first-level resource pool; there is one second-level resource pool; and there is at least one third-level resource pool, with each hardware processing core having its own corresponding third-level resource pool. During virtual machine task processing, the virtual machine can store generated tasks to be processed in its own first-level resource pool. Both the virtual machine and the host machine can read and write data to the first-level resource pool. The host machine reads tasks generated by the virtual machine from the first-level resource pool and places them into the second-level resource pool. Subsequently, the host machine can distribute the tasks stored in the second-level resource pool to the third-level resource pool for processing by the corresponding hardware processing cores. This three-level resource pool structure enables asynchronous communication and interaction between virtual machine task submission, host machine task scheduling, and hardware processing core task processing, reducing the waiting time for task submission, scheduling, and processing, improving system throughput and hardware utilization, and optimizing virtual machine task processing efficiency.

[0145] The method provided in this application sets up a buffer queue between the primary resource pool and the tertiary resource pool, enabling virtual machines and hardware processing cores to asynchronously perform task distribution and task processing. This effectively reduces I / O blocking or task waiting between the virtual machine and the host machine and between the host machine and the hardware processing core, thereby improving overall processing efficiency.

[0146] In one optional embodiment, this application re-divides virtualization scheduling into a three-tiered resource pool. From top to bottom, these are the virtual machine (guest) layer, the host machine's unified scheduling layer, and the hardware encoding / decoding core's task layer. The three-tiered resource pool aims to pool potentially blocking processes at each stage of the virtualization chain, increasing throughput asynchronously and resolving congestion issues at each stage.

[0147] First, there's the primary resource pool, which resides within the guest virtual machine (VM). Each VM has encoding and decoding tasks, and there may be multi-channel scenarios, such as simultaneously playing two or more videos or encoding data from two screens. These tasks are initially placed in the guest's primary resource pool. This pool is shared with the host (server); the guest can read and write to it, and the host can also read and write through a special channel. Each VM has its own primary resource pool, as well as the port and capabilities for communication with the host.

[0148] The secondary resource pool resides on the host side. The host is responsible for direct communication with all guests, making its role crucial. Decisions regarding guest task scheduling and encoding / decoding power allocation are made on the host side. The secondary resource pool acts as a bridge between guests and the hardware processing core. Software strategies such as weight allocation, priority adjustment, and load balancing control can be implemented within the secondary resource pool. Taking the simplest perfect average scheduling algorithm as an example, assuming there are 20 guests, numbered 1-20, this means there are 20 primary resource pools. The secondary resource pool scheduler can retrieve data from these 20 primary resource pools. Perfect average scheduling involves first retrieving tasks from the first primary resource pool, then from the second, and so on, from 1 to 20. The retrieved tasks are initially stored in the secondary resource pool and then distributed to the tertiary resource pools.

[0149] The three-level resource pool is an abstraction of the hardware processing cores. Assuming there are 3 decoders and 3 encoders, each decoder / encoder will have its own three-level resource pool, resulting in a total of 6 three-level resource pools: 3 decoding pools and 3 encoding pools. The two-level resource pools distribute tasks from the first-level resource pools to the three-level resource pools. The distribution strategy can be to prioritize tasks to the least busy hardware processing cores. For example, if there is a decoding task to process, and the three three-level resource pools have 30 tasks in pool 1, 20 tasks in pool 2, and 40 tasks in pool 3, then the new task will be distributed to pool 2. Here, it is assumed that all tasks require the same hardware processing time.

[0150] The three-level resource pool solves the problem of low hardware utilization and inability to fully utilize hardware in related technologies. Methods in related technologies suffer from low I / O (input / output) efficiency of guest data flow to hardware and hardware idleness due to inefficient software scheduling. These problems are addressed in the three-level resource pool solution. The first-level and second-level resource pools communicate asynchronously, as do the second-level and third-level resource pools. Notifications after task completion (notifications sent to the guest or host) are asynchronous and efficient. Because the second-level resource pool merely forwards tasks, the time required to process tasks is orders of magnitude lower than the data generation speed of the first-level resource pool and the actual task processing speed of the third-level resource pool. This indirectly achieves the effect of multiple guests sharing multiple encoding / decoding hardware, maximizing throughput and saturating hardware utilization.

[0151] Assume that the computer equipment has N virtual machines in its operating environment, each capable of initiating M concurrent video encoding and decoding tasks; the host is equipped with P physical encoder cores and Q physical decoder cores.

[0152] Step 1: Each guest initializes its primary resource pool (guest task pool), which is used to collect the encoding and decoding tasks generated by the guest (e.g., video A playback, video B encoding, screen C transcoding). This primary resource pool can be read by the host.

[0153] Step 2: The host initializes the secondary resource pool (host Scheduler Pool), which is responsible for communicating with the primary resource pools of all guests, task fetching, job sorting, weight / priority allocation, load monitoring, etc.

[0154] Step 3: The host asynchronously retrieves tasks from the first-level resource pool of each guest and distributes the tasks to the third-level resource pool according to a preset strategy (e.g., priority of the least idle hardware, priority of the longest task waiting time).

[0155] Step 4: The three-level resource pool (HardwareCodecPools) consists of multiple encoder core pools and decoder core pools. The host assigns tasks to the most suitable three-level resource pool and starts hardware execution. After the task is completed, the hardware asynchronously returns the completion status to the host or guest through a dedicated channel.

[0156] Step 5: After the task is completed, the host or guest updates the resource pool status (such as the number of idle resources in the third-level resource pool, the length of the task queue, etc.) based on the completion status and load data, and can trigger the assignment of new tasks or the rescheduling of guest tasks.

[0157] By following the steps above, the data flow from guest initiation → guest pool → host pool → hardware pool is designed as a three-level asynchronous resource pool, effectively avoiding problems such as IO blocking, task queuing, and hardware idleness.

[0158] In summary, the method provided in this embodiment ensures that the hardware encoding / decoding core runs at almost full load continuously, achieving higher resource utilization. Multiple guests can submit tasks concurrently, significantly improving system throughput and enabling faster encoding / decoding processing in virtualized scenarios. The task flow adopts an asynchronous pooling structure, reducing the synchronous waiting time between guest, host, and hardware, and improving I / O channel efficiency. The secondary resource pool on the host side has a dynamic scheduling strategy (weight, priority, hardware status feedback), which can adjust task allocation according to real-time system load, effectively improving system scalability and load balancing capabilities.

[0159] The method provided in this embodiment adopts a three-level resource pool structure, designing the guest layer, host layer, and hardware encoding / decoding core layer as independent resource pools and connecting them through an asynchronous mechanism, which is different from the two-level structure in related technologies.

[0160] The method provided in this embodiment uses asynchronous pooling of task flows. The guest task submission, host scheduling, and hardware execution are communicated / interacted asynchronously, which reduces synchronous waiting and improves system throughput and hardware utilization.

[0161] The method provided in this embodiment adopts a dynamic resource scheduling strategy. The host layer allocates tasks to the most idle hardware processing core pool based on real-time data such as the length of the guest pool queue, the load of the hardware processing core pool, and the historical task completion status, thereby optimizing resource utilization.

[0162] The method provided in this embodiment employs a high-concurrency multi-user support mechanism, achieving 100% continuous utilization of hardware processing cores in concurrent scenarios involving multiple guests, multiple video streams, and multiple hardware processing cores. It utilizes a channel-sharing guest-host communication mechanism, where each guest pool shares a channel with the host, enabling bidirectional access / read / write of data between the guest task pool and the host resource pool, thus improving scheduling efficiency.

[0163] Figure 6 This application shows a structural block diagram of a virtual machine task processing apparatus provided in an exemplary embodiment. The apparatus is used to implement a computer device, the computer device including at least one hardware processing core; the apparatus includes: The reading module 1001 is used to read tasks from the primary resource pools corresponding to at least one virtual machine and store them in the secondary resource pools corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, wherein the target virtual machine is any one of the at least one virtual machine, and the at least one virtual machine shares the resources of the host machine; Distribution module 1002 is used to distribute the tasks stored in the secondary resource pool to the tertiary resource pools corresponding to the at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, wherein the target processing core is any one of the at least one hardware processing core; The processing module 1003 is used to process the tasks stored in the third-level resource pool corresponding to the target processing core, based on the target processing core.

[0164] In an optional embodiment, the reading module 1001 is configured to read tasks from at least one primary resource pool according to the first resource information and store them in the secondary resource pool; The first resource information includes at least one of the following: the order of the at least one primary resource pool, the task queue length of the at least one primary resource pool, the weight of the at least one primary resource pool, and the priority of the tasks in the at least one primary resource pool.

[0165] In an optional embodiment, the reading module 1001 is configured to sequentially read tasks from the at least one primary resource pool and store them in the secondary resource pool according to the arrangement order of the at least one primary resource pool; or Based on the task queue length of the at least one primary resource pool, tasks from the primary resource pool with the longest task queue are preferentially read and stored in the secondary resource pool; or Based on the weights of the at least one primary resource pool, tasks from the primary resource pool with the highest weight are read first and stored in the secondary resource pool; or Based on the priority of tasks in the at least one primary resource pool, the task with the highest priority is read from the at least one primary resource pool and stored in the secondary resource pool.

[0166] In an optional embodiment, the reading module 1001 is configured to determine the task score of each task in the at least one primary resource pool based on the task queue length of the at least one primary resource pool, the weight of the at least one primary resource pool, and the priority of the tasks in the at least one primary resource pool, and preferentially read the task with the highest task score from the at least one primary resource pool and store it in the secondary resource pool; or The resource pool score of each primary resource pool is determined based on the task queue length of the at least one primary resource pool and the weight of the at least one primary resource pool. Tasks are preferentially read from the primary resource pool with the highest resource pool score and stored in the secondary resource pool.

[0167] In an optional embodiment, the reading module 1001 is used to preferentially read the highest priority task from the primary resource pool with the highest resource pool score and store it in the secondary resource pool.

[0168] In an optional embodiment, the distribution module 1002 is configured to distribute the tasks stored in the secondary resource pool to the at least one tertiary resource pool based on the second resource information, the task type of the tasks stored in the secondary resource pool, and the core type of the at least one hardware processing core. The second resource information includes any one of the following: the order of the at least one tertiary resource pool, the task queue length of the at least one tertiary resource pool, the weight of the at least one tertiary resource pool, the priority of tasks in the secondary resource pool, the historical task completion status of the at least one tertiary resource pool, and the load status of the at least one hardware processing core.

[0169] In an optional embodiment, the distribution module 1002 is configured to filter at least one candidate tertiary resource pool from the at least one tertiary resource pool based on the task type of the tasks stored in the secondary resource pool and the core type of the at least one hardware processing core. The distribution module 1002 is used to distribute the tasks stored in the secondary resource pool to the at least one candidate tertiary resource pool according to the second resource information.

[0170] In an optional embodiment, the distribution module 1002 is configured to, for any task stored in the secondary resource pool, if the task type is an encoding task, select at least one first processing core with the core type of encoder from the at least one hardware processing core. The distribution module 1002 is used to determine the third-level resource pool corresponding to the at least one first processing core as a candidate third-level resource pool.

[0171] In an optional embodiment, the distribution module 1002 is configured to, for any task stored in the secondary resource pool, if the task type of the task is a decoding task, select at least one second processing core with core type of decoder from the at least one hardware processing core. The distribution module 1002 is used to determine the third-level resource pool corresponding to the at least one second processing core as a candidate third-level resource pool.

[0172] In an optional embodiment, the distribution module 1002 is configured to determine the third-level resource pool to be distributed from the at least one candidate third-level resource pool based on the second resource information. The distribution module 1002 is used to distribute the task to the three-level resource pool to be distributed.

[0173] In an optional embodiment, the distribution module 1002 is configured to determine the candidate tertiary resource pool that appears first in the order of the at least one candidate tertiary resource pools as the tertiary resource pool to be distributed; or Based on the task queue length of the at least one candidate tertiary resource pool, the candidate tertiary resource pool with the shortest task queue is determined as the tertiary resource pool to be distributed; or Based on the weights of the at least one candidate tertiary resource pool, the candidate tertiary resource pool with the highest weight is determined as the tertiary resource pool to be distributed; or Based on the load status of the hardware processing cores corresponding to the at least one candidate tertiary resource pool, the candidate tertiary resource pool corresponding to the hardware processing core with the lowest load is determined as the tertiary resource pool to be distributed.

[0174] In an optional embodiment, the distribution module 1002 is used to call a machine learning model to process the second resource information, the task type of the tasks stored in the secondary resource pool, and the core type of the at least one hardware processing core to obtain a distribution strategy for the tasks in the secondary resource pool. The distribution module 1002 is used to distribute the tasks stored in the secondary resource pool to the at least one tertiary resource pool according to the distribution strategy.

[0175] In an optional embodiment, the device further includes: The notification module 1004 is used to send asynchronous result notifications to the host machine and the virtual machine corresponding to the task for any task stored in the three-level resource pool corresponding to the target processing core, based on the target processing core. The asynchronous result notifications are used to provide feedback on the processing result of the task.

[0176] Figure 7 A structural block diagram of an electronic device 800 provided in an exemplary embodiment of this application is shown. Optionally, the electronic device 800 is used to execute the virtual machine task processing method provided in the embodiments of this application.

[0177] Optionally, the electronic device can be a portable mobile terminal, such as a smartphone, tablet, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop, or desktop computer. The electronic device 800 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names. Typically, the electronic device 800 includes a processor 801 and a memory 802.

[0178] Processor 801 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 801 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0179] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices.

[0180] In some embodiments, the electronic device 800 may optionally include: a peripheral device interface 803 and at least one peripheral device. Those skilled in the art will understand that... Figure 7 The structure shown does not constitute a limitation on the electronic device 800, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0181] Figure 8 The diagram illustrates the structure of a server 900 provided in an exemplary embodiment of this application. The server 900 includes multiple processors 901. The server 900 is used to execute the virtual machine task processing method provided in the embodiments of this application.

[0182] This application also provides a computing cluster, which includes multiple servers, at least one of which is used to execute the virtual machine task processing method provided in the embodiments of this application.

[0183] This application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the virtual machine task processing method provided in the above method embodiments.

[0184] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the virtual machine task processing method provided in the above-described method embodiments.

[0185] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0186] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0187] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A virtual machine task processing method, characterized in that, The method is performed by a computer device, the computer device including at least one hardware processing core; the method includes: Tasks are read from the primary resource pools corresponding to at least one virtual machine and stored in the secondary resource pool corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, wherein the target virtual machine is any one of the at least one virtual machines, and the at least one virtual machine shares the resources of the host machine; The tasks stored in the secondary resource pool are distributed to the tertiary resource pools corresponding to the at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, wherein the target processing core is any one of the at least one hardware processing core. Based on the target processing core, the tasks stored in the three-level resource pool corresponding to the target processing core are processed.

2. The method according to claim 1, characterized in that, The step of reading tasks from the primary resource pools corresponding to at least one virtual machine and storing them in the secondary resource pool corresponding to the host machine includes: Tasks are read from at least one primary resource pool according to the first resource information and stored in the secondary resource pool; The first resource information includes at least one of the following: the order of the at least one primary resource pool, the task queue length of the at least one primary resource pool, the weight of the at least one primary resource pool, and the priority of the tasks in the at least one primary resource pool.

3. The method according to claim 2, characterized in that, The step of reading tasks from at least one primary resource pool according to the first resource information and storing them in the secondary resource pool includes: Tasks are sequentially read from the at least one primary resource pool and stored in the secondary resource pool according to the arrangement order of the at least one primary resource pool; or Based on the task queue length of the at least one primary resource pool, tasks from the primary resource pool with the longest task queue are preferentially read and stored in the secondary resource pool; or Based on the weights of the at least one primary resource pool, tasks from the primary resource pool with the highest weight are read first and stored in the secondary resource pool; or Based on the priority of tasks in the at least one primary resource pool, the task with the highest priority is read from the at least one primary resource pool and stored in the secondary resource pool.

4. The method according to claim 2, characterized in that, The step of reading tasks from at least one primary resource pool according to the first resource information and storing them in the secondary resource pool includes: Based on the task queue length of the at least one primary resource pool, the weight of the at least one primary resource pool, and the priority of the tasks in the at least one primary resource pool, determine the task score of each task in the at least one primary resource pool, and preferentially read the task with the highest task score from the at least one primary resource pool and store it in the secondary resource pool; or The resource pool score of each primary resource pool is determined based on the task queue length of the at least one primary resource pool and the weight of the at least one primary resource pool. Tasks are preferentially read from the primary resource pool with the highest resource pool score and stored in the secondary resource pool.

5. The method according to claim 4, characterized in that, The step of prioritizing reading tasks from the primary resource pool with the highest resource pool score and storing them in the secondary resource pool includes: The highest priority task is read from the first-level resource pool with the highest resource pool score and stored in the second-level resource pool.

6. The method according to any one of claims 1 to 5, characterized in that, The step of distributing the tasks stored in the secondary resource pool to the tertiary resource pools corresponding to the at least one hardware processing core includes: Based on the second resource information, the task type of the tasks stored in the second-level resource pool, and the core type of the at least one hardware processing core, the tasks stored in the second-level resource pool are distributed to the at least one third-level resource pool; The second resource information includes any one of the following: the order of the at least one tertiary resource pool, the task queue length of the at least one tertiary resource pool, the weight of the at least one tertiary resource pool, the priority of tasks in the secondary resource pool, the historical task completion status of the at least one tertiary resource pool, and the load status of the at least one hardware processing core.

7. The method according to claim 6, characterized in that, The step of distributing tasks stored in the secondary resource pool to the at least one tertiary resource pool based on the second resource information, the task type of the tasks stored in the secondary resource pool, and the core type of the at least one hardware processing core includes: Based on the task type of the tasks stored in the secondary resource pool and the core type of the at least one hardware processing core, at least one candidate tertiary resource pool is selected from the at least one tertiary resource pool. Based on the second resource information, the tasks stored in the secondary resource pool are distributed to the at least one candidate tertiary resource pool.

8. The method according to claim 7, characterized in that, The step of selecting at least one candidate tertiary resource pool from the at least one tertiary resource pool based on the task type of the tasks stored in the secondary resource pool and the core type of the at least one hardware processing core includes: For any task stored in the secondary resource pool, if the task type is an encoding task, at least one first processing core with the core type of encoder is selected from the at least one hardware processing core. The three-level resource pool corresponding to the at least one first processing core is determined as a candidate three-level resource pool.

9. The method according to claim 7, characterized in that, The step of selecting at least one candidate tertiary resource pool from the at least one tertiary resource pool based on the task type of the tasks stored in the secondary resource pool and the core type of the at least one hardware processing core includes: For any task stored in the secondary resource pool, if the task type is a decoding task, at least one second processing core with the core type of decoder is selected from the at least one hardware processing core. The tertiary resource pool corresponding to the at least one second processing core is identified as a candidate tertiary resource pool.

10. The method according to claim 8 or 9, characterized in that, The step of distributing tasks stored in the secondary resource pool to the at least one candidate tertiary resource pool based on the second resource information includes: Based on the second resource information, a third-level resource pool to be distributed is determined from the at least one candidate third-level resource pool; The task is distributed to the third-level resource pool to be distributed.

11. The method according to claim 10, characterized in that, The step of determining the tertiary resource pool to be distributed from the at least one candidate tertiary resource pool based on the second resource information includes: Based on the order of the at least one candidate tertiary resource pools, the candidate tertiary resource pool that appears first in the order is determined as the tertiary resource pool to be distributed; or Based on the task queue length of the at least one candidate tertiary resource pool, the candidate tertiary resource pool with the shortest task queue is determined as the tertiary resource pool to be distributed; or Based on the weights of the at least one candidate tertiary resource pool, the candidate tertiary resource pool with the highest weight is determined as the tertiary resource pool to be distributed; or Based on the load status of the hardware processing cores corresponding to the at least one candidate tertiary resource pool, the candidate tertiary resource pool corresponding to the hardware processing core with the lowest load is determined as the tertiary resource pool to be distributed.

12. The method according to claim 6, characterized in that, The step of distributing tasks stored in the secondary resource pool to the at least one tertiary resource pool based on the second resource information, the task type of the tasks stored in the secondary resource pool, and the core type of the at least one hardware processing core includes: The machine learning model is invoked to process the second resource information, the task type of the tasks stored in the secondary resource pool, and the core type of the at least one hardware processing core to obtain the task distribution strategy in the secondary resource pool. The tasks stored in the secondary resource pool are distributed to the at least one tertiary resource pool according to the distribution strategy.

13. The method according to any one of claims 1 to 12, characterized in that, After processing the tasks stored in the third-level resource pool corresponding to the target processing core, the method further includes: For any task stored in the three-level resource pool corresponding to the target processing core, asynchronous result notifications are sent to the host machine and the virtual machine corresponding to the task based on the target processing core. The asynchronous result notifications are used to provide feedback on the processing result of the task.

14. A virtual machine task processing device, characterized in that, Applied to a computer device, the computer device including at least one hardware processing core; the device includes: The reading module is used to read tasks from the primary resource pools corresponding to at least one virtual machine and store them in the secondary resource pools corresponding to the host machine; the primary resource pool corresponding to the target virtual machine is used to store the tasks generated by the target virtual machine, wherein the target virtual machine is any one of the at least one virtual machine, and the at least one virtual machine shares the resources of the host machine; The distribution module is used to distribute the tasks stored in the secondary resource pool to the tertiary resource pools corresponding to the at least one hardware processing core; the tertiary resource pool corresponding to the target processing core is used to store the tasks to be processed by the target processing core, wherein the target processing core is any one of the at least one hardware processing core; The processing module is used to process the tasks stored in the third-level resource pool corresponding to the target processing core, based on the target processing core.

15. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the virtual machine task processing method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is loaded and executed by a processor to implement the virtual machine task processing method as described in any one of claims 1 to 13.

17. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, wherein a processor retrieves the computer instructions from the computer-readable storage medium, causing the processor to load and execute them to implement the virtual machine task processing method as described in any one of claims 1 to 13.