Resource scheduling method and device and electronic equipment

By responding to the resource call request of the target process in the smart terminal electronic device and obtaining and allocating the target partition identity, the cache hit rate reduction caused by resource competition is solved, and more efficient resource scheduling and response performance is achieved.

CN119271420AActive Publication Date: 2025-01-07SMARTER SILICON (SHANGHAI) TECH CO LTD

Patent Information

Application Number
CN202411803238.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-01-07
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

Different types of application processes in smart terminal electronic devices are prone to resource competition when accessing cache resources, resulting in the problem of lower hit rate.

Method used

By responding to the resource call request of the target process, obtain its target partition identity, and assign the corresponding target resource partition to the target process according to the identifier, use resource configuration strategies to ensure that the partition matches the process, and dynamically adjust the partition identity to respond to the process's resource scheduling. Change of priority.

Benefits of technology

It improves the efficiency of process resource calls and system response performance, and improves the utilization rate and user experience of cache resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271420A_ABST
    Figure CN119271420A_ABST
Patent Text Reader

Abstract

The invention discloses a resource scheduling method and device and electronic equipment, and relates to the technical field of data processing.The method comprises the steps that in response to a resource calling request of a target process of the electronic equipment, a target partition identifier corresponding to the target process is obtained; based on the target partition identifier, allocating a corresponding target resource partition to the target process, the target resource partition being one of a plurality of cached resource partitions; wherein the target partition identifier is allocated to the target process when the target event occurs in the process, and the target event is related to the resource scheduling priority change of the process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and more specifically to a resource scheduling method, device and electronic device. Background Art

[0002] Currently, the processing system of electronic devices will add a high-speed cache memory (cache for short) between the processor and the memory. By setting up the cache, the speed difference between the processor and the memory can be compensated. That is, the information to be used by the processor is transferred to the cache, so that the processor can directly obtain the information from the cache, thereby improving the access speed.

[0003] However, for electronic devices such as smart terminals that are strongly related to user interaction, when different types of application processes in the electronic devices access cache resources, resource competition and reduced hit rate are prone to occur. Summary of the invention

[0004] In view of this, this application provides the following technical solutions: A resource scheduling method, comprising: In response to a resource call request of a target process of an electronic device, obtaining a target partition identifier corresponding to the target process; Based on the target partition identifier, assigning a corresponding target resource partition to the target process, wherein the target resource partition is one of a plurality of cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

[0005] Optionally, allocating a corresponding target resource partition to the target process based on the target partition identifier includes: Determine a target partition identifier corresponding to the target process; According to the resource configuration strategy corresponding to the target partition identifier, the corresponding target resource partition is allocated to the target process, the resource configuration strategy includes the correspondence between the partition identifier and the resource partition, and the target partition identifier is one of the partition identifiers.

[0006] Optionally, it also includes: In response to a target event occurring in a process, a corresponding partition identifier is updated for the process.

[0007] Optionally, in response to a target event occurring in a process, updating a corresponding partition identifier for the process includes: Obtain a first process identifier of a first process in which a target event occurs; Selecting a first partition identifier from the plurality of partition identifiers, wherein the resource configuration policy corresponding to the first partition identifier corresponds to the resource scheduling priority of the first process; The corresponding information of the first process identifier is written into the first partition identifier.

[0008] Optionally, writing the corresponding information of the first process identifier into the first partition identifier includes: Parsing the first process identifier to obtain first thread identifiers corresponding to the first process; All first thread identifiers corresponding to the first process are written into the first partition identifier.

[0009] Optionally, the multiple partition identifiers are respectively configured with different resource allocation strategies, and the resource allocation strategy includes at least: resource partitions corresponding to the partition identifiers; The multiple partition identifiers include at least two types of partition identifiers, and the two types of partition identifiers correspond to resource allocation strategies with at least two different resource call priorities, respectively.

[0010] Optionally, it also includes: In response to the target process being updated from the first process group to the second process group, it is determined that a target event occurs in the target process.

[0011] A resource scheduling device, comprising: An acquisition unit, configured to respond to a resource call request of a target process of an electronic device and acquire a target partition identifier corresponding to the target process; an allocating unit, configured to allocate a corresponding target resource partition to the target process based on the target partition identifier, wherein the target resource partition is one of the plurality of cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

[0012] An electronic device, comprising: a cache, the cache comprising at least one resource partition; A scheduling component, wherein the scheduling component is used to execute the resource scheduling method as described in any one of the above.

[0013] Optionally, it also includes: The configuration module is used to store resource configuration strategies, wherein the resource configuration strategies include the corresponding relationship between the partition identifier and the resource partition. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0015] Figure 1 A schematic diagram of a resource scheduling method provided in an embodiment of the present application; Figure 2 A schematic diagram of the information format of a resource configuration strategy provided in an embodiment of the present application; Figure 3 A flowchart of a resource scheduling method based on update events of process groups provided in an embodiment of the present application; Figure 4 A flowchart of a partition identification updating method provided in an embodiment of the present application; Figure 5 A schematic diagram of a resource processing module of an electronic device provided in an embodiment of the present application; Figure 6 A schematic diagram of an initialization process provided in an embodiment of the present application; Figure 7 A schematic diagram of a process for dynamically allocating partition identifiers to a process provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of a resource scheduling device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0017] The terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0018] The embodiment of the present application provides a resource scheduling method, which is applied to an application scenario of scheduling cache resources corresponding to an electronic device. Among them, the electronic device can be various types of devices with information processing functions, such as smart phones, tablet computers, wearable devices, portable computers, all-in-one machines, desktop computers, vehicle-mounted terminals, servers and server clusters. A variety of storage modules may be included in the electronic device, such as memory, cache and external storage modules. Adding a cache (cache memory, cache) between the CPU (central processing unit) and the memory of the electronic device can reduce data access time and improve system performance. In a computer system, the cache is usually divided into multiple levels, from the CPU cache (such as L1, L2, L3 cache) to the main memory (RAM), and then to the disk cache. In the embodiment of the present application, efficient calling of cache resources can be achieved to improve the processing performance of the system.

[0019] See also Figure 1 , is a flow chart of a resource scheduling method provided in an embodiment of the present application, the method may include the following steps: S101. In response to a resource call request of a target process of an electronic device, obtain a target partition identifier corresponding to the target process.

[0020] S102: Allocate a corresponding target resource partition to the target process based on the target partition identifier.

[0021] An electronic device will execute multiple processes in the running state. A process is the execution flow of a program in the electronic device regarding a data set. It is the unit for resource allocation and scheduling in the system and represents the running instance of the program. The process that currently needs to call cache resources in the electronic device is determined as the target process, that is, the resource call request is a cache resource call request. The resource configuration strategy executed by the electronic device includes the correspondence between partition identifiers and resource partitions. Resource partitions refer to the divided areas in the cache. For example, the partition identifiers include 01, 02, and 03. Correspondingly, partition identifier 01 can correspond to resource partition 001; partition identifier 02 can correspond to resource partition 002; partition identifier 03 can correspond to resource partition 003, etc. The correspondence between partition identifiers and resource partitions can be configured when the cache system is initialized.

[0022] The target partition identifier corresponding to the target process is the identifier information assigned to the target process when the target event occurs in the process, and the target event is related to the change of the resource scheduling priority of the process. For example, the target event can be a switching event of the response priority of the current process. Specifically, the target event can be a switching event of the application in the electronic device. When the electronic device switches from running the first application to the second application, the response priority corresponding to the second application will be higher than the priority of the first application. Further, the response priority of each process corresponding to the second application will be higher than the priority of each process corresponding to the first application. Therefore, when the application running in the electronic device is switched, the switching event of the response priority of the process will be triggered, and the update of the partition identifier of the target process can be further triggered according to the event. In the embodiment of the present application, the target partition identifier corresponding to the target process is the partition identifier currently configured by the target process. The cache resources of the target resource partition corresponding to the target partition identifier can meet the resource call request of the target process, and the cache resources of the target resource partition can further meet the response requirements of the target process.

[0023] After obtaining the target resource partition corresponding to the target partition identifier, the target process will be assigned to the target resource partition so that the target process can call the cache resources in the target resource partition. In the embodiment of the present application, the correspondence between the partition identifier and the resource partition pre-stored in the electronic device is configured in advance, and each resource partition can correspond to a cache resource with different characteristics, so that the cache resources corresponding to each partition identifier can be different. Specifically, the resource partitions corresponding to each partition identifier can all be resource partitions with different characteristics, such as the resource storage capacity of the resource partition corresponding to each partition identifier is different, or a part of the resource partitions corresponding to each partition identifier is the same and the other part is different. It is also possible to divide each resource partition into different levels according to its characteristics, and the resource partitions under each level can be one or more, for example, the storage capacity range of the resource partitions corresponding to different levels is different, such as the storage capacity of each resource partition of the first level is greater than the storage capacity of each resource partition of the second level. Specifically, the characteristics of each resource partition can be pre-configured according to real-time application requirements, and the corresponding relationship between the partition identifier and each resource partition can be further configured.

[0024] However, the correspondence between the process and the partition identifier in the electronic device is not fixed. When a resource call request of the target process is received, the current target partition identifier corresponding to the target process will be determined, so that the target process can be allocated to the target resource partition that best matches it. For example, the target event can be a switching event of an application in an electronic device. When the target process runs the first application in the electronic device, it can be a background process, and the target process corresponds to the first partition identifier; when the electronic device currently switches to the second application, the target process can be a foreground process, and the partition identifier of the target process can be determined as the second partition identifier. The second resource partition corresponding to the second partition identifier has more callable cache resources than the first resource partition corresponding to the first partition identifier, which can better meet the cache resource call requirements of the target process as a foreground process, and improve the process resource call requirements and the response performance of the system. In the present application, the information included in the cache resource can be determined based on the attribute information corresponding to the cache resource, such as the cache resource includes: storage space size, cache granularity, cache data synchronization configuration mechanism, etc. For example, the cache space is usually allocated resources in units of portion (portion can be a unit data block in the cache space), and the cache partition with more cache resources includes more cache data blocks (portion).

[0025] The resource scheduling method of the embodiment of the present application is described below in conjunction with specific application scenarios.

[0026] In one implementation of an embodiment of the present application, based on the target partition identifier, a corresponding target resource partition is allocated to the target process, including: determining the target partition identifier corresponding to the target process; and allocating the corresponding target resource partition to the target process according to the resource configuration policy corresponding to the target partition identifier.

[0027] The resource configuration strategy includes the correspondence between the partition identifier and the resource partition, and the target partition identifier is one of the partition identifiers, that is, the cache resources in the target resource partition corresponding to the target partition identifier can match the resource call requirements of the target thread. In order to quickly determine the resource partition that meets the process, a resource configuration strategy can be generated in advance and stored in the electronic device, such as a scheduling component that executes the resource call method in the electronic device, so that the target resource partition can be determined according to the target partition identifier corresponding to the target process and the resource configuration strategy, and the target resource partition can be configured, such as bandwidth configuration, cache data reading configuration, etc.

[0028] Specifically, when generating the resource configuration strategy, different resource partitions can be determined for different partition identifiers. For example, the number of cache resources in some resource partitions can be larger, or the corresponding cache resources can have stronger real-time update synchronization characteristics, so as to meet different cache resource call requirements. Figure 2 , is a schematic diagram of the information format of a resource configuration strategy provided in an embodiment of the present application. Figure 2 In the figure, PARTID is used to represent the partition identifier, and CPBM is used to represent the cache strategy. The corresponding resource partition locations in the cache strategy are listed in the figure. Figure 2 The corresponding resource partition is identified in the form of hexadecimal encoding. Specifically, the resource partition may correspond to multiple resource blocks in the L3 layer cache (i.e., shared cache) corresponding to the DSU, that is, the resource block corresponding to the corresponding partition identifier can be determined through the resource configuration strategy. The DSU is part of the ARMDynamIQ technology. It is a CPU cluster design that allows different types and numbers of CPU cores (including large cores and small cores) to be combined together to share resources and communicate. The correspondence between the partition identifier and the resource partition can be stored in the corresponding area as a configuration file, so that when calling resources, the resource partition corresponding to the current partition identifier can be obtained based on the configuration file. For example, the configuration file can be an embedded management unit file MSC file. In order to meet the resource calling requirements of different processes, some partition identifiers can be configured with a large number of resource blocks, and some partition identifiers can be configured with a small number of resource blocks. In this way, if there is a foreground process with a high response requirement, the foreground process can be allocated to the partition identifier corresponding to a large number of resource blocks to meet the resource calling requirements of the foreground process, so that the foreground process can respond to the user's operation in a timely manner and improve the user experience.

[0029] In order to meet the cache resource call requirements of the corresponding process in real time, the corresponding relationship between the process and the partition identifier is not fixed in the embodiment of the present application, but is updated according to the change of resource scheduling priority. Specifically, in response to the occurrence of a target event in the process, the corresponding partition identifier is updated for the process, and then the target resource partition of the process is dynamically adjusted to meet the performance requirements.

[0030] The target event is related to the resource scheduling priority change of the process. For example, the target event can be a switching event of an application currently running on the electronic device, or a user-triggered operation event, etc. Correspondingly, the target event can also be generated when the process is configured or adjusted.

[0031] The switching events can be monitored by capturing key system-related signals. For example, it can be combined with the change information of the usual process grouping, that is, whether the target event is generated is determined based on the update of the process grouping. In this way, the monitoring process of the target event in the embodiment of the present application can be combined with the update event of the process grouping, which is easier to implement in technology. At the same time, the relevant information allocated by the general process grouping can make it more convenient to distinguish different processes, and it is also convenient to reuse the existing technology, thereby improving the efficiency of resource call processing.

[0032] In one embodiment, a flowchart of a method for resource scheduling based on update events of process groups is also provided. Figure 3 , the method may include the following steps: S301: In response to a target process being updated from a first process group to a second process group, determining that a target event occurs in the target process.

[0033] S302: Determine a target partition identifier corresponding to the target process based on the target event.

[0034] S303: Allocate a corresponding target resource partition to the target process based on the target partition identifier.

[0035] In order to facilitate the response and management of processes, processes can be grouped. For example, in an operating system, process grouping can realize the allocation of different resource restrictions to processes in different groups, such as CPU time, memory or other storage resource usage, I / O bandwidth, etc. It can also be grouped according to the priority of the process to ensure that high-priority processes can obtain more resources and faster responses. Different process groups can correspond to different partition identifiers, thereby corresponding to different resource partitions. It should be noted that in the embodiment of the present application, the processes in each process group are not fixed. Based on the operating state of the electronic device, the response mode, and the influence of the application program being run, the processes in each process group will be updated. When the process group update is detected, the corresponding target event will be generated, so that the partition identifier corresponding to the process will also be updated after the target event is detected. For example, in the previous process monitoring cycle, the target process belongs to the background process, which is in the first process group, and the first process group corresponds to the first partition identifier. At this time, the target process corresponds to the first partition identifier. When the response state of the application in the electronic device changes, the corresponding process group will be updated. If the target process belongs to the foreground process at this time, the target process can be updated to the second process group corresponding to the foreground process. The second process group corresponds to the second partition identifier. At this time, the target partition identifier corresponding to the target process is the second partition identifier, and it can call the cache resources of the second resource partition corresponding to the second partition identifier. In this way, the process in the electronic device can be matched to the optimal cache resource in real time, meet its cache resource call requirements, and improve response efficiency.

[0036] In this embodiment, the general Control Groups (CGroup) technology for managing processes can be combined, which can isolate physical resources for processes, so as to reduce mutual interference between processes and improve the response speed and stability of the system. For example, the process grouping can be achieved through the CGroup technology, such as assigning the foreground process to the corresponding foreground process group and the background process to the corresponding background process group. Then the relevant information of the process can also be dynamically adjusted through this technology, such as dynamically changing the relevant information of each process in the process group, for example, according to the current running state of the electronic device, the corresponding process is added to the relevant process group, or the process in the relevant process group is adjusted, such as the current application is switched, and some processes in the background process group can be adjusted to the foreground process group. Correspondingly, in the embodiment of the present application, the scheduling component that executes the resource scheduling method can be data-connected with the component that executes the CGroup process group allocation information, so that the scheduling component can obtain the relevant update information of the process group, thereby determining whether to adjust the partition identifier of the corresponding process according to these update information, so as to achieve the reuse of the existing technology, making the technology more convenient to implement, and making the resource scheduling processing more efficient.

[0037] Furthermore, in one implementation of the embodiment of the present application, a partition identification updating method is also included, and the method is used to update the corresponding partition identification for the process in response to the occurrence of a target event in the process. Figure 4 , the method may include the following steps: S401: Obtain a first process identifier of a first process in which a target event occurs.

[0038] S402: Select a first partition identifier from multiple partition identifiers.

[0039] S403: Write the corresponding information of the first process identifier into the first partition identifier.

[0040] Wherein, the resource configuration strategy corresponding to the first partition identifier corresponds to the resource scheduling priority of the first process. Specifically, the first process in which the target event occurs may be the process that generates the target event, such as a newly started process. Correspondingly, the first process may also be the process affected by the target event, such as the target event refers to the user of the electronic device starting an audio application, and the corresponding audio-related process is the first process. Then, the first process may be parsed to determine the process feature information corresponding to the first process, wherein the process feature information may include the process response requirements, the frequency of the process calling resources, the amount of information of the process calling cache resources, the number of threads corresponding to the process, etc. Then, according to the process feature information corresponding to the first process, the first partition identifier matching the first process is determined. Wherein, in the process of determining the first partition identifier, the resource configuration strategy corresponding to the partition identifier may also be obtained, and the first partition identifier corresponding to the first process may be determined based on the corresponding relationship between the resource configuration strategy and the resource scheduling priority. Correspondingly, after determining the first process in which the target event occurs, the first grouping information including the first process identifier may also be determined, and the appropriate partition identifier may be determined according to the first grouping information, that is, the first partition identifier is obtained. The process of grouping processes is usually implemented based on CGroup technology. CGroup technology is used to control CPU (central processing unit) resources. When grouping processes, it has taken into account the priority and other conditions related to process operation. Therefore, the corresponding relationship between the partition identifier and the grouping information corresponding to the CGroup can be established in advance. When a process is updated and enters a process group, the matching partition identifier is assigned to it. In this way, the corresponding management based on CGroup grouping is easier to implement by using the existing mechanism. At the same time, the cache resources subsequently allocated to the process in the group match the resource control of the CPU, which makes the allocation of resources more accurate and makes the subsequent operation efficiency of the process higher.

[0041] Among them, the resource configuration strategy includes the correspondence between the partition identifier and the resource partition, so that the resource partition that can meet the resource scheduling priority of the first process can be determined through the resource configuration strategy, so that the partition identifier corresponding to the resource partition is determined as the first partition identifier. For example, the first process needs to call cache resources frequently, that is, its corresponding resource scheduling priority is higher, and the partition identifier corresponding to the resource partition with higher response efficiency can be determined as the first partition identifier to improve the efficiency of cache resource calling. After the first partition identifier is determined, the first process identifier will be written into the first partition identifier to allocate the partition identifier to the first process, so that the cache resource calling requirements of the first process can be met based on the first partition identifier. Among them, the first process identifier can represent the process information of the first process, such as the thread information and configuration information included in the first process.

[0042] Furthermore, in an embodiment of the present application, the corresponding information of the first process identifier is written into the first partition identifier, including: parsing the first process identifier, obtaining each first thread identifier corresponding to the first process, and writing all first thread identifiers corresponding to the first process into the first partition identifier.

[0043] During the operation of an electronic device, a thread is an instance of a process, a unit called and executed by the CPU, and a basic unit that is smaller than a process and can run independently. Threads depend on the existence of processes and threads scheduled by the operating system. Therefore, it is necessary to parse the first process identifier, obtain the first thread identifiers corresponding to the first process, and then write all the first thread identifiers to the first partition identifier. In this way, when executing the first threads corresponding to the first process, the cache resources of the corresponding target resource partition can also be obtained based on the first partition identifier, ensuring the accuracy of cache resource calls and resource response efficiency.

[0044] In an embodiment of the present application, when determining the correspondence between each partition identifier and a resource partition, different resource partitions can be configured to meet resource calls of different requirements. In one implementation, the multiple partition identifiers in the embodiment of the present application are respectively configured with different resource allocation strategies, and the resource allocation strategy at least includes: resource partitions corresponding to the partition identifiers. Among them, the multiple partition identifiers include at least two types of partition identifiers, and the two types of partition identifiers correspond to resource allocation strategies of at least two different resource call priorities.

[0045] In this embodiment, the resource allocation strategy at least includes a resource partition corresponding to a partition identifier, that is, it can ensure which resource partition is allocated to the corresponding partition identifier. In order to meet the resource call requirements of different processes, multiple partition identifiers can be divided into at least two types of partition identifiers, such as a first type of partition identifier and a second type of partition identifier. Different types of partition identifiers correspond to resource allocation strategies with different resource call priorities. For example, the first type of partition identifier corresponds to a resource allocation strategy with a higher resource call priority, and the second type of partition identifier corresponds to a resource allocation strategy with a lower resource call priority. Specifically, a resource allocation strategy with a higher resource call priority may be to allocate the corresponding partition identifier to a resource partition with a first-level cache resource feature, wherein the cache resource feature may refer to the features of the corresponding resource partition such as the partition size, the number of resources, the resource update rate, and the resource response efficiency. Taking the cache resource feature as the resource partition size as an example, the first-level cache resource feature refers to a resource partition with a larger resource partition. Correspondingly, a resource allocation strategy with a lower resource call priority may be to allocate the corresponding partition identifier to a resource partition with a second-level cache resource feature, and the second-level cache resource feature may refer to a smaller corresponding resource partition. For example, the first type of partition identifier may be the partition identifier corresponding to the foreground process, which may correspond to a resource partition with more cache resource blocks; the second type of partition identifier may be the partition identifier corresponding to the background process, which may correspond to a resource partition with a relatively small number of cache resource blocks. In this way, more cache resources can be configured for the foreground process, reducing the problem of cache resource misses of the foreground process, and responding to user operations in a timely manner when interacting with the user, thereby improving the user experience.

[0046] The above method can be performed at the operating system level of the electronic device and implemented through the interaction between the operating system and the underlying cache management module.

[0047] Taking a Linux-based electronic device whose operating system is an Android system as an example, the resource calling method of an embodiment of the present application is explained. In order to complete the call to the cache resources more efficiently, the resource scheduling method can be executed by a scheduling component in the electronic device. Specifically, the scheduling component is determined according to the characteristics of the current electronic device. For example, the scheduling component can be an MPAM module provided by the ARM architecture, in which MPAM (Memory System Resource Partitioning and Monitoring) is used to divide and monitor memory system resources and supports memory system partitioning. Thereby, the process in the electronic device is controlled to use the corresponding cache resources through MPAM.

[0048] See also Figure 5 , is a schematic diagram of a resource processing module of an electronic device provided in an embodiment of the present application. Figure 5As shown in Figure 1, in the operating system of electronic devices, user space and kernel space are the two main system layers, where user space is the environment for application programs to run in the operating system. In this space, programs can only access limited resources and are managed by the operating system. Kernel space is the core part of the operating system. It has direct control over the hardware and is responsible for managing system resources, including CPU, memory, disk, and I / O devices.

[0049] Before executing a task, you can also pre-generate a resource configuration strategy, that is, pre-generate the corresponding relationship between each partition identifier and the corresponding resource partition. Figure 6 , is a schematic diagram of an initialization process provided in an embodiment of the present application, the initialization process corresponds to a process of pre-configuring the corresponding relationship between each partition identifier and the resource partition. Specifically, the initialization process includes the following steps: S601. Call Android-MPAM (monitoring component) when the core dynamic library registers the JNI method by registering the Android operating system process.

[0050] When libandroid_runtime (a core dynamic library in the Android system, which provides multiple functions and interfaces to enable applications to interact with the underlying Android system) registers the JNI method through register_android_os_Process (registering the Android operating system process), the initialization method of Android-MPAM (Android system memory system resource partitioning and monitoring module, referred to as the monitoring component) is called for initialization. Among them, libandroid_runtime provides an interface for the interaction between the Java layer and the Native layer (C / C++ code), which is implemented through Java NativeInterface (JNI). JNI allows Java code to call native library functions, and vice versa, call Java methods from native code.

[0051] S602: Based on the initialization method of Android-MPAM, determine the cache partition corresponding to each partition identifier.

[0052] Among them, the configuration principle of the initialization method of Android-MPAM is that the foreground process is configured with more cache resources than the background process. For example, the cache space can be divided to obtain multiple cache partitions. Specifically, the cache space can be in units of data cache blocks, and the number of data cache blocks in each cache partition is different. For example, the number of data cache blocks in the first-level cache partition is greater than the number of data cache blocks in the second-level cache partition. For example, the cache partition corresponding to the partition identifier of the foreground process can be configured with more data cache blocks than the cache partition corresponding to the partition identifier of the background process.

[0053] S603: Determine the correspondence between the partition identifier and the cache partition, and configure the correspondence into the scheduling component.

[0054] Among them, the scheduling component is used to execute the resource scheduling method and allocate the corresponding cache partition to the process. Usually, the correspondence between each partition identifier and the resource partition is determined according to the priority of the resource call. For example, the foreground process will be configured with more resource blocks than the background process, that is, the partition identifier corresponding to the foreground process will match the resource partition with a larger number of resources, and the partition identifier corresponding to the background process will match the resource partition with a smaller number of resources. Taking the cache resources corresponding to DSU as an example, the shared cache area L3 can be divided into multiple resource blocks. At the same time, the scheduling component MPAM will support the call of resource partitions corresponding to multiple partition identifiers. Each partition identifier uses the resource block of the corresponding resource partition according to the correspondence with the resource partition included in the resource configuration strategy. In this way, since the number of resource blocks of the resource partition configured by the foreground process is larger, the problem of cache resource misses of the foreground process can be reduced. When interacting with the user, it can respond to the user's operation more promptly, thereby improving the user experience.

[0055] See also Figure 7 , is a schematic diagram of a process for dynamically allocating partition identifiers to a process provided by an embodiment of the present application, wherein the process includes: S701. In response to the switching of the electronic device application, the upper-layer AMS component updates the priority of the process calling cache resources of the electronic device by adjusting the component.

[0056] In the user space, the application that interacts with the user will be monitored. When the application switching is detected, if the current user opens application 2 (represented by APP2) and closes application 1 (represented by APP1), it is equivalent to generating an application switching event, which will cause APP1 to return to the background and APP2 to enter the foreground. At this time, the upper-layer AMS component will update the process priority of the electronic device through the adjustment component. Among them, the AMS component can be a system server that interacts with the upper-layer application in the Android system, which is mainly responsible for the startup, switching, scheduling, and application process management and scheduling of related components in the Android system. The adjustment component can be a component in the Android system, such as an OoM Adjuster component, which is used to dynamically adjust the memory usage priority of the process according to the priority and memory usage of the process. In the embodiment of the present application, the adjustment component can adjust the priority of the process to the cache resource call in response to the switching of the application. For example, when it is detected that APP2 enters the foreground, the process corresponding to APP2 can be determined as the foreground process, so that the priority of its corresponding cache resource call is adjusted to a high priority, that is, the cache resource is scheduled first.

[0057] S702. In response to the priority update of the process calling the cache resource, the processing component adjusts the grouping update information of the target process, and sends the updated grouped target process to the monitoring component, so that the monitoring component can respond to the update grouping event and determine the updated target partition identifier corresponding to the target process.

[0058] Among them, the target process refers to the process whose resource scheduling priority changes after the current application is switched. After the cache resource call priority of the process is updated in response to the application switch, the process grouping of the corresponding target process can be adjusted through the corresponding processing component, and the updated process group can be added to the code library, such as libandroid_runtime in the Android system (which is a core dynamic library in the Android system, which contains the core code of the Android runtime environment (ART), including class loaders, virtual machines, JIT compilers, etc.), and then the code library passes the updated process group to the dynamic link library (such as libprocessgroup), which is responsible for managing process groups. Specifically, the processing component can be a functional component that performs process grouping changes, such as a component that performs CGroup functions. CGroup can organize processes into tree-structured groups and apply specific resource restrictions and policies to each group. In the embodiment of the present application, the grouping update of the target process can be realized based on this technology, such as adjusting the target process from the background process group to the foreground process group, thereby determining the partition identifier corresponding to the target process that meets the foreground process call resource mode. While updating the process grouping settings, the monitoring (such as Android-MPAM) will also be notified to pass the partition identifier corresponding to the target process after the grouping change to the scheduling component, so that the scheduling component can determine the resource partition of the corresponding thread based on the partition identifier.

[0059] In an embodiment of the present application, a monitoring component (such as Android-MPAM) is added to the user space (User Space), so that when the upper-layer AMS performs process grouping updates or switches, the monitoring component can transmit the partition identifier or related information corresponding to the updated target process to the scheduling component (such as DSU / SLC MPAM), so that the scheduling component can accurately allocate the corresponding cache resources and improve the efficiency and performance of process processing in the system.

[0060] S703: Obtain thread identification information of all threads corresponding to the target process, and write each thread identification information into a target partition identification corresponding to the target process.

[0061] S704: The target partition identifier written into the thread identifier information is passed to the scheduling component, so that the scheduling component determines the cache partition of the corresponding process based on the partition identifier.

[0062] For example, the thread identifiers (such as TID) of all threads of the process corresponding to the target partition identifier are obtained, and the thread identifier TID is written into the partition identifier of the scheduling component MPAM of the cache in the kernel space. The cache may be a cache corresponding to the DSU (DynamIQ Shared Unit), which is part of the ARM DynamIQ technology. It is a new CPU cluster design that allows different types and numbers of CPU cores (including large cores and small cores) to be combined together to share resources and communicate. The cache may also be an SLC (System Level Cache) cache, which is a system-level cache that serves as the next level cache for all connected CPUs and is usually implemented in a memory interconnect based on the AMBA Coherent Hub Interconnect (CHI) protocol.

[0063] Taking the scheduling component MPAM for DSU as an example, when the CPU needs to execute the corresponding task, the scheduling component will be configured into the CPU register according to the resource allocation policy of the partition identifier corresponding to the task. In this way, when the task is executed, the resource access of each thread of the process corresponding to the task can be restricted to the resource partition corresponding to the partition identifier in the resource allocation policy, thereby realizing efficient calling of cache resources.

[0064] In the embodiment of the present application, a resource scheduling device is also provided. Figure 8 , the device comprises: The acquisition unit 801 is used to respond to a resource call request of a target process of an electronic device and acquire a target partition identifier corresponding to the target process; An allocating unit 802 is configured to allocate a corresponding target resource partition to the target process based on the target partition identifier, where the target resource partition is one of the multiple cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

[0065] Optionally, the allocation unit includes: A first determining subunit, used to determine a target partition identifier corresponding to the target process; The first allocation subunit is used to allocate the corresponding target resource partition to the target process according to the resource allocation strategy corresponding to the target partition identifier, the resource allocation strategy includes the correspondence between the partition identifier and the resource partition, and the target partition identifier is one of the partition identifiers.

[0066] Optionally, it also includes: The updating unit is used to update the corresponding partition identifier for the process in response to the occurrence of a target event in the process.

[0067] Optionally, the updating unit includes: A first acquisition subunit is used to obtain a first process identifier of a first process in which a target event occurs; A selection subunit, configured to select a first partition identifier from among the plurality of partition identifiers, wherein the resource configuration policy corresponding to the first partition identifier corresponds to the resource scheduling priority of the first process; The first writing subunit is used to write the corresponding information of the first process identifier into the first partition identifier.

[0068] Optionally, the first writing subunit is configured as: Parsing the first process identifier to obtain first thread identifiers corresponding to the first process; All first thread identifiers corresponding to the first process are written into the first partition identifier.

[0069] Optionally, the multiple partition identifiers are respectively configured with different resource allocation strategies, and the resource allocation strategy includes at least: resource partitions corresponding to the partition identifiers; The multiple partition identifiers include at least two types of partition identifiers, and the two types of partition identifiers correspond to resource allocation strategies with at least two different resource call priorities, respectively.

[0070] Optionally, it also includes: The target event determining unit is used to determine that a target event occurs in the target process in response to the target process being updated from the first process group to the second process group.

[0071] It should be noted that the specific implementation of each unit and sub-unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0072] In another embodiment of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the resource scheduling method as described in any one of the above items is implemented.

[0073] In another embodiment of the present application, an electronic device is further provided, and the electronic device may include: a cache, the cache comprising at least one resource partition; A scheduling component, wherein the scheduling component is used to implement: In response to a resource call request of a target process of an electronic device, obtaining a target partition identifier corresponding to the target process; Based on the target partition identifier, assigning a corresponding target resource partition to the target process, wherein the target resource partition is one of a plurality of cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

[0074] Optionally, allocating a corresponding target resource partition to the target process based on the target partition identifier includes: Determine a target partition identifier corresponding to the target process; According to the resource configuration strategy corresponding to the target partition identifier, the corresponding target resource partition is allocated to the target process, the resource configuration strategy includes the correspondence between the partition identifier and the resource partition, and the target partition identifier is one of the partition identifiers.

[0075] Optionally, it also includes: In response to a target event occurring in a process, a corresponding partition identifier is updated for the process.

[0076] Optionally, in response to a target event occurring in a process, updating a corresponding partition identifier for the process includes: Obtain a first process identifier of a first process in which a target event occurs; Selecting a first partition identifier from the plurality of partition identifiers, wherein the resource configuration policy corresponding to the first partition identifier corresponds to the resource scheduling priority of the first process; The corresponding information of the first process identifier is written into the first partition identifier.

[0077] Optionally, writing the corresponding information of the first process identifier into the first partition identifier includes: Parsing the first process identifier to obtain first thread identifiers corresponding to the first process; All first thread identifiers corresponding to the first process are written into the first partition identifier.

[0078] Optionally, the multiple partition identifiers are respectively configured with different resource allocation strategies, and the resource allocation strategy includes at least: resource partitions corresponding to the partition identifiers; The multiple partition identifiers include at least two types of partition identifiers, and the two types of partition identifiers correspond to resource allocation strategies with at least two different resource call priorities, respectively.

[0079] Optionally, it also includes: In response to the target process being updated from the first process group to the second process group, it is determined that a target event occurs in the target process.

[0080] Optionally, the electronic device further includes: The configuration module is used to store resource configuration strategies, wherein the resource configuration strategies include the corresponding relationship between the partition identifier and the resource partition.

[0081] It should be noted that the specific implementation of the scheduling component in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0082] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0083] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0084] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0085] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A resource scheduling method, comprising: In response to a resource call request of a target process of an electronic device, obtaining a target partition identifier corresponding to the target process; Based on the target partition identifier, assigning a corresponding target resource partition to the target process, wherein the target resource partition is one of a plurality of cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

2. The method according to claim 1, allocating a corresponding target resource partition to the target process based on the target partition identifier, comprises: Determine a target partition identifier corresponding to the target process; According to the resource configuration strategy corresponding to the target partition identifier, the corresponding target resource partition is allocated to the target process, the resource configuration strategy includes the correspondence between the partition identifier and the resource partition, and the target partition identifier is one of the partition identifiers.

3. The method according to claim 2, further comprising: In response to a target event occurring in a process, a corresponding partition identifier is updated for the process.

4. The method according to claim 3, wherein in response to a target event occurring in a process, updating a corresponding partition identifier for the process comprises: Obtain a first process identifier of a first process in which a target event occurs; Selecting a first partition identifier from the plurality of partition identifiers, wherein the resource configuration policy corresponding to the first partition identifier corresponds to the resource scheduling priority of the first process; The corresponding information of the first process identifier is written into the first partition identifier.

5. The method according to claim 4, wherein the step of writing the corresponding information of the first process identifier into the first partition identifier comprises: Parsing the first process identifier to obtain first thread identifiers corresponding to the first process; All first thread identifiers corresponding to the first process are written into the first partition identifier.

6. According to the method of claim 1, a plurality of partition identifiers are respectively configured with different resource allocation strategies, and the resource allocation strategies at least include: a resource partition corresponding to the partition identifier; The multiple partition identifiers include at least two types of partition identifiers, and the two types of partition identifiers correspond to resource allocation strategies with at least two different resource call priorities, respectively.

7. The method according to claim 1, further comprising: In response to the target process being updated from the first process group to the second process group, it is determined that a target event occurs in the target process.

8. A resource scheduling device, comprising: An acquisition unit, configured to respond to a resource call request of a target process of an electronic device and acquire a target partition identifier corresponding to the target process; an allocating unit, configured to allocate a corresponding target resource partition to the target process based on the target partition identifier, wherein the target resource partition is one of the plurality of cached resource partitions; The target partition identifier is allocated to the target process when a target event occurs in the process, and the target event is related to a change in resource scheduling priority of the process.

9. An electronic device, comprising: a cache, the cache comprising at least one resource partition; A scheduling component, wherein the scheduling component is used to execute the resource scheduling method according to any one of claims 1 to 7.

10. The electronic device according to claim 9, further comprising: The configuration module is used to store resource configuration strategies, wherein the resource configuration strategies include the corresponding relationship between the partition identifier and the resource partition.

Citation Information

Patent Citations

  • Shared resource allocation method, device and equipment

    CN110879748A

  • Bandwidth allocation method based on application process priorities and electronic equipment

    CN112134813A

  • Resource control method and device

    CN118312322A

  • Multi-level computing resource scheduling control for operating system partitions

    US20040226015A1

  • Resource management based on a process identifier

    US20160179580A1

Cited By

  • RESOURCE ALLOCATION METHOD AND DEVICE AS WELL AS ELECTRONIC DEVICE

    DE102025151505A1