Data processing method and electronic equipment
By creating a partition cache area in the screen-off standby state of the terminal device, the lag problem that occurs when the device switches from the screen-off standby state to the screen-on state is solved, achieving a smoother user operating experience.
Patent Information
- Application Number
- CN202310907364.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-01-21
AI Technical Summary
When the terminal device switches from the screen-off standby state to the screen-on state, it may have slow response and stuttering, affecting the user's user experience.
When the terminal device is in the screen-off standby state, create a partition cache area to store the cache data generated by the tasks to be executed to avoid recycling and releasing the cache data of the application before the screen is turned off.
This ensures that when the terminal device switches to the bright screen state, no lag occurs when the user operates on the application interface before the screen is turned off, providing a smoother user experience.
Smart Images

Figure CN119336240A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of terminal technology, and in particular to a data processing method and an electronic device. Background Art
[0002] When the terminal device switches from the screen-off standby state to the screen-on state, the application interface of the application before the screen is turned off will be displayed. When the user operates on the application interface again, for example, the user slides the application interface or the user clicks a button in the application interface. Slow response and freeze may occur, affecting the user experience. Summary of the invention
[0003] The disclosed embodiments provide a data processing method and an electronic device. When a terminal device is in a screen-off standby state, the terminal device does not recycle and release the cached data of the application before the screen is off. When the terminal device switches to a screen-on state, if the user operates on the application interface of the application before the screen is off, there will be no lag phenomenon, which can bring a more fluent user experience to the user.
[0004] To achieve the above objectives, the embodiments of the present disclosure adopt the following technical solutions:
[0005] In a first aspect, the present disclosure provides a data processing method, which includes: first, detecting the screen state of a terminal device, the screen state including a screen-off standby state. Then, when the terminal device is in the screen-off standby state, using the system cache, creating a partition cache area; finally, storing cache data generated by a task to be executed during operation in the partition cache area, the task to be executed being a task that is executed when the terminal device is in the screen-off standby state.
[0006] Based on the data processing method of the first aspect, by detecting the screen state of the terminal device, when the screen state is the screen-off standby state, a partitioned cache area is created. Afterwards, the partitioned cache area can be used to store the cache data generated during the operation of the task to be executed when the terminal device is in the screen-off standby state. In this way, it is avoided that the cache data of the application before the screen is turned off is recovered and released in order to store the cache data corresponding to the task to be executed. When the terminal device switches to the bright screen state, the cache data of the application before the screen is turned off is still retained in the system cache. Therefore, when the user operates on the application interface of the application before the screen is turned off, the application before the screen is turned off can still run smoothly, thereby avoiding affecting the user experience.
[0007] In combination with the first aspect, in another possible implementation method, when the terminal device is in a screen-off standby state, the method also includes: obtaining a resource pressure value, the resource pressure value is a pressure value corresponding to the terminal device when executing a task to be executed; based on a preset grading table, determining a target pressure range corresponding to the resource pressure value, the preset grading table includes multiple pressure ranges and adjustment values of partitioned cache areas corresponding to each pressure range; multiple pressure ranges include a target pressure range; and adjusting the partitioned cache area using the adjustment value of the partitioned cache area corresponding to the target pressure range.
[0008] Based on this implementation, the size of the partition cache area can be dynamically adjusted through the resource pressure value. By adjusting the size of the partition cache area, the I / O pressure and memory pressure of the terminal device can be reduced, so that the tasks to be executed can run normally in the terminal device in the screen-off standby state, thereby ensuring the operating performance of the operating system.
[0009] In combination with the first aspect, in another possible implementation, obtaining a resource pressure value includes: registering a first pressure trigger and a second pressure trigger with a pressure stall information mechanism PSI, wherein the first pressure trigger is used to detect a pressure value of a first resource, and the second pressure trigger is used to detect a pressure value of a second resource, and the first resource and the second resource are different; using the first pressure trigger, determining the pressure value of the first resource; using the second pressure trigger, determining the pressure value of the second resource; and determining the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource. A method for obtaining a resource pressure value is provided.
[0010] In combination with the first aspect, in another possible implementation, determining the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource includes: determining the maximum value of the pressure value of the first resource and the pressure value of the second resource as the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource. A method for determining the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource is provided.
[0011] In combination with the first aspect, in another possible implementation manner, the pressure value of the first resource is an I / O pressure value, and the pressure value of the second resource is a memory pressure value.
[0012] In combination with the first aspect, in another possible implementation, the partition cache area is created by using the system cache, including: based on the cache elimination algorithm, using the linked list corresponding to the system cache to create the partition cache area, the system cache includes the file page cache, the index node cache and the directory entry cache. Based on this implementation, the partition cache area is created by using the existing system cache, which will not bring additional hardware overhead to the terminal device, thereby avoiding increasing the use cost.
[0013] In combination with the first aspect, in another possible implementation, the partition cache area includes a file page partition cache area, an index node partition cache area, and a directory entry partition cache area.
[0014] In combination with the first aspect, in another possible implementation, the screen state further includes a screen-on state; the method further includes: when the terminal device is in the screen-on state, deregistering the partition cache area, and deregistering the first pressure trigger and the second pressure trigger to the PSI. Based on this implementation, when the terminal device is in the screen-on state, the partition cache area and the adjustment of the size of the partition cache area can be deregistered. This avoids unnecessary tasks from consuming resources of the terminal device.
[0015] In a second aspect, an embodiment of the present disclosure provides a data processing device, which can be applied to an electronic device to implement the method in the first aspect. The functions of the data processing device can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as a detection module, a creation module, and a storage module.
[0016] The detection module is configured to detect the screen status of the terminal device, including the screen-off standby state. The creation module is configured to create a partition cache area using the system cache when the terminal device is in the screen-off standby state. The storage module is configured to store cache data generated by the task to be executed during the operation in the partition cache area, and the task to be executed is a task that runs when the terminal device is in the screen-off standby state.
[0017] In combination with the second aspect, in a possible implementation, the data processing device also includes an acquisition module, a determination module and an adjustment module. The acquisition module is configured to acquire a resource pressure value, which is a pressure value corresponding to when the terminal device executes a task to be executed. The determination module is configured to determine a target pressure range corresponding to the resource pressure value based on a preset grading table, the preset grading table includes multiple pressure ranges and adjustment values of partitioned cache areas corresponding to each pressure range; the multiple pressure ranges include a target pressure range; the adjustment module is configured to adjust the partitioned cache area using the adjustment value of the partitioned cache area corresponding to the target pressure range.
[0018] In combination with the second aspect, in a possible implementation, the determination module is also configured to register a first pressure trigger and a second pressure trigger to the pressure stall information mechanism PSI, the first pressure trigger is used to detect the pressure value of a first resource, and the second pressure trigger is used to detect the pressure value of a second resource, and the first resource and the second resource are different; using the first pressure trigger, determine the pressure value of the first resource; using the second pressure trigger, determine the pressure value of the second resource; based on the pressure value of the first resource and the pressure value of the second resource, determine the resource pressure value.
[0019] In combination with the second aspect, in a possible implementation, the determination module is further configured to determine the maximum value of the pressure value of the first resource and the pressure value of the second resource as the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource.
[0020] In conjunction with the second aspect, in a possible implementation manner, the pressure value of the first resource is an I / O pressure value, and the pressure value of the second resource is a memory pressure value.
[0021] In combination with the second aspect, in a possible implementation, the creation module is also configured to create a partition cache area based on a cache elimination algorithm and using a linked list corresponding to the system cache. The system cache includes a file page cache, an index node cache, and a directory entry cache.
[0022] In conjunction with the second aspect, in a possible implementation, the partition cache area includes a file page partition cache area, an index node partition cache area, and a directory entry partition cache area.
[0023] In conjunction with the second aspect, in a possible implementation, the screen state further includes a screen-on state; and the data processing apparatus further includes a logout module. The logout module is configured to logout the partition cache area and logout the first pressure trigger and the second pressure trigger to the PSI when the terminal device is in the screen-on state.
[0024] In a third aspect, the present disclosure provides an electronic device, comprising: a memory, a display screen, and one or more processors; the memory, the display screen, and the processor are coupled. The memory is used to store computer program codes, and the computer program codes include computer instructions; when the electronic device is running, the processor is used to execute one or more computer instructions stored in the memory, so that the electronic device executes the data processing method as described in any one of the first aspects above.
[0025] In a fourth aspect, the present disclosure provides a computer storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute any of the data processing methods in the first aspect.
[0026] In a fifth aspect, the present disclosure provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the data processing method as described in any one of the first aspects.
[0027] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting a first terminal device to implement the functions involved in the first aspect. In one possible design, the device also includes a memory for storing necessary program instructions and data for the first terminal device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.
[0028] It should be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present disclosure.
[0030] Figure 2 A schematic diagram of a software structure of a terminal device provided in an embodiment of the present disclosure Figure 1 .
[0031] Figure 3 A schematic diagram of a software structure of a terminal device provided in an embodiment of the present disclosure Figure 2 .
[0032] Figure 4 One of the flowcharts of a data processing method provided in an embodiment of the present disclosure.
[0033] Figure 5 A schematic diagram of an lru linked list corresponding to a file page cache provided in an embodiment of the present disclosure.
[0034] Figure 6 A schematic diagram of creating an lru linked list corresponding to a file page partition cache area provided in an embodiment of the present disclosure.
[0035] Figure 7 The second flowchart of a data processing method provided in an embodiment of the present disclosure.
[0036] Figure 8 A schematic diagram of the structure of a data processing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0037] The technical solution in the embodiment of the present disclosure will be described below in conjunction with the drawings in the embodiment of the present disclosure. Among them, in the description of the present disclosure, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present disclosure is only a kind of association relationship describing the associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. And, in the description of the present disclosure, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present disclosure, in the embodiments of the present disclosure, the words "first", "second" and the like are used to distinguish between the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present disclosure should not be interpreted as being more preferred or more advantageous than other embodiments or design. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for easy understanding.
[0038] In addition, the network architecture and business scenarios described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.
[0039] In order to make the description of the following embodiments clear and concise, a brief introduction to the relevant concepts or technologies is first given:
[0040] (1) Screen-off standby state: This means that when a terminal device (such as a mobile phone, tablet computer, etc.) is not in use, although the display screen is off, the terminal device can still run tasks. In this state, the terminal device remains powered on, and various hardware resources such as the CPU and memory run at low power consumption, so that the terminal device will not miss any notifications, while maximizing the standby time of the terminal device. When the user uses the terminal device again, the display screen and other hardware resources can be quickly activated to put the terminal device into the screen-on state.
[0041] (2) File System (FS): refers to a mechanism used to manage and organize data structures such as files and directories in the operating system. In a file system, each file and directory has its own unique name and path, and occupies a certain amount of disk space on the hard disk or other storage devices. Different types of file systems have different organizational methods, storage mechanisms, and characteristics. Common file systems are mainly used to manage data writing and reading, optimize disk space, and support multi-user sharing and access to data.
[0042] (3) File page: refers to the page corresponding to the document or file stored in the terminal device (such as a mobile phone, tablet computer, etc.). This page can be presented in HTML format. The file page can also display the file name, type, size, file icon and other metadata, such as creation date, modification date, etc. By clicking the link or button on the file page, the file content can be downloaded and opened.
[0043] (4) I / O request: refers to the request sent by the process or thread of the input / output (I / O) operation in the computer system to the operating system. I / O requests can be used to interact with external devices (such as hard disks, printers, networks, etc.). Generally, the interaction with external devices includes data reading, data writing, and data transmission.
[0044] (5) Cache eviction algorithm (Least Recently Used, LRU): It refers to the process of deciding which cache data should be retained and which cache data should be eliminated in the computer's system cache. Specifically, it compares and selects the cache data that should be retained or eliminated in the system cache based on the time when the cache data was most recently accessed or used. When the system cache is full, if you want to add new cache data, you need to eliminate the old cache data first.
[0045] The LRU algorithm removes the cache data that has not been used for the longest time (that is, the cache data with the longest access time) from the system cache to free up space, and adds the new cache data to the system cache. This can improve the cache hit rate and thus improve the performance of the computer system. Common LRU algorithms can be implemented through data structures such as linked lists, hash tables, and heaps.
[0046] (6) Pressure Stall Information (PSI) mechanism: refers to a performance monitoring and troubleshooting tool in the Linux kernel. PSI can be used to diagnose performance problems caused by system resource pressure. PSI can monitor and count the pressure of system resources such as CPU, memory and block devices. By analyzing indicators such as CPU pressure, memory pressure and block device pressure, the degree of pressure on system resources can be measured. Among them, CPU pressure is used to indicate the proportion of time when the CPU usage reaches a critical level, which can be obtained by monitoring "CPU stall time". Memory pressure is used to indicate the degree to which the process is delayed or terminated due to insufficient memory, which can be obtained by monitoring "memory stalltime". Block device pressure is used to indicate the proportion of time when the disk I / O queue length reaches saturation, which can be obtained by monitoring "IO stall time".
[0047] In recent years, with the rapid development of mobile communications, terminal devices are becoming more and more intelligent. The functions of terminal devices are also increasing. They are no longer just communication tools that meet people's needs for communication, but have become indispensable smart devices in people's daily lives.
[0048] When the user does not need to use the terminal device, the terminal device can actively enter the screen-off standby state. For example, if the user does not operate the terminal device within a preset time, the terminal device actively enters the screen-off standby state. The terminal device can also passively enter the screen-off standby state. For example, the user locks the screen by pressing the power button to make the terminal device passively enter the screen-off standby state. After a period of time, if the user needs to use the terminal device, the terminal device can enter the screen-on state by clicking the power button, or through various unlocking methods such as fingerprints and faces. At this time, the terminal device will display the application interface of the application before the screen is turned off (also known as the current application).
[0049] When the terminal device turns on the screen, if the user continues to perform user operations in the application interface of the current application, the current application needs to read the relevant files corresponding to the user operations according to the user operations. Usually, the relevant files corresponding to the user operations are stored in the system cache. Among them, the system cache includes file page cache, inode cache and dentry cache.
[0050] Generally, the relevant files corresponding to the user operation will be stored in the file page cache. The file page cache is used to cache the cache data generated by the terminal device during operation. The cache data stored in the file page cache can be managed using the LRU algorithm, so the cache data stored in the file page cache is dynamically changed. Exemplarily, the cache data can be a file page.
[0051] The current application can first search for the above-mentioned related files in the file page cache. When the file page cache includes the related files corresponding to the user operation, the current application can directly obtain the files from the file page cache, which greatly improves the access efficiency of the files. When the file page cache does not contain the file required by the current application, the current application needs to read the corresponding file through the file system.
[0052] The file system includes an index node cache and a directory entry cache. The index node cache is used to cache the index nodes of the file metadata generated by the terminal device during operation. The directory entry cache is used to cache the directory entry data generated by the terminal device during operation. The index node cache can speed up the access speed of the file metadata. The directory entry cache can speed up the resolution and search of the file path.
[0053] If the current application needs to read a file through the file system, it can first search for the file in the index node cache and directory entry cache in the file system. If the file is not found in the index node cache and directory entry cache, it is necessary to read the file from the storage device to which the above file belongs through the file system. If the file can be found in the index node cache and directory entry cache, the current application can directly obtain the file from the index node cache and directory entry cache.
[0054] If the file system needs to be used to read the file from the storage device to which the file belongs, the current application needs to send an I / O request to the storage device through the file system. If there are many files required, the number of I / O requests sent will also increase. This will cause the I / O process to be blocked and the I / O delay to increase, so that the current application cannot obtain the file in time, resulting in a freeze.
[0055] In addition, when the terminal device is in the screen-off standby state, there are still some pending tasks running in the background, such as data communication between the current application and other applications, data sorting of the operating system, download tasks of the current application, or audio playback tasks, etc. The cache data generated by the above pending tasks during operation is generally stored in the system cache.
[0056] If the cache data generated by the task to be executed is too much during its operation, the operating system needs to recycle and release some cache data from the system cache to store the cache data generated by the task to be executed during its operation, so as to ensure the normal operation of the task to be executed. For example, the operating system can release some cache data from the above-mentioned file page cache, index node cache or directory entry cache. The method of releasing cache data can be based on the LRU algorithm to release cache data that has not been used for a long time in the file page cache, index node cache or directory entry cache.
[0057] Therefore, after the screen is off and the system is in standby mode for a period of time, if too much cache data is generated during the execution of the task to be executed, most of the cache data corresponding to the current application in the above caches (i.e., file page cache, index node cache, or directory entry cache) will be recycled and released. When the terminal device turns on the screen again and the user operates in the current application, the current application needs to re-read the file. This will cause a sharp increase in the number of I / O requests, block the operation of the I / O process, and cause the current application to freeze. For example, the WeChat application in the terminal device may freeze when sliding.
[0058] To this end, the embodiment of the present disclosure provides a data processing method, when the terminal device is in the screen-off standby state, the terminal device can use the system cache to create a partitioned cache area. The partitioned cache area is used to store the cache data generated during the operation of the task to be executed. In this way, it is possible to avoid recycling and releasing the cache data of the current application in order to store the cache data generated during the operation of the task to be executed. When the terminal device switches to the screen-on state, if the user operates on the application interface of the current application, the current application will not be stuck, which can bring a more fluid user experience to the user.
[0059] Figure 1 FIG. 1 shows a schematic diagram of the hardware structure of a terminal device. Figure 1 As shown, the terminal device 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 above-mentioned sensor module 180 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.
[0061] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the terminal device 100. In other embodiments, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0062] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0063] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0064] 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.
[0065] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (IC) interface, an inter-integrated circuit sound (IS) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0066] 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 terminal device 100. In other embodiments, the terminal device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0067] 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 terminal device through the power management module 141.
[0068] 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.
[0069] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc. In some embodiments, the antenna 1 of the terminal device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology.
[0070] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 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.
[0071] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the terminal device 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.
[0072] 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.
[0073] The wireless communication module 160 can provide wireless communication solutions 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 communication technology (nearfield communication, NFC), infrared technology (infrared, IR), etc. applied on the terminal device 100.
[0074] 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 1, 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 1.
[0075] The terminal device 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, which 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 terminal device 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 static image or a video. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0078] 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 terminal device 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.
[0079] The internal memory 121 may be used to store computer executable program codes, which may include instructions. The processor 110 executes various functional applications and data processing of the terminal device 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.
[0080] 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.), etc. The data storage area may store data created during the use of the terminal device 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.
[0081] The terminal device 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 headphone jack 170D, and the application processor.
[0082] The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195 to achieve contact and separation with the terminal device 100. The terminal device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0083] In addition, an operating system, such as Hongmeng operating system, iOS operating system, Android operating system, Windows operating system, etc., is running on the above components. Applications can be installed and run on the operating system. In other embodiments, there may be multiple operating systems running in the terminal device.
[0084] It should be understood that Figure 1 The hardware modules included in the terminal device shown are only illustrative descriptions and do not limit the specific structure of the terminal device. In fact, the terminal device provided by the embodiment of the present disclosure may also include other hardware modules that have an interactive relationship with the hardware modules illustrated in the figure, which are not specifically limited here. For example, the terminal device may also include a flashlight, a micro-projection device, etc. For another example, if the terminal device is a PC, then the terminal device may also include components such as a keyboard and a mouse.
[0085] The software system of the above terminal device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the terminal device is illustrated.
[0086] Figure 2 is a software structure diagram of a terminal device in an embodiment of the present disclosure. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, The system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime and system library, kernel layer, and storage device layer.
[0087] The application layer may include a series of application packages. For example, the application package may include multiple applications such as email, camera, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0088] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0089] The application framework layer may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, etc., and the embodiments of the present disclosure do not impose any restrictions on this.
[0090] Activity Manager: used to manage the life cycle of each application. Applications usually run in the operating system in the form of Activities. For each Activity, there is a corresponding application record (ActivityRecord) in the Activity Manager. This ActivityRecord records the status of the Activity of the application. The Activity Manager can use this ActivityRecord as an identifier to schedule the Activity process of the application.
[0091] Window Manager Service: It is used to manage the graphical user interface (GUI) resources used on the screen. Specifically, it can be used to obtain the screen size, create and destroy windows, show and hide windows, layout windows, manage focus, and manage input methods and wallpapers.
[0092] The system library and kernel layer below the application framework layer can be called the underlying system, which includes an underlying display system for providing display services. For example, the underlying display system includes a display driver in the kernel layer and a surface manager in the system library.
[0093] Android Runtime includes core libraries and virtual machines. 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 object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0094] 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.
[0095] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0096] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0097] OpenGL ES is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0098] SGL is a graphics engine for 2D graphics.
[0099] The kernel layer is the layer between hardware and software. The kernel layer can include multiple functional modules. For example, file page cache, file system, block and driver, etc.
[0100] The file system includes an index node cache and a directory entry cache. Applications in the application layer can send I / O requests to devices in the storage device layer through the file system to obtain file data.
[0101] A block is the smallest unit for managing storage devices in an operating system. It can be a fixed-size data block or sector, or a logical data unit.
[0102] The driver includes at least display driver, camera driver, audio driver, sensor driver, etc.
[0103] like Figure 2 As shown, before the terminal device is in the screen-off standby state, the memory space in the file page cache is the first space 10, the memory space in the index node cache is the second space 20, and the memory space in the directory entry cache is the third space 30.
[0104] When the terminal device is in the screen-off standby state, since the terminal device still needs to process the tasks to be executed, the cache data generated when processing the tasks to be executed will gradually occupy the memory space in the file page cache, the index node cache, and the directory entry cache. For example, when the terminal is in the screen-off standby state, the memory space occupied in the file page cache is the fourth space 11, the memory space occupied in the index node cache is the fifth space 21, and the memory area in the directory entry cache is the sixth space 31. The longer the terminal device is in the screen-off standby state, most of the memory space in the file page cache, the index node cache, and the target item cache will be occupied.
[0105] The storage device layer can include multiple storage modules. For example, embedded MultiMediaCard (eMMC) and Universal Flash Storage (UFS). Among them, eMMC is often used in embedded systems as the main storage medium. UFS is used to implement flash storage. UFS has the advantages of fast data transmission, high bandwidth, low power consumption and high reliability, and can be widely used in various terminal devices and consumer electronic products.
[0106] The methods in the following embodiments can all be implemented in a terminal device having the above hardware structure or software structure.
[0107] In some examples, in order to implement the data processing method provided in the embodiments of the present application, Figure 2 Based on the software structure diagram of the terminal device shown in Figure 3 As shown, the application framework layer may further include a scene state management module. The scene state management module is used to detect the screen state of the terminal device.
[0108] If it is detected that the terminal device is in the screen-off standby state, the scene state management module sends a screen-off instruction to the partition cache management module to instruct the partition cache management module to create a partition cache area. Send a limit adjustment instruction to the cache limit management module to instruct the cache limit management module to control the size of the partition cache area.
[0109] If it is detected that the terminal device is in the screen-on state, the scene state management module sends a screen-on instruction to the partition cache management module to instruct the partition cache management module to deregister the partition cache area. A pressure monitoring deregistration instruction is sent to the cache limit management module to instruct the cache limit management module to deregister the target pressure trigger's monitoring of the I / O pressure value and the memory pressure value.
[0110] The kernel layer may also include a scene cache management module, which includes a partition cache management module and a cache quota management module.
[0111] When the terminal device is in the screen-off standby state, the partition cache management module in the scene cache control module is used to receive the screen-off instruction, and in response to the screen-off instruction, create a zoned cache area. The zoned cache area includes the file page zoned cache area (zoned pagecache), the index node zoned cache area (zoned icache) and the directory entry zoned cache area (zoned dcache).
[0112] like Figure 3 As shown, the file page partition cache area can be created by the partition cache management module in the file page cache. The index node partition cache area can be created by the partition cache management module in the index node cache. The directory entry partition cache area can be created by the partition cache management module in the directory entry cache.
[0113] When the terminal device is in a screen-on state, the partition cache management module is used to receive a screen-on instruction and, in response to the screen-on instruction, to deregister the partition cache area.
[0114] When the terminal device is in the screen-off standby state, the cache quota management module in the scene cache control module is used to receive the quota adjustment instruction, and in response to the quota adjustment instruction, control the size of the partition cache area. For example, the cache quota management module is used to control the size of the file page partition cache area, the size of the index node partition cache area, and the size of the directory entry partition cache area.
[0115] When the terminal device is in the screen-on state, the cache limit management module is used to receive a pressure monitoring logout instruction, and in response to the pressure monitoring logout instruction, log out of the target pressure trigger's monitoring of the I / O pressure value and the memory pressure value, and no longer adjusts the size of the control partition cache area based on the I / O pressure value and the memory pressure value.
[0116] A data processing method provided by an embodiment of the present disclosure is described in detail below in conjunction with the accompanying drawings. The method can be applied to the above-mentioned terminal device. Figure 4 As shown, the method specifically includes:
[0117] Step 401: When the scene state management module detects that the terminal device is in the screen-off standby state, it sends a limit adjustment instruction to the cache limit management module and sends a screen-off instruction to the partition cache management module.
[0118] The limit adjustment instruction is used to instruct the cache limit management module to control the size of the partition cache area. The screen off instruction is used to instruct the partition cache management module to create a partition cache area.
[0119] In some examples, when the user does not need to use the terminal device, the user will press the power button to turn off the screen of the terminal device. At this time, the terminal device is in a screen-off standby state. Alternatively, when the terminal device does not detect user operation for a period of time, the terminal device will enter the screen-off standby state.
[0120] When the terminal device is in the screen-off standby state, some pending tasks will still be running in the background. When the pending tasks are running, some cache data will be generated, which will generally be stored in the system cache. Among them, the system cache includes file page cache, index node cache and directory entry cache.
[0121] Before the terminal device turns off the screen, the system cache stores the cache data of the current application. When the task to be executed is running, the system cache will inevitably recycle and release some of the original cache data in order to store the cache data generated by the task to be executed during the execution. The released original cache data may be the cache data of the current application. If the task to be executed requires a lot of memory, the cache data of the current application will be recycled and released in large quantities.
[0122] Therefore, when the terminal device turns on the screen again and the user operates in the application interface of the current application, in response to the user operation, the current application will search the system cache for the cached data before the screen went out, so as to provide services to the user based on the cached data before the screen went out. During the search process, it is found that the required cached data of the current application cannot be found because it has been recycled and released, and it needs to be retrieved from the storage device again. In the process of re-retrieval from the storage device, a large number of I / O requests will be generated, causing the current application to freeze.
[0123] In some examples, in order to ensure that the current application does not freeze when the terminal device is on, the present disclosure uses the scene state management module in the terminal device to detect the screen state of the terminal device. The screen state of the terminal device includes the screen off standby state and the screen on state.
[0124] When the scene state management module detects that the terminal device is in the screen-off standby state, it can send a screen-off instruction to the partition cache management module to enable the partition cache management module to create a partition cache area. Afterwards, the partition cache area is used to store the cache data generated by the task to be executed during operation. In this way, the cache data generated by the task to be executed during operation will not affect the cache data of the current application in the system cache. Therefore, when the terminal device turns on the screen, the cache data of the current application can be directly obtained from the system cache to avoid jamming.
[0125] In some examples, when the scene status management module detects that the terminal device is in a screen-off standby state, it can also send a limit adjustment instruction to the cache limit management module, so that the cache limit management module sets the initial value of the partitioned cache area based on the limit adjustment instruction, and reasonably adjusts the size of the partitioned cache area according to the memory required by the task to be executed during the running process, thereby ensuring the normal operation of the task to be executed.
[0126] Step 402: The cache quota management module receives a quota adjustment instruction.
[0127] Step 403: In response to the quota adjustment instruction, the cache quota management module sets the initial value of the partition cache area and registers the target pressure trigger to monitor the I / O pressure value and the memory pressure value.
[0128] The target pressure trigger includes an I / O pressure trigger and a memory pressure trigger. The I / O pressure trigger is used to monitor the I / O pressure value. The memory pressure trigger is used to monitor the memory pressure value. The I / O pressure value and the memory pressure value are corresponding pressure values when the terminal device executes the task to be executed.
[0129] After the cache quota management module of the terminal device receives the quota adjustment instruction, the cache quota management module can pre-set the initial value of the partition cache area and register the target pressure trigger to monitor the I / O pressure value and the memory pressure value. After that, the size of the partition cache area can be adjusted according to the I / O pressure value and the memory pressure value to ensure the normal operation of the task to be executed.
[0130] In some examples, the initial value of the partition cache area set by the cache quota management module is 10%. That is, 10% of the memory space is migrated from the system cache as the initial cache space of the partition cache area. It should be noted that the initial value of the partition cache area can be flexibly adjusted according to actual needs, and the embodiments of the present disclosure do not impose any restrictions on this.
[0131] In some examples, the cache quota management module registers the target pressure trigger, which can be the cache quota management module registering the target pressure trigger with the PSI to monitor the I / O pressure value and the memory pressure value using the target pressure trigger. Subsequently, the size of the partition cache area can be adjusted in time according to the I / O pressure value and the memory pressure value. In this way, the operating performance of the operating system is avoided from being affected by excessive I / O pressure value and memory pressure value.
[0132] Exemplarily, the cache quota management module registers an I / O pressure trigger with PSI, and the I / O initial pressure value N=5 monitored by the I / O pressure trigger. N=5 is used to indicate that the time waiting for I / O when the task to be executed is running accounts for 5% of the entire statistical period. The cache quota management module registers a memory pressure trigger with PSI, and the memory initial pressure value M=5 monitored by the memory pressure trigger is used to indicate that the time waiting for memory resources when the task to be executed is running accounts for 5% of the entire statistical period. The larger the N and M, the greater the impact on system performance.
[0133] In some examples, the values of the I / O pressure value N and the memory pressure value M may be related to the initial value of the partition cache area. If the initial value of the partition cache area changes, the I / O pressure value N and the memory pressure value M may also change. The present disclosure does not limit the specific values of the I / O pressure value N and the memory pressure value M.
[0134] Different terminal devices at different times have different pending tasks to be processed in the screen-off standby state, and the corresponding required system resources will also be different. When the required system resources are large, if the memory space of the partition cache area is small, then the memory reclaimed from the partition cache area by the terminal device is very limited. This will cause the cached data in the partition cache area to be frequently replaced, which will increase the I / O pressure and memory pressure, thereby affecting the operating system's performance. If the memory space of the partition cache area is large, the terminal device can reclaim a certain amount of memory from the partition cache area as needed, which will have little impact on I / O and memory, and will not affect the operating system's performance.
[0135] Therefore, the present disclosure utilizes a cache quota management module to monitor the I / O pressure value and the memory pressure value. When the I / O pressure value and the memory pressure value increase, the cache quota management module can dynamically adjust the size of the partition cache area to reduce the I / O pressure value and the memory pressure value, so that the tasks to be executed can run normally when the terminal device is in the screen-off standby state, thereby ensuring the operating performance of the operating system.
[0136] Step 404: The partition cache management module receives a screen-off instruction.
[0137] Step 405: In response to the screen off instruction, the partition cache management module obtains the initial value of the partition cache area from the cache quota management module, and creates the partition cache area based on the initial value.
[0138] The partition cache area may include multiple areas. Exemplarily, the multiple areas include a file page partition cache area, an index node partition cache area, and a directory entry partition cache area.
[0139] After the partition cache management module of the terminal device receives the screen-off instruction, the partition cache management module may obtain the initial value of the partition cache area from the cache limit management module, and create the partition cache area based on the initial value.
[0140] In some examples, the terminal device includes a system cache. Figure 2 As shown, the system cache includes file page cache, index node cache and directory entry cache. The partition cache management module creates a partition cache area based on the initial value. The partition cache management module divides part of the memory space in the system cache based on the initial value and sets the memory space as the partition cache area.
[0141] Exemplarily, based on the initial value, the partition cache management module divides part of the memory space in the file page cache in the system cache, and sets the memory space as the file page partition cache area. Divides part of the memory space in the index node cache in the system cache, and sets the memory space as the index node partition cache area. Divides part of the memory space in the directory entry cache in the system cache, and sets the memory space as the directory entry partition cache area.
[0142] In some examples, the partition cache management module divides part of the memory space in the system cache and sets the memory space as the partition cache area, which can be to migrate a certain amount of cache data from the system cache and use the memory space corresponding to the migrated cache data as the initial cache space of the partition cache area. Since the system cache usually uses the LRU algorithm to manage cache data, migrating a certain amount of cache data from the system cache can be to select the cache data that has not been used the longest from the system cache for migration, and use the memory space corresponding to the migrated cache data as the initial cache space of the partition cache area.
[0143] Exemplarily, the LRU algorithm can manage cache data through an LRU linked list. Usually, the header of the LRU linked list is used to store the cache data that is frequently accessed recently, and the tail of the LRU linked list is used to store the cache data that is not frequently accessed. It can be understood that the header of the LRU linked list corresponding to the system cache also stores the cache data that is frequently accessed recently, and the tail of the LRU linked list also stores the cache data that is not frequently accessed.
[0144] Therefore, the cache data that has not been used the longest time from the system cache is selected for migration, and the cache data that is not frequently accessed is recycled from the tail of the lru linked list corresponding to the system cache. Then, the cache data that is not frequently accessed is migrated to the head of the lru linked list corresponding to the partition cache area, and the memory space occupied by the cache data that is not frequently accessed is used as the initial cache space of the partition cache area.
[0145] The following is an example of dividing part of the memory space from the file page cache in the system cache to create a file page partition cache area.
[0146] Figure 5 The example shows the lru linked list corresponding to the file page cache of a terminal device before the screen is turned off. The lru linked list corresponding to the file page cache includes page 1, page 2, page 3, page 4 and page 5. Among them, page 1, page 2, page 3, page 4 and page 5 are cached data in the file page cache.
[0147] When the terminal device is in the screen-off standby state, the partition cache management module can insert part of the cache data in the tail of the lru linked list corresponding to the file page cache into the head of the lru linked list corresponding to the file page partition cache area. Figure 6 As shown, the cache data pages 3, 4 and 5 in the lru linked list corresponding to the file page cache are inserted into the header of the lru linked list corresponding to the file page partition cache area. That is, the memory space occupied by pages 3, 4 and 5 is used as the initial cache space of the file page partition cache area.
[0148] It can be understood that part of the memory space is divided from the index node cache in the system cache to create the index node partition cache area and part of the memory space is divided from the directory entry cache in the system cache to create the directory entry partition cache area and Figure 6 The process of dividing part of the memory space from the file page cache in the system cache and creating a file page partition cache area is similar and will not be repeated here.
[0149] Based on the above method, when the terminal device is in the screen-off standby state, a partition cache area can be created in the system cache. In this way, all cache data generated by the task to be executed during its operation can be stored in the partition cache area, and the data management of the cache data corresponding to the task to be executed can be completed in the partition cache area, thereby reducing the impact on the cache data corresponding to the current application in the system cache. In other words, when the task to be executed accesses a new file and generates new cache data, the new cache data can be directly updated to the lru linked list corresponding to the partition cache area.
[0150] Therefore, the present disclosure avoids recycling and releasing the cache data of the current application in order to store the cache data corresponding to the task to be executed. When the terminal device switches to the bright screen state, the cache data of the current application is still retained in the system cache. When the user operates on the application interface of the current application, a large number of I / O requests will not be generated, and there will be no application delays or freezes. This ensures that after the user unlocks the application, the current application can still run stably and smoothly, thereby providing the user with a better continuity operation experience.
[0151] In some examples, when the system's memory resources are tight, a certain amount of memory can also be reclaimed from the partitioned cache area. The partitioned cache area can use the LRU algorithm to manage cached data in the partitioned cache area. Exemplarily, when the system's memory resources are tight, memory can be reclaimed from the tail of the LRU linked list corresponding to the partitioned cache area based on the LRU algorithm.
[0152] Step 406: When the target pressure trigger detects that the I / O pressure value or the memory pressure value reaches a preset threshold, a notification instruction is sent to the cache quota management module.
[0153] The notification instruction is used to instruct the cache quota management module to adjust the size of the partition cache area. The notification instruction includes an I / O pressure value and / or a memory pressure value.
[0154] After the cache limit management module triggers the target pressure trigger to monitor the I / O pressure value and the memory pressure value, if the target pressure trigger detects that the I / O pressure value or the memory pressure value reaches the preset threshold, the target pressure trigger will send a notification instruction to the cache limit management module to instruct the cache limit management module to adjust the size of the partition cache area, thereby reducing the I / O pressure and memory pressure.
[0155] In some examples, when a target pressure trigger detects that an I / O pressure value or a memory pressure value reaches a preset threshold, the target pressure trigger can trigger a notification event to instruct the cache quota management module to adjust the size of the partition cache area in the form of a notification event.
[0156] In some examples, the preset threshold may be set based on a target pressure trigger registered by the cache quota management module and an initial pressure value detected by the target pressure trigger. For example, the I / O initial pressure value N=5 monitored by the I / O pressure trigger, the memory initial pressure value M=5 monitored by the memory pressure trigger, and the preset threshold is set to 10. That is, when the I / O pressure value N=10 monitored by the I / O pressure trigger or the memory pressure value M=10 monitored by the memory pressure trigger, a notification instruction is sent to the cache quota management module. The preset thresholds in the present disclosure can be flexibly adjusted according to actual needs, and there are no restrictions on this.
[0157] Step 407: The cache quota management module receives the notification instruction.
[0158] Step 408: In response to the notification instruction, the cache quota management module adjusts the size of the partition cache area based on the I / O pressure value, the memory pressure value and the preset classification table.
[0159] When the cache limit management module receives the notification instruction, the size of the partition cache area can be adjusted according to the I / O pressure value and / or memory pressure value in the notification instruction.
[0160] In some examples, the cache quota management module adjusts the size of the partitioned cache area according to the I / O pressure value and / or memory pressure value in the notification instruction, and the resource pressure value can be determined based on the I / O pressure value and / or memory pressure value in the notification instruction. The size of the partitioned cache area is adjusted based on the resource pressure value and the preset classification table. It should be noted that the process of adjusting the size of the partitioned cache area by the cache quota management module is similar to the process of creating the partitioned cache area in step 405, which will not be repeated here.
[0161] In some examples, determining the resource pressure value based on the I / O pressure value and / or memory pressure value in the notification instruction can be based on the I / O pressure value and / or memory pressure value in the notification instruction, and taking the maximum value of the I / O pressure value and / or memory pressure value as the resource pressure value.
[0162] In some examples, the preset classification table includes multiple pressure ranges and adjustment values of the partitioned cache area corresponding to each pressure range. Based on the resource pressure value and the preset classification table, adjusting the size of the partitioned cache area can be to determine a target pressure range corresponding to the resource pressure value; and to search the preset classification table for the adjustment value of the partitioned cache area corresponding to the target pressure range. The size of the partitioned cache area is adjusted based on the adjustment value of the partitioned cache area corresponding to the target pressure range. The multiple pressure ranges include the target pressure range.
[0163] Exemplarily, the preset classification table is shown in Table 1:
[0164] Table 1
[0165] Pressure range Adjustment value of partition cache area X<5 10% 5≤X<10 15% 10≤X<20 20% 20≤X 25%
[0166] As shown in Table 1, the preset classification table includes four pressure ranges, namely pressure range 1, X<5, pressure range 2, 5≤X<10, pressure range 3, 10≤X<20, and pressure range 4, 20≤X. Wherein, X is the resource pressure value. X is the maximum value of the I / O pressure value N and the memory pressure value M.
[0167] When X falls within the pressure range 1 (ie, X<5), that is, the maximum value of the I / O pressure value N and the memory pressure value M is less than 5, the cache quota management module sets the size of the partition cache area to 10%.
[0168] When X falls within the pressure range 2 (ie, 5≤X<10), that is, the maximum value of the I / O pressure value N and the memory pressure value M is greater than or equal to 5 and less than 10, the cache limit management module sets the size of the partition cache area to 15%.
[0169] When X falls within the pressure range 3 (ie, 10≤X<20), that is, the maximum value of the I / O pressure value N and the memory pressure value M is greater than or equal to 10 and less than 20, the cache quota management module sets the size of the partition cache area to 20%.
[0170] When X falls within the pressure range 4 (ie, when 20≤X), that is, the maximum value of the I / O pressure value N and the memory pressure value M is greater than or equal to 20, the cache quota management module sets the size of the partition cache area to 25%.
[0171] It is understandable that the multiple pressure ranges in the preset classification table and the adjustment values of the partitioned cache area corresponding to each pressure range are only examples. The adjustment values of the multiple pressure ranges and the partitioned cache area corresponding to each pressure range can be adjusted based on actual usage requirements, and the present disclosure does not limit this.
[0172] For example, the cache quota management module obtains a notification instruction, in which the I / O pressure value N=8 and the memory pressure value M=8. Based on the I / O pressure value and the memory pressure value, the resource pressure value X is obtained to be 8, and the target pressure range corresponding to the resource pressure value is determined to be pressure range 2, and the cache quota management module sets the size of the partition cache area to 15%.
[0173] Then the cache quota management module registers the target pressure trigger again. The I / O pressure trigger in the target pressure trigger detects the I / O pressure value N=10, and the memory pressure trigger detects the memory pressure value M=10. The notification instruction is triggered again, and then based on the I / O pressure value and the memory pressure value in the notification instruction, the resource pressure value X is obtained to be 10, and the target pressure range corresponding to the resource pressure value is determined to be pressure range 3. Then the cache quota management module sets the size of the partition cache area to 20%.
[0174] Continue to register the target pressure trigger. When it is determined that the target pressure range corresponding to the resource pressure value is the pressure range 4, 20≤X, the cache limit management module sets the size of the partition cache area to 25%. At this time, the target pressure trigger is no longer registered, and the size of the partition cache area is no longer increased. Because if the size of the partition cache area continues to increase, it means that more cache data needs to be migrated from the system cache. This will cause the cache data of the current application stored in the system cache to be greatly reduced, and thus it will not be able to protect the cache data of the current application. When the terminal device turns on the screen, there will still be freezes when using the current application.
[0175] In other examples, the cache quota management module can determine the adjustment value of the partition cache area according to the I / O pressure value, the memory pressure value and the preset classification table, and then send the adjustment value of the partition cache area to the partition cache management module, which adjusts the size of the partition cache area based on the adjustment value, thereby obtaining the adjusted partition cache area.
[0176] Step 409: When the scene state management module detects that the terminal device is in the screen-on state, it sends a pressure monitoring deregistration instruction to the cache limit management module and sends a screen-on instruction to the partition cache management module.
[0177] The pressure monitoring deregistration instruction is used to instruct the deregistration of the monitoring of the I / O pressure value and the memory pressure value by the target pressure trigger. The screen-on instruction is used to instruct the partition cache management module to deregister the partition cache area.
[0178] When the user uses the terminal device, the terminal device will enter the screen-on state. In the screen-on state, a separate memory space is no longer needed to store the cache data of the task to be executed. In other words, in the screen-on state, the partitioned cache area is no longer needed. Therefore, when the terminal device is in the screen-on state, the partitioned cache management module needs to cancel the partitioned cache area. Correspondingly, since the partitioned cache area is not needed, the cache limit management module is no longer needed to control the size of the partitioned cache area. That is, the cache limit management module needs to cancel the target pressure trigger's monitoring of the I / O pressure value and the memory pressure value.
[0179] Step 410: The cache quota management module receives a pressure monitoring logout instruction.
[0180] Step 411: In response to the pressure monitoring deregistration instruction, the cache quota management module deregisters the target pressure trigger.
[0181] After the cache quota management module receives the pressure monitoring deregistration instruction, it responds to the pressure monitoring deregistration instruction and deregisters the target pressure trigger. The target pressure trigger no longer needs to monitor the I / O pressure value and the memory pressure value. The cache quota management module no longer needs to adjust the size of the partition cache area according to the I / O pressure value and the memory pressure value.
[0182] In some examples, the cache quota management module deregistering the target pressure trigger may be the cache quota management module deregistering the target pressure trigger to the PSI.
[0183] Step 412: The partition cache management module receives a screen-on instruction.
[0184] Step 413: In response to the screen-on instruction, the partition cache management module cancels the partition cache area.
[0185] After the partition cache management module receives the screen-on instruction, it can deregister the partition cache area in response to the screen-on instruction.
[0186] In some examples, the partition cache management module canceling the partition cache area may be to migrate cache data in the partition cache area back to the system cache. For example, the partition cache management module migrates cache data in the file page partition cache area in the partition cache area back to the file page cache; migrates cache data in the index node partition cache area in the partition cache area back to the index node cache; and migrates cache data in the directory entry partition cache area in the partition cache area back to the directory entry cache.
[0187] In other examples, migrating cache data in the partition cache area back to the system cache may be inserting the cache data in the partition cache area into the tail of the lru linked list corresponding to the system cache. For example, the partition cache management module inserts the cache data in the file page partition cache area of the partition cache area into the tail of the lru linked list corresponding to the file page cache; inserts the cache data in the index node partition cache area of the partition cache area into the tail of the lru linked list corresponding to the index node cache; inserts the cache data in the directory entry partition cache area of the partition cache area into the tail of the lru linked list corresponding to the directory entry cache. This process is the inverse of the process of creating a partition cache area.
[0188] It should be noted that the embodiment of the present disclosure may not limit the execution order between step 410 and step 412. For example, step 410 may be executed first and then step 412; or step 412 may be executed first and then step 410. The specific order may be determined based on actual usage requirements.
[0189] Therefore, this solution is adopted to detect the screen state of the terminal device, and create a partition cache area when the screen state is the off-screen standby state. Afterwards, the partition cache area can be used to store the cache data generated by the task to be executed during the operation when the terminal device is in the off-screen standby state. In this way, the cache data of the current application is avoided to be recovered and released in order to store the cache data corresponding to the task to be executed. Therefore, when the terminal device switches to the bright screen state, the cache data of the current application is still retained in the system cache. When the user operates on the application interface of the current application, a large number of I / O requests will not be generated, and there will be no delay or jamming of the current application. This ensures that the current application can still run stably and smoothly after the user unlocks it, thereby providing the user with a better continuous operation experience. In addition, the I / O pressure value and the memory pressure value are detected by registering the target pressure trigger, and the size of the partition cache area is dynamically adjusted based on the I / O pressure value and the memory pressure value. This avoids excessive I / O pressure and memory pressure caused by the partition cache area being too small, which affects the operating performance of the terminal device.
[0190] For ease of understanding, the following Figure 7 The data processing method provided by the embodiment of the present disclosure is described. Figure 7 As shown, the data processing method may include the following steps 701-703.
[0191] Step 701: Detect the screen status of the terminal device.
[0192] Among them, the screen status includes the screen-off standby status.
[0193] Step 702: When the terminal device is in the screen-off standby state, use the system cache to create a partition cache area.
[0194] In the embodiment of the present disclosure, the screen state of the terminal device is detected, and the screen state includes the screen-off standby state. When the terminal device is in the screen-off standby state, the partition cache area is created by using the system cache. Figure 4 Step 401, step 404-step 405 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0195] Step 703: Storing cache data generated during the execution of the task to be executed in the partition cache area.
[0196] Among them, the tasks to be executed are tasks that are run when the terminal device is in the screen-off standby state.
[0197] After the partition cache area is created, cache data generated by the task to be executed during its operation can be stored in the partition cache area, thereby avoiding affecting the cache data of the current application.
[0198] In some examples, when the terminal device is in a screen-off standby state, the method also includes: obtaining a resource pressure value, the resource pressure value being a pressure value corresponding to when the terminal device executes a task to be executed; determining a target pressure range corresponding to the resource pressure value based on a preset grading table, the preset grading table including multiple pressure ranges and adjustment values of partitioned cache areas corresponding to each pressure range; multiple pressure ranges including a target pressure range; and adjusting the partitioned cache area using the adjustment values of the partitioned cache area corresponding to the target pressure range.
[0199] In the embodiment of the present disclosure, when the terminal device is in a screen-off standby state, a resource pressure value is obtained, and the resource pressure value is a pressure value corresponding to when the terminal device executes a task to be executed; based on a preset classification table, a target pressure range corresponding to the resource pressure value is determined, and the preset classification table includes multiple pressure ranges and adjustment values of partitioned cache areas corresponding to each pressure range; the multiple pressure ranges include a target pressure range; the partitioned cache area is adjusted using the adjustment value of the partitioned cache area corresponding to the target pressure range, and the above Figure 4 Steps 401 to 403 and steps 406 to 408 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0200] In some examples, obtaining a resource pressure value includes: registering a first pressure trigger and a second pressure trigger to a pressure stall information mechanism PSI, the first pressure trigger being used to detect a pressure value of a first resource, the second pressure trigger being used to detect a pressure value of a second resource, the first resource and the second resource being different; determining the pressure value of the first resource using the first pressure trigger; determining the pressure value of the second resource using the second pressure trigger; and determining the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource.
[0201] Wherein, the first pressure trigger and the above Figure 4 The I / O pressure trigger in step 403 in the embodiment shown is similar. Figure 4 The memory pressure trigger in step 403 in the illustrated embodiment is similar.
[0202] In the embodiment of the present disclosure, a first pressure trigger and a second pressure trigger are registered with the pressure stall information mechanism PSI, the first pressure trigger is used to detect the pressure value of the first resource, and the second pressure trigger is used to detect the pressure value of the second resource, the first resource and the second resource are different; the pressure value of the first resource is determined by using the first pressure trigger; the pressure value of the second resource is determined by using the second pressure trigger; based on the pressure value of the first resource and the pressure value of the second resource, the resource pressure value is determined, which can be referred to the above Figure 4 Step 403 and step 408 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0203] In some examples, determining a resource pressure value based on a pressure value of a first resource and a pressure value of a second resource includes: based on the pressure value of the first resource and the pressure value of the second resource, determining a maximum value of the pressure value of the first resource and the pressure value of the second resource as the resource pressure value.
[0204] In the embodiment of the present disclosure, based on the pressure value of the first resource and the pressure value of the second resource, the maximum value of the pressure value of the first resource and the pressure value of the second resource is determined as the resource pressure value. Figure 4 Step 408 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0205] In some examples, the pressure value of the first resource is an I / O pressure value, and the pressure value of the second resource is a memory pressure value.
[0206] In some examples, partition cache areas are created using system cache, including: based on a cache elimination algorithm, using a linked list corresponding to the system cache to create partition cache areas, the system cache including a file page cache, an index node cache, and a directory entry cache.
[0207] In the embodiment of the present disclosure, based on the cache elimination algorithm, a linked list corresponding to the system cache is used to create a partition cache area. The system cache includes a file page cache, an index node cache, and a directory entry cache. For details, refer to the above Figure 4 Step 405 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0208] In some examples, the partition cache area includes a file page partition cache area, an index node partition cache area, and a directory entry partition cache area.
[0209] In some examples, the screen state also includes a screen-on state. The method also includes: when the terminal device is in the screen-on state, deregistering the partition cache area, and deregistering the first pressure trigger and the second pressure trigger to the PSI.
[0210] In the embodiment of the present disclosure, the screen state also includes a bright screen state; when the terminal device is in a bright screen state, the partition cache area is deregistered, and the first pressure trigger and the second pressure trigger are deregistered to the PSI. Figure 4 Steps 409 to 413 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.
[0211] Corresponding to the method in the above-mentioned embodiment, the embodiment of the present disclosure further provides a data processing device. The data processing device can be applied to an electronic device to implement the method in the above-mentioned embodiment. The functions of the data processing device can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.
[0212] For example, Figure 8 A schematic diagram of the structure of a data processing device 800 is shown. Figure 8 As shown, the data processing device 800 may include: a detection module 801, a creation module 802, a storage module 803, etc.
[0213] Among them, the detection module 801 is configured to detect the screen state of the terminal device, and the screen state includes the screen-off standby state. The creation module 802 is configured to use the system cache to create a partition cache area when the terminal device is in the screen-off standby state. The storage module 803 is configured to store cache data generated by the task to be executed during the operation in the partition cache area, and the task to be executed is a task that runs when the terminal device is in the screen-off standby state.
[0214] In a possible implementation, the data processing device also includes an acquisition module 804, a determination module 805, and an adjustment module 806. The acquisition module 804 is configured to acquire a resource pressure value, which is a pressure value corresponding to when the terminal device executes a task to be executed. The determination module 805 is configured to determine a target pressure range corresponding to the resource pressure value based on a preset grading table, the preset grading table includes multiple pressure ranges and an adjustment value of a partitioned cache area corresponding to each pressure range; the multiple pressure ranges include a target pressure range; the adjustment module 806 is configured to adjust the partitioned cache area using the adjustment value of the partitioned cache area corresponding to the target pressure range.
[0215] In one possible implementation, the determination module 805 is also configured to register a first pressure trigger and a second pressure trigger to a pressure stall information mechanism PSI, wherein the first pressure trigger is used to detect a pressure value of a first resource, and the second pressure trigger is used to detect a pressure value of a second resource, and the first resource and the second resource are different; determine the pressure value of the first resource by using the first pressure trigger; determine the pressure value of the second resource by using the second pressure trigger; and determine the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource.
[0216] In a possible implementation, the determination module 805 is further configured to determine a maximum value of the pressure value of the first resource and the pressure value of the second resource as the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource.
[0217] In a possible implementation, the pressure value of the first resource is an I / O pressure value, and the pressure value of the second resource is a memory pressure value.
[0218] In a possible implementation, the creation module 802 is further configured to create a partition cache area based on a cache elimination algorithm using a linked list corresponding to a system cache, where the system cache includes a file page cache, an index node cache, and a directory entry cache.
[0219] In a possible implementation, the partition cache area includes a file page partition cache area, an index node partition cache area, and a directory entry partition cache area.
[0220] In a possible implementation, the screen state further includes a screen-on state; and the data processing apparatus further includes a deregistration module 807. The deregistration module 807 is configured to deregister the partition cache area and deregister the first pressure trigger and the second pressure trigger to the PSI when the terminal device is in the screen-on state.
[0221] It should be understood that the division of units or modules (hereinafter referred to as units) in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; or all in the form of hardware; or some units can be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware.
[0222] For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in a memory in the form of a program, and called and executed by a certain processing element of the device. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software called by a processing element.
[0223] It should be understood that each step in the above method embodiment provided by the present disclosure can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present disclosure can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0224] In one example, the unit in the above apparatus may be one or more integrated circuits configured to implement the above method, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of at least two of these integrated circuit forms.
[0225] For another example, when the units in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a CPU or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system on a chip SOC.
[0226] In one implementation, the units of the above apparatus implementing the corresponding steps in the above method can be implemented in the form of a processing element scheduling program. For example, the apparatus may include a processing element and a storage element, and the processing element calls the program stored in the storage element to execute the method of the above method embodiment. The storage element may be a storage element on the same chip as the processing element, that is, an on-chip storage element.
[0227] In another implementation, the program for executing the above method may be in a storage element on a different chip from the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element to the on-chip storage element to call and execute the method of the above method embodiment.
[0228] For example, the embodiments of the present disclosure may also provide a device, such as an electronic device, which may include a processor and a memory for storing instructions executable by the processor. When the processor is configured to execute the above instructions, the electronic device implements the data processing method of the above embodiment. The memory may be located inside the electronic device or outside the electronic device. And the processor includes one or more.
[0229] In another implementation, the unit of the device implementing each step in the above method may be configured as one or more processing elements, which may be arranged on the corresponding electronic device, and the processing element here may be an integrated circuit, for example: one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of these integrated circuits. These integrated circuits may be integrated together to form a chip.
[0230] For example, the present disclosure also provides a chip, which can be applied to the above electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected through lines; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuit to implement the method in the above method embodiment.
[0231] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by an electronic device, the electronic device can implement the above-mentioned data processing method.
[0232] The disclosed embodiments also provide a computer program product, including computer instructions for the electronic device to run as described above, and when the computer instructions are run in the electronic device, the electronic device can implement the data processing method as described above. Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above 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.
[0233] In the several embodiments provided in the present disclosure, 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 modules or units is only a logical function division, and 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.
[0234] 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.
[0235] In addition, each functional unit in each embodiment of the present disclosure 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.
[0236] 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 disclosure 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, such as a program. The software product is stored in a program product, such as a computer-readable storage medium, including a number of instructions to enable a terminal device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the methods of each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, disk or optical disk and other media that can store program codes.
[0237] For example, the embodiments of the present disclosure may also provide a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by an electronic device, the electronic device implements the data processing method in the aforementioned method embodiment.
[0238] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A data processing method, characterized in that: Methods include: Detecting the screen status of the terminal device, wherein the screen status includes a screen-off standby state; When the terminal device is in a screen-off standby state, using the system cache to create a partition cache area; The partition cache area stores cache data generated during the running of the task to be executed, and the task to be executed is a task that is run when the terminal device is in a screen-off standby state.
2. The method according to claim 1, characterized in that When the terminal device is in a screen-off standby state, the method further includes: Acquire a resource pressure value, where the resource pressure value is a pressure value corresponding to when the terminal device executes the task to be executed; Determining a target pressure range corresponding to the resource pressure value based on a preset classification table, wherein the preset classification table includes a plurality of pressure ranges and an adjustment value of a partitioned cache area corresponding to each pressure range; the plurality of pressure ranges includes the target pressure range; The partitioned cache area is adjusted using the adjustment value of the partitioned cache area corresponding to the target pressure range.
3. The method according to claim 2, characterized in that The obtaining of the resource pressure value includes: registering a first pressure trigger and a second pressure trigger with a pressure stall information mechanism PSI, wherein the first pressure trigger is used to detect a pressure value of a first resource, and the second pressure trigger is used to detect a pressure value of a second resource, and the first resource and the second resource are different; Using the first pressure trigger, determining the pressure value of the first resource; using the second pressure trigger, determining the pressure value of the second resource; The resource pressure value is determined based on the pressure value of the first resource and the pressure value of the second resource.
4. The method according to claim 3, wherein determining the resource pressure value based on the pressure value of the first resource and the pressure value of the second resource comprises: Based on the pressure value of the first resource and the pressure value of the second resource, a maximum value of the pressure value of the first resource and the pressure value of the second resource is determined as the resource pressure value.
5. The method according to claim 3 or 4, characterized in that: The pressure value of the first resource is an I / O pressure value, and the pressure value of the second resource is a memory pressure value.
6. The method according to any one of claims 1 to 5, characterized in that The method of using the system cache to create a partition cache area includes: Based on a cache elimination algorithm, the partition cache area is created using a linked list corresponding to a system cache, wherein the system cache includes a file page cache, an index node cache, and a directory entry cache.
7. The method according to claim 6, characterized in that The partition cache area includes a file page partition cache area, an index node partition cache area and a directory entry partition cache area.
8. The method according to any one of claims 1 to 7, characterized in that The screen state also includes a screen-on state, and the method further includes: When the terminal device is in a screen-on state, the partition cache area is deregistered, and the first pressure trigger and the second pressure trigger are deregistered to the PSI.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having computer program instructions stored thereon; characterized in that: When the computer program instructions are executed by an electronic device, the electronic device implements the method according to any one of claims 1 to 8.