A method and electronic device for resource scheduling

CN114911587BActive Publication Date: 2026-08-28HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110182053.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-09
Publication Date
2026-08-28
Estimated Expiration
2041-02-09

AI Technical Summary

Technical Problem

[0005]对于多线程游戏而言,由于渲染线程存在对某些被分配在前台可见(top-app,TA)分组中的线程的依赖,而当前的技术无法精准识别出与渲染线程相关的线程,仅仅将渲染线程添加到VIP分组并不能保证提高性能

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911587B_ABST
    Figure CN114911587B_ABST
Patent Text Reader

Abstract

The application provides a resource scheduling method and an electronic device. The method is applied to an electronic device, the electronic device comprises at least one big core and at least one small core, and the method comprises the following steps: determining a correlation coefficient of a candidate thread and a target thread according to a running time of the candidate thread and the target thread, the candidate thread comprises multiple candidate threads; determining a related thread by taking the candidate thread whose correlation coefficient is greater than or equal to a first threshold value as the related thread; increasing an upper big core threshold value of the related thread, and not increasing the upper big core threshold value of threads other than the related thread in the multiple candidate threads. The application can accurately identify the related thread of the target thread, avoid performance problems, and reduce power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic equipment technology, and more specifically, to a resource scheduling method and electronic equipment. Background Technology

[0002] With the continuous development of embedded technology, mobile terminals, represented by smartphones and tablets, have experienced rapid growth. The central processing unit (CPU) of mobile terminals has evolved from a single core to dual-core, quad-core, and even octa-core processors. A multi-core processor refers to a CPU that integrates at least two processing cores. Typically, a multi-core processor contains several large cores and several small cores, with the large cores having higher performance and lower power consumption than the small cores.

[0003] For scheduling big and small cores, the commonly used scheduling strategy is energy-aware scheduling (EAS). In short, EAS scheduling determines whether to run on big cores or small cores based on task grouping and load.

[0004] Specifically, during application execution, multiple threads may interact and execute. To improve application smoothness, terminals typically bind the most heavily loaded threads to high-performance cores. For example, in game applications, because the rendering thread has a high load, terminals usually bind it to high-performance cores. In this case, adding the rendering thread to a critical (VIP) group can make it easier to run on high-performance cores, thereby enhancing the user experience.

[0005] For multi-threaded games, the rendering thread depends on certain threads assigned to the top-app (TA) group. Current technology cannot accurately identify threads related to the rendering thread, and simply adding the rendering thread to the VIP group does not guarantee improved performance. To circumvent this performance issue, the existing approach is to adjust the core allocation threshold for the TA group to match that of the VIP group. This method, while ensuring that threads related to the rendering thread are allocated to high-core memory, also allocates unnecessary threads to high-core memory, resulting in power consumption degradation while solving the performance problem. Summary of the Invention

[0006] This application provides a resource scheduling method and an electronic device that can accurately identify the associated threads of a target thread, thereby avoiding performance issues and reducing power consumption.

[0007] In a first aspect, a resource scheduling method is provided, applied to an electronic device, the electronic device including at least one large core and at least one small core, the method comprising: determining a correlation coefficient between a candidate thread and a target thread based on the running time of a candidate thread and a target thread, the candidate threads including multiple threads; identifying candidate threads with a correlation coefficient greater than or equal to a first threshold as associated threads; increasing the large core threshold of the associated threads, and without increasing the large core threshold of the threads other than the associated threads among the multiple candidate threads.

[0008] According to the resource scheduling method provided in this application, the correlation coefficient between the target thread and candidate threads is calculated based on runtime, thereby accurately determining the associated threads of the target thread. Then, the threshold for these associated threads to execute on large cores is increased, making it easier for them to execute on large cores (i.e., increasing the probability of executing on large cores), thus ensuring the performance of the target thread. Based on this, the thresholds for other candidate threads to execute on large cores remain unchanged or are reduced, thereby decreasing their probability of executing on large cores and reducing unnecessary thread execution on large cores. This saves computing resources and enables electronic devices to achieve a better energy efficiency ratio.

[0009] This electronic device can exist in various forms, such as mobile terminals (e.g., smartphones), computers, personal digital assistants, wearable devices, in-vehicle devices, Internet of Things (IoT) devices, handheld game consoles, and smart TVs, etc. It can also be other devices capable of displaying images.

[0010] The electronic device can be a device running various operating systems. For example, the aforementioned electronic device can be a device running Android, a device running iOS, or a device running Windows.

[0011] The electronic device has a multi-core processor, including at least one large core and at least one small core. For example, it may include multiple large cores and multiple small cores, and may also include at least one medium core. This application does not limit this.

[0012] This resource scheduling method can be applied to various scenarios, such as video applications, games, reading, and other applications that require user interaction (e.g., chat applications).

[0013] In conjunction with the first aspect, in some implementations of the first aspect, before determining the correlation coefficient between the candidate thread and the target thread based on the running time of the candidate thread and the target thread, the method further includes: sampling the running time of multiple threads and the target thread; after the sampling is completed, identifying the thread among the multiple threads whose load is greater than or equal to a second threshold as the candidate thread.

[0014] Specifically, load is a statistical value, not an instantaneous value. Therefore, the closer to the current time, the greater its weight; the farther away from the current time, the smaller its weight. In this embodiment, after sampling the running time of multiple threads and the target thread, the load of each thread is determined. At this point, the working status of the device within the current time period can be accurately known. Then, threads with a load greater than or equal to a preset second threshold are identified as candidate threads, i.e., threads (samples) with excessively low loads are removed. This increases the accuracy of identifying associated threads and reduces the subsequent computational load.

[0015] Alternatively, in other implementations, low-load threads may be eliminated first, and then sampling may be performed (in this case, only candidate threads are sampled), and this application does not limit this.

[0016] In conjunction with the first aspect, in some implementations of the first aspect, before sampling the running time of the multiple threads and the target thread, the method further includes: determining the thread with the highest current load as the target thread; and determining multiple other threads under the process corresponding to the target thread as the multiple threads.

[0017] In conjunction with the first aspect, in some implementations of the first aspect, the target thread is the rendering thread.

[0018] Optionally, the target thread can also be the thread with the highest load.

[0019] In conjunction with the first aspect, in some implementations of the first aspect, the period for sampling the runtime of multiple threads and the target thread is equal to the working cycle of the rendering thread.

[0020] At this point, the runtime of multiple threads and the target thread can be periodically sampled, and the sampling period can be determined based on the frame rate. For example, the sampling period can be equal to the rendering thread's working cycle (i.e., refresh time slice). The advantage of this setting is that each sample can most realistically reflect the working state of each thread. Each sample means the rendering thread is actually working once. The correlation coefficient calculated from the sampled values ​​obtained in this way is also more accurate, enabling a more precise determination of the associated threads of the target thread.

[0021] In conjunction with the first aspect, in some implementations of the first aspect, increasing the large core threshold of the associated thread includes: migrating the associated thread from a second power-aware scheduling (EAS) group to a first EAS group, wherein the large core threshold of the first EAS group is greater than the large core threshold of the second EAS group.

[0022] In conjunction with the first aspect, in some implementations of the first aspect, the first EAS group is the group in which the target thread resides.

[0023] In conjunction with the first aspect, in some implementations of the first aspect, the first EAS group is a critical group, and the second EAS group is a foreground visible group.

[0024] In conjunction with the first aspect, in some implementations of the first aspect, candidate threads whose correlation coefficients in multiple consecutive calculations are all less than a first threshold are determined as non-associated threads; the step of not increasing the upper core threshold of the multiple candidate threads other than the associated threads includes: migrating the non-associated threads from the first EAS group to the second EAS group.

[0025] In other words, in order to maintain a balance between performance and power consumption, this application adopts a "fast on, slow off" strategy. When a candidate thread is found to be an associated thread of the target thread, it is immediately added to the VIP group (increasing the threshold for adding large cores). Correspondingly, it is necessary to calculate multiple times that the candidate thread is not an associated thread of the target thread (i.e., a non-associated thread) before removing it from the VIP group (decreasing the threshold for adding large cores). This can reduce the additional scheduling overhead caused by frequent switching between large and small cores.

[0026] In conjunction with the first aspect, in some implementations of the first aspect, the runtime includes the time the thread spends running in user mode and kernel mode.

[0027] In a second aspect, an electronic device is provided, including at least one large core and at least one small core. The electronic device further includes: a processing module, configured to determine the correlation coefficient between the candidate thread and the target thread based on the running time of the candidate thread and the target thread, wherein the candidate thread includes multiple threads; the processing module is further configured to identify candidate threads with a correlation coefficient greater than or equal to a first threshold as associated threads; and a scheduling module, configured to increase the large core threshold of the associated threads, and without increasing the large core threshold of the threads other than the associated threads among the multiple candidate threads.

[0028] In conjunction with the second aspect, in some implementations of the second aspect, the electronic device further includes: a sampling module, used to sample the running time of multiple threads and the target thread; after the sampling is completed, the processing module is further used to determine the thread among the multiple threads whose load is greater than or equal to a second threshold as the candidate thread.

[0029] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is further configured to: determine the thread with the highest current load as the target thread; and determine multiple other threads under the process corresponding to the target thread as the multiple threads.

[0030] In conjunction with the second aspect, in some implementations of the second aspect, the target thread is the rendering thread.

[0031] In conjunction with the second aspect, in some implementations of the second aspect, the period for sampling the runtime of multiple threads and the target thread is equal to the working cycle of the rendering thread.

[0032] In conjunction with the second aspect, in some implementations of the second aspect, the scheduling module is specifically used to: migrate the associated thread from the second power-aware scheduling EAS group to the first EAS group, wherein the large core threshold of the first EAS group is greater than the large core threshold of the second EAS group.

[0033] In conjunction with the second aspect, in some implementations of the second aspect, the first EAS group is the group in which the target thread resides.

[0034] In conjunction with the second aspect, in some implementations of the second aspect, the first EAS group is a critical group, and the second EAS group is a foreground visible group.

[0035] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is further configured to: determine candidate threads whose correlation coefficients in multiple consecutive calculations are all less than a first threshold as non-associated threads; the scheduling module is specifically configured to: migrate the non-associated threads from the first EAS group to the second EAS group.

[0036] In conjunction with the second aspect, in some implementations of the second aspect, the runtime includes the time the thread spends running in user mode and kernel mode.

[0037] In a third aspect, an electronic device is provided, including at least one processor, the at least one processor being coupled to a memory to read and execute instructions in the memory to implement any of the methods in the first aspect.

[0038] Optionally, the electronic device may also include a memory.

[0039] Fourthly, a computer storage medium is provided, including computer instructions that, when executed on an electronic device, cause the electronic device to perform any of the methods in the first aspect.

[0040] Fifthly, a computer program product is provided that, when the computer program product is run on a computer, causes the computer to perform any of the methods in the first aspect. Attached Figure Description

[0041] Figure 1 This is a flowchart of an example of a resource scheduling method provided in the embodiments of this application.

[0042] Figure 2 This is a flowchart of another example of the resource scheduling method provided in the embodiments of this application.

[0043] Figure 3 This is a graph showing the sampled runtime values ​​of a subset of threads.

[0044] Figure 4 This is a schematic block diagram of the electronic device provided in the embodiments of this application.

[0045] Figure 5 This is a structural schematic diagram of the resource scheduling device provided in the embodiments of this application. Detailed Implementation

[0046] The technical solutions of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them.

[0047] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0048] The term "comprising" in this document indicates the presence of the described feature, whole, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or collections thereof. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0049] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0050] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0051] In this document, the term "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can be expressed as: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0052] To facilitate understanding of the embodiments of this application, the relevant terms involved in this application will be introduced first.

[0053] 1. Multi-core processor.

[0054] A multi-core processor is a central processing unit that integrates at least two processing cores. Typically, a multi-core processor contains several large cores and several small cores, with the large cores having higher performance and lower power consumption than the small cores.

[0055] For example, a multi-core processor may include one, two, or four large cores, and four, six, or nine small cores. The large cores may operate at a frequency of 2.6 GHz, and the small cores may operate at a frequency of 2.1 GHz.

[0056] For example, the large core can be an A57 processing core, and the small core can be an A53 processing core.

[0057] Furthermore, multi-core processors can be grouped into more granular categories. For example, a multi-core processor can contain several large cores, several medium cores, and several small cores. The performance and power consumption of medium cores fall between those of large cores and small cores.

[0058] For example, a multi-core processor may include one large core, two medium cores, and five small cores.

[0059] For example, a multi-core processor can include 2 large cores, 2 medium cores, and 4 small cores.

[0060] In this embodiment, a multi-core processor can be divided into several levels according to the processing power of its cores. The processing core with the highest processing power can be called a large core, and the processing core with the lowest processing power can be called a small core. Intermediate levels may include one or more medium cores with different processing capabilities.

[0061] In the embodiments of this application, the electronic device including the multi-core processor has at least one large core and at least one small core, and may or may not have a medium core; this application does not limit this.

[0062] 2. Thread.

[0063] A thread is the smallest unit of computation that an operating system can schedule. It is contained within a process and is the actual unit of operation within that process. A thread refers to a single, sequential flow of control within a process. Multiple threads can run concurrently within a process, each executing different tasks in parallel. The execution efficiency of a thread directly impacts the performance of the terminal.

[0064] Rendering thread: also called drawing thread or frame drawing thread, is used to draw image frames and is a thread with a high workload.

[0065] 3. Energy-aware scheduling (EAS).

[0066] For scheduling big.LITTLE architecture, the commonly used scheduling strategy is the EAS (Executable Array of Independent Cores) scheduling strategy. In short, EAS scheduling determines whether to run on a large core or a small core based on task grouping and load. To achieve a relatively high energy efficiency, the key to EAS scheduling lies in how to correctly and reasonably group tasks, and how to set the boost threshold for each group to run on a large core. To understand how to optimize it, we need to understand the basic principles of EAS scheduling: how to determine whether to run on a large core or a small core based on task load.

[0067] The load of a task is primarily determined by its current state. When a task is running or runnable, its load increases. When a task is sleeping, its load decreases. Because task load is a statistical value, not an instantaneous one, its weight increases with time closer to the present and decreases with time further away.

[0068] In the Android system, tasks can be divided into different groups based on their importance and requirements. For example, there are foreground (TA) groups and background groups. For TA groups, we want to more easily utilize large cores to reduce latency, while for background groups, we want to run on small cores for longer periods to save power. Therefore, setting appropriate large core thresholds (boost values) for different groups becomes crucial. Table 1 shows a typical correspondence between EAS groups and large core Boost values.

[0069] Table 1:

[0070]

[0071]

[0072] Whether a task runs on a large core is primarily determined by its own workload and its boost value. A task with a high workload may run on a large core even with a boost value of 0. Similarly, a task with a low workload may run on a large core if its boost value is high enough. Boost is a value between -100 and 100. The closer the value is to 100, the more likely the task is to run on a large core; the closer it is to -100, the more it tends to save power, i.e., run on a small core.

[0073] In other words, EAS scheduling makes the scheduler aware of different types of tasks, divides them into different groups according to their importance and demand, and applies different weights to affect the energy efficiency of the task. For example, for the TA group, it makes it easier to use large cores to reduce latency, while for the background group (tasks that are not perceived by the user), it makes them run on small cores for a longer time to save power.

[0074] In the embodiments of this application, if the threshold for a certain task (thread) to be used on a large core is increased, the task is more likely to be used on a large core, that is, the probability of it being used on a large core is greater.

[0075] At this point, a task can be moved from the current EAS group to another EAS group. If the threshold for using a large core in the adjusted EAS group is greater than that in the original EAS group, the task becomes more likely to be used on a large core, meaning the probability of it being used on a large core is higher.

[0076] For example, if a thread is currently in the TA group, adding the thread to the VIP group will make it easier for the thread to be assigned to a large core, meaning the probability of it being assigned to a large core is higher.

[0077] 4. Correlation coefficient.

[0078] The correlation coefficient, originally designed by statistician Carl Pearson, is a statistical indicator used to study the degree of linear correlation between variables, and is generally represented by the letter r.

[0079] In statistics, the correlation coefficient is used to measure the degree of linear correlation between two variables X and Y. Its value ranges from -1 to 1, and it is a statistical indicator reflecting the strength of the relationship between the variables. The closer R is to 1, the stronger the correlation between the two variables, while the closer it is to -1, the more incompatible the two variables are.

[0080] In the natural sciences, this coefficient is widely used to measure the correlation between two variables, and its calculation formula is as follows:

[0081]

[0082] Currently, with the development and advancement of technology, the processing power of mobile terminals has become increasingly powerful, enabling a wide variety of applications to run on them to meet diverse user needs. During application execution, multiple threads interact and execute. To improve application smoothness, terminals typically bind the most demanding threads to high-performance cores. For example, in game applications, because the rendering thread has a high load, terminals usually bind it to high-performance cores. In this case, adding the rendering thread to the critical (VIP) group can make it easier to utilize high-performance cores, thereby enhancing the user experience.

[0083] For multi-threaded games, the rendering thread depends on certain threads assigned to the TA (Targeting Thread) group. Current technology cannot accurately identify these threads, and simply adding the rendering thread to the VIP (VIP) group does not guarantee improved performance. To circumvent this performance issue, the current approach is to adjust the high-core threshold of the TA group to match that of the VIP group. While this method ensures that threads related to the rendering thread are executed on high cores, it also executes unnecessary threads on high cores. This results in power consumption degradation while solving the performance problem, thereby shortening the standby time of mobile devices and reducing the user experience.

[0084] In view of this, embodiments of this application provide a resource scheduling method and an electronic device that accurately identifies the associated threads of a target thread based on correlation coefficients, thereby avoiding performance issues while reducing power consumption and achieving a better energy efficiency ratio.

[0085] This application first provides a resource scheduling method, which is applied to an electronic device including at least one large core and at least one small core.

[0086] This electronic device can exist in various forms, such as mobile terminals (e.g., smartphones), computers, personal digital assistants, wearable devices, in-vehicle devices, Internet of Things (IoT) devices, handheld game consoles, and smart TVs, etc. It can also be other devices capable of displaying images.

[0087] The electronic device can be a device running various operating systems. For example, the aforementioned electronic device can be a device running Android, a device running iOS, or a device running Windows.

[0088] The electronic device has a multi-core processor, including at least one large core and at least one small core. For example, it may include multiple large cores and multiple small cores, and may also include at least one medium core. This application does not limit this.

[0089] This resource scheduling method can be applied to various scenarios, such as video applications, games, reading, and other applications that require user interaction (e.g., chat applications).

[0090] Figure 1 This is a flowchart of the resource scheduling method 100 provided in the embodiments of this application, as follows: Figure 1 As shown, the method 100 includes:

[0091] Step 110: Determine the correlation coefficient between the candidate thread and the target thread based on the running time of the candidate thread and the target thread, wherein the candidate thread includes multiple threads.

[0092] Step 120: Candidate threads with a correlation coefficient greater than or equal to the first threshold are identified as associated threads.

[0093] Step 130: Increase the threshold for the associated thread to access the largest core, but do not increase the threshold for the thread accessing the largest core among the multiple candidate threads other than the associated thread.

[0094] Specifically, in this embodiment, the candidate thread can be a heavily loaded thread, such as a rendering thread. The correlation coefficient between the candidate thread and the target thread can be determined based on their running times. Since there are multiple candidate threads, the correlation coefficient between each candidate thread and the target thread can be determined based on their running times. In other words, multiple candidate threads can be iterated through one by one. If there are N candidate threads, then N correlation coefficients can be calculated, where N is a positive number greater than or equal to 2.

[0095] Next, the correlation coefficients corresponding to multiple candidate threads are compared with a preset first threshold, and candidate threads with correlation coefficients greater than or equal to the first threshold are identified as associated threads. There may be one or more associated threads. Here, the associated thread of the target thread is a thread that has a logical dependency on the target thread.

[0096] The first threshold can be obtained from experience and is easy to understand. The first threshold should be close to 1. For example, it can be any value between 0.9 and 1, such as 0.90, 0.95 or 0.985.

[0097] According to the resource scheduling method 100 provided in this application embodiment, the correlation coefficient between the target thread and candidate threads is calculated by runtime, thereby accurately determining the associated threads of the target thread. Then, the threshold for these associated threads to execute on large cores is increased, making it easier for them to execute on large cores (i.e., increasing the probability of executing on large cores), thus ensuring the performance of the target thread. Based on this, the thresholds for other candidate threads to execute on large cores remain unchanged or are reduced, thereby decreasing their probability of executing on large cores and reducing unnecessary thread execution on large cores, thus saving computing resources and enabling electronic devices to achieve a better energy efficiency ratio.

[0098] Optionally, the target thread can be the rendering thread, or it can be the thread with the highest current load.

[0099] Optionally, increasing the big core threshold for associated threads can be achieved by migrating the associated threads from the second power-aware scheduling EAS group to the first EAS group, where the big core threshold for the first EAS group is greater than that for the second EAS group.

[0100] For example, the first EAS group can be a key (VIP) group, and the second EAS group can be a foreground visible (TA) group.

[0101] For example, the first EAS group can be a TA group, and the second EAS group can be a front-end group or a back-end group.

[0102] Optionally, the first EAS group can be the group where the target thread is located.

[0103] For example, if the target thread is the rendering thread and its EAS group is the VIP group, and the second EAS group is the TA group, then the associated thread can be migrated (added) to the VIP group to make it easier for it to be used on large cores.

[0104] In other words, this application embodiment identifies the associated threads of the target thread based on the correlation coefficient, and combines the existing EAS scheduling grouping and settings to add the associated threads of the application's rendering thread to the VIP group to obtain a better energy efficiency ratio.

[0105] The threshold for the upper largest core after the associated thread is increased can be equal to, less than or greater than, the threshold for the upper largest core of the target thread; this application does not limit this.

[0106] Optionally, before determining the correlation coefficient between the candidate thread and the target thread based on their runtime, method 100 further includes:

[0107] The runtime of multiple threads and the target thread is sampled;

[0108] After the sampling is completed, the threads with a load greater than or equal to the second threshold among the multiple threads are identified as candidate threads.

[0109] Specifically, load is a statistical value, not an instantaneous value. Therefore, the closer to the current time, the greater its weight; the farther away from the current time, the smaller its weight. In this embodiment, after sampling the running time of multiple threads and the target thread, the load of each thread is determined. At this point, the working status of the device within the current time period can be accurately known. Then, threads with a load greater than or equal to a preset second threshold are identified as candidate threads, i.e., threads (samples) with excessively low loads are removed. This increases the accuracy of identifying associated threads and reduces the subsequent computational load.

[0110] Alternatively, in other implementations, low-load threads may be eliminated first, and then sampling may be performed (in this case, only candidate threads are sampled), and this application does not limit this.

[0111] Optionally, the second threshold can be THREAD_LIGHT_WEIGHT_TICKS_NUM.

[0112] In this embodiment, the electronic device samples the runtime of multiple threads and the target thread to obtain multiple sample values. The correlation coefficient between the candidate thread and the target thread can then be calculated using the following formula based on these sample values:

[0113]

[0114] Where r is the correlation coefficient between the candidate thread and the rendering thread. Variables X and Y are used to characterize the runtime data of the target thread and candidate thread, respectively, where Xi represents the runtime of the target thread obtained in the i-th sampling. This represents the average historical runtime of the target thread. Yi represents the runtime of the candidate thread obtained in the i-th sampling. This represents the average historical running time of the candidate thread.

[0115] For example, the first threshold can be 0.95. If the correlation coefficient between a candidate thread and the target thread is 0.97, which is greater than the first threshold, then the candidate thread can be identified as an associated thread. In this case, the thread can be migrated from the second EAS group to the first EAS group.

[0116] For example, the first threshold can be 0.95. If the correlation coefficient between a candidate thread and the target thread is 0.77, which is less than the first threshold, then the candidate thread is not an associated thread of the target thread and does not need to be scheduled.

[0117] Optionally, the first threshold can be DEFAULT_CORRELATION.

[0118] Optionally, the target thread can be the rendering thread. In this case, the runtime of multiple threads and the target thread can be periodically sampled, and the sampling period can be determined based on the frame rate. For example, the sampling period can be equal to the rendering thread's working cycle (i.e., refresh time slice). The advantage of this setting is that each sample can most realistically reflect the working state of each thread. Each sample means the rendering thread is actually working once. The correlation coefficient calculated from the sampled values ​​obtained in this way is also more accurate, enabling a more precise determination of the associated threads of the target thread.

[0119] For example, if the rendering thread operates at a frame rate of 30 frames per second, the sampling period can be 33 milliseconds. However, if the frame rate is 60 frames per second, the sampling period can be 17 milliseconds.

[0120] Optionally, multiple other threads within the process corresponding to the target thread can be identified as the multiple threads. For example, the target thread can be the rendering thread, and all other threads within the process of the rendering thread can be sampled and filtered to determine candidate threads, and finally, the associated thread can be determined.

[0121] Optionally, the runtime of each thread may include the time the thread spends running in user mode and kernel mode.

[0122] At this point, the system's ` / proc / pid / task / tid / stat` node contains the thread's `utime` and `stime` information. These two values ​​represent the time the thread has been running in user mode and kernel mode since it came to life. The working duration of each thread can be calculated based on these two values. The target thread of the application and other threads in the same process are used as variables X and Y, respectively. The sampling period is defined based on the refresh time slice of the rendering thread. The node values ​​of the thread's `stat` are sampled multiple times (e.g., 30-40 times). The sum of `utime` and `stime` is used as the value of the sampling point to calculate the correlation coefficient between X and Y. When the correlation coefficient between X and Y is greater than the set first threshold, Y is defined as the rendering-associated thread of X. After traversing all threads, the rendering-associated threads can be obtained. Since thread scheduling is constantly changing, it is necessary to repeatedly perform the identification of associated threads to better reflect the correlation between threads.

[0123] Optionally, method 100 further includes: identifying candidate threads whose correlation coefficients in multiple consecutive calculations are all less than a first threshold as non-associated threads.

[0124] The step of not increasing the maximum core threshold for threads other than the associated thread among the multiple candidate threads includes:

[0125] The unrelated thread is migrated from the first EAS group to the second EAS group.

[0126] In other words, in order to maintain a balance between performance and power consumption, this application adopts a "fast on, slow off" strategy. When a candidate thread is found to be an associated thread of the target thread, it is immediately added to the VIP group (increasing the threshold for adding large cores). Correspondingly, it is necessary to calculate multiple times that the candidate thread is not an associated thread of the target thread (i.e., a non-associated thread) before removing it from the VIP group (decreasing the threshold for adding large cores). This can reduce the additional scheduling overhead caused by frequent switching between large and small cores.

[0127] The resource scheduling method provided in this application embodiment will be further described below with reference to specific examples. Figure 2 This is a flowchart of the resource scheduling method 200 provided in the embodiments of this application, as follows: Figure 2 As shown, the method 200 includes:

[0128] Step 210: The electronic device identifies multiple other threads within the process in which the rendering thread resides.

[0129] Specifically, when a user opens a pre-installed game application on an electronic device, the system enters a state of recognizing the game's rendering thread. This can be determined by the invocation of the rendering function, indicating that the rendering thread is being executed. Based on this rendering thread, the electronic device can determine the corresponding process and, consequently, the other threads within that process.

[0130] Optionally, if no externally received game rendering thread identifier (tid) is received, i.e., the rendering thread is not identified, the thread with the highest load (tid) is used as a substitute.

[0131] Step 220: Sample the runtime of the multiple other threads and the rendering thread.

[0132] Simultaneously sample the rendering thread and N threads under that process, and parse the stime and utime values ​​of the nodes as sample values. The sampling period is 33ms, and sample values ​​are continuously sampled 40 times to obtain a sample of 40 from N+1 threads. Figure 3 This is a graph showing the sampled runtime values ​​of a subset of threads.

[0133] Step 230: Determine the threads among the multiple other threads whose load is greater than or equal to the second threshold as candidate threads.

[0134] Step 240: Determine the correlation coefficient between the candidate thread and the rendering thread based on the running time of the candidate thread and the rendering thread. The candidate thread includes multiple threads.

[0135] Step 250: Candidate threads with a correlation coefficient greater than or equal to the first threshold are identified as associated threads.

[0136] Step 260: Migrate the associated thread from the second EAS group to the first EAS group.

[0137] Specifically, invalid samples are first removed based on the preset low load threshold THREAD_LIGHT_WEIGHT_TICKS_NUM (i.e., the second threshold), which increases the recognition accuracy of associated threads and reduces the subsequent computational load.

[0138] Then, the correlation between the rendering thread and each candidate thread is calculated using a correlation coefficient algorithm. For example... Figure 3 As shown, in this embodiment, during the game, sampling calculations are performed on the rendering thread and two threads, Thread-4770 and Audio Track. The correlation coefficient between Thread-4770 and the rendering thread is 0.991, and the correlation coefficient between Audio Track and the rendering thread is 0.567. Therefore, it can be determined that the thread Thread-4770 is a related thread because it is greater than the threshold of 0.985, and this thread is added from the TA group to the VIP group.

[0139] Step 270: Candidate threads whose correlation coefficients are all less than the first threshold in multiple consecutive calculations are identified as non-associated threads.

[0140] Step 280: Migrate the unrelated thread from the first EAS group to the second EAS group.

[0141] Specifically, in this embodiment of the application, a "fast up, slow down" mechanism is used to manage thread groups. When the candidate thread relevance calculated in step 250 is greater than the threshold DEFAULT_CORRELATION (first threshold), it is added to the VIP group (i.e., the first EAS group). When the candidate thread relevance is lower than the threshold, the number of times the thread relevance is lower than the threshold is incremented. When the number reaches a certain number (e.g., 5 times), the thread is deleted from the VIP group. At this time, the thread can be migrated back to the TA group (i.e., the second EAS group).

[0142] After completing step 280, the electronic device can repeat step 220 to start a new round of associated thread identification procedures to better reflect the correlation between threads.

[0143] The above text combined Figures 1 to 3 The resource scheduling method of the embodiments of this application is described in detail below, in conjunction with... Figure 4 , 5 The apparatus of the embodiments of this application is described in detail. It should be understood that... Figure 4 , 5 The device shown can achieve Figure 1 , 2 The steps shown in the method flow are one or more. To avoid repetition, they will not be described in detail here.

[0144] Figure 4 This is a schematic block diagram of the electronic device 400 provided in an embodiment of this application. Figure 4 As shown, the electronic device 400 includes at least one large core and at least one small core, and also includes a processing module 420 and a scheduling module 430.

[0145] Processing module 420 is used to determine the correlation coefficient between the candidate thread and the target thread based on the running time of the candidate thread and the target thread, wherein the candidate thread includes multiple threads;

[0146] The processing module 420 is further configured to identify candidate threads whose correlation coefficient is greater than or equal to the first threshold as associated threads;

[0147] The scheduling module 430 is used to increase the core threshold of the associated thread, but does not increase the core threshold of the other threads among the multiple candidate threads besides the associated thread.

[0148] Optionally, the electronic device 400 also includes:

[0149] The sampling module 410 is used to sample the running time of multiple threads and the target thread;

[0150] After the sampling is completed, the processing module 420 is further configured to identify the threads among the plurality of threads whose load is greater than or equal to the second threshold as the candidate threads.

[0151] Optionally, the processing module 420 is further configured to: determine the thread with the highest current load as the target thread; and determine multiple other threads under the process corresponding to the target thread as the multiple threads.

[0152] Optionally, the target thread is the rendering thread.

[0153] Optionally, the sampling period for the runtime of multiple threads and the target thread is equal to the working period of the rendering thread.

[0154] Optionally, the scheduling module 430 is specifically used to: migrate the associated thread from the second power-aware scheduling EAS group to the first EAS group, wherein the large core threshold of the first EAS group is greater than the large core threshold of the second EAS group.

[0155] Optionally, the first EAS group is the group where the target thread is located.

[0156] Optionally, the first EAS group is a critical group, and the second EAS group is a foreground visible group.

[0157] Optionally, the processing module 420 is further configured to: determine candidate threads whose correlation coefficients in multiple consecutive calculations are all less than a first threshold as non-associated threads; the scheduling module 430 is specifically configured to: migrate the non-associated threads from the first EAS group to the second EAS group.

[0158] Optionally, the runtime includes the time the thread spends running in user mode and kernel mode.

[0159] Specifically, the electronic device 400 may correspond to the electronic device in methods 100 and 200 according to embodiments of this application, or a chip configured in the electronic device. The electronic device 400 may include components for performing... Figure 1 Alternatively, it can be a unit of the method executed by the electronic device in method 2. Furthermore, each unit in the electronic device 400 and the other operations and / or functions described above are respectively for implementing the corresponding processes of method 100 and method 200. The specific process of each unit executing the corresponding steps described above has been described in detail in method 100 and 200, and will not be repeated here for the sake of brevity.

[0160] Figure 5 This is a structural schematic diagram of the resource scheduling device 500 provided in an embodiment of this application. The device 500 can be a resource scheduling apparatus, or it can be a chip or circuit disposed within a device. For example, the device 500 can be a mobile phone, or a chip within a mobile phone. Figure 5 As shown, the device 500 includes a processor 510, a memory 520, and a communication interface 530. The memory 520 stores instructions, and the processor 510 executes these instructions. When an instruction is executed, the processor 510 performs the method provided in the above-described method embodiment. The processor 510 also controls the communication interface 530 to communicate with the outside world.

[0161] Furthermore, the processor 510, memory 520, and communication interface 530 can communicate with each other through internal connection paths to transmit control and / or data signals.

[0162] Furthermore, the memory 520 can be integrated into the processor 510 or set separately from the processor 510.

[0163] Specifically, the device 500 can be used to perform Figure 1The apparatus 500 may further include steps for performing resource scheduling in the method 100. Figure 2 The electronic device 500 executes the method of resource scheduling 200 as a module. Furthermore, each module in the device 500 and the other operations and / or functions described above are respectively for implementing... Figure 2 The corresponding process of Method 200 is as follows. The specific process of each module executing the above-mentioned steps has been described in detail in Method 200, and will not be repeated here for the sake of brevity.

[0164] This application also provides a computer-readable storage medium including a computer program that, when run on a computer, causes the computer to perform the methods provided in the above-described method embodiments.

[0165] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the method provided in the above-described method embodiments.

[0166] This application also provides a chip system including a memory and a processor. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a network device equipped with the chip system performs the method provided in the above-described method embodiments.

[0167] The chip system may include input circuits or interfaces for transmitting information or data, and output circuits or interfaces for receiving information or data.

[0168] It should be understood that in the embodiments of this application, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0169] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0170] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0171] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0172] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0173] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0174] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0175] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0176] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A resource scheduling method applied to an electronic device, the electronic device comprising at least one large core and at least one small core, characterized in that, The method includes: The correlation coefficient between the candidate thread and the target thread is determined based on the running time of the candidate thread and the target thread, wherein the candidate thread includes multiple threads; Candidate threads with a correlation coefficient greater than or equal to the first threshold are identified as associated threads; The associated thread is migrated from the second power-aware scheduling EAS group to the first EAS group, where the large core threshold of the first EAS group is greater than that of the second power-aware scheduling EAS group. Candidate threads whose correlation coefficients in multiple consecutive calculations are all less than the first threshold are determined to be non-associated threads. The unrelated threads are migrated from the first EAS group to the second power-aware scheduling EAS group; The electronic device samples the runtime of multiple candidate threads and the target thread to obtain multiple sample values, and then calculates the correlation coefficient between the candidate threads and the target thread based on the sample values ​​using the following formula: Where r is the correlation coefficient between the candidate thread and the target thread, and variables X and Y are used to characterize the runtime data of the target thread and the candidate thread, respectively, where Xi represents the runtime of the target thread obtained in the i-th sampling. Let represent the average historical running time of the target thread, and Yi represent the running time of the candidate thread obtained in the i-th sampling. This represents the average historical running time of the candidate threads.

2. The method according to claim 1, characterized in that, Before determining the correlation coefficient between the candidate thread and the target thread based on their runtime, the method further includes: The runtime of multiple threads and the target thread is sampled; After the sampling is completed, the threads with a load greater than or equal to the second threshold among the multiple threads are identified as candidate threads.

3. The method according to claim 2, characterized in that, Before sampling the runtime of multiple threads and the target thread, the method further includes: The thread with the highest current load is identified as the target thread; The multiple other threads under the process corresponding to the target thread are identified as the multiple threads.

4. The method according to claim 2 or 3, characterized in that, The target thread is the rendering thread.

5. The method according to claim 4, characterized in that, The sampling period for the runtime of multiple threads and the target thread is equal to the working period of the rendering thread.

6. The method according to claim 1, characterized in that, The first EAS group is the group where the target thread is located.

7. The method according to claim 1, characterized in that, The first EAS group is a critical group, and the second power-aware scheduling EAS group is a foreground visible group.

8. The method according to claim 1, characterized in that, The runtime includes the time the thread spends running in user mode and kernel mode.

9. An electronic device comprising at least one large core and at least one small core, characterized in that, The electronic device also includes: A processing module is used to determine the correlation coefficient between the candidate thread and the target thread based on the running time of the candidate thread and the target thread, wherein the candidate thread includes multiple threads; The processing module is also used to determine the candidate threads whose correlation coefficient is greater than or equal to the first threshold as associated threads; The scheduling module is used to migrate the associated thread from the second power-aware scheduling EAS group to the first EAS group, wherein the large core threshold of the first EAS group is greater than the large core threshold of the second power-aware scheduling EAS group. The processing module is also used to determine the candidate thread whose correlation coefficient is less than the first threshold in multiple consecutive calculations as a non-associated thread; The scheduling module is also used to migrate the unrelated thread from the first EAS group to the second power-aware scheduling EAS group. The electronic device samples the runtime of multiple candidate threads and the target thread to obtain multiple sample values, and then calculates the correlation coefficient between the candidate threads and the target thread based on the sample values ​​using the following formula: Where r is the correlation coefficient between the candidate thread and the target thread, and variables X and Y are used to characterize the runtime data of the target thread and the candidate thread, respectively, where Xi represents the runtime of the target thread obtained in the i-th sampling. Let represent the average historical running time of the target thread, and Yi represent the running time of the candidate thread obtained in the i-th sampling. This represents the average historical running time of the candidate threads.

10. The electronic device according to claim 9, characterized in that, The electronic device also includes: The sampling module is used to sample the runtime of multiple threads and the target thread; After the sampling is completed, the processing module is further configured to identify the threads among the plurality of threads whose load is greater than or equal to the second threshold as the candidate threads.

11. The electronic device according to claim 10, characterized in that, The processing module is also used for: The thread with the highest current load is identified as the target thread; The multiple other threads under the process corresponding to the target thread are identified as the multiple threads.

12. The electronic device according to claim 10 or 11, characterized in that, The target thread is the rendering thread.

13. The electronic device according to claim 12, characterized in that, The sampling period for the runtime of multiple threads and the target thread is equal to the working period of the rendering thread.

14. The electronic device according to claim 9, characterized in that, The first EAS group is the group where the target thread is located.

15. The electronic device according to claim 9, characterized in that, The first EAS group is a critical group, and the second power-aware scheduling EAS group is a foreground visible group.

16. The electronic device according to claim 9, characterized in that, The runtime includes the time the thread spends running in user mode and kernel mode.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 8.

18. A chip system, characterized in that, Includes: a processor for retrieving and running a computer program from memory, causing an electronic device having the chip system mounted to perform the method as described in any one of claims 1 to 8.

19. A resource scheduling apparatus, characterized in that, It includes at least one processor, the at least one processor being coupled to a memory, reading and executing instructions in the memory to implement the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Resource scheduling method and terminal equipment

    CN111045814A

  • Interrupt processing method and device, storage medium and electronic equipment

    CN111831412A