Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The electronic device according to the embodiments of the present application may be an electronic device with communication capability, and the electronic device may include various handheld devices with wireless communication function, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem, and various forms of User Equipment (UE), Mobile Stations (MS), terminal devices (terminal device), and so on.
The following describes embodiments of the present application in detail.
Fig. 1 is a system architecture diagram of a multi-core processor control method provided in an embodiment of the present application, including a plurality of cores 110, temperature sensors 120, and a core switching unit 130, where the cores 110 include at least one core 110 in an operating state and at least one core 110 in an idle state, the cores 110 may be integrated on the multi-core processor, each core 110 may be provided with at least one temperature sensor 120, the temperature sensors 120 are connected to the core switching unit 130, and the core switching unit 130 may perform a start-up or shut-down operation on the cores 110 according to temperature information received from the temperature sensors 120, so as to flexibly switch the cores 110 between the operating state and the idle state.
Through the system architecture, the processor cores can be dynamically switched based on the temperature of the processor cores to reduce the temperature of the processor cores, the performance of a multi-core processor is not required to be reduced, and the power consumption is reduced while the use experience of a user is greatly improved.
To more clearly illustrate the System architecture, an application scenario of the multi-core processor control method in the embodiment of the present application is described in detail below with reference to fig. 2, where fig. 2 is an application scenario diagram of a multi-core processor control method provided in the embodiment of the present application, and the multi-core processor control method includes a System-on-a-Chip (SoC) Chip, where the SoC Chip includes a plurality of cores, each of the cores is integrated with at least one temperature sensor, and the temperature sensor may be internally provided with a periodic timer to periodically and asynchronously obtain a temperature of each core, and when a temperature of a core in an operating state is too high, the core with an excessively high temperature is turned off, and the core with a lower temperature in an idle state is used to replace the core with an excessively high temperature, so that the temperature of the processor core can be dynamically switched based on the temperature of the processor core to lower the temperature of the processor core, the performance of the multi-core processor is not required to be reduced, and the power consumption is reduced while the use experience of a user is greatly improved.
A multi-core processing method in the embodiment of the present application is described in detail below with reference to fig. 3, where fig. 3 is a schematic flow diagram of a control method for a multi-core processor provided in the embodiment of the present application, and specifically includes the following steps:
step 301, a first temperature of each first core and a second temperature of each second core are obtained.
When the number of the first cores of the multi-core processor of the electronic device is smaller than the total number of the cores of the multi-core processor, step 301 is executed, where the first cores are cores in a working state, and the second cores are cores in an idle state.
Wherein the first temperature and the second temperature may be asynchronously obtained by at least one temperature sensor provided on each core of the multi-core processor.
It should be noted that, a temperature difference meeting the temperature difference threshold needs to exist between the first temperature and the second temperature in the embodiment of the present application, for example, the temperature difference threshold may be set to 5 degrees celsius, if the obtained temperature difference between the first temperature and the second temperature is greater than or equal to 5 degrees celsius, the subsequent steps may be continuously performed, if the obtained temperature difference between the first temperature and the second temperature is less than 5 degrees celsius, at this time, the working state and the idle state are switched without practical beneficial effects, the number of cores in the working state needs to be increased to reduce the temperature, which does not belong to the scope of the embodiment of the present application, and details are not repeated here. In addition, the temperature difference threshold may be flexibly changed according to a scene, and the above examples do not limit the present application.
Optionally, the temperature sensor may be provided with a built-in periodic timer, for example, the first temperature and the second temperature are obtained every 5 seconds, and since the temperature of the core of the multi-core processor does not change suddenly, the first temperature and the second temperature are obtained periodically, which may save power consumption.
Step 302, determining a third core according to the first temperature.
It should be noted that, the third core is a core in an overheat state, and the first core is a core in an operating state, and the operating state may include a normal operating state, an overheat state, and the like, so that the third core is actually screened from the first core, and the screening step may be as follows:
firstly, whether the first temperature is greater than a preset temperature threshold value or not can be judged, and if the first temperature is greater than the preset temperature threshold value, a first duration that the first temperature is greater than the preset temperature threshold value is obtained; then, it may be determined whether the first duration is greater than or equal to a predetermined time threshold, and if the first duration is greater than or equal to the predetermined time threshold, the third core is determined.
Specifically, the first temperature may include temperature data of a plurality of first cores, the first time period may also include a plurality of time period data in which the first temperature exceeds the preset temperature threshold, and when the temperature of any one of the first cores is greater than the preset temperature threshold and the time period is greater than the preset time threshold, the first core may be determined to be a third core, that is, a core in an overheat state.
Optionally, after determining whether the first duration is greater than or equal to a preset time threshold, if the first duration is less than the preset time threshold, the step of obtaining the first temperature is executed again.
The third core is determined according to the first temperature, so that an accurate core in an overheat state can be obtained, preparation is made for switching of subsequent cores, the use experience of a user is improved, power consumption is reduced, whether the working state of the core is switched or not is judged by setting the running time threshold of the processor core, the performance loss of the memory caused by frequently switching the state of the core in a short time can be avoided, and the working efficiency of the core is improved.
Step 303, switching at least one of the second cores to a working state according to the second temperature, and switching at least one of the third cores to an idle state.
Wherein, the number N of the second cores and the number M of the third cores are obtained, and the N, M is a positive integer, and then, whether the number N of the second cores is greater than or equal to the number M of the third cores is determined, and at this time, two switching paths exist,
if the number N of the second cores is greater than or equal to the number M of the third cores, the second core is a first switching path, and since the number of the second cores is greater, in the first switching path, all the third cores may be switched to an idle state, and the second cores corresponding to all the third cores may be switched to an operating state, specifically, the second core switching priority may be determined according to the ascending order of the second temperature, and the M second cores may be switched to the operating state according to the second core switching priority, and the M third cores may be switched to the idle state. For example, if there are two second cores with temperatures of 20 degrees celsius and 30 degrees celsius respectively, and there is only one third core with a temperature of 90 degrees celsius, then the two second cores may be arranged in ascending order according to the second temperature, the second core with a temperature of 20 degrees celsius is arranged at the first priority, the second core with a temperature of 30 degrees celsius is arranged at the second priority, and at this time, the third core with a temperature of 90 degrees celsius needs to be switched to the idle state, and the second core with a temperature of 20 degrees celsius of the first priority is selected to replace the third core to continue working;
if the number N of the second cores is smaller than the number M of the third cores, the second switching path is used, and because the number of the second cores is smaller, all the cores in the overheat state, that is, the third cores cannot be switched to the idle state, only the third cores having the same number as the second cores are selected to enter the idle state, and all the second cores are switched to the working state. For example, if there are three third cores with a temperature of 90 degrees celsius, 95 degrees celsius, and 98 degrees celsius, respectively, and there is only one second core with a temperature of 30 degrees celsius, then the third core switching priorities are ordered as: the third core at 98 degrees celsius, the third core at 95 degrees celsius, and the third core at 90 degrees celsius, at this time, the third core at 98 degrees celsius may be switched to an idle state, and the second core may be switched to a working state to replace the third core at 98 degrees celsius to continue working.
Optionally, in the second switching path, because the third core still continues to operate, in order to avoid a further increase in the temperature of the third core that continues to operate, the frequency of the third core that continues to operate may be reduced, and the frequency of the second core that has just been switched to an operating state may be increased, so that the temperature differences between the multiple cores may be balanced, and the temperature of the cores may be reduced as much as possible without changing the performance of the multi-core processor.
Optionally, if the number N of the second cores is smaller than the number M of the third cores after determining whether the number N of the second cores is greater than or equal to the number M of the third cores, the step of obtaining the first temperature is continuously performed.
By the method, the processor cores can be dynamically switched based on the temperature of the processor cores to reduce the temperature of the processor cores, the performance of the multi-core processor is not required to be reduced, and the power consumption is reduced while the use experience of a user is greatly improved.
Next, a detailed description is given to another multi-core processor control method in the embodiment of the present application with reference to fig. 4, where fig. 4 is a schematic flow diagram of another multi-core processor control method provided in the embodiment of the present application, and the method specifically includes the following steps:
step 401, obtaining an initial temperature of each core of a multi-core processor of the electronic device.
The initial temperature is a plurality of groups of data, including the temperature of each core, when the multi-core processor needs to work, the initial temperature of each core of the multi-core processor can be obtained through the thermistor or the temperature sensor, and therefore preparation can be made for subsequently selecting the first core and the second core.
Step 402, determining the first core and the second core according to the initial temperature.
The priority of the operating cores can be determined according to the ascending order of the initial temperature, the highest priority of the operating cores is determined as the first core, and the rest are determined as the second core.
By determining the first core and the second core according to the initial temperature, which cores are operated and which cores are idle can be selected according to the temperature when the multi-core processor is started, and the power consumption is reduced while the performance is not reduced.
Step 403, when the number of the first cores of the multi-core processor of the electronic device is smaller than the total number of the cores of the multi-core processor, acquiring a first temperature of each first core and a second temperature of each second core.
Step 404, determining a third core according to the first temperature, wherein the third core is in an overheating state.
Step 405, switching at least one of the second cores to a working state and at least one of the third cores to an idle state according to the second temperature.
The steps not described in detail above can be referred to the method described in fig. 3, and are not described again here.
Through the steps, the processor cores can be dynamically switched based on the temperature of the processor cores to reduce the temperature of the processor cores, the performance of a multi-core processor is not required to be reduced, and the power consumption is reduced while the use experience of a user is greatly improved.
Referring to fig. 5 in accordance with the embodiment shown in fig. 3 and fig. 4, fig. 5 is a schematic structural diagram of an electronic device 500 provided in the embodiment of the present application, as shown in the figure, the electronic device 500 includes an application processor 501, a communication interface 502, and a memory 503, where the application processor 501, the communication interface 502, and the memory 503 are connected to each other through a bus 504, and the bus 504 may be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 504 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus. Wherein the memory is for storing a computer program comprising program instructions, the application processor being configured for invoking the program instructions, performing the method of:
when the number of first cores of a multi-core processor of the electronic equipment is smaller than the total number of cores of the multi-core processor, acquiring a first temperature of each first core and a second temperature of each second core, wherein the multi-core processor at least comprises two cores, the first cores are cores in a working state, and the second cores are cores in an idle state;
determining a third core according to the first temperature, wherein the third core is a core in an overheat state;
and switching at least one second core into a working state according to the second temperature, and switching at least one third core into an idle state.
In one possible example, in the obtaining the first temperature of each first core and the second temperature of each second core other than the first core, the instructions in the program are specifically configured to: asynchronously acquiring the first temperature and the second temperature through at least one temperature sensor arranged on each core of the multi-core processor.
In one possible example, in the determining a third core based on the first temperature, the instructions in the program are specifically configured to: judging whether the first temperature is greater than a preset temperature threshold value or not;
if so, acquiring a first time length for which the first temperature is greater than the preset temperature threshold;
judging whether the first time length is greater than or equal to a preset time threshold value or not;
and if the first duration is greater than or equal to a preset time threshold, determining the third core.
In one possible example, in terms of switching at least one of the second cores to the operating state and at least one of the third cores to the idle state according to the second temperature, the instructions in the program are specifically configured to perform the following operations: acquiring the number N of the second cores and the number M of the third cores, wherein N, M is a positive integer;
judging whether the number N of the second cores is larger than or equal to the number M of the third cores;
if the number N of the second cores is greater than or equal to the number M of the third cores, determining a second core switching priority according to the ascending order of the second temperature;
and switching the M second cores into a working state and switching the M third cores into an idle state according to the second core switching priority.
In one possible example, after the determining whether the number N of second cores is greater than or equal to the number M of third cores, the instructions in the program are further specifically configured to: if the number N of the second cores is smaller than the number M of the third cores, determining a third core switching priority according to the descending order of the first temperature;
and switching the N third cores into an idle state and switching the N second cores into a working state according to the third core switching priority.
In one possible example, after the determining whether the first temperature is greater than the preset temperature threshold or after the determining whether the first time duration is greater than or equal to the preset time threshold, the instructions in the program are further specifically configured to: if the first temperature is not greater than a preset temperature threshold or the first time length is less than a preset time threshold, continuing to execute the step of obtaining the first temperature.
In one possible example, in a preceding aspect of the obtaining the first temperature of each first core and the second temperature of each second core other than the first core, the instructions in the program are further specifically configured to: acquiring the initial temperature of each core of a multi-core processor of the electronic equipment;
determining the first core and the second core according to the initial temperature.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the electronic device comprises corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above-mentioned functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
Fig. 6 is a block diagram of structural units of a multicore processor control apparatus 600 according to an embodiment of the present application. The multi-core processor control device 600 is applied to an electronic device, and comprises a processing unit 601, a communication unit 602 and a storage unit 603, wherein the processing unit 601 is used for executing any step in the method embodiments, and when data transmission such as transmission is executed, the communication unit 602 is optionally called to complete corresponding operation. The details will be described below.
The processing unit 601 is configured to obtain a first temperature of each first core and a second temperature of each second core when the number of first cores of a multi-core processor of the electronic device is smaller than the total number of cores of the multi-core processor, where the multi-core processor includes at least two cores, the first core is a core in a working state, and the second core is a core in an idle state;
determining a third core according to the first temperature, wherein the third core is a core in an overheat state;
and switching at least one second core into a working state according to the second temperature, and switching at least one third core into an idle state.
In one possible example, in terms of the obtaining the first temperature of each first core and the second temperature of each second core except the first core, the processing unit 601 is specifically configured to: asynchronously acquiring the first temperature and the second temperature through at least one temperature sensor arranged on each core of the multi-core processor.
In one possible example, in the aspect of determining the third core according to the first temperature, the processing unit 601 is specifically configured to: judging whether the first temperature is greater than a preset temperature threshold value or not;
if so, acquiring a first time length for which the first temperature is greater than the preset temperature threshold;
judging whether the first time length is greater than or equal to a preset time threshold value or not;
and if the first duration is greater than or equal to a preset time threshold, determining the third core.
In a possible example, in terms of switching at least one of the second cores to the working state and at least one of the third cores to the idle state according to the second temperature, the processing unit 601 is specifically configured to: acquiring the number N of the second cores and the number M of the third cores, wherein N, M is a positive integer;
judging whether the number N of the second cores is larger than or equal to the number M of the third cores;
if the number N of the second cores is greater than or equal to the number M of the third cores, determining a second core switching priority according to the ascending order of the second temperature;
and switching the M second cores into a working state and switching the M third cores into an idle state according to the second core switching priority.
In a possible example, after the determining whether the number N of second cores is greater than or equal to the number M of third cores, the processing unit 601 is specifically further configured to: if the number N of the second cores is smaller than the number M of the third cores, determining a third core switching priority according to the descending order of the first temperature;
and switching the N third cores into an idle state and switching the N second cores into a working state according to the third core switching priority.
In a possible example, after the determining whether the first temperature is greater than a preset temperature threshold, or after the determining whether the first time duration is greater than or equal to a preset time threshold, the processing unit 601 is further specifically configured to: if the first temperature is not greater than a preset temperature threshold or the first time length is less than a preset time threshold, continuing to execute the step of obtaining the first temperature.
In one possible example, in terms of the obtaining of the first temperature of each first core and the second temperature of each second core except the first core, the processing unit 601 is further specifically configured to: acquiring the initial temperature of each core of a multi-core processor of the electronic equipment;
determining the first core and the second core according to the initial temperature.
Embodiments of the present application also provide a computer storage medium, where the computer storage medium stores a computer program for electronic data exchange, the computer program enabling a computer to execute part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising an electronic device.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.