Data processing method, electronic equipment and storage medium

By dynamically adjusting the memory clock frequency in electronic devices and optimizing processor resource allocation, the problem that the prior art cannot adapt to multiple application scenarios is solved, data read and write performance is improved and power consumption is reduced.

CN118981244APending Publication Date: 2024-11-19HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410840210.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

The prior art cannot adapt to the demand for data read and write rates in multiple data read and write application scenarios, resulting in too slow read and write rates in low read and write load scenarios and too high power consumption in high read and write load scenarios.

Method used

By dynamically adjusting the clock frequency of the memory in the electronic device, the high-frequency processing unit is called first to process the read and write tasks according to the read and write load value and processor load situation, and reduce the clock frequency after the read and write tasks are completed to reduce power consumption.

Benefits of technology

It improves data read and write performance in low read and write load scenarios, reduces power consumption in high read and write load scenarios, and realizes adaptation to multiple application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118981244A_ABST
    Figure CN118981244A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method, electronic equipment and a storage medium. The method includes running a memory at a first clock frequency. If it is detected that the first thread used for executing the first task is started, the clock frequency of the memory is adjusted from the first clock frequency to the second clock frequency. The second clock frequency is greater than the first clock frequency. The read-write data volume corresponding to the first task is smaller than the preset data volume. According to the method, the clock frequency of the memory can be automatically improved through thread recognition in a low-load read-write scene, the data read-write performance is improved, and the first task processing speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application number 202310212343.3 submitted to the State Intellectual Property Office of China, application date February 27, 2023, and invention name “Data processing method, electronic device and storage medium”. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a data processing method, an electronic device and a storage medium. Background Art

[0003] Memory is a memory element used to store data and is used in various electronic devices. The clock frequency of the memory reflects the read and write performance of the memory. Generally speaking, the higher the clock frequency of the memory, the faster the read and write rate, but the power consumption will also increase. The lower the clock frequency of the memory, the slower the read and write rate, and the power consumption will also decrease. Therefore, in order to balance power consumption and read and write performance, the clock frequency of the memory can be dynamically adjusted. For example, when the amount of read and write data is small, a lower clock frequency can be set for the memory. When the amount of read and write data is large, a higher clock frequency can be set for the memory.

[0004] However, the application scenarios of data reading and writing are diverse, and the current clock frequency adjustment scheme cannot adapt to the requirements of data reading and writing rates in various application scenarios. Summary of the invention

[0005] In view of this, the present application provides a data processing method, an electronic device and a storage medium, which can be applicable to a variety of data reading and writing application scenarios and meet the requirements of a variety of application scenarios for data reading and writing performance.

[0006] In a first aspect, the present application provides a data processing method, which is applied to an electronic device, wherein the electronic device includes a memory. In a low read / write load scenario, the electronic device runs the memory at a first clock frequency. If the electronic device detects that a first thread is started, the clock frequency of the memory is adjusted from the first clock frequency to a second clock frequency to increase the clock frequency of the memory. After the electronic device runs the memory at the second clock frequency, the electronic device uses the memory to perform data reading and writing of the first task.

[0007] The above-mentioned first thread is used to execute the first task, and the amount of read and write data corresponding to the first task is less than the preset data amount. Since the amount of read and write data corresponding to the first task is small, the load value of the memory does not reach the preset frequency increase threshold. In a low read and write load scenario, if the electronic device recognizes that a specific thread (such as the first thread) is started, even if the load value of the memory does not reach the preset frequency increase threshold, the electronic device can adjust the clock frequency of the memory to a higher clock frequency (i.e., the second clock frequency). After the electronic device runs the memory at the second clock frequency, it can speed up the data read and write rate of the first task and improve the performance of data reading and writing in a low read and write load scenario.

[0008] In a possible implementation of the first aspect, the first task includes starting a first application, scanning a code, or loading a preset picture. The data volume of the preset picture is less than a preset value.

[0009] In a possible implementation manner of the first aspect, the method further includes: after the memory completes reading and writing data of the first task, adjusting a clock frequency of the memory from the second clock frequency to the first clock frequency.

[0010] In this way, after completing the data reading and writing of the first task, the electronic device can timely reduce the frequency of the storage to reduce the power consumption of the electronic device.

[0011] In another possible implementation of the first aspect, the operating the memory at the first clock frequency includes: operating the memory at the first clock frequency when the load value of the memory is less than a preset frequency reduction threshold. The method further includes: operating the memory at the second clock frequency when the load value of the memory is greater than a preset frequency increase threshold. The preset frequency increase threshold is greater than the preset frequency reduction threshold. When the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, operating the memory at the current clock frequency.

[0012] The load value of the memory can reflect the load on the memory. The electronic device can adjust the clock frequency of the memory according to the load value of the memory. When the load value of the memory is large, the electronic device increases the clock frequency of the memory to speed up the data reading and writing rate. When the load value of the memory is small, the electronic device decreases the clock frequency of the memory to reduce the power consumption of the electronic device.

[0013] In another possible implementation of the first aspect, the processor of the electronic device includes a plurality of processing units, and the operating frequency of each processing unit is different. After the memory is operated at the second clock frequency, the above method further includes: counting the duration of the operation of the memory at the second clock frequency and the amount of data read and written by the memory per unit time. If the duration of the operation of the memory at the second clock frequency is greater than a preset duration threshold, and the amount of data read and written by the memory per unit time is greater than a first data volume threshold, the amount of data to be read and written by the memory is obtained. If the amount of data to be read and written by the memory is greater than the second data volume threshold, the first processing unit of the processor is preferentially called to process the read and write tasks. The operating frequency of the first processing unit is greater than the preset operating frequency.

[0014] In the embodiment of the present application, when the memory is under heavy load for a long time and the amount of data to be read and written in the memory is large, it is difficult for the electronic device to speed up the reading and writing of the electronic device by increasing the reading and writing rate of the memory. At this time, the electronic device can process the reading and writing tasks by scheduling the first processing unit with the fastest processing rate to improve the overall reading and writing throughput of the electronic device.

[0015] In another possible implementation of the first aspect, the first processing unit of the processor is preferentially called to process the read and write tasks, including: obtaining a load value of the processor of the electronic device, and if the load value of the processor is less than a preset load threshold, preferentially calling the first processing unit of the processor to process the read and write tasks. The operating frequency of the first processing unit is greater than the preset operating frequency.

[0016] Since the read and write tasks are only part of the tasks performed by the electronic device, in order for the electronic device to normally perform tasks that do not involve data reading and writing, the electronic device can also determine whether to call the first processing unit of the processor to process the read and write tasks in combination with the current processor load. If the processor load value is less than the preset load threshold, it can be considered that the processor of the electronic device currently has additional capacity to process the read and write tasks. In this case, the electronic device can give priority to calling the first processing unit of the processor to process the read and write tasks, thereby speeding up the rate at which the processor processes the read and write tasks.

[0017] In another possible implementation of the first aspect, the method further includes: when the number of multiple read and write tasks reaches a preset number of tasks, triggering an interrupt request to the processor, and the processor responds to the interrupt request and centrally processes the multiple read and write tasks.

[0018] The electronic device can add interrupt aggregation processing while the clock frequency of the memory is kept increasing, so that multiple interrupt requests are merged into one interrupt request. In response to the interrupt request, the processor can centrally process multiple read and write tasks. In this way, the number of interrupt requests can be greatly reduced, and the number of times the processor of the electronic device is interrupted can be reduced. The processor will not be frequently interrupted by interrupt requests, which can reduce the impact of interrupt requests of read and write tasks on the processor processing rate, and improve the data reading and writing performance of electronic devices in high read and write load scenarios.

[0019] In another possible implementation of the first aspect, after adjusting the clock frequency of the memory from the first clock frequency to the second clock frequency and before the memory completes the data reading and writing of the first task, the method further includes: periodically querying whether the memory has completed the data reading and writing of the first task.

[0020] The electronic device periodically queries whether the memory has completed data reading and writing, that is, polling to check the reading and writing status of the memory, and can obtain the latest status of the memory in real time. The implementation method is simple and easy to operate.

[0021] In a second aspect, the present application provides a data processing method, which is applied to an electronic device, and the electronic device includes a memory and a processor. The processor includes a plurality of processing units, and the operating frequency of each processing unit is different. The method includes: running the memory at a second clock frequency. The second clock frequency is greater than the first clock frequency. The duration of running the memory at the second clock frequency and the amount of data read and written by the memory per unit time are counted. If the duration of running the memory at the second clock frequency is greater than a preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data volume threshold, the amount of data to be read and written by the memory is obtained. If the amount of data to be read and written by the memory is greater than the second data volume threshold, the first processing unit of the processor is preferentially called to process the read and write tasks. The operating frequency of the first processing unit is greater than the preset operating frequency.

[0022] In a possible implementation of the second aspect, the above-mentioned priority calling of the first processing unit of the processor to process the read and write tasks includes: obtaining a load value of the processor of the electronic device. If the load value of the processor is less than a preset load threshold, the first processing unit of the processor is preferentially called to process the read and write tasks.

[0023] In another possible implementation of the second aspect, the method further includes: when the number of multiple read and write tasks reaches a preset task number threshold, triggering an interrupt request to the processor, and the processor responds to the interrupt request and centrally processes the multiple read and write tasks.

[0024] In another possible implementation of the second aspect, the operating the memory at the second clock frequency includes: operating the memory at the second clock frequency when the load value of the memory is greater than a preset frequency increase threshold. The method further includes: operating the memory at the first clock frequency when the load value of the memory is less than a preset frequency reduction threshold. Operating the memory at the current clock frequency when the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold.

[0025] In another possible implementation of the second aspect, when the memory is operated at the first clock frequency, the method further includes: if it is detected that the first thread is started, adjusting the clock frequency of the memory from the first clock frequency to the second clock frequency. The first thread is used to execute the first task, and the amount of read and write data corresponding to the first task is less than the preset data amount.

[0026] In another possible implementation of the second aspect, the first task includes starting a first application, scanning a code, or loading a preset picture. The data volume of the preset picture is less than a preset value.

[0027] In another possible implementation manner of the second aspect, the method further includes: after the memory completes reading and writing data of the first task, adjusting the clock frequency of the memory from the second clock frequency to the first clock frequency.

[0028] In another possible implementation of the second aspect, after adjusting the clock frequency of the memory from the first clock frequency to the second clock frequency and before the memory completes the data reading and writing of the first task, the method further includes: periodically querying whether the memory has completed the data reading and writing of the first task.

[0029] In a third aspect, the present application provides an electronic device, comprising: a memory and a processor. The memory is coupled to the processor. The memory stores a computer program code, the computer program code comprising a computer instruction, and when the computer instruction is executed by the processor, the electronic device executes the method described in the first aspect and any possible implementation thereof or the second aspect and any possible implementation thereof.

[0030] In a fourth aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect and any possible implementation thereof or the second aspect and any possible implementation thereof.

[0031] In a fifth aspect, the present application provides a computer program product comprising program instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect and any possible implementation thereof or the second aspect and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of an example of clock frequency adjustment provided in an embodiment of the present application;

[0033] Figure 2 A hardware structure block diagram of an example of an electronic device provided in an embodiment of the present application;

[0034] Figure 3 A software structure block diagram of an example of an electronic device provided in an embodiment of the present application;

[0035] Figure 4 A flowchart of a data processing method example 1 provided in an embodiment of the present application;

[0036] Figure 5 A software interaction diagram of a data processing method example 1 provided in an embodiment of the present application;

[0037] Figure 6 A flowchart of a second data processing method example provided in an embodiment of the present application;

[0038] Figure 7 A software interaction diagram of a data processing method example 2 provided in an embodiment of the present application;

[0039] Figure 8 A flowchart of a data processing method example 3 provided in an embodiment of the present application;

[0040] Fig. 9 A schematic diagram of an example of read / write performance adjustment provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The present application embodiment provides a data processing method, which can provide targeted clock frequency adjustment schemes for various application scenarios to meet the data reading and writing requirements of electronic devices in various application scenarios. In order to facilitate understanding of the method provided by the present application embodiment, the relevant background and the clock frequency adjustment scheme in the related art are first introduced here.

[0042] The memory is a storage device of an electronic device, which stores the programs executed by the electronic device and the data required to execute the programs. The electronic device reads the programs or data in the memory to achieve normal operation. In addition, the electronic device can also write data in the memory to achieve data storage. The operation of an electronic device reading data from the memory or writing data in the memory can be called an input / output (I / O) operation (or read / write operation).

[0043] The memory includes an internal memory and an external memory. The external memory stores a large amount of data that the electronic device needs to permanently store. The internal memory serves as a storage space for temporarily storing data. The I / O operation of the electronic device on the external memory needs to pass through the internal memory. When the electronic device reads data, it copies the data in the external memory to the internal memory, and then reads the copied data in the internal memory. When the electronic device writes data, it writes the data in the internal memory, and then copies the data written in the internal memory to the external memory. The rate at which the electronic device accesses the internal memory is very fast, and the delay in the electronic device performing the I / O operation can be considered to be mainly the delay in accessing the external memory. Therefore, in the embodiment of the present application, the read and write performance of the electronic device is improved by adjusting the clock frequency of the memory, which is mainly for the external memory. Of course, the method provided in the embodiment of the present application can also be applied to the internal memory.

[0044] The clock frequency of the memory is related to the read and write rate of the memory. The higher the clock frequency of the memory, the faster the read and write rate, and the higher the power consumption. The lower the clock frequency of the memory, the slower the read and write rate, and the lower the power consumption. Here is a solution in the related art for improving the read and write performance of electronic devices by adjusting the clock frequency of the memory.

[0045] In the related art, the load value of the memory can reflect the load borne by the memory. The electronic device can adjust the clock frequency of the memory according to the load value of the memory. When the load value of the memory is large, the electronic device increases the clock frequency of the memory to speed up the data reading and writing rate. When the load value of the memory is small, the electronic device lowers the clock frequency of the memory to reduce the power consumption of the electronic device.

[0046] Exemplarily, when the load value of the memory is less than the preset frequency reduction threshold, the electronic device operates the memory at a first clock frequency. When the load value of the memory is greater than the preset frequency increase threshold, the electronic device operates the memory at a second clock frequency. When the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, the memory is operated at the current clock frequency. The preset frequency increase threshold is greater than the preset frequency reduction threshold. The second clock frequency is greater than the first clock frequency. The preset frequency increase threshold and the preset frequency reduction threshold can be set according to actual application scenarios or requirements, and are not limited here.

[0047] like Figure 1 As shown, if the current load value of the memory is greater than the preset up-frequency threshold (upthreshold), the electronic device controls the memory to up-frequency (scale_up), and adjusts the clock frequency of the memory to the highest clock frequency (such as the second clock frequency). If the current load value of the memory is less than the preset down-frequency threshold (downdifferential), the electronic device controls the memory to down-frequency (scale_down), and adjusts the clock frequency of the memory to the lowest clock frequency (such as the first clock frequency). If the current load value of the memory is between the preset up-frequency threshold and the preset down-frequency threshold, the electronic device controls the memory to maintain the current clock frequency (keep_cur_freq). That is, if the current clock frequency of the memory is the highest clock frequency, the memory continues to maintain the highest clock frequency. If the current clock frequency of the memory is the lowest clock frequency, the memory continues to maintain the lowest clock frequency.

[0048] It is understandable that the example only takes the memory having two clock frequencies (the first clock frequency and the second clock frequency) as an example to illustrate the process of the electronic device adjusting the clock frequency of the memory according to the load value of the memory. Of course, the memory may also have more clock frequencies (greater than 2), which will not be described here.

[0049] Here, the load value of the memory can be determined according to the parameters related to the read and write performance in the electronic device. For example, the load value of the memory can be determined according to the running time of the current application in the foreground and the wake-up time of the memory. The running time of the current application in the foreground can represent the total duration of the current application in the foreground activity. The wake-up time of the memory can represent the duration of the electronic device performing the I / O operation. The load value of the memory can be equal to the ratio of the wake-up time of the memory to the running time of the current application in the foreground, indicating the proportion of the duration of the electronic device performing the I / O operation within the total duration of the current application in the foreground activity. For another example, the load value of the memory can be determined according to the duration of the electronic device performing the I / O operation within the preset statistical duration. For example, the load value is equal to the ratio of the duration of the electronic device performing the I / O operation within the preset statistical duration to the preset statistical duration. If the load value is close to 100%, it indicates that the electronic device performs too many I / O operations and the memory is close to full load operation. At this time, the read and write delay of the electronic device is large.

[0050] The I / O operation of electronic devices involves a variety of application scenarios. The above clock frequency adjustment solution cannot meet the requirements for read and write speed in some application scenarios.

[0051] For example, in scenarios with low read and write data volumes, such as application startup, code scanning, and image loading, the electronic device reads the data of the corresponding task in the memory to implement the task. Since the amount of read and write data involved in these scenarios is small, the load value of the memory does not reach the above-mentioned preset frequency increase threshold, and the electronic device runs the memory at the lowest clock frequency. When the memory runs at a lower clock frequency, the data read and write rate is low, the rate at which the electronic device executes tasks is also slow, and the user experience is poor.

[0052] For example, in related application scenarios such as large file compression, loading large games, and single large file copying, electronic devices need to read and write a large amount of data. Due to the large amount of read and write data involved in these scenarios, the load value of the memory reaches the above-mentioned preset frequency increase threshold, and the electronic device runs the memory at the highest clock frequency. However, maintaining the highest clock frequency for a long time will increase the power consumption of the electronic device and shorten the battery life of the electronic device.

[0053] An embodiment of the present application provides a data processing method that can improve the data read and write performance of an electronic device in a low read and write load scenario and a high read and write load scenario. The low read and write load scenario can be an application scenario with a small amount of read and write data. In a low read and write load scenario, the load value of the memory of the electronic device does not reach a preset frequency increase threshold, and the electronic device runs the memory at a low clock frequency (i.e., a first clock frequency). The high read and write load scenario can be an application scenario with a large amount of read and write data. In a high read and write load scenario, the load value of the memory of the electronic device is always greater than a preset low-frequency threshold, and the electronic device runs the memory at a high clock frequency (i.e., a second clock frequency).

[0054] In a low read / write load scenario, the electronic device runs the memory at a first clock frequency. If the electronic device detects that the first thread is started, the clock frequency of the memory is adjusted from the first clock frequency to the second clock frequency to increase the clock frequency of the memory. After the electronic device runs the memory at the second clock frequency, the electronic device uses the memory running at the second clock frequency to perform data reading and writing of the first task.

[0055] The above-mentioned first thread is used to execute the first task, and the amount of read and write data corresponding to the first task is less than the preset data amount. The first task corresponds to a read and write task with a small amount of read and write data. For example, the first task is to start the first application, scan a code, or load a preset picture. The amount of data of the preset picture is less than the preset value, such as a preset picture with a data amount less than a few bits or kilobits. Since the amount of read and write data corresponding to the first task is small, the load value of the memory does not reach the preset frequency increase threshold. In a low read and write load scenario, if the electronic device recognizes that a specific thread (such as the first thread) is started, even if the load value of the memory does not reach the preset frequency increase threshold, the electronic device can also adjust the clock frequency of the memory to a higher clock frequency (ie, the second clock frequency). After the electronic device runs the memory at the second clock frequency, it can speed up the data read and write rate of the first task and improve the performance of data reading and writing in a low read and write load scenario.

[0056] In a high read / write load scenario (i.e., a scenario in which the load value of the memory is less than a preset frequency increase threshold), the electronic device runs the memory at a second clock frequency. The electronic device counts the duration of this operation of the memory at the second clock frequency and the amount of data read and written by the memory per unit time. If the duration of the electronic device running the memory at the second clock frequency this time is greater than the preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data volume threshold, it can be considered that the memory is currently in a heavy read / write load state. In this case, the electronic device can obtain the amount of data to be read and written by the processor. If the amount of data to be read and written by the processor is greater than the second data volume threshold, it can be considered that the memory currently still has a large amount of data waiting to be read and written, and the electronic device can give priority to calling the first processing unit of the processor to handle the read / write tasks.

[0057] Here, the operating frequency of the first processing unit is greater than the preset operating frequency, and the first processing unit can be a processor including a processing unit with the highest operating frequency among multiple processing units. When the electronic device confirms that the memory is in a heavy read-write load state, and there is still a large amount of data waiting to be read and written in the memory, the electronic device can schedule the processing unit with the fastest processing rate to process the waiting read and write tasks. In this way, when the memory of the electronic device is in a heavy read-write load state, the rate at which the electronic device processes read and write tasks can be increased, the duration of the electronic device in a high read-write load scenario can be shortened, and the read and write throughput of the electronic device can be increased.

[0058] For example, the electronic device described in the embodiments of the present application may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, a media player, etc. The embodiments of the present application do not impose any special restrictions on the specific form of the electronic device.

[0059] In the embodiment of the present application, the electronic device is a mobile phone 100 as an example, and the hardware structure of the electronic device is introduced through the mobile phone 100. Figure 2 As shown, the mobile phone 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0060] Among them, the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), a driver processor, etc. Among them, different processing units can be independent devices or integrated in one or more processors. The processor 110 can be the nerve center and command center of the mobile phone 100. The processor 110 can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0061] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0062] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0063] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the mobile phone 100 by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 may execute the instructions stored in the internal memory 121, and the internal memory 121 may include a program storage area and a data storage area.

[0064] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), a configuration file of the motor 191, etc. The data storage area may store data created during the use of the mobile phone 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0065] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142, it can also power the mobile phone 100 through the power management module 141.

[0066] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. In some embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0067] The wireless communication function of the mobile phone 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor. In some embodiments, the antenna 1 of the mobile phone 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the mobile phone 100 can communicate with the network and other devices through wireless communication technology.

[0068] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0069] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the mobile phone 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0070] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the same device as at least some modules of the processor 110.

[0071] The wireless communication module 160 can provide wireless communication solutions for application on the mobile phone 100, including WLAN (such as (wirelessfidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), nearfield wireless communication technology (nearfield communication, NFC), infrared technology (infrared, IR), etc.

[0072] The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 may also receive a signal to be sent from the processor 110, modulate the signal, amplify the signal, and convert it into an electromagnetic wave for radiation via the antenna 2.

[0073] The mobile phone 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.

[0074] The sensor module 180 may include sensors such as a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a Hall sensor, a touch sensor, an ambient light sensor, and a bone conduction sensor. The mobile phone 100 may collect various data through the sensor module 180 .

[0075] The mobile phone 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0076] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel.

[0077] The mobile phone 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor. The ISP is used to process the data fed back by the camera 193. The camera 193 is used to capture a still image or a video. In some embodiments, the mobile phone 100 may include one or more cameras 193.

[0078] The button 190 includes a power button, a volume button, etc. The button 190 may be a mechanical button. It may also be a touch button. The motor 191 may generate a vibration prompt. The motor 191 may be used for an incoming call vibration prompt or for touch vibration feedback. The indicator 192 may be an indicator light, which may be used to indicate the charging status, the change in power, or may be used to indicate messages, missed calls, notifications, etc.

[0079] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the mobile phone 100 by inserting the SIM card interface 195 or pulling the SIM card interface 195 out. The mobile phone 100 can support one or more SIM card interfaces. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.

[0080] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also include more or fewer modules than those provided in the above embodiments, and different interface connection methods in the above embodiments may be used between the modules, or a combination of multiple interface connection methods. The hardware structure of the electronic device provided in the embodiments of the present application can also refer to the hardware structure of the mobile phone 100 as shown in the figure. The methods in the following embodiments can all be implemented in an electronic device having the above hardware structure.

[0081] The software system of the mobile phone 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture or a cloud architecture. The present application embodiment takes the layered architecture of the Android system as an example to illustrate the software structure of the mobile phone 100.

[0082] Figure 3 1 is a software structure diagram of the mobile phone 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, a hardware abstraction layer (HAL) and a kernel layer.

[0083] The application layer may include a series of application packages. For example, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications, and the present application embodiment does not impose any restrictions on this.

[0084] The application framework layer provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes some predefined functions. For example, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager, etc., and the embodiments of the present application do not impose any restrictions on this.

[0085] The Android runtime consists of a core library and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0086] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0087] The HAL layer encapsulates the Linux kernel driver, provides an interface to the upper layer, and shields the implementation details of the underlying hardware. For example, the HAL layer may include camera HAL, Wi-Fi HAL, Bluetooth HAL, etc.

[0088] The kernel layer is the layer between hardware and software. The kernel layer includes drivers and system service programs. Drivers include at least display drivers, camera drivers, audio drivers, sensor drivers, etc.

[0089] Taking the scenario of launching an application on a mobile phone as an example, the interaction process between the software layer and the hardware of the mobile phone is illustrated. After the user clicks on any application icon in the mobile phone interface, the touch sensor of the mobile phone receives the user's click operation, and the hardware interrupt of the click operation will be sent to the kernel layer. The kernel layer of the mobile phone determines the application launch event corresponding to the click operation, and notifies the application framework layer of the application indicated by the application launch event. The application framework layer starts the application indicated by the application launch event and notifies the lower layer to read the application interface image. After the kernel layer receives the notification of reading the application interface image, it instructs the driver layer to read the application interface image through the memory. After the memory reads the application interface image, the hardware interrupt of the read completion is sent to the kernel layer. After the kernel layer receives the hardware interrupt of the read completion, it notifies the application framework layer to display the interface image.

[0090] In some implementations, the layered architecture of the software system of the mobile phone can be simplified into an application layer, a kernel layer, and a driver layer. The application layer can be used to provide application services. The kernel layer includes system service programs for providing system services. The driver layer includes a driver program for driving hardware, such as driving a memory, to achieve data reading and writing.

[0091] In the following embodiments, the method provided by the embodiments of the present application is described by taking the electronic device as a mobile phone as an example. The mobile phone includes a memory. The memory stores the program executed by the mobile phone and the data required to execute the program. The mobile phone reads and writes data through the memory to achieve normal operation.

[0092] Here, the electronic device is a mobile phone, and the first task is to start the first application as an example to introduce the method provided by the embodiment of the present application in the low read and write load scenario. The memory of the mobile phone includes a first clock frequency and a second clock frequency. The first clock frequency is less than the second clock frequency. Figure 4 As shown, the method provided in the embodiment of the present application includes the following steps:

[0093] S401, the mobile phone runs the memory at a first clock frequency.

[0094] In the embodiment of the present application, the memory of the mobile phone can run at a first clock frequency and a second clock frequency. The first clock frequency is less than the second clock frequency. When the load value of the memory of the mobile phone is less than the above-mentioned preset frequency increase threshold, the mobile phone runs the memory at the first clock frequency. At this time, the memory of the mobile phone runs at a lower clock frequency, which can save energy consumption of the mobile phone.

[0095] S402: If it is detected that the first thread is started, the mobile phone adjusts the clock frequency of the memory from the first clock frequency to the second clock frequency.

[0096] The first thread is used to execute and start the first application. The amount of read and write data corresponding to starting the first application is less than the preset amount of data, corresponding to a read and write task with a small amount of read and write data. If the mobile phone recognizes that the first thread is started, such as recognizing the thread identifier of the first thread in the started thread, or recognizing the application identifier of the first application, the mobile phone performs a frequency increase operation on the memory, and adjusts the clock frequency of the memory from the first clock frequency to the second clock frequency.

[0097] For example, when the mobile phone runs the memory at the first clock frequency, the user clicks the application icon of the first application in the mobile phone to open the first application. The amount of read and write data involved in starting the first application is small, and the load value of the memory does not reach the above-mentioned preset frequency increase threshold. Taking the simplified layered architecture of the mobile phone software system as an example, Figure 5As shown, in response to a click operation by the user, the mobile phone starts executing the first thread and starts the first application through the first thread. When the kernel layer of the mobile phone recognizes that the first thread is running, the kernel layer of the mobile phone sends a frequency increase instruction to the driver layer for instructing the memory to increase the frequency. In response to the frequency increase instruction, the driver layer of the mobile phone instructs the memory to adjust its clock frequency from the first clock frequency to the second clock frequency.

[0098] After the mobile phone adjusts the clock frequency of the memory from the first clock frequency to the second clock frequency, the mobile phone can use the memory to execute data reading and writing to start the first application, and read the data required to start the first application through the memory. Figure 5 As shown, when the kernel layer of the mobile phone recognizes that the first thread is running, it can notify the driver layer to read the data required for starting the first application. The driver layer instructs the memory to read the data required for starting the first application.

[0099] It is understandable that the frequency-up operation of the memory is faster than the operation of the memory responding to the data reading of the driver layer. In this way, the memory has completed the frequency-up operation before reading the data required by the first application, that is, the memory has been running at the second clock frequency. Because the clock frequency of the memory is adjusted to the relatively high second clock frequency before reading the data required to start the first application, the mobile phone can read the data required to start the first application at a faster read and write rate, thereby increasing the rate of starting the first application and improving the user experience.

[0100] In order to reduce the impact of the memory clock frequency on the power consumption of the mobile phone, in some implementations, the mobile phone can reduce the memory clock frequency after reading the data for starting the first application to save the power consumption of the mobile phone. Specifically, Figure 4 As shown, after the above S402, the method provided in the embodiment of the present application further includes the following steps:

[0101] S403, after the memory completes reading and writing data for starting the first application, the mobile phone adjusts the clock frequency of the memory from the second clock frequency to the first clock frequency.

[0102] The clock frequency of the memory is positively correlated with the power consumption. That is, the higher the clock frequency of the memory, the greater the power consumption, and the lower the clock frequency of the memory, the lower the power consumption. In order to reduce the power consumption of the mobile phone and improve the battery life of the mobile phone, the mobile phone can perform a frequency reduction operation on the memory after completing the reading of the data for starting the first application and starting the first application, and adjust the clock frequency of the memory from the second clock frequency to the first clock frequency.

[0103] like Figure 5As shown, after the storage device completes the reading and writing of data for starting the first application, the driver layer of the mobile phone returns the data for starting the first application and instructs the storage device to reduce the clock frequency. The mobile phone changes the clock frequency of the storage device from the second clock frequency to the first clock frequency. In this way, after the mobile phone completes the reading and writing of data, the storage device can be reduced in time to reduce the power consumption of the mobile phone.

[0104] In some implementations, after the mobile phone adjusts the clock frequency of the memory from the first clock frequency to the second clock frequency, the mobile phone may periodically query whether the memory has completed the data reading and writing for starting the first application. For example, after the driver layer of the mobile phone sends an instruction to the memory to read the data required to start the first application, it may query the memory at preset time intervals (such as every 100 milliseconds or every 200 milliseconds, etc.) whether the data reading and writing are completed. If the memory has completed the data reading and writing for starting the first application, the mobile phone executes the above S403, that is, after the memory has completed the data reading and writing for starting the first application, the mobile phone adjusts the clock frequency of the memory from the second clock frequency to the first clock frequency.

[0105] The mobile phone periodically queries whether the memory has completed data reading and writing, that is, polling to check the reading and writing status of the memory. The mobile phone can obtain the latest status of the memory in real time, and the implementation method is simple and easy to operate.

[0106] In an embodiment of the present application, when the amount of read and write data of the first task currently executed by the mobile phone is small, the load value of the memory does not reach the preset frequency increase threshold, and the mobile phone is in a low read and write load scenario. If the mobile phone runs the memory at a lower clock frequency, the rate at which the mobile phone executes the first task is also slower. However, for the first task, such as starting an application, scanning a code, etc., although the amount of read and write data involved is small, the requirement for the rate is high. Therefore, the mobile phone can advance the frequency of the memory by identifying the operation of a specific thread to increase the rate at which the mobile phone executes the first task, reduce user waiting time, and improve user experience. After completing the data reading and writing of the first task, the clock frequency of the memory is reduced.

[0107] In an embodiment of the present application, the mobile phone can also perform a second task with a large amount of read and write data. The second task can be a task such as large file compression, running a large game, or large file copying. The amount of read and write data corresponding to the second task is greater than the preset data amount. The load value of the memory can reach the above-mentioned frequency increase threshold, and the mobile phone will run the memory at a higher clock frequency. That is, in a high read and write load scenario, the mobile phone runs the memory at a high clock frequency to increase the data read and write rate.

[0108] Here, the electronic device is a mobile phone, and the second task performed by the mobile phone is to copy the target file as an example to introduce the method provided by the embodiment of the present application in the high read and write load scenario. The memory of the mobile phone includes a first clock frequency and a second clock frequency. The first clock frequency is less than the second clock frequency. Figure 6 As shown, the method provided in the embodiment of the present application includes the following steps:

[0109] S601: The mobile phone runs the memory at the second clock frequency.

[0110] When the mobile phone is copying a target file, the amount of read and write data corresponding to the target file is greater than the preset data amount. The load value of the memory can reach the above-mentioned frequency increase threshold, and the mobile phone runs the memory at the second clock frequency to increase the rate of copying the target file. The preset data amount can be set according to the actual application scenario or demand, and is not limited here.

[0111] S602, the mobile phone counts the duration of the memory running at the second clock frequency and the amount of data read and written by the memory in a unit time.

[0112] The mobile phone can monitor the read and write performance through some parameters. The length of time that the memory runs at the second clock frequency can reflect the length of time that the memory is under high load pressure. The amount of data read and written by the memory per unit time can reflect the read and write rate of the memory. Taking the simplified layered architecture of the mobile phone software system as an example, Figure 7 As shown, when the mobile phone runs the memory at the second clock frequency, the kernel layer of the mobile phone counts the duration of the memory running at the second clock frequency and the amount of data read and written by the memory per unit time. The longer the memory runs at the second clock frequency this time, the greater the amount of data read and written by the memory per unit time, and it can be considered that the current read and write pressure of the memory is greater. These two parameters can be used to measure whether the memory is currently in a heavy read and write load state.

[0113] In some implementations, the mobile phone can start a timing function at each frequency increase to time the duration that the memory continues to operate at the second clock frequency. When the mobile phone is copying a target file, since the amount of read and write data corresponding to the target file is large, the mobile phone adjusts the clock frequency of the memory from the first clock frequency to the second clock frequency, and starts timing the duration of the memory operating at the second clock frequency.

[0114] S603, if the duration of the mobile phone running the memory at the second clock frequency is greater than the preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data amount threshold, the mobile phone obtains the amount of data to be read and written by the memory.

[0115] If the duration of the mobile phone running the memory at the second clock frequency is greater than the preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data volume threshold, it indicates that the memory is currently in a heavy read and write load state. The mobile phone further obtains the amount of data to be read and written by the memory. Figure 7 As shown, when the driver layer of the mobile phone determines that the duration of running the memory at the second clock frequency is greater than the preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data amount threshold, the driver layer of the mobile phone notifies the kernel layer of the mobile phone to obtain the amount of data to be read and written by the memory. The preset duration threshold and the first data amount threshold can be set according to actual application scenarios or requirements, and are not limited here.

[0116] It can be understood that if the data reading and writing currently executed by the mobile phone only involves the data reading and writing of the second task of copying the target file, the amount of data to be read and written obtained by the mobile phone is the amount of data remaining in the target file that has not been copied. If the data reading and writing currently executed by the mobile phone includes the data reading and writing of other reading and writing tasks in addition to the data reading and writing of the second task of copying the target file, the amount of data to be read and written obtained by the mobile phone is the sum of the amount of data remaining in the target file that has not been copied and the amount of data not completed by other reading and writing tasks.

[0117] S604: If the amount of data to be read or written in the memory is greater than the second data amount threshold, the mobile phone preferentially calls the first processing unit of the processor to process the read or write task.

[0118] If the amount of data to be read and written in the mobile phone is greater than the second data volume threshold, it can be considered that the amount of data that the memory has not completed reading and writing is large, and the memory will be in a heavy read and write load state for a long period of time. The memory is already running at the maximum clock frequency (i.e., the second clock frequency) at this time, and the mobile phone can no longer increase the memory read rate by adjusting the clock frequency of the memory. In this case, the mobile phone can give priority to calling the first processing unit of the processor to handle the read and write tasks of copying the target file, thereby speeding up the rate at which the processor copies the target file. The second data volume threshold is set according to the actual application scenario or demand, and is not limited here.

[0119] Here, the processor may include multiple processing units (or cores). The first processing unit may be the processing unit with the highest operating frequency among the multiple processing units of the processor. The operating frequency of the first processing unit is greater than the preset operating frequency. For example, the processor of the mobile phone may include three processing units. The first processing unit may be the processing unit with the highest operating frequency among the three processing units. The preset operating frequency can be set according to the actual application scenario or demand. For example, the preset operating frequency can be set to the operating frequency of the processing unit with the second highest operating frequency among the multiple processing units.

[0120] In some implementations, the first processing unit may have multiple operating frequencies. In this case, the mobile phone may preferentially schedule the first processing unit of the processor to process the read and write tasks corresponding to the copy target file at the highest operating frequency. In this way, the speed at which the processor copies the target file can be further increased.

[0121] It is understandable that the read and write operations of the mobile phone involve the read and write processes of the memory and the read and write processes of the processor. Take the example of a mobile phone copying a target file to illustrate the process of the mobile phone performing read and write operations. When the mobile phone copies the target file, it needs to read and write the data of the target file in the memory (i.e., the read and write process of the memory). After the memory completes the reading of the target file, it will notify the processor of the read and write task of copying the target file. After receiving the notification, the processor can process the read and write tasks corresponding to the copied target file (i.e., the read and write process of the processor), such as opening the target file or prompting the user that the copying of the target file is complete. The mobile phone can also notify the processor of a read and write task corresponding to the copied target file after the memory completes the reading and writing of a certain amount of data of the target file, and the processor will process the read and write task. The copied target file can correspond to multiple read and write tasks.

[0122] In the embodiment of the present application, when the memory is under heavy load for a long time and the amount of data to be read and written in the memory is large, it is difficult for the mobile phone to speed up the reading and writing of the mobile phone by increasing the reading and writing rate of the memory. At this time, the mobile phone can process the reading and writing tasks by scheduling the first processing unit with the fastest processing rate to improve the overall reading and writing throughput of the mobile phone.

[0123] Since the reading and writing tasks are only part of the tasks performed by the mobile phone, in order for the mobile phone to normally perform tasks that do not involve data reading and writing, in some implementations, the mobile phone can also combine the current processor load to determine whether to call the first processing unit of the processor to process the reading and writing tasks. Specifically, the priority calling of the first processing unit of the processor to process the reading and writing tasks in the above S604 may include the following steps:

[0124] S701, the mobile phone obtains a processor load value.

[0125] The load value of the processor may reflect the current load condition of the processor. For example, the load value of the processor may be the number of threads that the processor has not yet completed processing. For another example, the load value of the processor may be the utilization rate of the processor.

[0126] S702: If the load value of the processor is less than a preset load threshold, the mobile phone preferentially calls the first processing unit of the processor to process the read and write tasks.

[0127] If the processor load value is less than the preset load threshold, for example, the number of threads currently not completed by the processor is less than the preset load threshold, it can be considered that the processor of the mobile phone currently has additional capacity to process read and write tasks. In this case, the mobile phone can preferentially call the first processing unit of the processor to process the read and write tasks, thereby speeding up the processor's processing rate of the read and write tasks.

[0128] like Figure 7 As shown, the kernel layer of the mobile phone determines whether the amount of data to be read and written is greater than the second quantity threshold. After confirming that the amount of data to be read and written by the mobile phone is greater than the second quantity threshold, it can be determined whether the load value of the processor is less than the preset load threshold. If the load value of the mobile phone processor is less than the preset load threshold, the kernel layer of the mobile phone will preferentially call the large core (ie, the first processing unit) of the processor to process the read and write tasks, and notify the driver layer of the mobile phone. The preset load threshold can be set according to the actual application scenario or demand, and is not limited here.

[0129] If the processor load value is greater than or equal to the preset load threshold, it can be considered that the current processor is already in an overloaded state and has no spare capacity to process the read and write tasks first, or calling the first processing unit to process the read and write tasks will slow down the processing rate of other tasks. At this time, the mobile phone continues to process the read and write tasks with the current scheduling strategy.

[0130] In order to improve the read and write performance of the mobile phone, the mobile phone can also change the processing operation of the interrupt request. In some implementations, the mobile phone can perform interrupt aggregation processing on multiple interrupt requests triggered by the memory. Specifically, after the above S604, the method provided in the embodiment of the present application can also include the following steps:

[0131] S605 , when the number of the multiple read-write tasks reaches a preset number of tasks, triggering an interrupt request to the processor, and the processor responds to the interrupt request and centrally processes the multiple read-write tasks.

[0132] After the mobile phone completes the reading and writing of the target file in the memory, or after the memory completes the reading and writing of a certain amount of data, it can notify the processor to complete the reading and writing task. The mobile phone can notify the processor to complete the reading and writing task by means of an interrupt request. If an interrupt request is sent to the processor after the memory completes the reading of data of each reading and writing task, when the amount of reading and writing data is large, the interrupt request frequency is high, and the processor will be constantly interrupted by the interrupt request, which will affect the processing rate of the processor.

[0133] In this case, multiple interrupt requests can be aggregated and combined into one interrupt request, that is, when the number of multiple read and write tasks reaches the preset number of tasks, an interrupt request is triggered to the processor. The preset number of tasks can be set according to the actual application scenario or requirements, and there is no restriction on this here. Figure 7 As shown, the driver layer of the mobile phone can add interrupt aggregation processing while the clock frequency of the memory is kept increasing, so that multiple interrupt requests are merged into one interrupt request. In response to the interrupt request, the processor can concentrate on processing multiple read and write tasks. In this way, the number of interrupt requests can be greatly reduced, and the number of times the processor of the mobile phone is interrupted can be reduced. The processor will not be interrupted frequently by interrupt requests, which can reduce the impact of interrupt requests of read and write tasks on the processor processing rate, and improve the data reading and writing performance of the mobile phone in high read and write load scenarios.

[0134] In other implementations, the mobile phone can also change the interrupt request processing strategy to a periodic query read and write task strategy. That is, the mobile phone can poll to check the read and write status of the memory. The mobile phone no longer triggers an interrupt request to the processor. The processor of the mobile phone can focus on processing the accumulated read and write tasks within a polling cycle. In this way, the processor will not be interrupted by the interrupt request, reducing the impact of the interrupt request of the read and write task on the processor processing rate, and improving the data read and write performance of the mobile phone in high read and write load scenarios.

[0135] In the embodiment of the present application, in the application scenarios of high read and write loads such as large file compression, large game loading, and large file copying, I / O operations can be the main time-consuming operations in the mobile phone. The driver layer of the mobile phone counts the duration of the memory continuously maintaining the high clock frequency and the amount of read and write data of the memory per unit time to determine whether the current memory is in a heavy read and write load state. The size of the amount of data to be read and written is obtained through the kernel layer of the mobile phone to determine whether to enable the scheduling strategy of the processing unit. When the duration of the memory continuously maintaining the high clock frequency, the amount of read and write data of the memory per unit time, and the amount of data to be read and written reach the corresponding threshold, the strategy of the processor processing terminal requests is adjusted in combination with the load of the current processor. That is, the interrupt request of the read and write task is processed by the first processing unit of the processor (the interrupt request is processed by the large core first), the processing speed of the interrupt request is improved, and the overall read and write throughput of the mobile phone is increased. In addition, the processing of interrupt aggregation can be added to the driver layer of the mobile phone, and the processing strategy of the interrupt request is changed to periodic query processing of read and write tasks. Alternatively, multiple interrupt requests are merged into one interrupt request to be processed by the processor. In this way, the number of interrupt requests can be greatly reduced, and the ultimate performance of the memory under high read and write load scenarios can be improved.

[0136] The following is an example of the method provided by the embodiment of the present application in combination with various read and write load scenarios. For example, the electronic device is a mobile phone, and the memory of the mobile phone includes a first clock frequency and a second clock frequency, and the first clock frequency is less than the second clock frequency. Figure 8 As shown, the method provided in the embodiment of the present application includes the following steps:

[0137] S801, the mobile phone obtains a load value of a memory.

[0138] The memory load value can reflect the load on the memory. The mobile phone can adjust the memory clock frequency according to the memory load value. When the memory load value is large, the mobile phone increases the memory clock frequency to speed up the data reading and writing rate. When the memory load value is small, the mobile phone decreases the memory clock frequency to reduce the power consumption of the electronic device.

[0139] S802, the mobile phone determines whether the load value of the memory is greater than the preset frequency increase threshold or less than the preset frequency reduction threshold. If the load value of the memory is less than the preset frequency reduction threshold, execute S803. If the load value of the memory is greater than the preset frequency increase threshold, execute S806. If the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, execute S811.

[0140] This step can be referred to above corresponding to Figure 1 The description content will not be repeated here.

[0141] S803, the mobile phone runs the memory at the first clock frequency.

[0142] S804: If the mobile phone detects that the first thread is started, the clock frequency of the memory is adjusted from the first clock frequency to the second clock frequency.

[0143] S805, after the memory completes the data reading and writing of the first task, the mobile phone adjusts the clock frequency of the memory from the second clock frequency to the first clock frequency.

[0144] Here, S803-S805 can refer to the description of S401-S403 above, which will not be repeated here.

[0145] S806: The mobile phone runs the memory at the second clock frequency.

[0146] S807, the mobile phone determines whether the duration of the memory running at the second clock frequency this time is greater than the preset duration threshold, and whether the amount of data read and written by the memory per unit time is greater than the first data amount threshold. If the duration of the memory running at the second clock frequency this time by the mobile phone is greater than the preset duration threshold, and the amount of data read and written by the memory per unit time is greater than the first data amount threshold, the mobile phone executes S808.

[0147] S808, the mobile phone determines whether the amount of data to be read or written in the memory is greater than the second data amount threshold. If the amount of data to be read or written in the memory is greater than the second data amount threshold, the mobile phone executes S809.

[0148] S809, the mobile phone determines whether the load value of the processor is less than a preset load threshold. If the load value of the processor is less than the preset load threshold, the mobile phone executes S810.

[0149] S810, the mobile phone preferentially calls the first processing unit of the processor to process the read and write tasks, and centrally processes multiple read and write tasks.

[0150] Here, S806-S810 can refer to the description of S601-S605 and S701-S702 above, which will not be repeated here.

[0151] S811: When the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, the mobile phone runs the memory at the current clock frequency.

[0152] This step can be referred to above corresponding to Figure 1 The description content will not be repeated here.

[0153] According to the above examples, the method provided in the embodiments of the present application is applicable to various application scenarios of read and write loads. Fig. 9 As shown, in low read / write load scenarios, the mobile phone can increase the frequency in advance through the recognition of a specific thread (such as the first thread), so that the clock frequency of the memory is adjusted from the first clock frequency to the second clock frequency, thereby achieving read / write performance adjustment. In high read / write load scenarios, the mobile phone can preferentially call the large core to process interrupt requests and reduce the number of interrupt requests to achieve read / write performance adjustment. In other read / write scenarios where the mobile phone does not recognize the operation of a specific thread, and the duration of the mobile phone running the memory at the second clock frequency does not reach the preset duration threshold or the amount of data read and written by the memory per unit time does not reach the first data amount threshold, the mobile phone can adjust the clock frequency of the memory according to the load value of the memory to achieve clock frequency adjustment to balance the power consumption of the mobile phone and the read / write performance of the mobile phone. That is, when the load value of the memory is less than the preset frequency increase threshold, the mobile phone runs the memory at the first clock frequency. When the load value of the memory is greater than the preset frequency reduction threshold, the mobile phone runs the memory at the second clock frequency. When the load value of the memory is greater than or equal to the preset frequency reduction threshold, but less than or equal to the preset frequency increase threshold, the mobile phone runs the memory at the current clock frequency.

[0154] Some other embodiments of the present application provide an electronic device, the electronic device comprising: a memory and one or more processors. The memory is coupled to the processor. The memory stores a computer program code, the computer program code comprising computer instructions. When the computer instructions are executed by the processor, the electronic device can perform each function or step in the above method embodiment. The structure of the electronic device can refer to Figure 2 The structure of the mobile phone 100 is shown.

[0155] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected by lines. For example, the interface circuit can be used to receive signals from other devices (such as memory). For another example, the interface circuit can be used to send signals to other devices (such as processors). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instruction is executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0156] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.

[0157] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step in the above method embodiment.

[0158] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0159] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0161] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0162] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0163] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A data processing method, characterized in that: Applied to an electronic device, the electronic device includes a memory and a processor, the processor includes multiple processing units, and each processing unit has a different operating frequency; the method includes: When the load value of the memory is less than a preset frequency reduction threshold, operating the memory at a first clock frequency; In response to the first thread being started, operating the memory at a second clock frequency; The second clock frequency is greater than the first clock frequency; the first thread is used to execute a first task, and the amount of read and write data corresponding to the first task is less than a preset data amount.

2. The method according to claim 1, characterized in that The first task includes launching a first application, scanning a code, or loading a preset image; The data volume of the preset image is smaller than a preset value.

3. The method according to claim 1 or 2, characterized in that The method further comprises: In response to the memory completing the data reading and writing of the first task, the storage is operated at the first clock frequency.

4. The method according to claim 1, wherein Before operating the memory at the first clock frequency, the method further includes: When the load value of the memory is greater than a preset frequency increase threshold, the memory is operated at the second clock frequency; wherein the preset frequency increase threshold is greater than a preset frequency decrease threshold.

5. The method according to claim 1, characterized in that Before operating the memory at the first clock frequency, the method further includes: When the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, the memory is operated at the current clock frequency.

6. The method according to claim 1, wherein After operating the memory at the second clock frequency, the method further includes: Counting the duration of operating the memory at the second clock frequency and the amount of data read and written by the memory per unit time; If the duration of operating the memory at the second clock frequency is greater than a preset duration threshold, and the amount of data read and written by the memory per unit time is greater than a first data amount threshold, obtaining the amount of data to be read and written by the memory; If the amount of data to be read and written in the memory is greater than a second data amount threshold, the first processing unit of the processor is preferentially called to process the read and write tasks; wherein the operating frequency of the first processing unit is greater than a preset operating frequency.

7. The method according to claim 6, characterized in that The first processing unit of the processor is preferentially called to process the read and write tasks, comprising: Obtaining a load value of a processor of the electronic device; If the load value of the processor is less than a preset load threshold, the first processing unit of the processor is preferentially called to process the read and write tasks; wherein the operating frequency of the first processing unit is greater than the preset operating frequency.

8. The method according to claim 6 or 7, characterized in that The method further comprises: When the number of the multiple read and write tasks reaches a preset number of tasks, an interrupt request is triggered to the processor, and the processor responds to the interrupt request and centrally processes the multiple read and write tasks.

9. A data processing method, characterized in that: Applied to an electronic device, the electronic device includes a memory and a processor, the processor includes multiple processing units, and each processing unit has a different operating frequency; the method includes: When the load value of the memory is greater than a preset frequency increase threshold, operating the memory at a second clock frequency; Counting the duration of operating the memory at the second clock frequency and the amount of data read and written by the memory per unit time; If the duration of operating the memory at the second clock frequency is greater than a preset duration threshold, and the amount of data read and written by the memory per unit time is greater than a first data amount threshold, obtaining the amount of data to be read and written by the memory; If the amount of data to be read and written in the memory is greater than a second data amount threshold, the first processing unit of the processor is preferentially called to process the read and write tasks; wherein the operating frequency of the first processing unit is greater than a preset operating frequency.

10. The method according to claim 9, characterized in that The first processing unit of the processor is preferentially called to process the read and write tasks, comprising: Obtaining a load value of a processor of the electronic device; If the load value of the processor is less than a preset load threshold, the first processing unit of the processor is preferentially called to process the read and write tasks.

11. The method according to claim 9 or 10, characterized in that The method further comprises: When the number of the plurality of read and write tasks reaches a preset task number threshold, an interrupt request is triggered to the processor, and the processor responds to the interrupt request and centrally processes the plurality of read and write tasks.

12. The method according to claim 9, characterized in that Before operating the memory at the second clock frequency, the method further includes: When the load value of the memory is less than a preset frequency reduction threshold, the memory is operated at the first clock frequency; wherein the second clock frequency is greater than the first clock frequency.

13. The method according to claim 9, characterized in that Before operating the memory at the second clock frequency, the method further includes: When the load value of the memory is greater than or equal to the preset frequency reduction threshold but less than or equal to the preset frequency increase threshold, the memory is operated at the current clock frequency.

14. The method according to claim 12, characterized in that In the case of operating the memory at the first clock frequency, the method further includes: In response to the start of the first thread, the memory is operated at the second clock frequency; wherein the first thread is used to execute a first task, and the amount of read and write data corresponding to the first task is less than a preset data amount.

15. The method according to claim 14, characterized in that The first task includes launching a first application, scanning a code, or loading a preset image; wherein the data volume of the preset image is less than a preset value.

16. The method according to claim 14 or 15, characterized in that The method further comprises: In response to the memory completing the data reading and writing of the first task, the memory operates at the first clock frequency.

17. An electronic device, characterized in that: include: A memory and a processor; the memory is coupled to the processor; wherein a computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8, or the electronic device executes the method according to any one of claims 9 to 16.

18. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, causes the electronic device to execute the method according to any one of claims 1 to 8, or causes the electronic device to execute the method according to any one of claims 9 to 16.