A task processing method and device based on multi-core system

By dividing the CPU core into a collection domain of business cores and control cores, and binding the business processing tasks to the business cores, the problem of insufficient business processing capabilities in a symmetric multi-processing system is solved, efficient business processing in asymmetric multi-processing state is achieved, and system performance is improved.

CN112306669BActive Publication Date: 2025-04-11ZTE CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201910714824.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-02
Publication Date
2025-04-11
Estimated Expiration
2039-08-02

AI Technical Summary

Technical Problem

In a symmetric multi-processing system, how to improve service processing capabilities, prevent system jitter and interference, and meet the needs of business processing tasks with high real-time performance and large data volume.

Method used

By dividing the CPU core into a business core collection domain and a control core collection domain, the business processing tasks are bound to the business core, and the business core handles the business processing tasks. In a symmetric multiprocessing system, dynamically switch to asymmetric multiprocessing state on business logic, so that business processing tasks completely exclusively operate the business core and avoid bottlenecks caused by system jitter.

Benefits of technology

In a symmetric multiprocessing system, dynamic smooth switching to asymmetric multiprocessing state is realized, ensuring that business processing tasks exclusively operate the service core, improving business processing performance, and avoiding the negative impact of system jitter on performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112306669B_ABST
    Figure CN112306669B_ABST
Patent Text Reader

Abstract

The present invention proposes a task processing method and device based on a multi-core system, the method comprising: dividing the CPU core into a business core set domain and a control core set domain; binding the business processing task to the business core in the business core set domain, and having the business core process the business processing task. According to the task processing method based on a multi-core system of the present invention, by dividing the CPU into a business core set domain and a control core set domain, binding the business processing task to the business core, and having the business core process the business processing task, in a symmetric multi-processing system, it can dynamically and smoothly switch to an asymmetric multi-processing state in the business logic, so that the business processing task completely exclusively runs the business core, and will not cause bottlenecks due to system jitter, thereby affecting business performance and indicators, thereby making full use of the single-core CPU processing power of the business core and improving business processing performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task processing method and device based on a multi-core system. Background Art

[0002] With the development of multi-core CPU systems, especially in the embedded field, the system has an increasing demand for completing business processing tasks with high real-time performance and large data volumes in addition to completing basic functions such as system management and control. For such complex systems with different processing tasks, it is particularly important for multi-core CPUs to coordinate with each other to prevent system jitter and interference to improve business processing performance. Summary of the invention

[0003] The technical problem to be solved by the present invention is how to improve the business processing capability in a symmetric multi-processing system. The present invention provides a task processing method and device based on a multi-core system.

[0004] A task processing method based on a multi-core system according to an embodiment of the present invention includes:

[0005] Divide the CPU core into a business core set domain and a control core set domain;

[0006] The business processing task is bound to the business core in the business core set domain, and the business processing task is processed by the business core.

[0007] According to the task processing method based on a multi-core system in an embodiment of the present invention, the business processing tasks are bound to the business cores by dividing the CPU into a business core set domain and a control core set domain. The business processing tasks are processed by the business cores. In a symmetric multi-processing system, it can dynamically and smoothly switch to an asymmetric multi-processing state in business logic, so that the business processing tasks completely exclusively run on the business cores, and will not cause bottlenecks due to system jitters, thereby affecting business performance and indicators. Therefore, the single-core CPU processing capability of the business core can be fully utilized, thereby improving business processing performance.

[0008] According to some embodiments of the present invention, dividing the CPU core into a service core set domain and a control core set domain includes:

[0009] Make all CPU cores online;

[0010] Selecting some CPU cores from all CPU cores as control cores to form the control core set domain;

[0011] The remaining CPU cores are used as service cores, and the service cores are processed offline and then online to form the service core set domain.

[0012] In some embodiments of the present invention, the method further comprises:

[0013] When all CPU cores are online, tasks are assigned to all CPU cores for processing;

[0014] After the business core goes offline, the tasks in the business core are migrated to the control core.

[0015] According to some embodiments of the present invention, the method further comprises:

[0016] Before the service core goes online again, the clock interrupt of the service core is enabled, and an online notification is sent to the operating system.

[0017] In some embodiments of the present invention, the method further comprises:

[0018] After the service processing task is bound to the service core in the service core set domain, the clock interrupt of the service core is disabled.

[0019] According to some embodiments of the present invention, the method further comprises:

[0020] Running a system call proxy task on the control core;

[0021] By means of shared memory, the service core makes a system call according to the running result of the system call proxy task running on the control core.

[0022] In some embodiments of the present invention, the method of enabling the service core to perform a system call according to the system call proxy task by means of a shared memory queue includes:

[0023] Allocating the shared memory, wherein the shared memory includes a system call descriptor;

[0024] Writing system call parameter information when the service core makes a system call into the descriptor, and modifying the descriptor state to being in request;

[0025] The control core searches for the descriptor in the request state, and executes a system call based on the system call parameter information in the descriptor.

[0026] A task processing device based on a multi-core system according to an embodiment of the present invention includes:

[0027] A partitioning module, used to partition the CPU core into a business core set domain and a control core set domain;

[0028] The task processing module is used to bind the business processing task to the business core in the business core set domain, so that the business processing task is processed by the business core.

[0029] According to the task processing device based on a multi-core system according to an embodiment of the present invention, in a symmetric multi-processing system, it is possible to dynamically and smoothly switch to an asymmetric multi-processing state in terms of business logic, so that the business processing tasks completely exclusively run on the business cores, and no bottleneck will be caused by system jitter, thereby affecting business performance and indicators.

[0030] According to an electronic device of an embodiment of the present invention, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the task processing method based on the multi-core system as described above are implemented.

[0031] According to the electronic device of the embodiment of the present invention, by executing the task processing method based on the multi-core system proposed in the present invention, in the symmetric multi-processing system, it can dynamically and smoothly switch to the asymmetric multi-processing state in the business logic, so that the business processing tasks completely exclusively run on the business core, and will not cause bottlenecks due to system jitters, affecting business performance and indicators.

[0032] According to the computer storage medium of the embodiment of the present invention, a computer program is stored on the computer storage medium, and when the computer program is executed by a processor, the steps of the task processing method based on a multi-core system as described above are implemented.

[0033] According to the computer storage medium of the embodiment of the present invention, by executing the task processing method based on a multi-core system proposed in the present invention, in a symmetric multi-processing system, it can dynamically and smoothly switch to an asymmetric multi-processing state in business logic, so that the business processing tasks completely exclusively run on the business core, thereby making full use of the single-core CPU processing power, and will not cause bottlenecks due to system jitters, affecting business performance and indicators. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a schematic diagram comparing the existing symmetrical pair processing system and the asymmetrical multi-processing system;

[0035] Figure 2 is a schematic diagram of the structure of a task processing device based on a multi-core system according to an embodiment of the present invention;

[0036] Figure 3 is a flow chart of a task processing method based on a multi-core system according to an embodiment of the present invention;

[0037] Figure 4 is a flow chart of a method for dividing into a service core set domain and a control core set domain according to an embodiment of the present invention;

[0038] Figure 5 is a schematic diagram of CPU core logic state transition according to an embodiment of the present invention;

[0039] Figure 6 is a schematic diagram of a layout of a system call proxy using a shared memory according to an embodiment of the present invention;

[0040] Figure 7 1. It is a schematic diagram of a system call proxy process performed by a service core and a control core according to an embodiment of the present invention;

[0041] Figure 8 It is a flow chart of a communication equipment management and forwarding integrated system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose, the present invention is described in detail below in conjunction with the accompanying drawings and preferred embodiments.

[0043] In the traditional method, there are two solutions for processing different tasks: asymmetric multi-processing architecture (AMP) and symmetric multi-processing architecture (SMP). Their characteristics are as follows: Figure 1 shown.

[0044] Among them, in the AMP solution, each CPU core handles different tasks or even runs a system independently, and the CPU cores will not affect each other. However, this system is highly complex and business program development and migration are difficult, so it is rarely used in systems that process complex tasks.

[0045] The SMP approach is widely used, with the characteristic that each CPU core shares the processing and runs a single copy of the operating system. Tasks are fairly scheduled among multiple CPU cores, and the load is balanced.

[0046] In a symmetric multi-processing system, in order to complete business processing tasks with high real-time performance and large data volumes, the approach adopted in related technologies is to reduce system jitter through system optimization to meet processing performance. Its basic working method and principle are described as follows:

[0047] First, shut down unnecessary system service processes, then migrate common tasks running in the business core to other CPU cores, then migrate all interrupts to other non-business cores, then bind business processing tasks to the business CPU core for execution. Through these operation processes, the time for executing business processing programs on the business CPU core is as unaffected as possible.

[0048] The main disadvantages of the above method are: due to the inherent symmetrical processing characteristics of the SMP solution, it cannot completely solve the system jitter problem, especially for the application scenario where the CPU business core is dynamically isolated after startup for business binding. These optimization methods cannot achieve complete isolation. The business processing task is not only easily affected by the task process, timer, interrupt lower half program, etc. that have been bound to the CPU core before the CPU core where it is located, but also by the additional overhead caused by unnecessary system clock interrupt scheduling (traditional dynamic clock TICKLESS can only reduce it), and system calls are blocked due to competition. The business processing task cannot occupy 100% of the CPU core running the business processing, resulting in the business processing task being unable to meet the business processing performance, and even easily due to scheduling strategies and scheduling priority issues, reverse blocking and affecting the normal operation of management and control functions.

[0049] like Figure 3 As shown, a task processing method based on a multi-core system according to an embodiment of the present invention includes:

[0050] S101: Divide the CPU core into a service core set domain and a control core set domain;

[0051] Therefore, different tasks can be processed by CPU cores in different collection domains, thus improving business processing efficiency. Figure 2 As shown, in the symmetric multi-processing system, the control core in the control core set domain can be a CPU core for management control; the business core can be a CPU core for business processing. By placing the control core and the business core in different scheduling sets, the control core and the business core can be isolated from each other without affecting each other, thus realizing an asymmetric multi-processing system in business logic.

[0052] S102: Bind the business processing task to the business core in the business core set domain, and let the business core process the business processing task.

[0053] According to the task processing method based on a multi-core system in an embodiment of the present invention, the business processing tasks are bound to the business cores by dividing the CPU into a business core set domain and a control core set domain. The business processing tasks are processed by the business cores. In a symmetric multi-processing system, it can dynamically and smoothly switch to an asymmetric multi-processing state in business logic, so that the business processing tasks completely exclusively run on the business cores, and will not cause bottlenecks due to system jitters, thereby affecting business performance and indicators. Therefore, the single-core CPU processing capability of the business core can be fully utilized, thereby improving business processing performance.

[0054] According to some embodiments of the present invention, Figure 4 As shown, the CPU core is divided into a business core set domain and a control core set domain, including:

[0055] S201: Make all CPU cores online;

[0056] S202: Selecting some CPU cores from all CPU cores as control cores to form a control core set domain;

[0057] S203: Use the remaining CPU cores as service cores, and process the service cores offline and then online to form a service core set domain.

[0058] It should be noted that traditionally, there are two CPU core logical states: CPU_ONLINE and CPU_OFFLINE. Figure 5 As shown, the present invention proposes a new CPU core logical state CPU_ONLINE_EXCLUSIVE. By using CPU hot-swap technology, the service core can switch from the traditional state to the third logical state CPU_ONLINE_EXCLUSIVE by going offline and then online. Figure 5 As shown in FIG. 1 , after the introduction of this new state, the operating system divides the business core into a scheduling set domain that is completely different from the control core, and schedules them independently to avoid mutual influence, thereby achieving an asymmetric processing effect in business logic.

[0059] When dividing the business core set domain and the control core set domain, first all CPU cores can be online, and then some CPU cores are selected as business cores and processed offline and then online to form a business core set domain.

[0060] In some embodiments of the present invention, the method may further include:

[0061] When all CPU cores are online, tasks are assigned to all CPU cores for processing.

[0062] When the business core goes offline, the tasks in the business core are migrated to the control core.

[0063] According to some embodiments of the present invention, the method further includes: before the service core comes online again, enabling the clock interrupt of the service core, and sending an online notification to the operating system.

[0064] It should be noted that after all programs or services running on the business core are migrated to the control core, the operating environment of the business core has been cleaned up. Before the business core goes online again, the clock interrupt of the corresponding business core can be enabled, and a CPU preparation for business online notification can be sent to the operating system kernel.

[0065] In some embodiments of the present invention, the method further includes: after binding the service processing task to the service core in the service core set domain, disabling the clock interrupt of the service core. Thus, by disabling the clock interrupt used for scheduling on the service core, it is possible to avoid interrupting the service processing task, thereby further improving the service processing performance.

[0066] According to some embodiments of the present invention, the method may further include:

[0067] Run the system call proxy task on the control core;

[0068] By means of shared memory, the business core makes a system call according to the running result of the system call proxy task running on the control core.

[0069] It should be noted that when the clock interrupt on the business core is turned off, the business processing task directly entering the system call will be blocked by resource competition such as semaphores and spin locks. Therefore, business processing tasks should try to avoid using system calls, but some scenarios cannot be avoided, such as obtaining time, reading and writing files, etc. In order to solve this problem, Figure 6 and Figure 7 As shown, the present invention proposes a system call proxy method, which runs the system call proxy task on the control core in advance, and does not directly call the system call on the business core. Instead, it notifies the proxy task to complete it indirectly through shared memory, thereby avoiding system performance loss caused by system blocking and context switching on the business core.

[0070] Among them, by means of a shared memory queue, the business core makes a system call according to the system call proxy task, including:

[0071] Allocate shared memory, which includes system call descriptors. Figure 6 As shown, two blocks of shared memory accessible to both the control core and the business core can be pre-allocated, one of which is used to represent a set of system call descriptors. Each descriptor contains fields such as status, system call number, parameters, and results. Each descriptor character has the same length, is continuous in the address space, and is organized in a ring manner.

[0072] Write the system call parameter information when the business core makes a system call into the descriptor, and change the descriptor status to "in request". When the business core makes a system call, first obtain the write pointer position in the description ring. After legal judgment, if the parameter requires a large block of memory, first apply for a block of memory from the parameter memory pool, fill the system call number and parameter or parameter memory address into the descriptor, and further change the descriptor status to "in request". Wait in a loop for the descriptor status to change to "execution completed", take out the result, and release the parameter memory pool.

[0073] The control core searches for the descriptor in the request state and executes the system call based on the system call parameter information in the descriptor. Figure 7 As shown, the control core starts the system call proxy task and sets it to a higher priority. This task continuously polls the descriptor status at the read pointer position in the descriptor ring until the status is changed to requesting. Further, the status is first modified to executing, and then the system call number and parameters are taken out to execute the system call. After parsing and executing, if the parameters require a large block of memory to save the result, it is applied from the parameter memory pool and the result is copied to the parameter memory. Further, the status is modified to execution completed. The read pointer is increased by 1, and the next descriptor is taken.

[0074] Combination Figure 4 and Figure 5 As shown in FIG. 1 , the specific steps of dividing the CPU core into the control core and the business core include:

[0075] Step 1: After the CPU is initialized, it enters the CPU_ONLINE logical state. In this state, the CPU checks all tasks in parallel and symmetrically, with fair scheduling and load balancing.

[0076] Step 2: Based on the above steps, send the service core offline preparation notification to the operating system kernel, and migrate all programs or services running in the service core to the control core, including management control tasks, timers, work queues, interrupts, and interrupt lower half programs. When the migration operation is completed, the CPU logic state of the service core changes to the CPU_OFFLINE state. In this state, the service core is powered off and offline.

[0077] Step 3: Based on the above steps, the operating environment of the business core has been cleaned up. Further, the clock interrupt of the corresponding business core is turned on, and the CPU is sent to the operating system kernel to wake up the business core and change the CPU logical state of the business core to CPU_ONLINE_EXCLUSIVE. In this state, the business core is in an independent scheduling collection domain, and the process scheduler starts execution in a completely different way from the control core. The running queue is empty, no tasks are executed, and no work queues, timers, and other interrupted lower-half programs are executed.

[0078] Step 4: Based on the above steps, the clock interrupt of the business core has been turned on and its scheduler starts running. At this time, the business processing task is started and bound to the corresponding business core for operation.

[0079] Through the above steps, the business core is in the CPU_ONLINE_EXCLUSIVE logical state set, and the control core is in the CPU_ONLINE logical state set. The two enter different scheduling set domains. The control core runs common management control, work queues, timers, interrupts, and interrupt lower half tasks, while the business core runs business processing tasks independently. Different tasks will not be load balanced between the control core and the business core: the business core will not actively pull up tasks in the control core task queue, and the control core scheduler cannot put tasks into the task scheduling queue of the business core.

[0080] Step 5: Optionally, based on step 4, the business processing task has been running. To further improve the business processing performance, choose to turn off the clock interrupt used for scheduling on the business core to prevent it from interrupting the business processing task.

[0081] Step 6: Optionally, based on step 4, a system call proxy task is pre-run on the control core. The business processing task running on the business core does not directly call the system call, but notifies the proxy task to complete it indirectly through a shared memory queue, thereby avoiding system performance loss caused by system blocking and context switching of the business core.

[0082] A task processing device based on a multi-core system according to an embodiment of the present invention includes: a partitioning module and a task processing module.

[0083] Specifically, the partitioning module can be used to partition the CPU core into a business core set domain and a control core set domain.

[0084] Therefore, different tasks can be processed by CPU cores in different collection domains, thus improving business processing efficiency. Figure 2 As shown, in the symmetric multi-processing system, the control core in the control core set domain can be a CPU core for management control; the business core can be a CPU core for business processing. By placing the control core and the business core in different scheduling sets, the control core and the business core can be isolated from each other without affecting each other, thus realizing an asymmetric multi-processing system in business logic.

[0085] The task processing module is used to bind the business processing tasks to the business cores in the business core set domain, and the business processing tasks are processed by the business cores.

[0086] According to the task processing device based on a multi-core system according to an embodiment of the present invention, in a symmetric multi-processing system, it is possible to dynamically and smoothly switch to an asymmetric multi-processing state in terms of business logic, so that the business processing tasks completely exclusively run on the business cores, and no bottleneck will be caused by system jitter, thereby affecting business performance and indicators.

[0087] According to some embodiments of the present invention, the partitioning module is specifically used for:

[0088] Make all CPU cores online;

[0089] Select some CPU cores from all CPU cores as control cores to form a control core set domain;

[0090] The remaining CPU cores are used as business cores, and the business cores are processed offline and then online to form a business core set domain.

[0091] It should be noted that, by using CPU hot-swap technology, the business core can switch from the traditional state to the third logical state CPU_ONLINE_EXCLUSIVE by going offline and then online. Figure 5 As shown in FIG. 1 , after the introduction of this new state, the operating system divides the business core into a scheduling set domain that is completely different from the control core, and schedules them independently to avoid mutual influence, thereby achieving an asymmetric processing effect in business logic.

[0092] When dividing the business core set domain and the control core set domain, first all CPU cores can be online, and then some CPU cores are selected as business cores and processed offline and then online to form a business core set domain.

[0093] In some embodiments of the present invention, the task processing module is further used to:

[0094] When all CPU cores are online, tasks are assigned to all CPU cores for processing;

[0095] After the business core goes offline, the tasks in the business core are migrated to the control core.

[0096] According to some embodiments of the present invention, the device further comprises: a control module. The control module is used to enable the clock interrupt of the service core before the service core comes online again, and send an online notification to the operating system.

[0097] It should be noted that after all programs or services running on the business core are migrated to the control core, the operating environment of the business core has been cleaned up. Before the business core goes online again, the clock interrupt of the corresponding business core can be enabled, and a CPU preparation for business online notification can be sent to the operating system kernel.

[0098] In some embodiments of the present invention, the control module is further used to: after binding the service processing task to the service core in the service core set domain, turn off the clock interrupt of the service core. Thus, by turning off the clock interrupt used for scheduling on the service core, it can be avoided that it interrupts the service processing task, thereby further improving the service processing performance.

[0099] According to some embodiments of the present invention, the apparatus may further include: a system call proxy module, the system call proxy module being used to run a system call proxy task on the control core;

[0100] By means of shared memory, the business core makes a system call according to the running result of the system call proxy task running on the control core.

[0101] It should be noted that when the clock interrupt on the business core is turned off, the business processing task directly entering the system call will be blocked by resource competition such as semaphores and spin locks. Therefore, business processing tasks should try to avoid using system calls, but some scenarios cannot be avoided, such as obtaining time, reading and writing files, etc. In order to solve this problem, Figure 6 and Figure 7 As shown, the present invention proposes a system call proxy method, which runs the system call proxy task on the control core in advance, and does not directly call the system call on the business core. Instead, it notifies the proxy task to complete it indirectly through shared memory, thereby avoiding system performance loss caused by system blocking and context switching on the business core.

[0102] Among them, the system call proxy module can be specifically used for:

[0103] Allocate shared memory, which includes system call descriptors. Figure 6 As shown, two blocks of shared memory accessible to both the control core and the business core can be pre-allocated, one of which is used to represent a set of system call descriptors. Each descriptor contains fields such as status, system call number, parameters, and results. Each descriptor character has the same length, is continuous in the address space, and is organized in a ring manner.

[0104] Write the system call parameter information when the business core makes a system call into the descriptor, and change the descriptor status to "in request". When the business core makes a system call, first obtain the write pointer position in the description ring. After legal judgment, if the parameter requires a large block of memory, first apply for a block of memory from the parameter memory pool, fill the system call number and parameter or parameter memory address into the descriptor, and further change the descriptor status to "in request". Wait in a loop for the descriptor status to change to "execution completed", take out the result, and release the parameter memory pool.

[0105] The control core searches for the descriptor in the request state and executes the system call based on the system call parameter information in the descriptor. Figure 7As shown, the control core starts the system call proxy task and sets it to a higher priority. This task continuously polls the descriptor status at the read pointer position in the descriptor ring until the status is changed to requesting. Further, the status is first modified to executing, and then the system call number and parameters are taken out to execute the system call. After parsing and executing, if the parameters require a large block of memory to save the result, it is applied from the parameter memory pool and the result is copied to the parameter memory. Further, the status is modified to execution completed. The read pointer is increased by 1, and the next descriptor is taken.

[0106] Combination Figure 4 and Figure 5 As shown in FIG. 1 , the specific steps of dividing the CPU core into the control core and the business core include:

[0107] Step 1: After the CPU is initialized, it enters the CPU_ONLINE logical state. In this state, the CPU checks all tasks for symmetrical parallel processing, fair scheduling, and load balancing.

[0108] Step 2: Based on the above steps, send the service core offline preparation notification to the operating system kernel, and migrate all programs or services running in the service core to the control core, including management control tasks, timers, work queues, interrupts, and interrupt lower half programs. When the migration operation is completed, the CPU logic state of the service core changes to the CPU_OFFLINE state. In this state, the service core is powered off and offline.

[0109] Step 3: Based on the above steps, the operating environment of the business core has been cleaned up. Further, the clock interrupt of the corresponding business core is turned on, and the CPU is sent to the operating system kernel to wake up the business core and change the CPU logical state of the business core to CPU_ONLINE_EXCLUSIVE. In this state, the business core is in an independent scheduling collection domain, and the process scheduler starts execution in a completely different way from the control core. The running queue is empty, no tasks are executed, and no work queues, timers, and other interrupted lower-half programs are executed.

[0110] Step 4: Based on the above steps, the clock interrupt of the business core has been turned on and its scheduler starts running. At this time, the business processing task is started and bound to the corresponding business core for operation.

[0111] Through the above steps, the business core is in the CPU_ONLINE_EXCLUSIVE logical state set, and the control core is in the CPU_ONLINE logical state set. The two enter different scheduling set domains. The control core runs common management control, work queues, timers, interrupts, and interrupt lower half tasks, while the business core runs business processing tasks independently. Different tasks will not be load balanced between the control core and the business core: the business core will not actively pull up tasks in the control core task queue, and the control core scheduler cannot put tasks into the task scheduling queue of the business core.

[0112] Step 5: Optionally, based on step 4, the business processing task has been running. To further improve the business processing performance, choose to turn off the clock interrupt used for scheduling on the business core to prevent it from interrupting the business processing task.

[0113] Step 6: Optionally, based on step 4, a system call proxy task is pre-run on the control core. The business processing task running on the business core does not directly call the system call, but notifies the proxy task to complete it indirectly through a shared memory queue, thereby avoiding system performance loss caused by system blocking and context switching of the business core.

[0114] The following describes in detail an implementation method of introducing a new CPU core logic state to perform asymmetric multi-processing scheduling in service logic according to an embodiment of the present invention with a specific embodiment:

[0115] Step 1: Add a new CPU_ONLINE_EXCLUSIVE collection. This collection uses a CPU bitmap to represent the CPU cores in this logical state. The BIT position represents the CPU core index. A value of 1 indicates that the CPU core is in the logical state, and a value of 0 indicates that it is not in this logical state. The initial state of this collection is empty.

[0116] Step 2: The control core sends an offline notification to perform offline processing on one or more service cores. After the service core enters the CPU_OFFLINE logical state, the operating system removes the service core from the CPU_ONLINE set, that is, sets the bit representing the service core in the CPU bitmap representing the set from 1 to 0.

[0117] Step 3: The control core sends a service online notification. Before executing the wake-up action, one or more service cores are added to the CPU_ONLINE_EXCLUSIVE set, that is, the bit representing the service core in the CPU bitmap representing the set is set from 0 to 1.

[0118] Step 4: When the business core is awakened, it detects the CPU bitmap representing the CPU_ONLINE_EXCLUSIVE set. If its bit is found to be 1, it will no longer be added to the CPU_ONLINE set.

[0119] Step 5: After the business core is awakened, the clock interrupt triggers task scheduling. Each time the scheduler runs, it detects the CPU bitmap representing the CPU_ONLINE_EXCLUSIVE set. When its BIT is found to be 1, it enters a different scheduling process.

[0120] Step 6: When the control core starts the business processing task and binds it to the business core, the legal condition is no longer just CPU_ONLINE, but the union of CPU_ONLINE and CPU_ONLINE_EXCLUSIVE.

[0121] Step 7: After the business core schedules and runs the business processing program, the clock interrupt is disabled.

[0122] The following describes in detail the implementation of the system call proxy according to an embodiment of the present invention with a specific embodiment:

[0123] Step 1: Pre-allocate two blocks of shared memory that can be accessed by both the control core and the business core: Figure 6 As shown in the figure, one block is used to represent the system call descriptor set. Each descriptor contains fields such as status, system call number, parameters, and results. Each descriptor has the same length, is continuous in the address space, and is organized in a ring. The other block is used as a parameter memory pool to store parameters larger than 8 bytes in system calls (such as file buf).

[0124] Step 2: If Figure 7 As shown, the control core starts the system call proxy task and sets it to a higher priority. This task continuously polls the descriptor status at the read pointer position in the descriptor ring until the status is changed to requesting. Further, the status is first modified to executing, and then the system call number and parameters are taken out to execute the system call. After parsing and executing, if the parameters require a large block of memory to save the result, it is applied from the parameter memory pool and the result is copied to the parameter memory. Further, the status is modified to execution completed. The read pointer is increased by 1, and the next descriptor is taken.

[0125] Step 3: When the business core makes a system call, it first obtains the write pointer position in the descriptor ring. After legal judgment, if the parameter requires a large block of memory, it first applies for a block of memory from the parameter memory pool, fills the system call number and parameters or parameter memory address into the descriptor, and further changes the descriptor status to requesting. It then loops and waits for the descriptor status to change to execution completed, retrieves the result, and releases the parameter memory pool.

[0126] The following describes in detail an implementation method of a multi-core system-based task processing method according to an embodiment of the present invention in a communication device management and forwarding board integrated system with a specific embodiment:

[0127] Step 1: Figure 8 As shown in the figure, after the system is powered on and the CPU completes normal initialization, the state is CPU_ONLINE, and all CPU cores complete the system version loading, process and service initialization and power on together. Different from the CPU core isolation at startup, the parallel execution of CPU cores greatly increases the power-on speed.

[0128] Step 2: Select and divide the control core for management and the service core for data packet forwarding, further disable the operating system interrupt load balancing management task, and further send a CPU offline preparation notification to the operating system kernel.

[0129] Step 3: Based on step 2, after receiving the above notification, the operating system will migrate the management process, common business process, kernel timer and work queue, interrupt and interrupt lower half program running in the business core to the control core. After completing the migration operation, the CPU logical state of the business core is changed to CPU_OFFLINE state.

[0130] Step 4: Based on step 3, enable the business core clock interrupt and change the CPU logic state to CPU_ONLINE_EXCLUSIVE.

[0131] Step 5: Based on step 4, start the packet sending and receiving task and bind it to the corresponding business core.

[0132] Step 6: Optionally, based on step 5, turn off the clock interrupt on the business core to reduce the time consumption caused by unnecessary system scheduling. At this time, the data forwarding task completely occupies the business core processing time and fully utilizes the CPU core performance.

[0133] Step 7: Optionally, based on step 5, run the system call proxy task on the control core.

[0134] The following describes in detail an implementation method of a multifunctional server system according to an embodiment of the present invention with a specific embodiment:

[0135] With the development of SDN and virtualization, the use of server architecture software to customize network control and computing nodes, and the deployment of OVS, OpenStack and other applications are becoming more and more widespread. The implementation method of the present invention in this application system is as follows:

[0136] Step 1: Install the kernel patch related to the present invention on the server operating system.

[0137] Step 2: Based on the number of CPU cores on the server and whether they are sufficient for business use, if the number of CPU cores is sufficient, the business CPU cores will be isolated during the system startup phase. Preferably, the startup parameter activation patch can fully utilize each CPU core before the business software runs.

[0138] Step 3: Power on the server, load the operating system and start related application services. Optionally, specify CPU cores and memory resources to start the corresponding virtual machine.

[0139] Step 4: Optionally, based on step 2, select a CPU core in the host machine or virtual machine for computing or soft forwarding interactive services, and perform the same steps 3 to 7 as in the above embodiment to dynamically isolate the service core and bind it to the service core for execution.

[0140] Step 5: Optionally, repeat the above steps to recycle the business core and reuse the control core.

[0141] According to an embodiment of the present invention, the electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the above method are implemented.

[0142] According to the electronic device of the embodiment of the present invention, by executing the task processing method based on the multi-core system proposed in the present invention, in the symmetric multi-processing system, it can dynamically and smoothly switch to the asymmetric multi-processing state in the business logic, so that the business processing tasks completely exclusively run on the business core, and will not cause bottlenecks due to system jitters, affecting business performance and indicators.

[0143] According to the computer storage medium of the embodiment of the present invention, a computer program is stored on the computer storage medium, and when the computer program is executed by the processor, the steps of the task processing method based on the multi-core system as described above are implemented.

[0144] According to the computer storage medium of the embodiment of the present invention, by executing the task processing method based on a multi-core system proposed in the present invention, in a symmetric multi-processing system, it can dynamically and smoothly switch to an asymmetric multi-processing state in business logic, so that the business processing tasks completely exclusively run on the business core, thereby making full use of the single-core CPU processing power, and will not cause bottlenecks due to system jitters, affecting business performance and indicators.

[0145] Through the description of the specific implementation methods, a deeper and more specific understanding of the technical means and effects adopted by the present invention to achieve the predetermined purpose should be obtained. However, the accompanying drawings are only for reference and illustration purposes and are not intended to limit the present invention.

Claims

1. A task processing method based on a multi-core system, characterized in that: include: Divide the CPU core into a business core set domain and a control core set domain; Binding a business processing task to a business core in the business core set domain, so that the business processing task is processed by the business core; The CPU cores are divided into a service core set domain and a control core set domain, including: Make all CPU cores online; Selecting some CPU cores from all CPU cores as control cores to form the control core set domain; The remaining CPU cores are used as service cores, and the service cores are processed offline and then online to form the service core set domain.

2. The task processing method based on a multi-core system according to claim 1, characterized in that: The method further comprises: When all CPU cores are online, tasks are assigned to all CPU cores for processing; After the business core goes offline, the tasks in the business core are migrated to the control core.

3. The task processing method based on a multi-core system according to claim 1, characterized in that: The method further comprises: Before the service core goes online again, the clock interrupt of the service core is enabled, and an online notification is sent to the operating system.

4. The task processing method based on a multi-core system according to claim 3, characterized in that: The method further comprises: After the service processing task is bound to the service core in the service core set domain, the clock interrupt of the service core is disabled.

5. The task processing method based on a multi-core system according to claim 1, characterized in that: The method further comprises: Running a system call proxy task on the control core; By means of shared memory, the service core makes a system call according to the running result of the system call proxy task running on the control core.

6. The task processing method based on a multi-core system according to claim 5, characterized in that: The method of enabling the service core to perform a system call according to the system call proxy task by means of a shared memory queue includes: Allocating the shared memory, wherein the shared memory includes a system call descriptor; Writing system call parameter information when the service core makes a system call into the descriptor, and modifying the descriptor state to being in request; The control core searches for the descriptor in the request state, and executes a system call based on the system call parameter information in the descriptor.

7. A task processing device based on a multi-core system, characterized in that: include: A partitioning module, used to partition the CPU core into a business core set domain and a control core set domain; A task processing module, used for binding a business processing task to a business core in the business core set domain, so that the business processing task is processed by the business core; The partitioning module is used for: Make all CPU cores online; Selecting some CPU cores from all CPU cores as control cores to form the control core set domain; The remaining CPU cores are used as service cores, and the service cores are processed offline and then online to form the service core set domain.

8. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by the processor.

9. A computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the task processing method based on a multi-core system as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Asymmetric multi-core system and realization method thereof

    CN102662740A

  • Slave core system call implementation method facing to isomerism many-core environment

    CN105468448A

  • Clock task processing method, device and facility

    CN105718320A