Multi-mode task processing method and deployment method under multi-core processor and electronic equipment

By dividing tasks into functional logic units in a multi-core processor and dynamically provisioning kernel wake-up, the problems of unbalanced task load and low communication efficiency are solved, and CPU performance optimization and communication efficiency are achieved.

CN120429098APending Publication Date: 2025-08-05DATANG MOBILE COMM EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410158874.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-04
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

In multi-core processors, unbalanced load of tasks leads to low CPU core utilization, frequent task switching and low communication efficiency.

Method used

By dividing tasks into multiple functional logic units, and dynamically provisioning task threads to wake up and deploy in the kernel according to the load of the business model, communication is performed using shared variables and shared memory to reduce communication between cores.

Benefits of technology

The CPU core load balancing is realized, the task switching overhead is reduced, and communication efficiency and performance utilization is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429098A_ABST
    Figure CN120429098A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a multi-mode task processing method, a deployment method and electronic equipment under a multi-core processor, and the method comprises the steps: a management unit of each business mode wakes up a task thread deployed in a core of the processor according to the business load of the business mode, the kernels to which the task threads awakened for different service modes belong are different; wherein each task thread comprises a plurality of specific function logic units; the same task thread is deployed in one or more kernels, and task threads of one or more business modes are deployed in the same kernel. The technical problems that in the multi-mode task processing process, loads of a CPU hard core are uneven, tasks are frequently switched, and communication efficiency is low can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a multi-mode task processing method, a deployment method, and an electronic device under a multi-core processor. Background Art

[0002] For communication systems with high real-time requirements, how to reasonably allocate tasks of different business models, maximize the rational use of hardware resources such as the CPU (Central Processing Unit), and achieve optimal system performance utilization has always been a research focus.

[0003] Currently, multiple tasks divided according to different functional logics are distributed on various CPU cores. Due to the dynamic changes in task execution time slices and task loads, the load on the CPU cores is uneven, with some CPU cores having high occupancy rates and some CPU cores having low occupancy rates.

[0004] In addition, there are many tasks in each business mode, which leads to huge overhead in switching between tasks. Since there is also a lot of message communication between tasks, frequent communication between cores is required to trigger the core inter-core terminals, resulting in low communication efficiency. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide a multi-mode task processing method, deployment method, and electronic device under a multi-core processor to solve the technical problems of uneven CPU core load, frequent task switching, and low communication efficiency during multi-mode task processing. The specific technical solution is as follows:

[0006] In a first aspect of the present application, a multi-mode task processing method in a multi-core processor is provided, the method comprising:

[0007] The management unit of each business mode wakes up the task thread deployed on the core of the processor according to the business load of the business mode. The task threads woken up for different business modes belong to different cores.

[0008] Each task thread contains multiple specific functional logic units; the same task thread is deployed in one or more cores, and the same core is deployed with task threads of one or more business modes.

[0009] Optionally, the functional logic units included in the task thread have priorities. The awakened task thread executes each of the functional logic units in sequence according to the priority from high to low, and after each execution of a functional logic unit, it determines whether the data queue of the functional logic unit with a higher priority is empty in sequence according to the priority from high to low. If not, it returns to execute the functional logic unit with the higher priority; if it is empty, it executes the functional logic of the next priority.

[0010] Optionally, also include:

[0011] The management unit of each business mode summarizes the execution time, execution time ratio and / or business volume of each functional logic unit reported by each task thread of the business mode, and calculates the average execution time, average execution time ratio, and / or average business volume of each functional logic unit.

[0012] Optionally, also include:

[0013] The management unit of each business mode evaluates the CPU resource occupancy ratio of each functional logic unit according to the average execution time, the average execution time ratio, and / or the average business volume.

[0014] Optionally, also include:

[0015] The management unit of each business mode summarizes the CPU load reported by each task thread of the business mode and calculates the average CPU load of each type of task thread. When the average CPU load of any type of task thread exceeds the threshold, at least one task thread of that type that is in dormant state in the business mode is awakened.

[0016] Optionally, the functions performed by the functional logic unit include: internal shared variable processing, inter-core message processing, network port packaged data reception and internal work queue processing.

[0017] Optionally, the business data of the task thread is obtained through external events, network messages or inter-core messages.

[0018] A second aspect of the present application provides a method for deploying multi-mode task threads in a multi-core processor, the method comprising:

[0019] Create a management process corresponding to each business mode; the management process of each business mode is used to create task threads under this business mode in different processor cores; each task thread contains multiple specific functional logic units; one or more task threads of business modes are deployed in the same core; the management process of each business mode is also used to wake up the task thread deployed in the core of the processor according to the business load of the business mode, wherein the task threads woken up for different business modes belong to different cores.

[0020] Optionally, each task process mounts a HOOK processing function of different priorities, and the HOOK processing function supports the following functions: internal shared variable processing, inter-core message processing, network port packaged data reception or internal work queue processing.

[0021] A third aspect of the present application provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0022] Memory for storing computer programs;

[0023] The processor is used to implement the method steps of multi-mode task processing under any of the above-mentioned multi-core processors when executing the program stored in the memory.

[0024] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps for implementing multi-mode task processing under any of the above-mentioned multi-core processors are implemented.

[0025] Beneficial effects of the embodiments of the present application:

[0026] In embodiments of the present application, a multi-mode task processing method, deployment method, and electronic device for a multi-core processor are provided. A management unit for each business mode awakens a task thread deployed on a processor core based on the business load of that business mode. Each task thread comprises multiple specific functional logic units. Task threads awakened for different business modes belong to different cores. The same task thread is deployed on one or more cores, and task threads for one or more business modes are deployed on the same core.

[0027] It can be seen that the task threads of multiple business modes can be spread across some or all of the CPU cores. The management units of multiple business modes control and coordinate to ensure that only one task thread is running on the same core at the same time. For each business mode, the core wake-up time is dynamically and flexibly adjusted according to the business load under this business mode, so that the CPU performance utilization is optimized and the problem of uneven load on different CPU cores will not occur.

[0028] In addition, the tasks of each business mode are divided into several functional logic units, which can be executed in a specific order, greatly reducing the overhead of task switching.

[0029] Because different task threads are scheduled and executed according to logical functional units, each functional logical unit resides within the same thread and can communicate and access each other through shared variables, shared memory, and shared work queues, eliminating the need for inter-core communication. This effectively avoids the system overhead of kernel-mode message queues and inter-core communication. Furthermore, the functional logical units of each task thread can share memory and a shared network data cache, effectively reducing memory copies between functional logical units and optimizing performance.

[0030] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0032] Figure 1 A flowchart of a multi-mode task processing method under a multi-core processor provided in an embodiment of the present application;

[0033] Figure 2 This is an example of the deployment of task threads in the kernel under different modes provided in the embodiments of the present application;

[0034] Figure 3 A schematic diagram of a task execution thread provided in an embodiment of the present application;

[0035] Figure 4 A flowchart of a method for deploying multi-mode task threads under a multi-core processor provided in an embodiment of the present application;

[0036] Figure 5 Another flowchart of a method for deploying multi-mode task threads on a multi-core processor provided in an embodiment of the present application;

[0037] Figure 6 A signaling interaction diagram of a method for processing multi-mode task threads in a multi-core processor provided in an embodiment of the present application;

[0038] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In the embodiments of this application, the term "and / or" describes the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0040] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.

[0041] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0042] The technical solution provided in the embodiment of the present application can be applicable to a variety of systems, especially 5G systems. For example, the applicable system can be a global system of mobile communication (GSM) system, a code division multiple access (CDMA) system, a wideband code division multiple access (WCDMA) general packet radio service (GPRS) system, a long term evolution (LTE) system, a LTE frequency division duplex (FDD) system, a LTE time division duplex (TDD) system, an advanced long term evolution (LTE-A) system, a universal mobile telecommunication system (UMTS), a world-wide interoperability for microwave access (WiMAX) system, a 5G new air interface (NR) system, etc. These various systems include terminal equipment and network equipment. The system may also include a core network part, such as an evolved packet system (EPS), a 5G system (5GS), etc.

[0043] Currently, multiple tasks divided according to different functional logics are distributed on various CPU cores. Due to the dynamic changes in task execution time slices and task loads, the load on the CPU cores is uneven, with some CPU cores having high occupancy rates and some CPU cores having low occupancy rates.

[0044] In addition, there are many tasks in each business mode, resulting in high overhead for switching between tasks; since there is also a lot of message communication between tasks, frequent communication between cores is required to trigger the inter-core terminals of the cores, resulting in low communication efficiency.

[0045] In order to solve the above problems, the present invention provides a multi-mode task processing method under a multi-core processor. Figure 1 , the method specifically comprises the following steps:

[0046] Step S101: The management unit of each business mode wakes up the task thread deployed on the core of the processor according to the business load of the business mode, and the task threads woken up for different business modes belong to different cores; each task thread contains multiple specific functional logic units; the same task thread is deployed in one or more cores, and the task threads of one or more business modes are deployed in the same core.

[0047] Specifically, the embodiments of this application are applicable to communication scenarios involving multiple business modes, that is, the business data to be processed involves multiple business modes. This application does not limit the basis for dividing business modes. For example, based on the network standard of the business data, it can be divided into 4G business mode, 5G business mode, etc.

[0048] In the embodiments of the present application, tasks to be processed in different business modes are organized into multiple functional logic units, which are executed within a single thread. Each functional logic unit is used to perform specific data processing and implement a specific function. Specifically, tasks executing a business mode are converted into data queues that sequentially execute specific functional logic units. These functional logic units are uniformly scheduled and executed by threads, and external inputs to the threads can include external events, messages, network packets, and so on. In the embodiments of the present application, these threads are defined as task threads.

[0049] In the embodiment of the present application, task threads are pre-deployed in the processor cores and automatically enter a dormant state after deployment, waiting to be awakened by the management unit. Each business mode corresponds to a management unit, which can be understood as a management process responsible for creating task threads in different cores and awakening the task threads deployed in the processor cores based on the business load under the business mode.

[0050] In the embodiment of the present application, the same task thread can be deployed in one or more cores, i.e., distributed deployment. In the same core, task threads for one or more business modes can be deployed. Specifically, taking the business mode including 4G business mode and 5G business mode as an example, in a core CORE of the CPU, task threads for 4G business mode and task threads for 5G business mode can be deployed at the same time.

[0051] The following is combined with Figure 2 The deployment of task threads in the kernel under different modes is illustrated by example. Figure 2In the example, 4g_manage represents the management unit of the 4g business mode, and 5g_manage represents the management unit of the 5g business mode, which are deployed in the cores CORE0 and CORE1 respectively. 4g worker1 represents the first task thread in the 4g business mode, and 4gworker2 represents the second task thread in the 4g business mode; 5g worker1 represents the first task thread in the 5g business mode, and 5gworker2 represents the second task thread in the 5g business mode. Figure 2 As shown in Figure 1, task threads are deployed in CORE 2 to CORE 17. It can be seen that task threads of different business models can be deployed in one core (CORE) at the same time, and the same task thread can also be deployed in different cores.

[0052] In the embodiment of the present application, the task threads of each business mode are initially in a dormant state, and the management unit dynamically starts and puts the task threads into dormancy according to the business load. The workflow and priority scheduling of the same task threads are the same, belonging to the multi-core shared working mode. At the same time, only one task thread can be executed in a CPU core, and other task threads of the core can be in a dormant or suspended state. In other words, the task thread of one business mode must first be dormant or suspended before the task thread of another business mode can be started.

[0053] In addition, in order to ensure high real-time performance and high performance, the core binding relationship of the task thread can be fixed in the initial stage, and the subsequent management unit only needs to control the startup and sleep of the task thread.

[0054] In the multi-core processor multi-mode task processing method provided in the embodiments of the present application, a management unit for each business mode awakens a task thread deployed on a processor core based on the business load of that business mode. Each task thread comprises multiple specific functional logic units; task threads awakened for different business modes belong to different cores. The same task thread is deployed on one or more cores, and task threads for one or more business modes are deployed on the same core.

[0055] It can be seen that the task threads of multiple business modes can be spread across some or all of the CPU cores. The management units of multiple business modes control and coordinate to ensure that only one task thread is running on the same core at the same time. For each business mode, the core wake-up time is dynamically and flexibly adjusted according to the business load under this business mode, so that the CPU performance utilization is optimized and the problem of uneven load on different CPU cores will not occur.

[0056] In addition, the tasks of each business model are divided into several functional logic units, which can be executed in a specific order. Different task threads run independently, and there is no message interaction or task switching between task threads, thereby saving a lot of resource overhead caused by task switching.

[0057] Because different task threads are scheduled and executed according to logical functional units, each functional logical unit resides within the same thread and can communicate and access each other through shared variables, shared memory, and shared work queues, eliminating the need for inter-core communication. This effectively avoids the system overhead of kernel-mode message queues and inter-core communication. Furthermore, the functional logical units of each task thread can share memory and a shared network data cache, effectively reducing memory copies between functional logical units and optimizing performance.

[0058] In one embodiment of the present application, the functional logic units included in the task thread have priorities. The awakened task thread executes each functional logic unit in sequence according to the priority from high to low. After each execution of a single functional logic unit, it determines whether the data queue of the functional logic unit with a higher priority is empty in sequence according to the priority from high to low. If it is not empty, it returns to execute the functional logic unit with the higher priority; if it is empty, it executes the functional logic unit with the next priority.

[0059] Specifically, different functional logic units perform different operations. Priorities can be set for each functional logic unit, and the data queues of these functional logic units are executed in order of priority. A data queue can be understood as the data to be processed by each functional logic unit. Specifically, if the data to be processed by functional logic unit a is data processed by functional logic unit b, then the data processed by functional logic unit b will be sent to functional logic unit a and added to the data queue of functional logic unit a.

[0060] During the execution of the task thread, the data queue of each functional logic unit is constantly updated. Specifically, during the execution process, each functional logic unit is executed in descending order of priority. After each execution of a single functional logic unit, the data queue of the highest-priority functional logic unit is checked to see if it is empty. If not, the execution returns to the highest-priority functional logic unit. If so, the data queue of the second-highest-priority functional logic unit is checked to see if it is empty. If not, the execution returns to the second-highest-priority functional logic unit, and so on. In other words, after each execution of a single functional logic unit, the data queue is traversed again in descending order of priority.

[0061] See also Figure 3 , Figure 3 A schematic diagram of a task execution thread provided in an embodiment of the present application, Figure 3, functional logic unit 1 to functional logic unit n are shown, where functional logic unit 1 has the highest priority, functional logic unit 2 has the second highest priority, and functional logic unit n has the lowest priority. Figure 3 Several loop processes are shown in the figure. Taking the first loop as an example, after executing the functional logic unit 1 with the highest priority, the functional logic unit 2 with the second highest priority is executed. Then, it is determined that the data queue of the functional logic unit 1 is not empty, and the execution of the functional logic unit 1 is continued.

[0062] It can be seen that the execution process of the task thread can be regarded as the process of cyclically executing each functional logic unit. The execution framework can be regarded as a cyclic execution framework. Through the cyclic execution method, it is ensured that the data queue of the high-priority functional logic unit will not be backlogged.

[0063] In one embodiment of the present application, the method also includes: the management unit of each business mode summarizes the execution time, execution time ratio and / or business volume of each functional logic unit reported by each task thread of the business mode, and calculates the average execution time, average execution time ratio, and / or average business volume of each functional logic unit.

[0064] Specifically, each task thread can count the execution time, execution time percentage, and executed business volume of each functional logic unit to monitor business load. As an example, the execution time of a functional logic unit = the time when the functional logic unit is exited - the time when the functional logic unit is started. Accordingly, the total execution time of a task thread = the sum of the execution times of functional logic units of all priorities. The execution time percentage of a single functional logic unit can then be calculated as (functional logic unit execution time / total task thread execution time) * 100%.

[0065] Each task thread reports the execution time and execution time percentage of each functional logic unit to the management unit, which aggregates these data to calculate the average execution time, average execution time percentage, and / or average workload for each functional logic unit. Furthermore, based on the average execution time, average execution time percentage, and / or average workload of each functional logic unit, the CPU resource utilization ratio of each functional logic unit can be assessed.

[0066] Specifically, the CPU load ratio represents the proportion of CPU resources occupied by each functional logic unit during the execution of a task thread. As an example, the CPU resource utilization ratio of each functional logic unit is calculated by performing a weighted operation based on the execution time ratio and the average business volume ratio, respectively, using the first weight and the second weight.

[0067] Administrators can use the CPU resource usage ratio to determine whether the execution of each functional logic unit is reasonable. For example, if a functional logic unit occupies too high a proportion of CPU resources in the execution of a task thread, it may be because there are too many redundant functions set in the program of the functional logic unit.

[0068] It is worth noting that, in the embodiment of the present application, there is no limitation on how to judge whether the execution of each functional logic unit is reasonable based on the CPU resource occupancy ratio, and the judgment can be made by the management personnel based on the business characteristics.

[0069] As can be seen, in the embodiment of the present application, since the tasks are divided into threads composed of multiple functional logic units, the management unit can effectively monitor and control the running time of the logic units. Specifically, statistics are collected on the execution status of each functional logic unit during the execution of the same task thread under this business model, providing a basis for analyzing the rationality of each functional logic unit. For example, for functional logic units with a relatively large execution time, manual intervention can be performed to test the functional logic unit separately to find the reason for the large execution time so as to optimize it.

[0070] In one embodiment of the present application, the management unit of each business mode summarizes the CPU loads reported by each task thread of the business mode, and calculates the average CPU load of each type of task thread. When the average CPU load of any type of task thread exceeds a threshold, at least one task thread of that type that is in a dormant state under the business mode is awakened.

[0071] In an embodiment of the present application, each task thread runs in a CPU core. If the average CPU load of a certain type of task thread is high and exceeds a preset threshold, it means that the business volume corresponding to the task thread of this type is large, and the currently awakened CPU core can no longer meet the business processing requirements. A new CPU core is needed to participate in the processing, that is, to wake up at least one task thread of this type that is in a dormant state under this business mode, and divert the business data to the new task thread to achieve load sharing and alleviate the CPU load.

[0072] It should be noted that when the management unit of this business mode decides to start a task thread on a certain CPU core, it needs to inform the management units of other business modes of the label of the CPU core to verify whether there is a conflict. If there is no conflict, start the task thread of the CPU core.

[0073] As can be seen, in the embodiments of the present application, multiple task threads can be deployed in each business mode, and the same task thread can be distributed across different cores. This allows the load of the CPU core running each task thread to be calculated. When the load is high, it indicates that the CPU core currently awakened and running the task thread can no longer meet the processing requirements of the business volume, and the CPU core where the task thread is deployed is awakened and runs the task thread. That is, for each task thread in different business modes, the number of awakened CPU cores can be flexibly adjusted based on the corresponding business volume.

[0074] In one embodiment of the present application, the functions performed by the functional logic unit include: internal shared variable processing, inter-core message processing, network port packaged data reception and internal work queue processing.

[0075] In the embodiments of the present application, each functional logic unit uses a vector scheduling framework when batch processing messages or Ethernet data frames. This means that network frames are batch processed and executed by the same functional unit, which can improve performance. The purpose of the functional logic unit batch processing network frames is to reduce the depth of nested function calls and scalar frame processing. This allows for vector processing of network data frames, further optimizing the miss rate of the CPU's I-cache (Instruction Cache) and D-cache (Data Cache), improving network frame processing efficiency, and enabling high-speed forwarding processing on the network data plane.

[0076] See also Figure 4 , the embodiment of the present application also provides a method for deploying multi-mode task threads under a multi-core processor, the method comprising the following steps:

[0077] S401: Create a management process corresponding to each business mode; the management process of each business mode is used to create task threads under the business mode in different processor cores; each task thread contains multiple specific functional logic units; one or more task threads of business modes are deployed in the same core; the management process of each business mode is also used to wake up the task thread deployed in the core of the processor according to the business load of the business mode, wherein the task threads woken up for different business modes belong to different cores.

[0078] Specifically, a corresponding management process is created for each business mode, with management processes for different business modes occupying different processor cores. By executing each business mode's management process, task threads for that business mode are created on different processor cores. After creation, the task threads automatically enter a dormant state. Task threads belonging to different business modes can be created on the same core.

[0079] It can be seen that in the embodiment of the present application, the deployment method of multi-mode task threads under the above-mentioned multi-core processor is adopted, and the task threads of multiple business modes can be all spread on part or all of the CPU cores. The management units of multiple business modes control and coordinate to ensure that only one task thread is running on the same core at the same time. For each business mode, the wake-up time of the core is dynamically and flexibly adjusted according to the business load under this business mode, so that the performance utilization of the CPU is optimized, and the problem of uneven load on different cores of the CPU will not occur.

[0080] In addition, the tasks of each business mode are divided into several functional logic units, which can be executed in a specific order, greatly reducing the overhead of task switching.

[0081] Because different task threads are scheduled and executed according to logical functional units, each functional logical unit resides within the same thread and can communicate and access each other through shared variables, shared memory, and shared work queues, eliminating the need for inter-core communication. This effectively avoids the system overhead of kernel-mode message queues and inter-core communication. Furthermore, the functional logical units of each task thread can share memory and a shared network data cache, effectively reducing memory copies between functional logical units and optimizing performance.

[0082] In one embodiment of the present application, each task process mounts a HOOK processing function of different priorities, and the HOOK processing function supports the following functions: internal shared variable processing, inter-core message processing, network port packaged data reception or internal work queue processing.

[0083] Specifically, when creating a task process, you can create and mount HOOK processing functions of different LEVEL levels according to a predefined plan, where the LEVEL level can represent the priority. A HOOK function is a function that is called when a specific event occurs, and is used to perform certain operations before or after the event occurs. The HOOK function is registered as a callback function in the event handler. When an event occurs, the event handler will automatically call the corresponding HOOK function. Among them, one or a group of HOOK processing functions can correspond to a functional logic unit, that is, perform a specific data processing function.

[0084] The following combination Figure 5 , taking the 4G business model and the 5G business model as examples, the deployment method of multi-mode task threads under multi-core processors is further explained. Figure 5 As shown, the steps include two branches, namely S501a-S504a and S501b-S504b, and the steps of the two branches can be executed synchronously.

[0085] S501a: Start the 5G management process.

[0086] S502a: The 5G management process creates N task threads, occupying cores core0-coreN.

[0087] S503a: Each task thread creates and mounts different levels of HOOK processing functions. Each level can support high and low priorities. Each priority level provides internal shared variables, inter-core message processing, network port packaged data reception, internal work queue processing and other functions.

[0088] S504a: The task thread is started and automatically enters the waiting semaphore state, waiting for the 5G management process to schedule.

[0089] Correspondingly, S501b: start the 4G management process.

[0090] S502b: The 4G management process creates N task threads, occupying cores core0 to coreN.

[0091] S503b: Each task thread creates and mounts different levels of HOOK processing functions. Each level can support high and low priorities. Each priority level provides internal shared variables, inter-core message processing, network port packaged data reception, internal work queue processing and other functions.

[0092] S504b: The task thread is started and automatically enters the waiting semaphore state, waiting for scheduling by the 4G management process.

[0093] It can be seen that for scenarios with multiple business modes and multi-core processing, a management process is first created for each business mode. The management process of each business mode is equivalent to a management unit, which can create multiple task processes distributed on different CPU cores and dynamically and flexibly adjust the wake-up time of the task processes in the core according to the business load of the business model, thereby improving the CPU performance utilization and avoiding the problem of uneven load on different CPU cores.

[0094] The following combination Figure 6 , taking the 4G business mode and the 5G business mode as examples, the processing method of multi-mode task threads under multi-core processors is further explained. Figure 6 As shown, the following steps are included:

[0095] Step S61: The 4G management unit and the 5G management unit respectively estimate the number of task threads that need to be started and awakened according to the cell service specifications.

[0096] In the initial stage, each 4G worker (task thread under the 4G business mode) and each 5G worker (task thread under the 5G business mode) is in a dormant state.

[0097] Step S62: The COER numbers assigned by the 4G manager and the 5G manager are verified to be free of conflict.

[0098] Specifically, it is necessary to interact with the CPU core numbers occupied by the task threads to be started under the two business modes. In the initial state, one business mode allocates task threads from front to back according to the core numbers, and the other business mode allocates task threads from back to front according to the core numbers. The initial state ensures that there is no conflict in the CPU core numbers occupied by both parties.

[0099] Step S63: The 4G management unit and the 5G management unit wake up the task threads respectively and start execution.

[0100] The 4G and 5G management units each activate their own task threads for execution, with each task thread running independently. When multiple task threads of the same type are activated, they share the service load according to the pre-configured multi-core balancing rules for each task thread. This means that service traffic is distributed across multiple task threads for load balancing.

[0101] Step S64: Each task thread executes the functional logic unit in descending order of priority.

[0102] When each functional logic unit processes messages or Ethernet data frames in batches, a vector scheduling framework is used, that is, network frames are processed in batches and executed on the same functional unit to improve performance.

[0103] Step S65: The 4G management unit and the 5G management unit respectively summarize the CPU loads reported by all started task threads, calculate the average CPU load of each task thread, and when the load reaches the threshold, additional task threads need to be started.

[0104] When the average CPU load of any task thread reaches a threshold, for example, above 85%, additional task threads need to be started.

[0105] Before starting, the CPU core number of the task thread to be started needs to interact with another management unit. If both sides verify that there is no conflict, the management unit will assign load sharing rules to the task thread to be started and wake up the task thread, that is, start executing the task thread.

[0106] Step S66: If the verification of the CPU core numbers exchanged between the management units fails, an alarm indicating that the service load is too high is reported to the management station.

[0107] If the interactive CPU core number verification fails, it proves that there is a conflict in the use of the CPU core, and the new task thread cannot be awakened. At this time, an alarm of excessive business load is reported to the management station.

[0108] It can be seen that the task threads of multiple business modes can be spread across some or all of the CPU cores. The management units of multiple business modes control and coordinate to ensure that only one task thread is running on the same core at the same time. For each business mode, the core wake-up time is dynamically and flexibly adjusted according to the business load under this business mode, so that the CPU performance utilization is optimized and the problem of uneven load on different CPU cores will not occur.

[0109] In addition, the tasks of each business mode are divided into several functional logic units, which can be executed in a specific order, greatly reducing the overhead of task switching.

[0110] Because different task threads are scheduled and executed according to logical functional units, each functional logical unit resides within the same thread and can communicate and access each other through shared variables, shared memory, and shared work queues, eliminating the need for inter-core communication. This effectively avoids the system overhead of kernel-mode message queues and inter-core communication. Furthermore, the functional logical units of each task thread can share memory and a shared network data cache, effectively reducing memory copies between functional logical units and optimizing performance.

[0111] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0112] Memory 703, used for storing computer programs;

[0113] The processor 701 is configured to execute the program stored in the memory 703, and implement the following steps:

[0114] The management unit of each business mode wakes up the task thread deployed on the core of the processor according to the business load of the business mode. The task threads woken up for different business modes belong to different cores.

[0115] Each task thread contains multiple specific functional logic units; the same task thread is deployed in one or more cores, and the same core is deployed with task threads of one or more business modes.

[0116] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0117] The communication interface is used for communication between the above electronic device and other devices.

[0118] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0119] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0120] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, the steps of the multi-mode task processing method under any of the above-mentioned multi-core processors are implemented.

[0121] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the multi-mode task processing method under any multi-core processor in the above embodiments.

[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0123] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0124] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.

[0125] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.

Claims

1. A multi-mode task processing method under a multi-core processor, characterized in that: The method comprises: The management unit of each business mode wakes up the task thread deployed on the core of the processor according to the business load of the business mode. The task threads woken up for different business modes belong to different cores. Each task thread contains multiple specific functional logic units; the same task thread is deployed in one or more cores, and the same core has task threads of one or more business modes deployed.

2. The method according to claim 1, characterized in that The functional logic units included in the task thread have priorities. The awakened task thread executes each functional logic unit in order from high to low priority. After each execution of a functional logic unit, the task thread determines whether the data queue of the functional logic unit with a higher priority is empty in order from high to low priority. If not, the task thread returns to execute the functional logic unit with the higher priority. If it is empty, the function logic of the next priority level will be executed.

3. The method according to claim 1, characterized in that Also includes: The management unit of each business mode summarizes the execution time, execution time ratio and / or business volume of each functional logic unit reported by each task thread of the business mode, and calculates the average execution time, average execution time ratio, and / or average business volume of each functional logic unit.

4. The method according to claim 3, characterized in that Also includes: The management unit of each business mode evaluates the CPU resource occupancy ratio of each functional logic unit according to the average execution time, the average execution time ratio, and / or the average business volume.

5. The method according to claim 1, characterized in that Also includes: The management unit of each business mode summarizes the CPU load reported by each task thread of the business mode and calculates the average CPU load of each type of task thread. When the average CPU load of any type of task thread exceeds the threshold, at least one task thread of that type that is in dormant state in the business mode is awakened.

6. The method according to any one of claims 1 to 5, characterized in that The functions performed by the functional logic unit include: internal shared variable processing, inter-core message processing, network port packaged data reception and internal work queue processing.

7. The method according to any one of claims 1 to 5, characterized in that The business data of the task thread is obtained through external events, network messages or inter-core messages.

8. A method for deploying multi-mode task threads under a multi-core processor, characterized in that: The method comprises: Create a management process corresponding to each business mode; the management process of each business mode is used to create task threads under this business mode in different processor cores; each task thread contains multiple specific functional logic units; one or more task threads of business modes are deployed in the same core; the management process of each business mode is also used to wake up the task thread deployed in the core of the processor according to the business load of the business mode, wherein the task threads woken up for different business modes belong to different cores.

9. The method according to claim 8, characterized in that Each of the task processes mounts a HOOK processing function of different priorities, and the HOOK processing function supports the following functions: internal shared variable processing, inter-core message processing, network port packaged data reception or internal work queue processing.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1-7 or 8-9 when executing a program stored in a memory.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1-7 or 8-9 are implemented.