Task execution method, device, mobile terminal and storage medium

By dividing the computing levels of CPU cores and matching target cores according to task priorities, the problem of unreasonable use of CPU resources in mobile terminals is solved, saving power and improving battery life.

CN112817428BActive Publication Date: 2024-10-08GUANGZHOU HUYA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110097611.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-25
Publication Date
2024-10-08
Estimated Expiration
2041-01-25

AI Technical Summary

Technical Problem

Unreasonable use of CPU resources in mobile terminals results in excessive power consumption and low battery life.

Method used

The computing levels are divided according to the computing power of the CPU core, and the target core is matched according to the priority of the task to be executed for task binding to achieve matching and utilization of tasks and CPU resources.

Benefits of technology

Save power consumption and improve the battery life of mobile terminals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112817428B_ABST
    Figure CN112817428B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and provides a task running method, device, mobile terminal and storage medium. When a CPU has cores with different computing capabilities, all cores are divided into cores of N computing levels according to computing capabilities; when there are tasks to be executed, a target core that matches the priority of the task to be executed is determined among the cores of the N computing levels, and the priority of the task to be executed represents the computing capability requirement of the task to be executed. The task to be executed is bound to the target core to realize the running of the task. The computing capability requirement of the task is matched with the computing capability of the CPU core, and the CPU resources are reasonably utilized, so as to save the power consumption of the mobile terminal and improve the endurance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task execution method, device, mobile terminal and storage medium. Background Art

[0002] With the development of science and technology, mobile terminals are gradually becoming popular in people's lives. Many mobile terminals use a central processing unit (CPU) with multiple cores to support the operation of multiple tasks in applications and improve processing speed.

[0003] In the process of supporting task execution, the CPU may use CPU resources irrationally, resulting in a large amount of power being consumed. Mobile terminals usually rely on batteries for power supply, but the amount of power that a battery can provide is limited, resulting in low battery life of the mobile terminal. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a task execution method, device, mobile terminal and storage medium.

[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, the present invention provides a task running method, which is applied to a mobile terminal, wherein the mobile terminal includes a CPU, and the method includes:

[0007] When the CPU has cores with different computing capabilities, all the cores are divided into N computing levels of cores according to the computing capabilities;

[0008] When there is a task to be executed, a target core matching the priority of the task to be executed is determined among the cores of the N computing levels; wherein the priority of the task to be executed represents the computing power requirement of the task to be executed; and the target core belongs to at least one of all the cores;

[0009] Bind the task to be executed to the target core for execution.

[0010] In an optional implementation, when the CPU has cores with different computing capabilities, the step of dividing all cores into cores of N computing levels according to the different computing capabilities includes:

[0011] Obtain the maximum operating frequency of each core in the CPU;

[0012] When the maximum operating frequencies of at least two cores meet a deduplication condition, determining that the CPU has cores with different computing capabilities; the deduplication condition indicates that the maximum operating frequencies of any two cores do not overlap;

[0013] All cores are divided into N computing levels of cores according to the maximum operating frequency of each core.

[0014] In an optional implementation, when the CPU has cores with different computing capabilities, the step of dividing all cores into cores of N computing levels according to the different computing capabilities includes:

[0015] Determining whether the CPU has cores with different computing capabilities according to the type information of the CPU;

[0016] If so, all cores are divided into N computing levels of cores according to different computing capabilities.

[0017] In an optional implementation, the step of determining whether the CPU has cores with different computing capabilities according to the type information of the CPU includes:

[0018] Obtaining a core type corresponding to the type information of the CPU in a pre-stored information table; the core type represents the computing capability of the core;

[0019] When there are at least two core types, it is determined that the CPU has cores with different computing capabilities.

[0020] In an optional implementation, when there is a task to be executed, the step of determining a target core that matches the priority of the task to be executed among the cores of the N computing levels includes:

[0021] When the task to be executed is an interactive task, among the cores of the N computing levels, a core with the highest computing level is determined as a target core matching the priority of the interactive task;

[0022] When the task to be executed is a low-frequency task, among the N cores of the computing levels, a core with the lowest computing level is determined as a target core that matches the priority of the low-frequency task; the low-frequency task represents a task with the shortest historical running time within a predetermined time;

[0023] When the task to be executed is a low-demand task, among the N cores of computing levels, the core with the lowest computing level is determined as the target core that matches the priority of the low-demand task; the low-demand task represents the task with the lowest computing power requirement among the currently executed tasks.

[0024] In a second aspect, the present invention provides a task execution device, which is applied to a mobile terminal, wherein the mobile terminal includes a CPU, and the device includes:

[0025] A classification module, for dividing all cores into N computing levels of cores according to computing capabilities when the CPU has cores with different computing capabilities;

[0026] a determination module, configured to determine, when there is a task to be executed, a target core matching the priority of the task to be executed among the cores of the N computing levels; wherein the priority of the task to be executed represents the computing power requirement of the task to be executed; and the target core belongs to at least one of all the cores;

[0027] A binding module binds the task to be executed to the target core for execution.

[0028] In an optional embodiment, the classification module is further used for:

[0029] Obtain the maximum operating frequency of each core in the CPU;

[0030] When the maximum operating frequencies of at least two cores meet a deduplication condition, determining that the CPU has cores with different computing capabilities; the deduplication condition indicates that the maximum operating frequencies of any two cores do not overlap;

[0031] All cores are divided into N computing levels of cores according to the maximum operating frequency of each core.

[0032] In an optional implementation manner, the determining module is further configured to:

[0033] When the task to be executed is an interactive task, among the cores of the N computing levels, a core with the highest computing level is determined as a target core matching the priority of the interactive task;

[0034] When the task to be executed is a low-frequency task, among the N cores of the computing levels, a core with the lowest computing level is determined as a target core that matches the priority of the low-frequency task; the low-frequency task represents a task with the shortest historical running time within a predetermined time;

[0035] When the task to be executed is a low-demand task, among the N cores of computing levels, the core with the lowest computing level is determined as the target core that matches the priority of the low-demand task; the low-demand task represents the task with the lowest computing power requirement among the currently executed tasks.

[0036] In a third aspect, the present invention provides a mobile terminal, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the aforementioned implementation modes is implemented.

[0037] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the aforementioned embodiments.

[0038] The task running method, device, mobile terminal and storage medium provided by the embodiments of the present invention. When the CPU has cores with different computing capabilities, all cores are divided into cores of N computing levels according to computing capabilities; when there is a task to be executed, a target core that matches the priority of the task to be executed is determined among the cores of the N computing levels, and the priority of the task to be executed represents the computing capability requirement of the task to be executed. The task to be executed is bound to the target core to realize the running of the task. The computing capability requirement of the task is matched with the computing capability of the CPU core, and the CPU resources are reasonably utilized, so as to save the power consumption of the mobile terminal and improve the battery life.

[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 A schematic block diagram of a mobile terminal provided by an embodiment of the present invention is shown;

[0042] Figure 2 An example diagram of a task running method provided by an embodiment of the present invention is shown;

[0043] Figure 3 A schematic diagram of a process flow of a task execution method provided by an embodiment of the present invention is shown;

[0044] Figure 4 Another schematic diagram of a process flow of a task execution method provided by an embodiment of the present invention is shown;

[0045] Figure 5 Another schematic diagram of a process flow of a task execution method provided by an embodiment of the present invention is shown;

[0046] Figure 6 Another schematic diagram of a process flow of a task execution method provided by an embodiment of the present invention is shown;

[0047] Figure 7A functional module diagram of a task running device provided by an embodiment of the present invention is shown.

[0048] Icons: 100 - mobile terminal; 110 - bus; 120 - processor; 130 - memory; 150 - I / O module; 170 - communication interface; 300 - task running device; 310 - classification module; 330 - determination module; 350 - binding module. DETAILED DESCRIPTION

[0049] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0050] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0051] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0052] The mobile terminal provided in the embodiment of the present invention may be a smart phone, a personal computer, a tablet computer, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present invention does not impose any limitation on this.

[0053] Please refer to Figure 1, is a block diagram of a mobile terminal 100 provided in an embodiment of the present invention. The mobile terminal 100 includes a bus 110, a processor 120, a memory 130, an I / O module 150, and a communication interface 170. A person skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal 100. For example, the mobile terminal 100 may further include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0054] The bus 110 may be a circuit that connects the above elements to each other and transfers communications (eg, control messages) between the above elements.

[0055] The processor 120 may receive commands from the other elements described above (eg, the memory 130 , the I / O module 150 , the communication interface 170 , etc.) through the bus 110 , may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.

[0056] The processor 120 may be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0057] The memory 130 may store commands or data received from the processor 120 or other elements (eg, the I / O module 150 , the communication interface 170 , etc.) or commands or data generated by the processor 120 or other elements.

[0058] The memory 130 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0059] The I / O module 150 may receive commands or data input from a user via input-output means (e.g., a sensor, a keyboard, a touch screen, etc.), and may transmit the received commands or data to the processor 120 or the memory 130 via the bus 110. It is also used to display various information (e.g., multimedia data, text data) received, stored, and processed from the above elements, and may display videos, images, data, etc. to the user.

[0060] The communication interface 170 may be used to communicate signaling or data with other node devices.

[0061] The processor of the mobile terminal provided in the embodiment of the present invention is a CPU with multiple cores. The core in the CPU is a chip made of single crystal silicon, which is used to complete data processing, calculation, command reception, storage, etc. A multi-core CPU refers to a processor with two or more cores. This type of CPU has multiple cores, which improves computing power and processing speed. It is widely used today. The number of cores can be four cores, six cores, or other numbers.

[0062] According to actual applications, multiple cores in the CPU are not necessarily the same. In order to meet the operating needs of mobile terminals in various situations, the cores can be designed to have different computing capabilities. Figure 2 , Figure 2 Three examples of such CPUs are given.

[0063] Figure 2 (a) is a schematic diagram of the CPU of smartphone A. The CPU has four cores, with two cores of different computing capabilities. Among them, core A1 and core A2 are cores of the first computing capability, and core A3 and core A4 are cores of the second computing capability.

[0064] Figure 2 (b) is a schematic diagram of the CPU of smartphone B. The CPU has six cores with three different computing capabilities. Among them, core B1 and core B2 are cores of the first computing capability, core B3 and core B4 are cores of the second computing capability, and core B5 and core B6 are cores of the third computing capability.

[0065] Figure 2 (c) in FIG. 1 is a schematic diagram of the CPU of smartphone C. The CPU has six cores in total, and has two cores with different computing capabilities. Among them, core C1, core C2, and core C3 are cores of the first computing capability, and core C4, core C5, and core C6 are cores of the second computing capability.

[0066] This embodiment will use the above-mentioned multi-core CPU smartphone as the execution subject to execute each step in each method provided in the embodiment of the present invention and achieve the corresponding technical effect. Figure 3 , is a flow chart of a task running method provided by an embodiment of the present invention. Figure 3 The specific process shown is described in detail.

[0067] Step S202, when the CPU has cores with different computing capabilities, all cores are divided into N computing levels of cores according to the computing capabilities;

[0068] It should be noted that, according to the design requirements of the smartphone, the CPU of the smartphone can be different cores or the same core. The performance of the core is related to its computing power and power consumption. The stronger the computing power, the better the performance, and correspondingly, the faster the power consumption.

[0069] Optionally, it is possible to determine whether the CPU has cores with different computing capabilities based on core performance parameters or the type of CPU, and then divide the cores into multiple operation levels. It is understandable that the value of N must be greater than or equal to 2.

[0070] Step S204, when there is a task to be executed, determining a target core that matches the priority of the task to be executed among the cores of N computing levels;

[0071] It should be noted that the application installed on the smartphone includes multiple tasks, and the tasks can be prioritized according to the functions implemented, or the running time and running status.

[0072] The priority of the task to be executed indicates the computing power requirement of the task to be executed; this priority may be preset or determined when the task is started or run.

[0073] Optionally, when there is a task to be executed, the priority of the task to be executed is obtained, and a core matching the task to be executed can be obtained based on the priority and cores of multiple computing levels. This is the target core, and the target core can be one or more.

[0074] Step S206, binding the task to be executed to the target core for execution;

[0075] Optionally, the running of the task requires support from a CPU core. After the task to be executed and the target core are determined, the two are bound to support the running of the task to be executed.

[0076] Through the above steps, when the CPU has cores with different computing capabilities, all cores are divided into N cores of computing levels according to computing capabilities; when there is a task to be executed, a target core that matches the priority of the task to be executed is determined among the N cores of computing levels. The priority of the task to be executed represents the computing capability requirement of the task to be executed. The task to be executed is bound to the target core to realize the operation of the task. In this way, the computing capability requirement of the task matches the computing capability of the CPU core, and the CPU resources are reasonably utilized, thereby saving the power consumption of the mobile terminal and improving the battery life.

[0077] In actual applications, different mobile terminals may not support the same system for running applications. Usually, the systems of mobile terminals are Android and iOS. For these two different systems, the embodiments of the present invention also provide two different methods to achieve adaptation with different systems and reduce the intrusion into the original system. The implementation methods of these two different systems are respectively introduced below.

[0078] Please refer to Figure 4 When the system of the smart phone is the first system, namely the Android system, a possible implementation method is provided for the above step S202, and step S202 includes the following steps:

[0079] Step S202A-1, obtaining the maximum operating frequency of each core in the CPU;

[0080] Optionally, you can first read the CPU core count by calling a function, and then obtain the maximum operating frequency of each core by reading a file in the smartphone.

[0081] Step S202A-3, when the maximum operating frequencies of at least two cores meet the deduplication condition, determining that the CPU has cores with different computing capabilities;

[0082] It should be noted that the maximum operating frequency of the core indicates the processing speed of the core. The larger the maximum operating frequency, the faster the processing speed, that is, the stronger the computing power.

[0083] The de-duplication condition indicates that the maximum operating frequencies of any two cores do not overlap, which can be understood as a large difference between the two maximum operating frequencies.

[0084] Optionally, the average power of the maximum operating frequencies of all cores may be calculated. When the maximum operating frequency of a core is not equal to the average power, it is determined that the CPU has cores with different computing capabilities.

[0085] Step S202A-5, dividing all cores into N computing levels of cores according to the maximum operating frequency of each core;

[0086] Optionally, the maximum operating frequencies of all cores may be de-emphasized to obtain de-emphasis parameters, and the value of N may be obtained according to the de-emphasis parameters to determine how many computing levels of cores all cores are divided into.

[0087] The following will take the Android smartphone A as an example to illustrate the above steps S202A-1 to S202A-5.

[0088] An application is installed in smartphone A. By calling the function "sysconf(SC_NPROCESSORS_CONF)" in the development tool of the application, it is found that the number of cores of the smartphone's CPU is 4. The smartphone's CPU has 4 cores, namely core A1, core A2, core A3 and core A4.

[0089] Then read the file / sys / devices / system / cpu / cpu[X] / cpufreq / cpuinfo_max_freq, substitute 0 to 4 into [X], and get the maximum operating frequency of core A1 and core A2 is 1.8 GHz, the maximum operating frequency of core A3 and core A4 is 1.4 GHz, calculate the average power of all cores, which is 1.6 GHz, meeting the deduplication condition, and calculate the deduplication parameter to be 2;

[0090] All cores can be divided into two levels of cores, that is, N is 2, cores A1 and A2 whose maximum operating frequency is greater than the average power are cores of the first level of operation, and cores A3 and A4 whose maximum operating frequency is less than the average power are cores of the second level of operation. The first level is the highest level and the second level is the lowest level, as shown in Table 1.

[0091] Table 1

[0092] core Maximum operating frequency ( / GHz) Operation level A1 1.8 Level 1 A2 1.8 Level 1 A3 1.4 Level 2 A4 1.4 Level 2

[0093] Optionally, the above steps are performed on a smartphone B with an Android system, and it is obtained that the smartphone B has 6 cores, namely core B1, core B2, core B3, core B4, core B5 and core B6; the maximum operating frequency of cores B1 to B2 is 2.6 GHz, the maximum operating frequency of cores B3 to B4 is 2.2 GHz, and the maximum operating frequency of cores B5 to B6 is 1.8 GHz. The average power of all cores is calculated to be 2.2 GHz, which meets the deduplication condition, and the deduplication parameter is calculated to be 3; all cores can be divided into 3 operation levels, that is, N is 3, cores B1 and B2 are cores with an operation level of one, cores B3 and B4 are cores with an operation level of two, and cores B5 and B6 are cores with an operation level of three, where the first level is the highest level and the third level is the lowest level, as shown in Table 2.

[0094] Table 2

[0095]

[0096]

[0097] Through the above steps, for the mobile terminal of the Android system, the maximum operating frequency of each core can be obtained. When the maximum operating frequencies of at least two cores meet the de-duplication condition, that is, the maximum operating frequencies of any two cores do not overlap, all the cores can be divided into N cores of computing levels, so as to realize the reasonable division of the cores in the CPU according to the computing power, and adapt to the Android system, with little intrusion on the original system, which is conducive to the stable operation of the mobile terminal.

[0098] In actual applications, the system of the smartphone may also be the second system, namely the iOS system, and the type information of the CPU can be used to determine whether the CPU has cores with different computing capabilities. Figure 5 , step S202 will be described in detail below.

[0099] Step S202B-1, obtaining the core type corresponding to the CPU type information in the pre-stored information table;

[0100] The pre-stored information table is a pre-stored information table in the application development tool, and includes CPU type information and corresponding core type.

[0101] Optionally, the CPU type information is obtained and the core type can be obtained through a pre-stored information table.

[0102] Step S202B-3, when there are at least two core types, determining that the CPU has cores with different computing capabilities;

[0103] Among them, the core type represents the computing power of the core;

[0104] Optionally, when there are multiple core types, that is, not less than two, the CPU has cores with different computing capabilities.

[0105] Step S202B-5, dividing all cores into N computing levels according to different computing capabilities;

[0106] Optionally, the value of N may be determined according to the number of core types, and all cores may be divided into cores of N computing levels.

[0107] The above steps S202B-1 to S202B-5 will be described below by taking the iOS smartphone C as an example.

[0108] As shown in Table 3, it is part of the content of a pre-stored information table provided in an embodiment of the present invention.

[0109] Table 3

[0110] ID Code_name Cpu_count Big Little 0x67ceee93 HURRICANE 4 2 2 0x67ceee93 HURRICANE 6 3 3 0xe81e7ef6 MONSOON_MISTRAL 6 2 4 0x07d34b9f VORTEX_TEMPEST 6 2 4 0x07d34b9f VORTEX_TEMPEST 8 4 4 0x462504d2 LIGHTNING_THUNDER 6 2 4 0x462504d2 LIGHTNING_THUNDER 8 4 4 0x1b588bb3 FIRESTORM_ICESTORM 6 2 4 0x1b588bb3 FIRESTORM_ICESTORM 8 4 4

[0111] Smartphone C has an application installed. In the development tool of the application, by calling the function "sysctlbyname("hw.cpufamily",&value,&len,NULL,0);", the CPU ID is obtained as 0x67ceee93, and the CPU type information is obtained as HURRICANE. By calling the function "sysctlbyname("hw.ncpu",&count,&len,NULL,0);", the number of CPU cores is obtained as 6.

[0112] Through the pre-stored information table, it is found that there are two types of cores, namely Big type and Little type. N is 2, and all cores can be divided into cores of two operation levels. The core corresponding to the Big type is the core with the first operation level, and the core corresponding to the Little type is the core with the second operation level. The first level is the highest level, and the second level is the lowest level. As shown in Table 4.

[0113] Table 4

[0114] core Core Types Operation level C1 Big Level 1 C2 Big Level 1 C3 Big Level 1 C4 Little Level 2 C5 Little Level 2 C6 Little Level 2

[0115] Through the above steps, for mobile terminals of iOS system, the core type can be determined by the type information of the CPU. When there are at least two core types, the CPU has cores with different computing capabilities, and all cores can be divided into cores of N computing levels, so that the cores in the CPU can be reasonably divided according to computing capabilities, and adapted to the iOS system, which has little invasiveness to the original system and is conducive to the stable operation of the mobile terminal.

[0116] In actual applications, there are multiple tasks in an application program and multiple cores in a CPU. The embodiment of the present invention prioritizes tasks and classifies cores, and provides a method for determining a core that matches a task according to its priority. Figure 6 , the above step S204 will be explained.

[0117] Step S204-1, when the task to be executed is an interactive task, among the cores of N computing levels, a core with the highest computing level is determined as a target core that matches the priority of the interactive task;

[0118] Among them, the interactive task is a task related to user interaction, which can also be understood as a UI thread, which is a thread that supports the interaction between the application and the user. This task has a high priority.

[0119] Optionally, when the task to be executed is an interactive task, the task is matched with a core having the highest computing level.

[0120] Step S204-3, when the task to be executed is a low-frequency task, among the cores of N operation levels, a core with the lowest operation level is determined as a target core that matches the priority of the low-frequency task;

[0121] Among them, the low-frequency task represents the task with the shortest historical running time within the scheduled time, and this kind of task has a low priority.

[0122] Optionally, the predetermined time may be seconds, minutes, days, etc., which are not limited in the embodiment of the present invention. For example, for one day, the historical duration of task execution within one day is obtained. When the task to be executed is the task with the shortest historical duration, the computing level matching the task is the lowest-level core.

[0123] Optionally, whether the task to be executed is a low-frequency task may also be determined by using the frequency.

[0124] Step S204-5, when the task to be executed is a low-demand task, among the N cores of the computing level, a core with the lowest computing level is determined as a target core that matches the priority of the low-demand task;

[0125] Optionally, the priorities of the tasks may be divided in advance according to the computing power requirements of the tasks. Among them, the low-demand tasks represent the tasks with the lowest computing power requirements among the currently executed tasks. Such tasks have a low priority.

[0126] Optionally, when the task to be executed is a task with low computing power requirement, the operation level matched with the task is the lowest level core.

[0127] It is understandable that during the execution of a task, the execution state of the task may change, such as changing from foreground execution to background execution. In this case, the core that matches the task is the core with the lowest computing level.

[0128] The following will take smartphone B as an example to illustrate the method of running the above tasks.

[0129] Smartphone B is installed with an application, which includes three tasks: update detection, data statistics and music playback. According to the computing power requirements, the priority of update detection can be set to low, the priority of data statistics can be set to medium, and the priority of music playback can be set to high.

[0130] When the task to be executed is music playback, the core that matches the priority of the update detection is determined to be the first-level operation level, that is, the highest-level core B1 and core B2. Music playback can be bound to either core B1 or core B2, or to both.

[0131] When the task to be executed is data statistics, the cores that match the priority of the data statistics are determined to be core B3 and core B4 with a computing level of level 2. The data statistics can be bound to either core B3 or core B4, or to both of them.

[0132] When the task to be executed is update detection, the cores that match the priority of update detection are determined to be the cores B5 and B6 at the third level, ie, the lowest level. Update detection can be bound to any one of cores B5 and B6.

[0133] After the task has been running for a while, if there is an incoming call, the application will switch to the background, and the status of music playback, data statistics and update detection will change. These three tasks will be bound to the core B5 and core B6 with a computing level of three.

[0134] The following will take smartphone C as an example to illustrate the method of running the above tasks.

[0135] Smartphone C is installed with applications, including interactive tasks and non-interactive tasks. The priority of the interactive task can be preset to be the highest, and the interactive task is bound to one, two or three of the cores C1, C2 and C3 with a computing level of level 1 during operation.

[0136] When the task to be executed is a non-interactive task such as a data reporting task, the historical running time of the task within a preset time, such as 1 day, can be obtained. If the historical running time is the longest among all non-interactive tasks, the priority of the task is high and it is bound to one, two or three of the cores C1, C2 and C3.

[0137] If the historical running time is the shortest among all non-interactive tasks, the priority of the task is low and it is bound to one of cores C4, C5, and C6.

[0138] If the historical running time is neither the longest nor the shortest among all non-interactive tasks, you can bind it to the core based on the computing power requirements of the data statistics.

[0139] It is understandable that when a task is running, the running time changes, the priority of the task will change, and the core matching it will change. According to the preset time, the core matching the priority of the task can be re-determined and the two can be bound.

[0140] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a task running device is given below. Figure 7 , Figure 7 This is a functional module diagram of the task running device 300 provided in this application. It should be noted that the basic principle and technical effects of the task running device 300 provided in this application are the same as those of the above-mentioned embodiments. For the sake of brief description, the parts not mentioned in this embodiment will not be repeated here. Please refer to the corresponding contents in the above-mentioned embodiments. The task running device 300 includes: a grading module 310, a determination module 330, and a binding module 350.

[0141] The classification module 310 is used to classify all the cores into N operation levels of cores according to the computing capabilities when the CPU has cores with different computing capabilities;

[0142] The determination module 330 is used to determine, when there is a task to be executed, a target core that matches the priority of the task to be executed among the cores of N computing levels; wherein the priority of the task to be executed represents the computing power requirement of the task to be executed; and the target core belongs to at least one of all the cores;

[0143] The binding module 350 is used to bind the task to be executed to the target core for execution.

[0144] Optionally, the grading module 310 is also used to: obtain the maximum operating frequency of each core in the CPU; determine that the CPU has cores with different computing capabilities when the maximum operating frequencies of at least two cores meet a deduplication condition; the deduplication condition indicates that the maximum operating frequencies of any two cores do not overlap; and divide all cores into cores of N computing levels according to the maximum operating frequency of each core.

[0145] Optionally, the grading module 310 is further used to: determine whether the CPU has cores with different computing capabilities according to the type information of the CPU; if so, divide all the cores into cores of N computing levels according to the different computing capabilities.

[0146] Optionally, the grading module 310 is further used to: obtain the core type corresponding to the CPU type information in the pre-stored information table; the core type represents the computing power of the core; when there are at least two core types, determine that the CPU has cores with different computing powers.

[0147] Optionally, the determination module 330 is further configured to: when the task to be executed is an interactive task, determine, among the cores of N operation levels, a core with the highest operation level as a target core matching the priority of the interactive task;

[0148] When the task to be executed is a low-frequency task, among the N cores with different operation levels, the core with the lowest operation level is determined as the target core that matches the priority of the low-frequency task; the low-frequency task represents the task with the shortest historical running time within the predetermined time;

[0149] When the task to be executed is a low-demand task, among the N cores of computing level, the core with the lowest computing level is determined as the target core that matches the priority of the low-demand task; the low-demand task represents the task with the lowest computing power requirement among the currently executed tasks.

[0150] The present invention further provides a mobile terminal, including a processor 120 and a memory 130. The memory 130 stores a computer program. When the processor executes the computer program, the method for executing the task disclosed in the above embodiment is implemented.

[0151] The embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 120, the task execution method disclosed in the embodiment of the present invention is implemented.

[0152] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0153] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0154] If the functions are implemented in the form of software function modules 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 the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0155] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A task running method, characterized in that: Applied to a mobile terminal, the mobile terminal includes a CPU, and the method includes: When the CPU has cores with different computing capabilities, all cores are divided into N cores of computing levels according to computing capabilities; when there is a task to be executed, a target core matching the priority of the task to be executed is determined among the N cores of computing levels; wherein the priority of the task to be executed represents the computing capability requirement of the task to be executed; and the target core belongs to at least one of all cores; Binding the task to be executed to the target core for execution; In the case where the system of the mobile terminal is an Android system, when the CPU has cores with different computing capabilities, the step of dividing all cores into cores of N computing levels according to computing capabilities includes: Obtaining the maximum operating frequency of each core in the CPU, and calculating the average power of the maximum operating frequencies of all cores; When the maximum operating frequency of a core is not equal to the average power, determining that the CPU has cores with different computing capabilities; De-duplication is performed according to the maximum operating frequency of all cores to obtain a de-duplication parameter, where the de-duplication parameter is N and represents the number of operation levels; The operation level to which each core belongs is determined according to the relationship between the maximum operating frequency of each core and the average power, so as to divide all the cores into cores of N operation levels.

2. The method according to claim 1, characterized in that In the case where the system of the mobile terminal is an IOS system, when the CPU has cores with different computing capabilities, the step of dividing all cores into cores of N computing levels according to computing capabilities includes: Determining whether the CPU has cores with different computing capabilities according to the type information of the CPU; If so, all cores are divided into N computing levels of cores according to different computing capabilities.

3. The method according to claim 2, characterized in that The step of determining whether the CPU has cores with different computing capabilities according to the type information of the CPU comprises: Obtaining a core type corresponding to the type information of the CPU in a pre-stored information table; the core type represents the computing capability of the core; When there are at least two core types, it is determined that the CPU has cores with different computing capabilities.

4. The method according to claim 1, characterized in that: The step of determining, when there is a task to be executed, a target core that matches the priority of the task to be executed among the cores of the N computing levels comprises: When the task to be executed is an interactive task, among the cores of the N computing levels, a core with the highest computing level is determined as a target core matching the priority of the interactive task; When the task to be executed is a low-frequency task, among the N cores of the computing levels, a core with the lowest computing level is determined as a target core that matches the priority of the low-frequency task; the low-frequency task represents a task with the shortest historical running time within a predetermined time; When the task to be executed is a low-demand task, among the N cores of computing levels, the core with the lowest computing level is determined as the target core that matches the priority of the low-demand task; the low-demand task represents the task with the lowest computing power requirement among the currently executed tasks.

5. A task running device, characterized in that: Applied to a mobile terminal, the mobile terminal includes a CPU, and the device includes: A classification module, for dividing all cores into N computing levels of cores according to computing capabilities when the CPU has cores with different computing capabilities; a determination module, configured to determine, when there is a task to be executed, a target core matching the priority of the task to be executed among the cores of the N computing levels; wherein the priority of the task to be executed represents the computing power requirement of the task to be executed; and the target core belongs to at least one of all the cores; A binding module binds the task to be executed to the target core for execution; In the case where the system of the mobile terminal is the Android system, the grading module is further used to: obtain the maximum operating frequency of each core in the CPU, and calculate the average power of the maximum operating frequencies of all cores; when the maximum operating frequency of a core is not equal to the average power, determine that the CPU has cores with different computing capabilities; perform deduplication according to the maximum operating frequencies of all cores to obtain a deduplication parameter, where the deduplication parameter is N and represents the number of operation levels; determine the operation level to which each core belongs based on the relationship between the maximum operating frequency of each core and the average power, so as to divide all cores into cores of N operation levels.

6. The device according to claim 5, characterized in that The determining module is also used for: When the task to be executed is an interactive task, among the cores of the N computing levels, a core with the highest computing level is determined as a target core matching the priority of the interactive task; When the task to be executed is a low-frequency task, among the N cores of the computing levels, a core with the lowest computing level is determined as a target core that matches the priority of the low-frequency task; the low-frequency task represents a task with the shortest historical running time within a predetermined time; When the task to be executed is a low-demand task, among the N cores of computing levels, the core with the lowest computing level is determined as the target core that matches the priority of the low-demand task; the low-demand task represents the task with the lowest computing power requirement among the currently executed tasks.

7. A mobile terminal, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

8. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 4.