Computing resource allocation method, system and equipment for multi-core system and medium
By partitioning and retaining computing resources in a multi-core system and scheduling according to business occupancy, the stability problem caused by the dispersion of computing resources is solved, and the stability and low complexity of the multi-core system are achieved.
Patent Information
- Application Number
- CN202410181097.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2025-07-22
AI Technical Summary
In multi-core systems, fluctuations in the computing resource occupancy rate of the business lead to dispersion of computing resources, affecting the stability and complexity of the system, and making it difficult to maintain.
Divide the reserved computing resources of a specified size, monitor the computing resource occupancy rate of each service, and schedule overload services to run in the reserved computing resources to avoid mutual interference between the computing resources.
It improves the stability of the multi-core system, prevents business jitter caused by excessive computing resource occupancy, and reduces system complexity.
Smart Images

Figure CN120353568A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer operating systems, and particularly relates to a method, system, device and medium for allocating computing resources for a multi-core system. Background Art
[0002] In a single large server, dozens of services are running simultaneously, and the number of threads running in parallel may reach hundreds of thousands. Threads compete for resources with each other, especially computing resources. In the process of using the existing technology, the inventor found that there are at least the following problems in the existing technology:
[0003] In the existing technology, as Figure 1 shown, when Service 1 to Service 4 are running, they respectively use CPU Core 1 to CPU Core 4. If the specified computing resource occupancy rate of Service 4 suddenly increases, Service 4 will expand to other CPU cores (such as CPU Core 3), which will cause the computing power of the computing resources in the applied CPU cores to be dispersed, resulting in an increase in the specified computing resource occupancy rate of Service 3. If the specified computing resource occupancy rate of Service 3 reaches the threshold, Service 3 will also apply for computing resources from other CPU cores, and finally it may even cause the computing resources of all CPU cores to be affected. This influence relationship is complex, resulting in an increase in system complexity and difficulty in maintenance, making the stability of the multi-core system relatively weak. Summary of the Invention
[0004] The present invention aims to solve the above technical problems at least to a certain extent, and provides a method, system, device and medium for allocating computing resources for a multi-core system.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] In the first aspect, the present invention provides a method for allocating computing resources for a multi-core system, which is applied to a multi-core system; the method includes:
[0007] Dividing a specified amount of computing resources as reserved computing resources and initializing the reserved computing resources;
[0008] Obtaining the total amount of computing resources occupied by each service in the multi-core system and the total amount of specified computing resources occupied in the total amount of computing resources occupied;
[0009] According to the total amount of computing resources occupied by each service in the multi-core system and the total amount of specified computing resources occupied in the total amount of computing resources occupied, obtaining the specified computing resource occupancy rate of each service in the multi-core system;
[0010] Determine whether the specified computing resource occupancy rate of each business in the multi-core system is greater than the computing resource occupancy rate threshold, if the specified computing resource occupancy rate of any business in the multi-core system is greater than the computing resource occupancy rate threshold, proceed to the next step, otherwise re-obtain the total computing resource occupancy of each business in the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy;
[0011] The business whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold is scheduled to run in the reserved computing resources.
[0012] The present invention can improve the stability of a multi-core system. Specifically, during the implementation of the present invention, by dividing computing resources of a specified size as reserved computing resources, and calculating the occupancy rate of the specified computing resources of each business under the multi-core system, when the occupancy rate of the specified computing resources of any business is greater than the computing resource occupancy rate threshold, a certain amount of computing resources is allocated to the business in the reserved computing resources so that the business can run normally. Based on the present invention, each business can occupy the reserved computing resources according to its own designated computing resource occupancy rate, thereby allowing the business to use the reserved computing resources when it is busy, and not use the reserved resources when it is off-peak, so as to achieve the purpose of using the reserved computing resources in a staggered manner, thereby preventing the sudden occupancy rate of a business's designated computing resources (such as millisecond-level computing resources) from being too high, causing jitters in other businesses, thereby avoiding the problem of mutual interference between the computing resources of each business, which is beneficial to improving the stability of the multi-core system.
[0013] In a possible design, the multi-core system includes multiple CPU cores; correspondingly, obtaining the total amount of computing resources occupied by each business in the multi-core system and the total amount of computing resources occupied by a specified number of computing resources in the total amount of computing resources occupied includes:
[0014] The service threads in all CPU cores in the multi-core system are grouped according to the type of service to obtain service thread groups corresponding to each service in all CPU cores;
[0015] Summarize the resource occupancy rates of the business thread groups corresponding to each business in all CPU cores to obtain the computing resource occupancy of each business in all CPU cores;
[0016] Extract the specified business threads in the business thread groups corresponding to each business in all CPU cores, and summarize the resource occupancy rates of the specified business threads in the business thread groups corresponding to each business in all CPU cores to obtain the specified computing resource occupancy of each business in all CPU cores;
[0017] Summarize the resource occupancy rates of the computing resources of each service in all CPU cores by service type to obtain the total computing resource occupancy of each service in the multi-core system;
[0018] Summarize the specified computing resource occupancy rates of each service in all CPU cores by service type to obtain the total specified computing resource occupancy in the total computing resource occupancy of each service in the multi-core system.
[0019] In a possible design, summarize the resource occupancy rates of the service thread groups corresponding to each service in all CPU cores to obtain the computing resource occupancy of each service in all CPU cores, including:
[0020] Send a notification to all CPU cores through IPI interrupts so that all CPU cores respond to the IPI interrupts and summarize the resource occupancy rate of each thread in the service thread group corresponding to each service into the resource occupancy rate summary data of each service group, and then calculate the computing resource occupancy of each service in all CPU cores in the multi-core system based on the grouped resource occupancy rate summary data.
[0021] In a possible design, send a notification to all CPU cores through IPI interrupts at a millisecond-level frequency.
[0022] In a possible design, the specified computing resource is a millisecond-level computing resource.
[0023] In a possible design, mark the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold in the multi-core system as overloaded services. Correspondingly, schedule the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold in the multi-core system to run in the reserved computing resources, including:
[0024] Apply for a specified amount of specified computing resources from the reserved computing resources according to the specified computing resource occupancy rate of the overloaded service in the multi-core system;
[0025] Share the specified computing resources for the overloaded services to use so that the overloaded services can run in the specified computing resources.
[0026] In a possible design, after marking the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold in the multi-core system as overloaded services and correspondingly scheduling the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold in the multi-core system to run in the reserved computing resources, the method further includes:
[0027] Re-obtain the total computing resource occupancy of each service under the multi-core system and the specified computing resource occupancy in the total computing resource occupancy, so as to obtain the latest specified computing resource occupancy rate of the overloaded service under the multi-core system;
[0028] Determine whether the latest specified computing resource occupancy rate of the overloaded service under the multi-core system is greater than the computing resource occupancy rate threshold. If not, release the reserved computing resources.
[0029] In a second aspect, the present invention provides a computing resource allocation system for a multi-core system, which is used to implement the computing resource allocation method for a multi-core system as described in any one of the above; the computing resource allocation system for a multi-core system includes a computing resource partitioning module, a specified computing resource occupancy rate monitoring module, and a computing resource scheduling module that are sequentially communicatively connected:
[0030] The computing resource partitioning module is used to partition a specified amount of computing resources as reserved computing resources and initialize the reserved computing resources;
[0031] The specified computing resource occupancy rate monitoring module is used to obtain the total computing resource occupancy of each service under the multi-core system and the specified computing resource occupancy in the total computing resource occupancy, and obtain the specified computing resource occupancy rate of each service under the multi-core system according to the total computing resource occupancy of each service under the multi-core system and the specified computing resource occupancy in the total computing resource occupancy; it is also used to determine whether the specified computing resource occupancy rate of each service under the multi-core system is greater than the computing resource occupancy rate threshold. If the specified computing resource occupancy rate of any service under the multi-core system is greater than the computing resource occupancy rate threshold, the service with the specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system is scheduled to run in the reserved computing resources through the computing resource scheduling module. Otherwise, re-obtain the total computing resource occupancy of each service under the multi-core system and the specified computing resource occupancy in the total computing resource occupancy.
[0032] In a third aspect, the present invention provides an electronic device, including:
[0033] A memory for storing computer program instructions; and,
[0034] A processor for executing the computer program instructions to complete the operations of the computing resource allocation method for a multi-core system as described in any one of the above.
[0035] Fourthly, the present invention provides a computer-readable storage medium for storing computer-readable computer program instructions, and the computer program instructions are configured to perform operations of the computing resource allocation method for a multi-core system as described in any one of the above when running. Description of the Drawings
[0036] Figure 1 is a schematic diagram of computing resource allocation in the prior art;
[0037] Figure 2 is a flowchart of the computing resource allocation method for a multi-core system in Embodiment 1;
[0038] Figure 3 is a schematic diagram of the computing resource occupancy of statistical services in the prior art;
[0039] Figure 4 is a schematic diagram of the computing resource occupancy of services in all CPU cores in Embodiment 1;
[0040] Figure 5 is a schematic diagram of the computing resource allocation method for a multi-core system in Embodiment 1;
[0041] Figure 6 is a block diagram of the computing resource allocation system for a multi-core system in Embodiment 2. Detailed Embodiments
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the descriptions of the embodiments or the prior art. Obviously, the following descriptions of the structures of the drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. It should be noted here that the descriptions of these embodiments are used to help understand the present invention, but do not constitute a limitation to the present invention.
[0043] Embodiment 1:
[0044] This embodiment discloses a computing resource allocation method for a multi-core system, which can be but is not limited to being executed by a computer device or a virtual machine with certain computing resources, such as being executed by an electronic device such as a personal computer, a smart phone, a personal digital assistant or a wearable device, or being executed by a virtual machine.
[0045] As Figure 2As shown in the figure, a method for allocating computing resources for a multi-core system is applied to a multi-core system including multiple CPU cores. It should be noted that a multi-core system is a computer system constructed using a multi-core processor, which means that two or more complete CPU cores (Central Processing Unit Core) are integrated in one processor. At this time, one processor can support multiple processors on the system bus, and all bus control signals and command signals are provided by the bus controller. The method may but is not limited to including the following steps:
[0046] S1. Divide a specified amount of computing resources as reserved computing resources, so as to apply for computing resources from the reserved computing resources when the computing resource occupancy rate of a service exceeds the computing resource occupancy rate threshold at the millisecond level, and initialize the reserved computing resources to ensure that the reserved computing resources can work properly, thereby improving the reliability and availability of the reserved computing resources. It should be noted that in this embodiment, any service can occupy a certain amount of computing resources in the reserved computing resources according to its own needs, and the computing resources in the reserved computing resources can be allocated to multiple services simultaneously.
[0047] S2. Obtain the total computing resource occupancy of each service in the multi-core system and the specified total computing resource occupancy in the total computing resource occupancy.
[0048] In this embodiment, the specified computing resources are millisecond-level computing resources, which have higher requirements for the computing power of CPU cores. When the specified computing resources are millisecond-level computing resources, applying this embodiment can effectively improve the stability of the multi-core system.
[0049] In the prior art, the industry generally uses the method of timer sampling to count the computing resource occupancy rate. For example, Figure 3 As shown in the figure, that is, only the computing resource occupancy of all services is counted on one CPU core, which will result in too long time consumption for one count and cannot meet the statistical requirements of resources such as millisecond-level computing resources. For example, when the number of groups reaches dozens, the amount of calculation required to summarize and calculate the resource occupancy data of all threads in all service groups and calculate the group computing resource occupancy based on this is large, which affects the normal operation of the system, resulting in a statistical period generally exceeding 1 second and unable to perform millisecond-level resource occupancy rate calculation. Based on this, in order to improve the statistical efficiency of the computing resource occupancy and the specified computing resource occupancy, this embodiment further makes the following improvements:
[0050] In this embodiment, obtaining the total computing resource occupancy of each service in the multi-core system and the specified total computing resource occupancy in the total computing resource occupancy includes:
[0051] S201. Group the service threads in all CPU cores of the multi-core system according to the type of service, and obtain the service thread groups corresponding to each service in all CPU cores; it should be noted that a service is essentially a set of special threads, which are called service thread groups in this embodiment. These thread sets utilize the container function of the multi-core system itself and have the resource limitation and isolation capabilities of the multi-core system. By restricting and modifying the dynamic behavior of the threads, an independent "operating environment" can be created for them, that is, the specified computing resources in the reserved computing resources can be shared for the service to use, so that the corresponding service can run in the specified computing resources.
[0052] Among them, the resource limitation and isolation capabilities of the multi-core system refer to: the operating system provides a mechanism similar to the cgroup mechanism (Control Groups mechanism, a physical resource isolation mechanism) to provide resource limitation and isolation capabilities. This mechanism can integrate thread sets into different groups according to needs, thus providing a unified framework for system resource management. Simply put, this mechanism can limit and record the physical resources used by a set of tasks. Essentially, this mechanism is that the operating system triggers corresponding hooks for resource scheduling during program operation to achieve the purpose of resource tracking and limitation.
[0053] S202. Aggregate the resource occupancy rates of the service thread groups corresponding to each service in all CPU cores to obtain the computing resource occupancy of each service in all CPU cores; it should be noted that the computing resource occupancy of a service in any CPU core is also the resource occupancy of the service thread group corresponding to the current service in the current CPU core (single core). In this embodiment, the resource occupancy rate of a service thread refers to the occupancy duration of the service thread for the CPU core within a period of time. For example, in 1 second, service thread A occupies 800 ms, which means the resource occupancy rate of service thread A is 80%.
[0054] Aggregating the resource occupancy rates of the service thread groups corresponding to each service in all CPU cores to obtain the computing resource occupancy of each service in all CPU cores includes:
[0055] Send notifications to all CPU cores through IPI (Inter-Processor Interrupt) interrupts, so that all CPU cores respond to the IPI interrupts and aggregate the resource occupancy rate of each thread in the service thread groups corresponding to each service into the resource occupancy rate aggregation data of each service group, and then calculate the computing resource occupancy of each service in all CPU cores in the multi-core system according to the aggregated resource occupancy rate data of the groups.
[0056] Specifically, in this embodiment, all CPU cores respond to IPI interrupts, and the computing resource occupancy of each service in all CPU cores can be obtained. Then, the computing resource occupancy of each service in all CPU cores is summarized according to the type of service to obtain the total computing resource occupancy of each service in the multi-core system, so as to facilitate obtaining the specified computing resource occupancy rate of each service in the multi-core system subsequently.
[0057] Specifically, in this embodiment, based on the Figure 4 shown method, the computing resource occupancy in each CPU core is statistically calculated.
[0058] Further, in this embodiment, notifications are sent to all CPU cores through IPI interrupts at a millisecond-level frequency to further improve the statistical efficiency of the computing resource occupancy and the specified computing resource occupancy.
[0059] S203. Extract the specified service threads in the service thread groups corresponding to each service in all CPU cores, and summarize the resource occupancy rates of the specified service threads in the service thread groups corresponding to each service in all CPU cores to obtain the specified computing resource occupancy of each service in all CPU cores;
[0060] S204. Summarize the computing resource occupancy of each service in all CPU cores according to the type of service to obtain the total computing resource occupancy of each service in the multi-core system; that is, summarize the computing resource occupancy of the same service in each CPU core to obtain the total computing resource occupancy of the same service in the multi-core system.
[0061] S205. Summarize the specified computing resource occupancy of each service in all CPU cores according to the type of service to obtain the total specified computing resource occupancy in the total computing resource occupancy of each service in the multi-core system. That is, summarize the specified computing resource occupancy of the same service in each CPU core to obtain the total specified computing resource occupancy of the same service in the multi-core system.
[0062] S3. Obtain the specified computing resource occupancy rate of each service in the multi-core system according to the total computing resource occupancy of each service in the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy; it should be understood that the specified computing resource occupancy rate of any service in the multi-core system is: where m0 is the total specified computing resource occupancy of the current service in the multi-core system, and m is the total computing resource occupancy of the current service in the multi-core system.
[0063] S4. Determine whether the specified computing resource occupancy rate of each service under the multi-core system is greater than the computing resource occupancy rate threshold. If the specified computing resource occupancy rate of any service under the multi-core system is greater than the computing resource occupancy rate threshold, it indicates that the corresponding service needs to allocate computing resources from the reserved computing resources, and then proceed to the next step. Otherwise, it indicates that the corresponding service does not need to allocate computing resources from the reserved computing resources. At this time, re-obtain the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy, that is, return to step S2.
[0064] S5. Schedule the service whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold to run in the reserved computing resources.
[0065] In this embodiment, the service whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold can be marked as an overloaded service. Correspondingly, scheduling the service whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold to run in the reserved computing resources includes:
[0066] S501. Apply for a specified amount of specified computing resources from the reserved computing resources according to the specified computing resource occupancy rate of the overloaded service under the multi-core system;
[0067] S502. Share the specified computing resources for the overloaded service to use, so that the overloaded service runs in the specified computing resources.
[0068] In this embodiment, when marking the service whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold as an overloaded service, correspondingly, after scheduling the service whose specified computing resource occupancy rate under the multi-core system is greater than the computing resource occupancy rate threshold to run in the reserved computing resources, the method further includes:
[0069] Re-obtain the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy, so as to obtain the latest specified computing resource occupancy rate of the overloaded service under the multi-core system;
[0070] Judge whether the latest specified computing resource occupancy rate of the overloaded service under the multi-core system is greater than the computing resource occupancy rate threshold. If so, do nothing. If not, release the reserved computing resources.
[0071] Based on the above process, in this embodiment, when the specified computing resource occupancy rate of the service is reduced to the computing resource occupancy rate threshold and below, the previously allocated shared computing resources can be released, that is, the reserved computing resources are released.
[0072] This embodiment can improve the stability of the multi-core system. Specifically, during the implementation of this embodiment, by dividing computing resources of a specified size as reserved computing resources, and calculating the occupancy rate of the specified computing resources of each business under the multi-core system, and then when the occupancy rate of the specified computing resources of any business is greater than the computing resource occupancy rate threshold, a certain amount of computing resources is allocated to the business in the reserved computing resources so that the business can run normally. Based on this embodiment, each business can occupy the reserved computing resources according to its own designated computing resource occupancy rate, thereby allowing the business to use the reserved computing resources when it is busy, and not use the reserved resources when it is off-peak, so as to achieve the purpose of using the reserved computing resources for the business in a staggered manner, thereby preventing the sudden occupancy rate of the specified computing resources (such as millisecond-level computing resources) of a business from being too high, causing jitters of other businesses, thereby avoiding the problem of mutual interference between the computing resources of each business, which is conducive to improving the stability of the multi-core system.
[0073] As an example, Figure 5 As shown, in this embodiment, all computing resources in CPU core 4 are divided as reserved computing resources, and services 1 to 3 are respectively run in CPU core 1 to CPU core 3. When the designated computing resource occupancy rate of each service (such as millisecond-level computing resource occupancy rate) is lower than the threshold, each service runs independently on its own computing resource without interfering with each other. When the designated computing resource occupancy rate of services 1 and 2 increases suddenly, computing resource 4 will be applied for from the reserved computing resources, that is, services 1 and 2 will be scheduled to run in the reserved computing resources, so as not to affect the stable operation of tasks in CPU core 3. In this way, this embodiment can prevent services whose designated computing resource occupancy rate is lower than the threshold from being affected by other services, thereby reducing the complexity of the multi-core system and improving the stability of the multi-core system.
[0074] Embodiment 2:
[0075] This embodiment discloses a computing resource allocation system for a multi-core system, which is used to implement the computing resource allocation method for a multi-core system in Embodiment 1; Figure 6 As shown, the computing resource allocation system for the multi-core system includes a computing resource partitioning module, a designated computing resource occupancy monitoring module and a computing resource scheduling module which are sequentially connected in communication:
[0076] The computing resource partitioning module is used to partition computing resources of a specified size as reserved computing resources and initialize the reserved computing resources;
[0077] The specified computing resource occupancy monitoring module is used to obtain the total computing resource occupancy of each service in the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy, and obtain the specified computing resource occupancy rate of each service in the multi-core system according to the total computing resource occupancy of each service in the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy; it is also used to determine whether the specified computing resource occupancy rate of each service in the multi-core system is greater than the computing resource occupancy rate threshold. If the specified computing resource occupancy rate of any service in the multi-core system is greater than the computing resource occupancy rate threshold, the service with the specified computing resource occupancy rate greater than the computing resource occupancy rate threshold in the multi-core system is scheduled to run in the reserved computing resource through the computing resource scheduling module, otherwise, the total computing resource occupancy of each service in the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy are obtained again.
[0078] It should be noted that for the working process, working details and technical effects of the computing resource allocation system for the multi-core system provided in Embodiment 2, reference can be made to Embodiment 1 and will not be elaborated here.
[0079] Embodiment 3:
[0080] Based on Embodiment 1 or 2, this embodiment discloses an electronic device, which may be a smart phone, a tablet computer, a notebook computer or a desktop computer, etc. The electronic device may be referred to as a user terminal, a portable terminal, a desktop terminal, etc. The electronic device includes:
[0081] A memory for storing computer program instructions; and,
[0082] A processor for executing the computer program instructions to complete the operations of the computing resource allocation method for the multi-core system as described in any one of Embodiment 1.
[0083] Embodiment 4:
[0084] Based on any one of Embodiments 1 to 3, this embodiment discloses a computer-readable storage medium for storing computer-readable computer program instructions, and the computer program instructions are configured to perform the operations of the computing resource allocation method for the multi-core system as described in Embodiment 1 when running.
[0085] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A computing resource allocation method for a multi-core system, characterized in that: Applied to a multi-core system; the method includes: Dividing a specified amount of computing resources as reserved computing resources and initializing the reserved computing resources; Obtaining the total computing resource occupation of each service under the multi-core system and the specified total computing resource occupation in the total computing resource occupation; Obtaining the specified computing resource occupation rate of each service under the multi-core system according to the total computing resource occupation of each service under the multi-core system and the specified total computing resource occupation in the total computing resource occupation; Judging whether the specified computing resource occupation rate of each service under the multi-core system is greater than the computing resource occupation rate threshold. If the specified computing resource occupation rate of any service under the multi-core system is greater than the computing resource occupation rate threshold, then proceed to the next step. Otherwise, re-obtain the total computing resource occupation of each service under the multi-core system and the specified total computing resource occupation in the total computing resource occupation; Scheduling the services with a specified computing resource occupation rate greater than the computing resource occupation rate threshold under the multi-core system to run in the reserved computing resources.
2. A computing resource allocation method for a multi-core system according to claim 1, characterized in that: The multi-core system includes multiple CPU cores; Correspondingly, obtaining the total computing resource occupation of each service under the multi-core system and the specified total computing resource occupation in the total computing resource occupation includes: Grouping the service threads in all CPU cores under the multi-core system by service type to obtain the service thread groups corresponding to each service in all CPU cores; Summarizing the resource occupation rates of the service thread groups corresponding to each service in all CPU cores to obtain the computing resource occupation amounts of each service in all CPU cores; Extracting the specified service threads in the service thread groups corresponding to each service in all CPU cores and summarizing the resource occupation rates of the specified service threads in the service thread groups corresponding to each service in all CPU cores to obtain the specified computing resource occupation amounts of each service in all CPU cores; Summarizing the computing resource occupation amounts of each service in all CPU cores by service type to obtain the total computing resource occupation of each service under the multi-core system; Summarizing the specified computing resource occupation amounts of each service in all CPU cores by service type to obtain the specified total computing resource occupation in the total computing resource occupation of each service under the multi-core system.
3. A computing resource allocation method for a multi-core system according to claim 2, characterized in that: Summarizing the resource occupation rates of the service thread groups corresponding to each service in all CPU cores to obtain the computing resource occupation amounts of each service in all CPU cores includes: Sending a notification to all CPU cores through an IPI interrupt so that all CPU cores respond to the IPI interrupt and summarize the resource occupation rate of each thread in the service thread group corresponding to each service into the resource occupation rate summary data of each service group, and then calculating the computing resource occupation amounts of each service in all CPU cores under the multi-core system according to the grouped resource occupation rate summary data.
4. A computing resource allocation method for a multi-core system according to claim 3, characterized in that: Sending a notification to all CPU cores through an IPI interrupt at a millisecond frequency.
5. A computing resource allocation method for a multi-core system according to claim 1, characterized in that: The specified computing resource is a millisecond-level computing resource.
6. A computing resource allocation method for a multi-core system according to claim 1, characterized in that: Mark the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system as overloaded services. Correspondingly, scheduling the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system to run in the reserved computing resources includes: Apply for a specified amount of specified computing resources from the reserved computing resources according to the specified computing resource occupancy rate of the overloaded service under the multi-core system; Share the specified computing resources for the overloaded service to use so that the overloaded service runs in the specified computing resources.
7. A computing resource allocation method for a multi-core system according to claim 1, characterized in that: After marking the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system as overloaded services and correspondingly scheduling the services with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system to run in the reserved computing resources, the method further includes: Re-obtain the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy to obtain the latest specified computing resource occupancy rate of the overloaded service under the multi-core system; Judge whether the latest specified computing resource occupancy rate of the overloaded service under the multi-core system is greater than the computing resource occupancy rate threshold. If not, release the reserved computing resources.
8. A computing resource allocation system for a multi-core system, characterized in that: Used to implement the computing resource allocation method for the multi-core system as described in any one of claims 1 to 7; the computing resource allocation system for the multi-core system includes a computing resource division module, a specified computing resource occupancy rate monitoring module, and a computing resource scheduling module that are communicatively connected in sequence: The computing resource division module is used to divide a specified amount of computing resources as reserved computing resources and initialize the reserved computing resources; The specified computing resource occupancy rate monitoring module is used to obtain the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy, and obtain the specified computing resource occupancy rate of each service under the multi-core system according to the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy; It is also used to judge whether the specified computing resource occupancy rate of each service under the multi-core system is greater than the computing resource occupancy rate threshold. If the specified computing resource occupancy rate of any service under the multi-core system is greater than the computing resource occupancy rate threshold, schedule the service with a specified computing resource occupancy rate greater than the computing resource occupancy rate threshold under the multi-core system to run in the reserved computing resources through the computing resource scheduling module, otherwise re-obtain the total computing resource occupancy of each service under the multi-core system and the total specified computing resource occupancy in the total computing resource occupancy.
9. An electronic device, characterized in that: Includes: A memory for storing computer program instructions; And, A processor for executing the computer program instructions to complete the operations of the computing resource allocation method for the multi-core system as described in any one of claims 1 to 7.
10. A computer-readable storage medium for storing computer-readable computer program instructions, characterized in that: The computer program instructions are configured to perform the operations of the computing resource allocation method for a multi-core system according to any one of claims 1 to 7 when running.
Citation Information
Cited By
Interrupt threading method for embedded edge soft real-time system IPI
CN121029364A
A method for embedded edge soft real-time system ipi interrupt threading
CN121029364B