A resource scheduling method for operating system cooperative optimization
By obtaining inter-process communication records and NUMA node topology information from the operating system, mapping the resource influence domain and determining distribution characteristic parameters, the problem of ignoring resource coupling relationships in existing scheduling methods is solved, achieving more efficient resource scheduling and performance improvement.
Patent Information
- Application Number
- CN202512033708.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-02-13
AI Technical Summary
Existing operating system resource scheduling methods fail to fully utilize inter-process communication records and NUMA node topology, causing resource coupling relationships to be ignored during process migration, thus affecting scheduling efficiency.
By acquiring inter-process communication records and NUMA node topology information, the influence domain of process resources is mapped and resource distribution characteristic parameters are determined, and candidate CPU cores are screened to achieve efficient scheduling.
It improves resource isolation after process migration, reduces performance degradation caused by resource contention, and enhances the rationality of scheduling decisions.
Smart Images

Figure CN121523914A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a resource scheduling method for operating system cooperative optimization. BACKGROUND
[0002] With the continuous expansion of cloud computing and data center scale, resource scheduling at the operating system level becomes more and more critical in improving system performance. Under the background of the popularity of multi-core processors and NUMA architecture, the reasonable allocation of processes among different CPU cores will directly affect the overall running efficiency of the operating system. At present, the operating system is usually equipped with a process scheduler to complete the allocation of processes to CPU cores, and also provides process affinity setting interfaces and memory management interfaces and other tools to allow users or upper-layer applications to intervene in scheduling decisions.
[0003] In the existing resource scheduling scheme, scheduling decisions are mainly based on CPU load balancing or simple resource occupation statistics. Specifically, the scheduler will collect the current load of each CPU core, and then allocate the to-be-scheduled process to the core with lower load. This method to some extent avoids the situation that some cores are overloaded. However, if the scheduling target is determined, it often happens that only the resource state of the target CPU core itself is considered, and the resource coupling relationship between the to-be-scheduled process and other related processes is ignored, and the physical layout information provided by the NUMA node topology structure is not fully utilized. SUMMARY
[0004] The present application provides a resource scheduling method for operating system cooperative optimization, to solve the problem of how to dynamically determine the target CPU core of process migration based on the resource coupling relationship reflected by the inter-process communication record and the distribution characteristics of process resource occupation in the multi-dimensional resource space, in combination with the NUMA node topology structure, in the process of operating system process scheduling, so as to realize efficient scheduling under the premise of ensuring resource space isolation.
[0005] The present application provides a resource scheduling method for operating system cooperative optimization, comprising: obtaining resource monitoring data of each process, inter-process communication records, resource states of each CPU core and NUMA node topology information based on operating system kernel interfaces;
[0006] Based on the inter-process communication record, the resource influence domain of the to-be-scheduled process is determined, the resource monitoring data of each process in the resource influence domain is mapped into a coordinate point in the multi-dimensional resource space, and the resource distribution characteristic parameter is determined according to the coordinate point and the NUMA node topology information;
[0007] mapping resource states of each CPU core to a multi-dimensional resource space, screening candidate CPU cores from each CPU core based on the resource distribution characteristic parameter, and determining resource space isolation degree;
[0008] in response to a resource scheduling request, migrating a process to be scheduled to a target core selected from the candidate CPU cores according to the resource space isolation degree through the operating system kernel interface.
[0009] Optionally, in a possible implementation, the method further includes:
[0010] determining, based on the inter-process communication record, processes having a direct communication relationship with the process to be scheduled as first-level associated processes;
[0011] determining, based on resource monitoring data of the process to be scheduled and each first-level associated process, a resource coupling relationship;
[0012] traversing the inter-process communication record of the first-level associated process, and determining a direct communication process of the first-level associated process as a second-level associated process;
[0013] determining, based on the resource coupling relationship, a boundary range of the resource influence domain, and regarding the process to be scheduled and each-level associated process located in the boundary range as associated processes in the resource influence domain.
[0014] Optionally, in a possible implementation, the method further includes:
[0015] constructing resource space metrics of the first-level associated process and the process to be scheduled in the multi-dimensional resource space;
[0016] regarding a representation length of the resource monitoring data of the process to be scheduled in the multi-dimensional resource space as a resource reference metric;
[0017] determining, based on the inter-process communication record, a communication type between the first-level associated process and the process to be scheduled; the communication type includes shared memory and pipe communication;
[0018] determining, based on a comparison result of the resource space metric and the resource reference metric, and whether the first-level associated process and the process to be scheduled have shared memory or pipe communication, whether the first-level associated process is included in the resource influence domain.
[0019] Optionally, in a possible implementation, the method further includes:
[0020] The resource monitoring data of each associated process is mapped to a multi-dimensional resource space to obtain the spatial coordinates of each associated process;
[0021] Determine the resource distribution center of the spatial coordinate points;
[0022] Determine the discrete characteristics of each spatial coordinate point relative to the resource distribution center;
[0023] Based on the discrete features and the spatial topological relationship of the spatial coordinate points, the resource distribution pattern of the associated processes is identified;
[0024] Based on the NUMA node topology information, the resource distribution characteristic parameters are determined according to the resource distribution pattern.
[0025] Optionally, in one possible implementation, identifying the resource distribution pattern of associated processes based on the discrete features and the spatial topological relationship of the spatial coordinate points includes:
[0026] Establish the spatial directional relationship between each spatial coordinate point and the resource distribution center, and statistically analyze the angular distribution interval of the spatial directional relationship;
[0027] Based on the comparison results of the discrete features and the modulus of the resource distribution center, and the comparison results of the angular distribution interval and the proportional relationship between the modulus and the discrete features, the resource distribution pattern is identified as a clustered distribution, a dispersed distribution, or a linear distribution.
[0028] Optionally, in one possible implementation, determining the resource distribution characteristic parameters based on the resource distribution pattern by combining the NUMA node topology information includes:
[0029] When the resource distribution pattern is identified as the clustered distribution, a reverse deployment vector is constructed based on the resource distribution center and the NUMA node topology information, and the reverse deployment vector is used as the resource distribution feature parameter.
[0030] When the resource distribution pattern is identified as the dispersed distribution, the maximum spatial gap between each spatial coordinate point is identified, and a gap center vector is constructed based on the endpoint position of the maximum spatial gap and the NUMA node topology information. The gap center vector is used as the resource distribution feature parameter.
[0031] When the resource distribution pattern is identified as a linear distribution, the dominant direction is extracted based on the arrangement of each spatial coordinate point, and an orthogonal deployment vector perpendicular to the dominant direction is constructed. The orthogonal deployment vector is used as the resource distribution feature parameter.
[0032] Optionally, in one possible implementation, mapping the resource states of each CPU core to a multi-dimensional resource space and filtering candidate CPU cores from each CPU core based on the resource distribution characteristic parameters includes:
[0033] The resource states of each CPU core are mapped to the multidimensional resource space to obtain the core space location of each CPU core;
[0034] Determine the spatial projection relationship between each of the core spatial locations and the resource distribution characteristic parameters;
[0035] CPU cores whose spatial projection relationship is a forward projection are selected as candidate CPU cores.
[0036] Optionally, in one possible implementation, determining the resource spatial isolation degree includes:
[0037] Based on the resource status of the candidate CPU core and the resource monitoring data of the associated processes within the resource influence domain, a resource space mapping relationship between the candidate CPU core and the resource influence domain is constructed.
[0038] Based on the resource space mapping relationship, the resource space isolation degree between each candidate CPU core and the resource influence domain is determined.
[0039] Optionally, in one possible implementation, migrating the process to be scheduled to a target core selected from candidate CPU cores based on the resource space isolation degree via the operating system kernel interface includes:
[0040] The target core is selected from the candidate CPU cores based on the resource space isolation.
[0041] The process to be scheduled is bound to the target kernel through the process affinity setting interface of the operating system kernel;
[0042] The memory pages of the process to be scheduled are migrated to memory nodes with NUMA affinity to the target kernel through the memory management interface of the operating system kernel.
[0043] Optionally, in one possible implementation, migrating the memory pages of the process to be scheduled to a memory node with NUMA affinity to the target kernel via the operating system kernel's memory management interface includes:
[0044] Based on the NUMA node topology information, a target memory node with NUMA affinity to the target core is determined;
[0045] The CPU cache hit rate and memory access latency of the process to be scheduled before migration are collected through the operating system kernel interface and used as benchmark performance indicators.
[0046] The memory pages of the process to be scheduled are migrated from the original memory node to the target memory node through the memory management interface.
[0047] The CPU cache hit rate and memory access latency of the scheduled process after the migration are used as performance indicators after the migration.
[0048] The effectiveness of resource scheduling is verified by comparing the baseline performance metrics with the post-migration performance metrics.
[0049] This application provides a resource scheduling method for operating system co-optimization. The beneficial effect is that this method ensures a significant isolation distance between the CPU core where the scheduled process resides after migration and its associated processes within the resource influence domain. This avoids migrating the scheduled process to a CPU core with similar resource consumption characteristics to associated processes, thereby reducing performance degradation caused by resource contention. Furthermore, this application combines NUMA node topology information to determine resource distribution characteristic parameters and utilizes the physical layout constraints of the operating system's underlying hardware topology. This ensures that process migration decisions consider not only logical resource consumption but also the physical NUMA node layout, further improving the rationality of scheduling decisions. Attached Figure Description
[0050] Figure 1 This is a flowchart illustrating a resource scheduling method for operating system collaborative optimization provided in an embodiment of this application;
[0051] Figure 2 This is a schematic diagram of clustered distribution identification of a resource scheduling method for operating system collaborative optimization provided in an embodiment of this application;
[0052] Figure 3 This is a schematic diagram of the NUMA node topology of a resource scheduling method for operating system collaborative optimization provided in an embodiment of this application;
[0053] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0055] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0056] Traditional operating system resource scheduling methods address the issue of finding a CPU core with a low load, i.e., the resource availability problem. This application, however, addresses the issue of finding a CPU core with greater resource space isolation, i.e., the resource distribution adaptability problem. The core of this application lies in mapping discrete, logical inter-process communication relationships into a quantifiable, continuous, multi-dimensional resource space. Then, based on the distribution patterns of related processes within the resource influence domain within this space, resource distribution characteristic parameters are determined. Finally, spatial mapping and spatial projection methods are used to screen candidate CPU cores, thereby achieving resource scheduling through operating system co-optimization.
[0057] The resource scheduling method for operating system collaborative optimization provided in this application can run as an extension module of the operating system kernel, be deployed as a user-space resource scheduling service, or be integrated into an existing operating system scheduler as a collaborative optimization strategy. The implementation platform for this method can include, but is not limited to, Linux, Windows, Unix, or other operating system platforms supporting NUMA architecture. This application can run in a single-machine multi-core environment or in a multi-node cluster environment to collaboratively optimize the process scheduling strategies of each node. This embodiment does not limit the specific deployment method or operating environment.
[0058] See Figure 1 This is a flowchart illustrating a resource scheduling method for operating system collaborative optimization provided in an embodiment of this application, including steps 100 to 400:
[0059] Step 100: Obtain resource monitoring data, inter-process communication records, resource status of each CPU core, and NUMA node topology information for each process based on the operating system kernel interface.
[0060] The resource monitoring data includes CPU utilization, memory usage, and I / O read / write rates for each process. This application periodically collects resource monitoring data from each process through the / proc file system or performance monitoring interface provided by the operating system kernel. CPU utilization represents the percentage of CPU time currently used by a process out of the total CPU time; memory usage represents the amount of physical memory currently occupied by a process; and I / O read / write rate represents the disk input / output operation rate of a process. Since the collection of the above resource monitoring data is a basic monitoring capability of the operating system, it will not be elaborated upon further here.
[0061] Inter-process communication (IPC) logs refer to the communication behavior logs recorded by the operating system that generate between processes due to data interaction, resource sharing, or cooperation. In this embodiment, IPC logs are obtained by reading the IPC logs of the operating system kernel or parsing process relationship information in the / proc file system. IPC logs contain information such as the identifier of the communicating process, the communication type, and the communication frequency. Communication types include shared memory, pipe communication, and message queues.
[0062] The resource status of each CPU core refers to the current load and operating status of each CPU core managed by the operating system. This application collects status information such as the load percentage and run queue length of each CPU core through the operating system kernel interface. The resource status of a CPU core reflects its current workload and available resource capacity.
[0063] NUMA node topology information refers to the topological distance between NUMA nodes and the affinity relationship between CPU cores and memory nodes in a NUMA architecture. This application obtains NUMA node topology information through the NUMA information interface provided by the operating system, such as the numactl tool in Linux or the / sys / devices / system / node directory. NUMA node topology information includes the identifier of each NUMA node, the topological distance between NUMA nodes, and the NUMA node to which each CPU core belongs. The topological distance reflects the difference in access latency between different NUMA nodes; the smaller the topological distance, the lower the access latency between nodes.
[0064] Preferably, compared with traditional scheduling methods that only collect single resource indicators such as CPU load, step 100 collects multi-dimensional resource monitoring data, inter-process communication relationships, and hardware topology, enabling resource scheduling decisions to comprehensively consider inter-process coupling relationships and underlying hardware characteristics.
[0065] Step 200: Determine the resource influence domain of the process to be scheduled based on inter-process communication records, map the resource monitoring data of each process within the resource influence domain to coordinate points in a multi-dimensional resource space, and determine the resource distribution characteristic parameters based on the coordinate points and NUMA node topology information.
[0066] In some embodiments, step 200 is specifically implemented by steps 210 and 220:
[0067] Step 210: Determine the resource influence domain of the process to be scheduled based on inter-process communication records.
[0068] Specifically, step 210 includes steps 211 to 214:
[0069] Step 211: Based on inter-process communication records, identify processes that have a direct communication relationship with the process to be scheduled, and designate them as first-level associated processes.
[0070] It is understood that a process to be scheduled refers to the target process that is about to undergo resource scheduling operations. This application extracts the communication information of the process to be scheduled from the inter-process communication records collected in step 100, searches for processes with a direct communication relationship with the process to be scheduled in the inter-process communication records, and marks the found processes as first-level associated processes. A direct communication relationship refers to inter-process communication methods such as shared memory, pipe communication, and message queues between two processes, without the need for forwarding through an intermediate process.
[0071] Step 212: Determine the resource coupling relationship based on the resource monitoring data of the process to be scheduled and each first-level associated process.
[0072] Resource coupling relationship is used to characterize the degree of correlation between two processes in resource usage. This application extracts the resource monitoring data of the process to be scheduled and the resource monitoring data of each first-level related process from the resource monitoring data collected in step 100, and determines the resource coupling relationship based on the positional relationship of the resource monitoring data of the two processes in the multi-dimensional resource space.
[0073] Specifically, this application uses the CPU utilization, memory usage, and I / O read / write speed of the process to be scheduled as a three-dimensional coordinate (x1, y1, z1), and the CPU utilization, memory usage, and I / O read / write speed of the first-level associated process as a three-dimensional coordinate (x2, y3, z4). 12 Two location points (z1, z2) are formed in the multidimensional resource space. This application determines the Euclidean distance between these two location points. The Euclidean distance reflects the degree of difference in resource usage patterns between the two processes. The smaller the Euclidean distance, the stronger the resource coupling relationship; the larger the Euclidean distance, the weaker the resource coupling relationship.
[0074] For example, assume the resource monitoring data of the process to be scheduled is CPU utilization of 50%, memory usage of 2GB, and IO read / write speed of 100MB / s; the resource monitoring data of the first-level associated process A is CPU utilization of 55%, memory usage of 2.1GB, and IO read / write speed of 95MB / s; and the resource monitoring data of the first-level associated process B is CPU utilization of 30%, memory usage of 4GB, and IO read / write speed of 200MB / s. To eliminate the difference in units, this application first normalizes the data of each dimension, normalizing the CPU utilization to the [0,1] interval, normalizing the memory usage according to the total system memory, and normalizing the IO read / write speed according to the maximum disk throughput. After normalization, the coordinates of the process to be scheduled are (0.5, 0.25, 0.1), the coordinates of the first-level associated process A are (0.55, 0.26, 0.095), and the coordinates of the first-level associated process B are (0.3, 0.5, 0.2). The Euclidean distance between the process to be scheduled and its primary associated process A is determined to be approximately 0.052, and the Euclidean distance between the process to be scheduled and its primary associated process B is determined to be approximately 0.33. Since the Euclidean distance (0.052) between the primary associated process A and its primary associated process B is much smaller than that between the two processes (0.33), it indicates that the resource coupling relationship between the process to be scheduled and its primary associated process A is strong, while the resource coupling relationship between the process to be scheduled and its primary associated process B is weak.
[0075] This application quantifies resource coupling relationships by determining Euclidean distance, and the boundary range of the resource influence domain can be determined based on the strength of the resource coupling relationship.
[0076] Step 213: Traverse the inter-process communication records of the first-level associated processes and determine the direct communication processes of the first-level associated processes as the second-level associated processes.
[0077] It is easy to understand that this application starts with each first-level associated process and continues to search downwards in the inter-process communication records for processes that have a direct communication relationship with the first-level associated processes, marking the found processes as second-level associated processes. By traversing the inter-process communication records level by level, this application identifies associated processes at all levels that have an indirect communication relationship with the process to be scheduled.
[0078] Step 214: Determine the boundary range of the resource influence domain based on the resource coupling relationship, and take the process to be scheduled and the associated processes at all levels located within the boundary range as associated processes within the resource influence domain.
[0079] It should be noted that the resource influence domain refers to the set of processes that may compete for resources or influence each other with the process to be scheduled during process scheduling. The boundary range is determined based on the strength of resource coupling and the type of inter-process communication. If the resource coupling is strong and the inter-process communication type is shared memory or pipe communication, the related processes are included in the resource influence domain. If the resource coupling is weak or the inter-process communication type is not shared memory or pipe communication, the related processes are considered as boundary nodes of the resource influence domain.
[0080] It should be noted that shared memory and pipe communication are two inter-process communication methods involving direct memory access or data transfer. Processes using shared memory communication access the same physical memory region simultaneously, while processes using pipe communication transfer data through the operating system kernel buffer. Both communication methods generate strong resource dependencies during process scheduling. In contrast, inter-process communication methods such as message queues and semaphores have relatively weaker resource dependencies. Therefore, this application selects shared memory and pipe communication as the communication type criteria for determining whether a process is included in the resource influence domain.
[0081] For example, assume that the process P to be scheduled has communication relationships with its first-level associated processes A, B, and C. Process P communicates with process A using shared memory, with a resource coupling distance of 0.05 (Euclidean distance). Process P communicates with process B using pipes, with a resource coupling distance of 0.08 (Euclidean distance). Process P communicates with process C using message queues, with a resource coupling distance of 0.06 (Euclidean distance). Meanwhile, the resource baseline metric for the process P to be scheduled, i.e., the resource monitoring data, has a representation modulus of 0.3 in the multidimensional resource space. In step A4, process A has an Euclidean distance of 0.05 less than the resource baseline metric of 0.3 and uses shared memory for communication, thus meeting the criteria for inclusion in the resource influence domain. Process B has an Euclidean distance of 0.08 less than the resource baseline metric of 0.3 and uses pipe communication, also meeting the criteria for inclusion in the resource influence domain. Although process C has an Euclidean distance of 0.06 less than the resource baseline metric of 0.3, its communication type is message queue, not shared memory or pipe communication. Therefore, process C, as a boundary node of the resource influence domain, is not included in the resource influence domain. Ultimately, the resource influence domain includes the process to be scheduled, process A (first-level associated), and process B (first-level associated).
[0082] Preferably, step 210 identifies the resource influence domain of the process to be scheduled by traversing inter-process communication records level by level and filtering related processes based on resource coupling relationships. Related processes within the resource influence domain refer to processes that may compete for resources with the process to be scheduled during process scheduling. Identifying the resource influence domain provides a basis for selecting the target CPU core for process migration. Compared with traditional scheduling methods based solely on CPU load, this application considers inter-process communication and resource coupling relationships by identifying the resource influence domain, enabling scheduling decisions to avoid migrating the process to be scheduled to a CPU core where there is a risk of resource competition with related processes within its resource influence domain.
[0083] Specifically, step 214, "determining the boundary range of the resource influence domain based on resource coupling relationships," includes steps A1 to A4:
[0084] Step A1: Construct resource space measurement of first-level associated processes and processes to be scheduled in the multi-dimensional resource space.
[0085] It is understandable that the resource space metric represents the distance between the primary associated processes and the process to be scheduled in the multidimensional resource space. In step 212, this application has already determined the resource coupling relationship between the process to be scheduled and each primary associated process by calculating the Euclidean distance; the resource space metric is the Euclidean distance calculated in step 212. This application extracts the Euclidean distance values between each primary associated process and the process to be scheduled, calculated in step 212, as the resource space metric to determine whether the primary associated process is included in the resource influence domain. The magnitude of the resource space metric reflects the degree of difference in resource usage patterns between the primary associated processes and the process to be scheduled; a smaller resource space metric indicates a more similar resource usage pattern.
[0086] Step A2: Use the representation modulus of the resource monitoring data of the process to be scheduled in the multidimensional resource space as the resource benchmark metric.
[0087] This application uses the components of the resource monitoring data of the process to be scheduled on three coordinate axes—CPU utilization, memory usage, and I / O read / write rate—to form a position vector in a multi-dimensional resource space, pointing from the origin to the location of the process to be scheduled. The magnitude of this position vector is the resource benchmark metric. The calculation method of the position magnitude follows the geometric definition of vector magnitude. Before calculation, the data of the three dimensions—CPU utilization, memory usage, and I / O read / write rate—needs to be normalized to eliminate differences in units. The resource benchmark metric reflects the distance of the process to be scheduled from the origin in the multi-dimensional resource space and is used as a comparison benchmark to determine whether related processes are included in the resource influence domain. The resource benchmark metric is not a fixed value preset by humans, but is calculated based on the resource monitoring data of the process to be scheduled itself, and therefore will change with the resource usage of the process to be scheduled.
[0088] Step A3: Determine the communication type between the primary associated process and the process to be scheduled based on inter-process communication records. Communication types include shared memory and pipe communication.
[0089] It should be noted that the inter-process communication records contain the identifiers of the communicating processes and information about the communication type. This application extracts the communication type between the primary associated process and the process to be scheduled from the inter-process communication records collected in step 100. Inter-process communication types provided by the operating system include, but are not limited to, shared memory, pipe communication, message queues, semaphores, and socket communication. In this application, shared memory and pipe communication are key communication types for determining whether a primary associated process is included in the resource influence domain.
[0090] Furthermore, in shared memory communication, multiple processes access the same physical memory region simultaneously. If the process to be scheduled is moved to a different CPU core or NUMA node, the access latency of shared memory will change, thus affecting the performance of first-level associated processes that have shared memory communication with the process to be scheduled. In pipe communication, processes transfer data through the operating system kernel buffer. If the process to be scheduled is moved, it will affect the access pattern and data transfer efficiency of the pipe buffer, similarly impacting first-level associated processes. In contrast, while message queues, semaphores, and other inter-process communication methods also involve inter-process interaction, their sensitivity to process scheduling location is relatively low, and their resource dependency is relatively weak.
[0091] Step A4: Based on the comparison results of resource space measurement and resource baseline measurement, and whether there is shared memory or pipe communication between the first-level associated process and the process to be scheduled, determine whether the first-level associated process is included in the resource influence domain.
[0092] It should be noted that a resource space metric being less than a resource baseline metric indicates that the distance between the resource monitoring data of a first-level associated process and the resource monitoring data of the process to be scheduled in the multidimensional resource space is less than the magnitude of the resource monitoring data of the process to be scheduled itself. Therefore, the resource usage patterns of the two processes are considered correlated. For example, let vector A be the position vector of the process to be scheduled in the multidimensional resource space, and vector B be the position vector of the first-level associated process in the multidimensional resource space. The Euclidean distance between vector A and vector B is distance AB, which is the resource space metric. The magnitude of vector A itself is length A, which is the resource baseline metric. The system checks whether distance AB is less than length A. If distance AB is less than length A, then the positional relationship between vector B and vector A in the multidimensional resource space is considered to satisfy the first condition for inclusion in the resource influence domain.
[0093] When resource usage patterns are similar (resource space metric is smaller than resource baseline metric) and shared memory or piped communication exists, the scheduling operation of the process to be scheduled may affect the first-level associated processes. Therefore, the first-level associated processes are included in the resource influence domain. After being included in the resource influence domain, this application continues to traverse downwards along the inter-process communication records of the lower-level associated processes, performing the same judgment operation on the second-level associated processes.
[0094] Conversely, if the resource space metric is greater than or equal to the resource baseline metric, or if there is no shared memory or pipe communication between the first-level associated process and the process to be scheduled, the first-level associated process is treated as the boundary node of the resource influence domain, and traversal downwards stops. A resource space metric greater than or equal to the resource baseline metric indicates insufficient spatial correlation in resource usage patterns between the first-level associated process and the process to be scheduled. The absence of shared memory or pipe communication indicates that although there is a communication relationship between the two processes, the type of communication is less sensitive to the process scheduling location. In both of these cases, the likelihood of the scheduling operation of the process to be scheduled affecting the first-level associated process is reduced; therefore, the first-level associated process is treated as the boundary node of the resource influence domain, and traversal downwards ceases.
[0095] For example, continuing the example in step 212, assume the resource baseline metric of the process to be scheduled is 0.568, the resource space metric between the first-level associated process A and the process to be scheduled is 0.052, and the resource space metric between the first-level associated process B and the process to be scheduled is 0.33. Meanwhile, the inter-process communication records show that the process to be scheduled communicates with the first-level associated process A using shared memory, and with the first-level associated process B using message queue communication. In the judgment of step A4, the resource space metric of the first-level associated process A (0.052) is less than the resource baseline metric (0.568), and the communication type is shared memory, satisfying the two conditions for inclusion in the resource influence domain. Therefore, the first-level associated process A is included in the resource influence domain, and this application continues to traverse the inter-process communication records of the lower-level processes of the first-level associated process A. Although the resource space metric of the first-level associated process B (0.33) is less than the resource baseline metric (0.568), the communication type is message queue, not shared memory or pipe communication. Therefore, the first-level associated process B, as a boundary node of the resource influence domain, is not included in the resource influence domain, and the downward traversal stops.
[0096] Preferably, steps A1 to A4 accurately determine the boundary range of the resource influence domain by comparing the resource space metric with the resource baseline metric and combining this with the judgment of the inter-process communication type. The resource space metric reflects the similarity of resource usage patterns between processes, while the inter-process communication type reflects whether there are memory sharing or data transfer relationships between processes that are sensitive to scheduling positions. Combining these two conditions can filter out processes that have resource associations with the process to be scheduled, avoiding the inclusion of processes with insufficient resource associations into the resource influence domain. Unlike the determination of the resource influence domain based on service call relationships in container scheduling scenarios, this application judges the resource association relationship between processes based on the inter-process communication method at the operating system level, utilizing the unique inter-process communication characteristics of the operating system. By setting the resource space metric to be less than the resource baseline metric as the judgment condition, this application avoids the subjectivity of manually setting a fixed threshold, allowing the determination of the boundary range to be dynamically adjusted according to the resource usage of the process to be scheduled.
[0097] Preferably, step 200 transforms the communication and resource coupling relationships between the process to be scheduled and its associated processes into quantitative parameters that can guide scheduling decisions by identifying the resource influence domain and determining resource distribution characteristic parameters. Identifying the resource influence domain allows this application to identify the set of processes that may compete for resources with the process to be scheduled during the scheduling process. Determining the resource distribution characteristic parameters allows this application to identify the distribution patterns of associated processes within the resource influence domain in the multi-dimensional resource space, providing directional guidance for subsequent selection of candidate CPU cores.
[0098] Step 220: Map the resource monitoring data of each process within the resource influence domain to coordinate points in the multi-dimensional resource space, and determine the resource distribution characteristic parameters based on the coordinate points and NUMA node topology information.
[0099] Specifically, step 220 includes steps 221 to 225:
[0100] Step 221: Map the resource monitoring data of each associated process to a multi-dimensional resource space to obtain the spatial coordinates of each associated process.
[0101] It is understood that the related processes within the resource influence domain have been determined in step 214, and the resource monitoring data corresponding to each related process has been collected in step 100. This application extracts the resource monitoring data of each related process, and uses the CPU utilization, memory usage, and IO read / write rate of the resource monitoring data as the three coordinate axis values of the multi-dimensional resource space to form the spatial coordinate points of each related process. This application uses the distribution of the spatial coordinate points of each related process in the multi-dimensional resource space to reflect the resource usage status distribution characteristics of each related process within the resource influence domain.
[0102] Step 222: Determine the resource distribution center of the spatial coordinate points.
[0103] The resource distribution center is the geometric center of each spatial coordinate point in the multidimensional resource space. This application determines the average value of each spatial coordinate point on the CPU utilization axis to obtain the coordinate components of the resource distribution center on the CPU utilization axis. The same average value determination operation is performed on the memory usage axis and the I / O read / write rate axis to obtain the coordinate components of the resource distribution center on all three axes, thus determining the resource distribution center. The resource distribution center represents the overall resource utilization level of each associated process within the resource influence domain.
[0104] Step 223: Determine the discrete characteristics of each spatial coordinate point relative to the resource distribution center.
[0105] Discrete features are used to measure the degree of dispersion of spatial coordinate points around the resource distribution center. This application determines the Euclidean distance between each spatial coordinate point and the resource distribution center, and uses the mean of these Euclidean distances as the discrete feature. A larger discrete feature value indicates a more dispersed distribution of resource monitoring data for each associated process in the multidimensional resource space; a smaller discrete feature value indicates a more concentrated distribution of resource monitoring data for each associated process in the multidimensional resource space.
[0106] Step 224: Identify the resource distribution patterns of associated processes based on discrete features and spatial topological relationships of spatial coordinate points.
[0107] Specifically, step 224 includes steps B1 and B2:
[0108] Step B1: Establish the spatial directional relationship between each spatial coordinate point and the resource distribution center, and statistically analyze the angular distribution range of the spatial directional relationship.
[0109] Understandably, this application uses the resource distribution center as a reference point and determines the direction vectors pointing from the resource distribution center to each spatial coordinate point. In the multidimensional resource space, any coordinate axis is selected as a reference coordinate axis, and the angle between each direction vector and the reference coordinate axis is determined, resulting in the direction angle corresponding to each spatial coordinate point. This application statistically analyzes the maximum and minimum values of each direction angle; the range between the maximum and minimum values is the angle distribution interval. The width of the angle distribution interval reflects the degree of concentration of the spatial coordinate points relative to the resource distribution center in terms of direction.
[0110] Step B2: Based on the comparison results of discrete features and the modulus of the resource distribution center, and the comparison results of the angular distribution interval and the proportional relationship between the modulus and discrete features, identify the resource distribution pattern as a clustered distribution, a dispersed distribution, or a linear distribution.
[0111] The modulus of the resource distribution center is the distance from the origin to the resource distribution center in the multidimensional resource space, determined based on the coordinate components of the resource distribution center on the three coordinate axes. The proportional relationship between the modulus and the discrete features is obtained by numerically comparing the modulus and the discrete features.
[0112] It should be noted that the discrete feature is lower than the modulus of the resource distribution center, indicating that the dispersion of each spatial coordinate point relative to the resource distribution center is less than the distance of the resource distribution center itself from the origin. In other words, the resource monitoring data of each associated process exhibits a relatively concentrated distribution in the multidimensional resource space. The angular distribution interval is narrower than the ratio of the modulus to the discrete feature, indicating that the directional distribution of each spatial coordinate point relative to the resource distribution center is relatively concentrated. Given both spatial and directional concentration, the resource distribution pattern is identified as a clustered distribution. A clustered distribution means that the associated processes within the resource influence domain exhibit a concentrated trend in resource usage.
[0113] When the discrete characteristic is higher than the modulus of the resource distribution center, it indicates that the dispersion of each spatial coordinate point relative to the resource distribution center is greater than the distance of the resource distribution center itself from the origin. In other words, the resource monitoring data of each associated process exhibits a relatively dispersed distribution in the multidimensional resource space. Under this dispersed distribution, regardless of the width of the angular distribution interval, the mutual distances between spatial coordinate points have formed a clear spatial separation, thus directly identifying the resource distribution pattern as a dispersed distribution. A dispersed distribution implies that the associated processes within the resource influence domain exhibit significant differences in resource usage.
[0114] When the discrete feature is lower than the modulus of the resource distribution center, and the angular distribution range is wider than the ratio of the modulus to the discrete feature, it indicates that the spatial coordinate points are relatively concentrated in spatial location but relatively dispersed in direction. This concentrated spatial location but dispersed direction characteristic suggests that the spatial coordinate points exhibit a linear distribution pattern extending along a certain direction, thus identifying the resource distribution pattern as linear. A linear distribution means that the associated processes within the resource influence domain exhibit a linear trend in resource use along a certain resource dimension.
[0115] like Figure 2 The diagram shown illustrates clustered distribution identification. The multidimensional resource space includes three dimensions: CPU utilization, memory usage, and I / O read / write speed. Figure 2The projection display uses CPU utilization and memory usage as two dimensions. A coordinate system is established with CPU utilization on the horizontal axis and memory usage on the vertical axis, ranging from 0 to 1.0 with a scale interval of 0.2. The origin of the coordinate system is located in the lower left corner. The resource distribution center O, marked by a red dot, is the geometric center of the spatial coordinates of associated processes within the resource influence domain. The length of the red solid line from the origin to the resource distribution center O is the modulus M, representing the distance of the resource distribution center from the origin in the multidimensional resource space. The green dashed circle drawn with the resource distribution center O as its center represents the range of the discrete feature D, which is the mean Euclidean distance between each associated process spatial coordinate and the resource distribution center. The blue dots P1 to P5 represent the spatial coordinates of associated processes within the resource influence domain. These points are concentrated near the resource distribution center O and all lie within the area of the green dashed circle. Gray dashed lines are drawn from the resource distribution center O to each associated process coordinate to show the spatial directional relationships. The purple dashed line drawn to the right from the resource distribution center O serves as the reference coordinate axis for measuring angles. The angles formed by the lines connecting the resource distribution center O to the coordinate points of each associated process and the reference coordinate axis constitute the angle distribution interval. The narrow range of the angles between these lines indicates that the directional distribution of each associated process relative to the resource distribution center is concentrated. The identifying characteristics of a clustered distribution are that the discrete feature D is less than the modulus M, the angle distribution interval is narrow, and the spatial coordinate points are concentrated near the resource distribution center.
[0116] Preferably, step 224 uses a combination of two geometric feature parameters—discrete features and angular distribution intervals—to identify the distribution patterns of related processes within the resource influence domain in the multidimensional resource space. Discrete features reflect the concentration or dispersion of spatial coordinate points in location, while angular distribution intervals reflect the concentration or dispersion of spatial coordinate points in direction. The combination of these two parameters can distinguish between three typical resource distribution patterns: clustered distribution, dispersed distribution, and linear distribution. Unlike traditional scheduling methods that rely solely on a single resource dimension, this application's distribution pattern recognition method based on spatial geometric relationships comprehensively considers the distribution characteristics of multiple resource dimensions, avoiding the limitations of single-dimensional judgment. Step 225: Combine NUMA node topology information to determine resource distribution feature parameters based on the resource distribution pattern.
[0117] Specifically, step 225 includes steps C1 to C3:
[0118] Step C1: When the resource distribution pattern is identified as clustered, construct a reverse deployment vector based on the resource distribution center and NUMA node topology information, and use the reverse deployment vector as a resource distribution feature parameter.
[0119] It is understandable that clustered distribution indicates that the locations of related processes within the resource influence domain are concentrated near the resource distribution center in the multidimensional resource space. This application constructs a reverse deployment vector based on the resource distribution center and NUMA node topology information to guide the processes to be scheduled to migrate to CPU cores far away from the resource concentration area.
[0120] Furthermore, the location of the resource distribution center in the multidimensional resource space is determined, and the coordinates of the resource distribution center are (x... c ,y c ,z c ), where x c y represents the average CPU utilization of all associated processes. c z is the average memory usage of all associated processes. c This represents the average I / O read / write rate of each associated process. This application constructs a direction vector pointing from the resource distribution center to the origin of the multi-dimensional resource space, where the direction vector is (-x...). c ,-y c ,-z c This direction vector is the base direction of the reverse deployment vector. The base direction of the reverse deployment vector indicates the direction opposite to the resource concentration area in terms of resource usage, that is, the direction of low CPU usage, low memory usage, and low I / O usage.
[0121] Furthermore, this application adjusts the reverse deployment vector by incorporating NUMA node topology information. This application extracts the identifier of each NUMA node and the topological distance between each NUMA node from the NUMA node topology information collected in step 100. This application determines the CPU core where each associated process within the resource influence domain currently resides, and based on the attribution relationship between CPU cores and NUMA nodes, counts which NUMA nodes each associated process is distributed across. This application identifies the NUMA node with the most concentrated distribution of associated processes and marks this NUMA node as the resource-concentrated NUMA node. This application selects the NUMA node with the largest topological distance from the resource-concentrated NUMA node from the NUMA node topology information and marks this NUMA node as the target NUMA node. This application adjusts the direction of the reverse deployment vector so that the reverse deployment vector not only points in the opposite direction of resource usage but also points in the direction of the target NUMA node, thereby achieving distance from the resource-concentrated area in both the logical resource space and physical NUMA topology dimensions.
[0122] For example, suppose there are 5 associated processes within the resource influence domain, the resource distribution center's coordinates in the multidimensional resource space are (0.6, 0.5, 0.3), and the direction of the basic reverse deployment vector is (-0.6, -0.5, -0.3). The NUMA node topology information shows that the system has 4 NUMA nodes (node 0, node 1, node 2, node 3). Of the 5 associated processes, 3 processes run on node 0, 1 process runs on node 1, and 1 process runs on node 2. Therefore, node 0 is the NUMA node in the resource cluster. The NUMA node topology distance matrix shows that the topological distance between node 0 and node 3 is the largest (30), therefore node 3 is the target NUMA node. Figure 3 As shown, the NUMA node topology is illustrated. This application adjusts the direction of the reverse deployment vector to a combined direction pointing simultaneously to the base reverse direction and the node 3 direction. The resulting reverse deployment vector can guide the scheduled process away from the resource concentration area and also guide the scheduled process to migrate to a NUMA node that is far from the resource concentration NUMA node, thereby reducing the probability of NUMA remote memory access after process migration.
[0123] Step C2: When the resource distribution pattern is identified as a decentralized distribution, identify the maximum spatial gap between each spatial coordinate point, construct the gap center vector based on the endpoint position of the maximum spatial gap and the NUMA node topology information, and use the gap center vector as a resource distribution feature parameter.
[0124] The maximum spatial gap is defined as the two spatial coordinate points corresponding to the maximum pairwise distance between each pair of spatial coordinate points. This application determines the Euclidean distance between each pair of spatial coordinate points and selects the two spatial coordinate points with the largest Euclidean distance as the endpoints of the maximum spatial gap.
[0125] Specifically, assuming the two endpoints of the maximum spatial gap are P1 (x1, y1, z1) and P2 (x2, y2, z2), this application determines the mean values of the coordinate components of the two endpoints on the three coordinate axes to obtain the initial gap center position Pmid. The initial gap center position is located at the geometric midpoint between the two endpoints, representing the center position of the sparsely distributed resource area.
[0126] Furthermore, this application adjusts the gap center position by incorporating NUMA node topology information. This application determines the CPU core where the associated processes corresponding to endpoint positions P1 and P2 currently reside, and based on the attribution relationship between the CPU core and NUMA nodes, determines which NUMA node P1 and P2 are located on. Assume P1 is located on NUMA node N1 and P2 is located on NUMA node N2. This application extracts the topological distance between nodes N1 and N2, as well as the topological distances between other NUMA nodes in the system and nodes N1 and N2, from the NUMA node topology information. This application selects NUMA nodes with appropriate topological distances to nodes N1 and N2 as target NUMA nodes, avoiding nodes that are too close or too far from nodes N1 or N2. This application adjusts the direction of the gap center position so that the gap center vector points towards the target NUMA node, thereby utilizing sparse resource regions while also considering the physical layout of the NUMA node topology.
[0127] This application constructs a gap center vector pointing from the origin of the multidimensional resource space to the adjusted gap center position. The gap center vector indicates the deployment direction in sparsely distributed resource areas, and this direction takes into account the NUMA node topology, so that the process to be scheduled can avoid overlapping with existing associated processes in resource usage after migration, and can also be placed in a reasonable position in the NUMA node topology.
[0128] For example, assume that the coordinates of the two endpoints P1 and P2 of the maximum spatial gap in the multidimensional resource space are (0.2, 0.1, 0.05) and (0.8, 0.9, 0.95) respectively, and the initial gap center position is (0.5, 0.5, 0.5). The process corresponding to P1 runs on NUMA node 1, and the process corresponding to P2 runs on NUMA node 3. The NUMA node topology distance information shows that the topology distance between node 1 and node 2 is 10, the topology distance between node 3 and node 2 is 10, and the topology distance between node 1 and node 3 is 20. Therefore, the topology distance between node 2 and nodes 1 and 3 is moderate. This application adjusts the gap center position to point towards node 2, constructs a gap center vector pointing from the origin to the adjusted position, and guides the process to be scheduled to migrate to the CPU core on node 2, thereby achieving deployment in resource-sparse areas while taking into account the NUMA node topology.
[0129] Step C3: When the resource distribution pattern is identified as linear, the dominant direction is extracted based on the arrangement of each spatial coordinate point, and an orthogonal deployment vector perpendicular to the dominant direction is constructed. The orthogonal deployment vector is used as the resource distribution feature parameter.
[0130] The dominant direction refers to the main direction in which the spatial coordinate points are arranged and extended in the multidimensional resource space. This application performs linear fitting on the coordinate data of each spatial coordinate point to obtain a fitted straight line, and the direction of the fitted straight line is the dominant direction.
[0131] Specifically, assume there are n related processes with spatial coordinates (x... i ,y i ,z i (i=1,2,...,n), this application uses the least squares method to perform linear fitting on the coordinate points to obtain the direction vector (a,b,c) of the fitted line. The direction vector (a,b,c) indicates that each spatial coordinate point is mainly arranged along this direction in the multidimensional resource space, reflecting the linear change trend of the associated process in resource use.
[0132] This application constructs orthogonal vectors perpendicular to the dominant direction in a multidimensional resource space. The construction of these orthogonal vectors follows the geometric relationship of vector orthogonality, meaning the dot product of the orthogonal vector and the dominant direction vector is zero. In three-dimensional space, there are infinitely many orthogonal vectors perpendicular to the direction vector (a, b, c). This application selects the orthogonal vector whose magnitude equals the discrete feature as the initial orthogonal deployment vector. The starting point of the initial orthogonal deployment vector is the resource distribution center, and its direction is perpendicular to the dominant direction, indicating the deployment direction that deviates from the linear arrangement direction.
[0133] Furthermore, this application adjusts the orthogonal deployment vector by incorporating NUMA node topology information. This application determines the CPU core where each associated process currently resides, and based on the attribution relationship between the CPU core and NUMA nodes, identifies which NUMA nodes each associated process is distributed across. This application statistically analyzes the distribution of associated processes across NUMA nodes, identifying which NUMA nodes the associated processes primarily traverse when arranged along the dominant direction. This application selects NUMA nodes from the NUMA node topology information that are at a moderate topological distance from the NUMA nodes in the dominant direction and are not on the extension line of the dominant direction as target NUMA nodes. This application adjusts the direction of the orthogonal deployment vector so that the orthogonal deployment vector is not only perpendicular to the dominant direction but also points towards the target NUMA node, thus deviating from the linear arrangement direction while still considering the NUMA node topology.
[0134] For example, assuming there are four associated processes within the resource influence domain, with spatial coordinates (0.2, 0.2, 0.1), (0.4, 0.3, 0.2), (0.6, 0.4, 0.3), and (0.8, 0.5, 0.4), the dominant direction vector obtained through linear fitting is (0.6, 0.3, 0.3), indicating that the associated processes are mainly arranged along the direction of simultaneous increase in CPU utilization, memory usage, and IO read / write speed. The resource distribution center is located at (0.5, 0.35, 0.25), with a discrete feature of 0.15. This application constructs an initial orthogonal deployment vector perpendicular to the dominant direction with a magnitude of 0.15. The associated process distribution shows that the four processes run on CPU0 and CPU1 of NUMA node 0 and CPU0 and CPU1 of NUMA node 1, respectively, with the dominant direction mainly spanning nodes 0 and 1. NUMA node topology information shows that the topological distance between node 2 and nodes 0 and 1 is moderate and not on the extension line of the dominant direction. This application adjusts the direction of the orthogonal deployment vector to point towards node 2, guiding the process to be scheduled to migrate to the CPU core on node 2, thereby deviating from the linear arrangement direction while taking into account the NUMA node topology.
[0135] Preferably, step 225 constructs corresponding resource distribution characteristic parameters for three different resource distribution patterns, incorporating NUMA node topology information during the construction process. For clustered distributions, a reverse deployment vector guides the scheduled process away from resource-concentrated areas and NUMA nodes. For dispersed distributions, a gap center vector guides the scheduled process to utilize sparse resource areas while selecting nodes with appropriate NUMA topology distances. For linear distributions, an orthogonal deployment vector guides the scheduled process away from the linear arrangement direction while avoiding NUMA nodes traversed by the linear arrangement. The construction methods of these three resource distribution characteristic parameters fully consider the distribution characteristics of each associated process in the multi-dimensional resource space and the NUMA topology of the underlying hardware, providing clear directional guidance for selecting the target CPU core for process migration. Compared with traditional scheduling methods that do not consider NUMA topology, this application adjusts resource distribution characteristic parameters by incorporating NUMA node topology information, enabling process migration decisions to simultaneously optimize logical resource space isolation and physical NUMA access latency. By selecting NUMA nodes with the largest topological distance in clustered distributions, selecting NUMA nodes with moderate topological distance in dispersed distributions, and selecting NUMA nodes that deviate from the dominant direction in linear distributions, this application achieves an organic combination of resource distribution characteristics and NUMA topology, avoiding the performance degradation problem caused by ignoring physical topological constraints based solely on logical resource distribution.
[0136] Preferably, step 220 maps the resource monitoring data of each associated process to a multi-dimensional resource space and identifies resource distribution patterns based on the geometric distribution characteristics of spatial coordinate points. This transforms the resource distribution within the resource influence domain into resource distribution feature parameters that can guide scheduling decisions. The resource distribution feature parameters express the preferred migration direction of the process to be scheduled in vector form. This direction simultaneously considers the resource coupling relationship between processes and the NUMA topology constraints of the underlying hardware, providing a quantitative basis for determining candidate CPU cores. Unlike container scheduling scenarios, this application utilizes NUMA node topology information at the operating system level, enabling resource scheduling decisions to further optimize physical memory access performance based on logical resource distribution optimization.
[0137] Step 300: Map the resource status of each CPU core to a multi-dimensional resource space, and select candidate CPU cores from each CPU core based on resource distribution characteristic parameters and determine the resource space isolation.
[0138] In some embodiments, step 300 is specifically implemented by steps 310 and 320:
[0139] Step 310: Map the resource status of each CPU core to a multi-dimensional resource space, and select candidate CPU cores from each CPU core based on resource distribution characteristic parameters.
[0140] Specifically, step 310 includes steps 311 to 313:
[0141] Step 311: Map the resource status of each CPU core to a multi-dimensional resource space to obtain the core space location of each CPU core.
[0142] Understandably, this application extracts status information such as CPU core load percentage and run queue length from the resource status of each CPU core collected in step 100, converting the CPU core resource status into a resource representation of the same dimension as process resource monitoring data. Specifically, this application determines the overall resource utilization level of a CPU core based on the CPU utilization, memory usage, and I / O read / write speed of all processes currently running on that CPU core, using these as coordinate components of the CPU core in a multi-dimensional resource space to form the core space location of each CPU core. This application reflects the resource usage status of each CPU core in the operating system by the distribution of the core space locations of each CPU core in the multi-dimensional resource space.
[0143] Step 312: Determine the spatial projection relationship between the location of each core space and the resource distribution characteristic parameters.
[0144] The spatial projection relationship is used to measure the projected distance of the core spatial location in the direction indicated by the resource distribution characteristic parameters. This application treats the resource distribution characteristic parameters as direction vectors in a multi-dimensional resource space, and determines the projection of the position vector corresponding to each core spatial location onto the direction of the resource distribution characteristic parameters. The position vector is a vector pointing from the origin of the multi-dimensional resource space to the core spatial location. The projection determination follows the geometric relationship of vector projection, and the projection length is the dot product of the position vector and the direction vector of the resource distribution characteristic parameters divided by the magnitude of the resource distribution characteristic parameter vector. A positive projection length indicates that the core spatial location is in the direction indicated by the resource distribution characteristic parameters, while a negative projection length indicates that the core spatial location is in the opposite direction.
[0145] Step 313: Select CPU cores with a forward projection relationship as candidate CPU cores.
[0146] It's easy to understand that CPU cores with a positive spatial projection relationship indicate that their core spatial location aligns with the deployment direction indicated by the resource distribution characteristic parameters. These parameters have already determined the preferred deployment direction based on the distribution patterns of related processes within the resource influence domain; therefore, CPU cores aligned with this preferred deployment direction are selected as candidate CPU cores. CPU cores with a negative spatial projection relationship, because their core spatial location is opposite to the preferred deployment direction, are unsuitable as migration targets for processes to be scheduled.
[0147] This application identifies candidate CPU cores by determining the spatial projection relationship of each CPU core in the deployment direction. The candidate CPU cores maintain a reasonable spatial separation from associated processes within the resource influence domain, reducing the likelihood of resource contention between the scheduled process and associated processes after migration.
[0148] Step 320: Determine the spatial isolation of resources.
[0149] Specifically, step 320 includes steps 321 and 322:
[0150] Step 321: Based on the resource status of candidate CPU cores and the resource monitoring data of related processes within the resource influence domain, construct the resource space mapping relationship between candidate CPU cores and resource influence domains.
[0151] It is understandable that the resource space mapping relationship represents the positional relationship between the candidate CPU core and each associated process within the resource influence domain in the multidimensional resource space. This application extracts the resource status of the candidate CPU core, which has been mapped to its core spatial location in step 311, and the resource monitoring data of each associated process within the resource influence domain, which has been mapped to spatial coordinate points in step 221. The Euclidean distance between the core spatial location of the candidate CPU core and the spatial coordinate points of each associated process is then determined. This application uses the Euclidean distance between the candidate CPU core and each associated process as the resource space mapping relationship, which reflects the degree of difference between the candidate CPU core's resource usage pattern and that of the associated processes within the resource influence domain.
[0152] Step 322: Based on the resource space mapping relationship, determine the resource space isolation degree between each candidate CPU core and the resource influence domain.
[0153] Resource space isolation is used to measure the degree of spatial separation between the candidate CPU core and each associated process within the resource influence domain in the multidimensional resource space. This application determines the Euclidean distance between the candidate CPU core and each associated process within the resource influence domain, i.e., the resource space mapping relationship determined in step 321, and uses the average of these Euclidean distances as the resource space isolation. A larger resource space isolation value indicates a greater average distance between the candidate CPU core and each associated process within the resource influence domain in the multidimensional resource space, and a higher degree of spatial separation.
[0154] Preferably, step 300 maps the resource status of each CPU core to a multi-dimensional resource space, filters candidate CPU cores based on resource distribution characteristic parameters, and determines the resource space isolation degree between each candidate CPU core and the resource influence domain. This narrows the migration target of the process to be scheduled from all CPU cores to a set of candidate CPU cores, and provides a quantitative basis for selecting the optimal target core from the candidate CPU cores. This application filters CPU cores that are consistent with the direction indicated by the resource distribution characteristic parameters through spatial projection relationships, ensuring that the candidate CPU cores meet the preferred deployment principles of being far from resource-concentrated areas, utilizing resource-sparse areas, or deviating from the linear arrangement direction in resource space location. The resource space isolation quantifies the spatial separation degree between the candidate CPU core and the resource influence domain, providing a clear evaluation index for selecting candidate CPU cores with a larger resource space isolation degree as the target core.
[0155] Step 400: Respond to the resource scheduling request and migrate the process to be scheduled to the target core selected from the candidate CPU cores based on the resource space isolation through the operating system kernel interface.
[0156] In some embodiments, step 400, "migrating the process to be scheduled to the target core selected from candidate CPU cores based on resource space isolation through the operating system kernel interface", includes steps 410 to 430:
[0157] Step 410: Select the target core from the candidate CPU cores based on the resource space isolation.
[0158] It is easy to understand that a candidate CPU core with a high resource space isolation degree indicates a significant difference in resource usage patterns between the candidate CPU core and the associated processes within the resource influence domain, and a clear spatial separation. This application selects the candidate CPU core with the higher resource space isolation degree value from the candidate CPU cores determined in step 322 as the target core. Running the scheduled process on the candidate CPU core with the higher resource space isolation degree can reduce the possibility of resource contention between the scheduled process and associated processes within the resource influence domain.
[0159] Step 420: Bind the process to be scheduled to the target kernel through the process affinity setting interface of the operating system kernel.
[0160] It is understandable that the process affinity setting interface is a system call interface provided by the operating system kernel for setting the CPU core on which a process runs. In the Linux operating system, the process affinity setting interface is the sched_setaffinity system call. This application calls the process affinity setting interface to set the CPU affinity mask of the process to be scheduled to the identifier of the target core, thereby enabling the operating system scheduler to schedule the process to be scheduled to run on the target core.
[0161] Step 430: Migrate the memory pages of the process to be scheduled to a memory node with NUMA affinity to the target kernel through the operating system kernel's memory management interface.
[0162] Specifically, step 430 includes steps 431 to 435:
[0163] Step 431: Determine the target memory node with NUMA affinity to the target core based on NUMA node topology information.
[0164] It should be noted that NUMA affinity refers to the topological relationship between CPU cores and memory nodes in a NUMA architecture. The CPU core experiences the lowest access latency when accessing memory nodes located on the same NUMA node. This application extracts the NUMA node identifier of the target core from the NUMA node topology information collected in step 100, and uses this NUMA node as the target memory node. Since the target memory node and the target core have NUMA affinity, after the memory pages of the process to be scheduled are migrated to the target memory node, the target core can achieve the lowest access latency when accessing the memory of the process to be scheduled.
[0165] Step 432: Collect the CPU cache hit rate and memory access latency of the process to be scheduled before migration through the operating system kernel interface, as a benchmark performance indicator.
[0166] Here, CPU cache hit rate represents the proportion of CPU cache hits when the scheduled process accesses data, and memory access latency represents the average latency time when the scheduled process accesses memory. This application collects CPU cache hit rate and memory access latency data of the scheduled process before migration through the performance monitoring interface provided by the operating system kernel (such as the perf tool interface of the Linux system), and uses it as a benchmark performance indicator for performance comparison after migration.
[0167] Step 433: Migrate the memory pages of the process to be scheduled from the original memory node to the target memory node through the memory management interface.
[0168] It is understandable that the memory management interface is a system call interface provided by the operating system kernel for migrating process memory pages. In the Linux operating system, the memory management interface is the migrate_pages system call. This application calls the memory management interface to migrate the memory pages of the process to be scheduled from the original memory node to the target memory node, completing the physical location migration of the memory pages.
[0169] Step 434: Use the CPU cache hit rate and memory access latency of the processes to be scheduled after migration as performance metrics after migration.
[0170] It is easy to understand that after the memory page migration is completed, this application once again collects the CPU cache hit rate and memory access latency data of the process to be scheduled through the performance monitoring interface provided by the operating system kernel, as a performance indicator after the migration.
[0171] Step 435: Verify the effectiveness of resource scheduling based on the comparison results between the baseline performance metrics and the post-migration performance metrics.
[0172] In this application, the performance metrics after migration are compared with baseline performance metrics to determine the changes in CPU cache hit rate and memory access latency. If the CPU cache hit rate after migration is higher than the CPU cache hit rate before migration, or the memory access latency after migration is lower than the memory access latency before migration, it indicates that the resource scheduling operation has improved the performance of the process to be scheduled, thus verifying the effectiveness of resource scheduling.
[0173] Preferably, steps 410 to 430 select a candidate CPU core with a high resource space isolation as the target core, and complete the migration of the process to be scheduled to the target core through the process affinity setting interface and memory management interface, thus realizing process scheduling based on resource space isolation. This application not only binds the process to be scheduled to the target core, but also migrates the memory pages of the process to be scheduled to the memory nodes with NUMA affinity to the target core, thereby further optimizing physical memory access performance based on logical resource space isolation. Compared with traditional scheduling methods that only set process affinity without migrating memory pages, this application avoids the performance degradation caused by the process still needing to access memory across NUMA nodes after being bound to a new CPU core by simultaneously completing process binding and memory page migration. By collecting CPU cache hit rate and memory access latency before and after migration, this application can verify the effectiveness of resource scheduling operations and provide feedback for subsequent scheduling decisions.
[0174] Preferably, this application achieves resource scheduling through operating system collaborative optimization by identifying resource influence domains based on inter-process communication records, determining resource distribution characteristic parameters based on resource distribution patterns, screening candidate CPU cores based on resource distribution characteristic parameters, and selecting target cores based on resource space isolation. This application transforms discrete inter-process communication relationships into continuous multi-dimensional resource space distribution, and determines the preferred deployment direction through spatial geometry methods, thus completing the domain transformation from a process communication topology problem to a resource space geometry optimization problem. In resource scheduling decisions, this application comprehensively considers inter-process communication relationships, resource coupling relationships, and NUMA node topology, ensuring that the process to be scheduled, after migration, remains isolated from related processes within the resource influence domain in the logical resource space and is positioned appropriately in the physical NUMA topology, avoiding resource contention problems and NUMA remote access performance degradation caused by scheduling based solely on CPU load.
[0175] Based on the above steps, this application also includes the following embodiments:
[0176] See Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The electronic device 40 includes: a processor 41, a memory 42, and a computer program; wherein,
[0177] The memory 42 is used to store the computer program, and the memory may also be flash memory. The computer program is, for example, an application program or functional module that implements the above method.
[0178] The processor 41 is configured to execute the computer program stored in the memory to implement the various steps performed by the device in the above method. For details, please refer to the relevant descriptions in the preceding method embodiments.
[0179] Alternatively, the memory 42 can be either standalone or integrated with the processor 41.
[0180] When the memory 42 is a device independent of the processor 41, the device may further include:
[0181] Bus 43 is used to connect the memory 42 and the processor 41.
[0182] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A resource scheduling method for operating system collaborative optimization, characterized in that, include: Based on the operating system kernel interface, resource monitoring data of each process, inter-process communication records, resource status of each CPU core, and NUMA node topology information are obtained. Based on the inter-process communication records, the resource influence domain of the process to be scheduled is determined, the resource monitoring data of each process within the resource influence domain is mapped to coordinate points in a multi-dimensional resource space, and the resource distribution characteristic parameters are determined based on the coordinate points and NUMA node topology information. The resource status of each CPU core is mapped to a multi-dimensional resource space, and candidate CPU cores are selected from each CPU core based on the resource distribution characteristic parameters and the resource space isolation is determined. In response to a resource scheduling request, the process to be scheduled is migrated to the target core selected from candidate CPU cores based on the resource space isolation degree through the operating system kernel interface.
2. The method according to claim 1, characterized in that, The step of determining the resource influence domain of the process to be scheduled based on the inter-process communication records includes: Based on the inter-process communication records, processes that have a direct communication relationship with the process to be scheduled are identified as first-level associated processes; Based on the resource monitoring data of the process to be scheduled and each of the first-level associated processes, the resource coupling relationship is determined; Traverse the inter-process communication records of the first-level associated processes to determine the direct communication processes of the first-level associated processes as second-level associated processes. Based on the resource coupling relationship, the boundary range of the resource influence domain is determined, and the process to be scheduled and the associated processes at all levels located within the boundary range are regarded as associated processes within the resource influence domain.
3. The method according to claim 2, characterized in that, Determining the boundary range of the resource influence domain based on the resource coupling relationship includes: Construct a resource space metric in a multi-dimensional resource space for the first-level associated process and the process to be scheduled; The representation modulus of the resource monitoring data of the process to be scheduled in the multidimensional resource space is used as the resource benchmark metric. The communication type between the primary associated process and the process to be scheduled is determined based on the inter-process communication records; the communication type includes shared memory and pipe communication. Based on the comparison results between the resource space metric and the resource baseline metric, and whether there is shared memory or pipe communication between the first-level associated process and the process to be scheduled, it is determined whether the first-level associated process is included in the resource influence domain.
4. The method according to claim 1, characterized in that, The process of mapping resource monitoring data of each process within the resource influence domain to coordinate points in a multi-dimensional resource space, and determining resource distribution characteristic parameters based on the coordinate points and NUMA node topology information, includes: The resource monitoring data of each associated process is mapped to a multi-dimensional resource space to obtain the spatial coordinates of each associated process; Determine the resource distribution center of the spatial coordinate points; Determine the discrete characteristics of each spatial coordinate point relative to the resource distribution center; Based on the discrete features and the spatial topological relationship of the spatial coordinate points, the resource distribution pattern of the associated processes is identified; Based on the NUMA node topology information, the resource distribution characteristic parameters are determined according to the resource distribution pattern.
5. The method according to claim 4, characterized in that, The process of identifying the resource distribution pattern of associated processes based on the discrete features and the spatial topological relationship of the spatial coordinate points includes: Establish the spatial directional relationship between each spatial coordinate point and the resource distribution center, and statistically analyze the angular distribution interval of the spatial directional relationship; Based on the comparison results of the discrete features and the modulus of the resource distribution center, and the comparison results of the angular distribution interval and the proportional relationship between the modulus and the discrete features, the resource distribution pattern is identified as a clustered distribution, a dispersed distribution, or a linear distribution.
6. The method according to claim 5, characterized in that, The step of determining the resource distribution characteristic parameters based on the resource distribution pattern, in conjunction with the NUMA node topology information, includes: When the resource distribution pattern is identified as the clustered distribution, a reverse deployment vector is constructed based on the resource distribution center and the NUMA node topology information, and the reverse deployment vector is used as the resource distribution feature parameter. When the resource distribution pattern is identified as the dispersed distribution, the maximum spatial gap between each spatial coordinate point is identified, and a gap center vector is constructed based on the endpoint position of the maximum spatial gap and the NUMA node topology information. The gap center vector is used as the resource distribution feature parameter. When the resource distribution pattern is identified as a linear distribution, the dominant direction is extracted based on the arrangement of each spatial coordinate point, and an orthogonal deployment vector perpendicular to the dominant direction is constructed. The orthogonal deployment vector is used as the resource distribution feature parameter.
7. The method according to claim 1, characterized in that, The process of mapping the resource status of each CPU core to a multi-dimensional resource space and filtering candidate CPU cores from each CPU core based on the resource distribution characteristic parameters includes: The resource states of each CPU core are mapped to the multidimensional resource space to obtain the core space location of each CPU core; Determine the spatial projection relationship between each of the core spatial locations and the resource distribution characteristic parameters; CPU cores whose spatial projection relationship is a forward projection are selected as candidate CPU cores.
8. The method according to claim 7, characterized in that, Determining the spatial isolation degree of resources includes: Based on the resource status of the candidate CPU core and the resource monitoring data of the associated processes within the resource influence domain, a resource space mapping relationship between the candidate CPU core and the resource influence domain is constructed. Based on the resource space mapping relationship, the resource space isolation degree between each candidate CPU core and the resource influence domain is determined.
9. The method according to claim 1, characterized in that, The step of migrating the process to be scheduled to the target core selected from candidate CPU cores based on the resource space isolation degree through the operating system kernel interface includes: The target core is selected from the candidate CPU cores based on the resource space isolation. The process to be scheduled is bound to the target kernel through the process affinity setting interface of the operating system kernel; The memory pages of the process to be scheduled are migrated to memory nodes with NUMA affinity to the target kernel through the memory management interface of the operating system kernel.
10. The method according to claim 9, characterized in that, The step of migrating the memory pages of the process to be scheduled to a memory node with NUMA affinity to the target kernel via the operating system kernel's memory management interface includes: Based on the NUMA node topology information, a target memory node with NUMA affinity to the target core is determined; The CPU cache hit rate and memory access latency of the process to be scheduled before migration are collected through the operating system kernel interface and used as benchmark performance indicators. The memory pages of the process to be scheduled are migrated from the original memory node to the target memory node through the memory management interface. The CPU cache hit rate and memory access latency of the scheduled process after the migration are used as performance indicators after the migration. The effectiveness of resource scheduling is verified by comparing the baseline performance metrics with the post-migration performance metrics.