Data processing method and device, storage medium, program product and chip system
By detecting the amount of storage space and adjusting the processing speed and processor resources of the target thread, the problem of terminal data display latency was solved, achieving fast and smooth data display.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2024-10-28
- Publication Date
- 2026-04-28
AI Technical Summary
When displaying data on the terminal, a large or small amount of storage space may cause the data to fail to be displayed in a timely manner, affecting the user experience.
By detecting the amount of storage space, the processing speed of the target thread can be controlled to increase to a preset processing speed, including adjusting the processor frequency, processor migration, or waking up/occupying threads that use system resources, in order to match the processing needs within the range of storage space.
Within a suitable storage space range, the target thread can quickly process associated data related to user input events, ensuring timely data display and improving user experience.
Smart Images

Figure CN121934797A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of resource processing technology, and in particular to a data processing method, apparatus, storage medium, program product, and chip system. Background Technology
[0002] Currently, when a terminal needs to display data, it needs to transfer the data to the storage space of a queue through a thread, and then another thread retrieves the data from the storage space for display.
[0003] In related technologies, both large and small amounts of storage space in the task queue can lead to data not being displayed in a timely manner, resulting in a reduced user experience. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a data processing method, apparatus, storage medium, program product, and chip system.
[0005] According to a first aspect of the present disclosure, a data processing method is provided, comprising:
[0006] Upon detecting a user input event, retrieve the amount of storage space in the queue;
[0007] When the amount of storage space is within a preset range, the processing speed of the target thread is increased to a preset processing speed; the target thread is the processing thread triggered by the user input event.
[0008] Optionally, the target thread includes a first thread; the step of controlling the processing speed of the target thread to increase to a preset processing speed when the amount of storage space is within a preset range includes:
[0009] If the number of storage spaces is less than a first preset number, the processing speed of the first thread is increased to a first processing speed; the first thread is used to respond to the user input event and transmit the associated data related to the user input event to the storage space in the queue.
[0010] Optionally, the target thread includes a second thread; the step of controlling the processing speed of the target thread to increase to a preset processing speed when the amount of storage space is within a preset range includes:
[0011] If the number of storage spaces is greater than a second preset number, the processing speed of the second thread is increased to a second processing speed; the second thread is used to retrieve the associated data from the storage space.
[0012] Optionally, when the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes:
[0013] When the amount of storage space is within the preset range, the processing frequency of the first processor where the target thread is located is increased to the first processing frequency.
[0014] Optionally, when the amount of storage space is within the preset range, controlling the processing frequency of the first processor where the target thread resides to be increased to a first processing frequency includes:
[0015] If the amount of storage space is within the preset range, and it is determined that the maximum processing frequency that the first processor where the target thread is located can provide is greater than or equal to the first processing frequency, the processing frequency of the first processor where the target thread is located is controlled to be increased to the first processing frequency.
[0016] Optionally, when the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes:
[0017] When the amount of storage space is within the preset range, the processor where the target thread is located is controlled to be transferred from the first processor to the second processor; the processing speed of the second processor is greater than that of the first processor.
[0018] Optionally, when the amount of storage space is within the preset range, controlling the processor where the target thread resides to switch from the first processor to the second processor includes:
[0019] If the amount of storage space is within the preset range, and the maximum processing frequency that the first processor where the target thread is located can provide is less than the first processing frequency, the processor where the target thread is located is controlled to be transferred from the first processor to the second processor; the first processing frequency is the processing frequency required by the first processor to process the target frame data.
[0020] Optionally, the method further includes:
[0021] Determine the computing power ratio between the first processor and the candidate processor;
[0022] Based on the ratio of the first processing frequency to the computing power, a second processing frequency required by the alternative processor to process the target frame data is obtained;
[0023] If the second processing frequency is less than or equal to the maximum processing frequency that the alternative processor can provide, the alternative processor shall be used as the second processor.
[0024] Optionally, when the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes:
[0025] If the amount of storage space is within a preset range and the target thread wakes up the third thread, control the processing speed of the third thread to be increased to the preset processing speed.
[0026] Optionally, when the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes:
[0027] If the amount of storage space is within a preset range, and the system resources acquired by the target thread are occupied by the fourth thread, control the processing speed of the fourth thread to be increased to the preset processing speed.
[0028] Optionally, the user input event includes at least one of the following:
[0029] Screen touch events, keyboard input events, mouse input events, stylus input events, and voice command events.
[0030] According to a second aspect of the present disclosure, a data processing apparatus is provided, comprising:
[0031] The acquisition module is configured to acquire the amount of storage space occupied in the queue when a user input event is detected.
[0032] The control module is configured to increase the processing speed of the target thread to a preset processing speed when the amount of storage space is within a preset range; the target thread is the processing thread triggered by the user input event.
[0033] According to a third aspect of the present disclosure, a data processing apparatus is provided, comprising:
[0034] processor;
[0035] Memory used to store processor-executable instructions;
[0036] The processor is configured as follows:
[0037] The steps of performing the data processing method provided in the first aspect of this disclosure.
[0038] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the data processing method provided in the first aspect of the present disclosure.
[0039] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the data processing method provided in the first aspect of the present disclosure.
[0040] According to a sixth aspect of the present disclosure, a chip system is provided, the chip system including a processing unit and an interface circuit, the processing unit acquiring program instructions through the interface circuit, the program instructions being executed by the processing unit, the processing unit being used to perform the steps of the data processing method provided in the first aspect.
[0041] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0042] If the amount of storage space is within the preset range, it means that the associated data related to the user input event cannot be processed quickly by the target thread, which will result in the associated data not being displayed quickly. In this case, the processing speed of the target thread can be increased to the preset processing speed, so that the target thread can process the associated data related to the user input event quickly, so that the associated data can be displayed quickly on the terminal screen.
[0043] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0045] Figure 1 This is a flowchart illustrating the steps of a data processing method according to an exemplary embodiment.
[0046] Figure 2 This is a schematic diagram illustrating the transfer of data between a first thread, a storage space, and a second thread according to an exemplary embodiment.
[0047] Figure 3 This is a schematic diagram illustrating a handwriting input event according to an exemplary embodiment.
[0048] Figure 4 This is a schematic diagram illustrating a click event according to an exemplary embodiment.
[0049] Figure 5This is a schematic diagram illustrating the transmission of data generated by a handwriting input event between a first thread, a storage space, and a second thread, according to an exemplary embodiment.
[0050] Figure 6 This is a flowchart illustrating the steps of a data processing method according to an exemplary embodiment.
[0051] Figure 7 This is a schematic diagram illustrating a queue where all storage space is free, according to an exemplary embodiment.
[0052] Figure 8 This is a schematic diagram illustrating, according to an exemplary embodiment, the existence of free and occupied storage space in a queue.
[0053] Figure 9 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment.
[0054] Figure 10 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment.
[0055] Figure 11 This is a block diagram illustrating a chip system according to an exemplary embodiment. Detailed Implementation
[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0057] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.
[0058] Figure 1 This is a flowchart illustrating the steps of a data processing method according to an exemplary embodiment, such as... Figure 1 As shown, the data processing method used in the terminal includes the following steps.
[0059] In step S10, if a user input event is detected, the amount of storage space in the queue is obtained.
[0060] A user input event indicates an event of interaction between a user and a terminal. User input events can be classified according to different criteria. For example, when classified by the type of input device, user input events include screen touch events, keyboard input events, mouse input events, stylus input events, and voice commands. When classified by the type of input action, user input events include click and slide events, where click and slide events can be achieved by the user through screen touch, keyboard input, mouse input, stylus input, etc.
[0061] The queue can be a queue that bears storage space. This queue can be a cache pool for managing data loading and display. The organizational structure of the queue adopts a first-in, first-out structure, and the data in the storage space that is first added to the queue will be output from the queue first.
[0062] In some scenarios, refer to Figure 2 As shown, after detecting a user input event, the first thread will transfer the associated data related to the user input event to the idle storage space in the queue, and then the second thread will obtain the associated data from the storage space and process it. The first thread can be a rendering thread (SF), and the second thread can be a display thread (render).
[0063] For example, taking the user input event as a stylus input event, refer to Figure 3 As shown, if the user writes the character "black" in the input method interface of the terminal, the image data such as the coordinates of each pixel point and the brightness of each pixel point of the character "black" will be sent to the rendering thread. The rendering thread uses this image data and the canvas data of this image data to form a data set and transfers it to the storage space in the queue. The display thread then obtains the data set from the storage space and synthesizes the data set onto the terminal screen to display the character "black".
[0064] Another example, taking the user input event as a click event, refer to Figure 4 As shown, if the user clicks on the link "Enter a new session" on the web page, the data of the new page linked after "Enter a new session" will be sent to the rendering thread. The rendering thread uses this data and the display framework of this data to form a data set and transfers it to the storage space in the queue. The display thread then obtains the data set from the storage space and synthesizes the data set onto the terminal screen to display the new page.
[0065] A queue can include multiple storage spaces, some of which are free and some are occupied. Therefore, upon detecting a user input event, determining the number of storage spaces in the queue includes: determining the number of occupied storage spaces in the queue. These occupied storage spaces are those occupied by associated data related to the user input event.
[0066] In step S20, if the amount of storage space is within a preset range, the processing speed of the target thread is increased to a preset processing speed.
[0067] If the amount of occupied storage space is within the preset range, it indicates that the amount of occupied storage space is too large or too small. In this case, the associated data in the storage space cannot be displayed in a timely manner, or it indicates that the user has entered a user input event, but some associated data related to the user input event has not been stored in the queue of storage space. In order to enable the data to be displayed in a timely manner, the processing speed of the target thread can be controlled to be increased to the preset processing speed. This will enable the associated data related to the user input event to be stored in the free storage space, and also enable the data in the occupied storage space to be output quickly, thereby improving the user experience.
[0068] The target thread is the processing thread triggered by the user input event. The target thread includes a first thread and a second thread. The first thread can be a rendering thread that responds to the user input event and transmits associated data related to the user input event to the storage space in the queue, for example, a rendering thread that transmits associated data related to the user input event to an idle storage space in the queue. The second thread can be a thread that reads data from the storage space, for example, a thread that retrieves associated data from the storage space occupied by the associated data and then displays it. After the data in the storage space is retrieved by the display thread, the storage space is released, switching from an occupied state to an idle state, so that the next frame of data can continue to occupy the idle storage space.
[0069] After detecting a user input event, the first thread transfers the associated data related to the user input event to the idle storage space in the queue. The idle storage space becomes an occupied storage space, and then the second thread retrieves the associated data from the occupied storage space in the queue for processing and sends it to the screen for display. During this process, if the number of occupied storage spaces in the queue is too large, it means that the processing speed of the first thread is greater than that of the second thread. The speed at which the first thread transfers the associated data to the storage space in the queue is greater than the speed at which the second thread retrieves the associated data from the storage space in the queue. In the case where the processing speed of the second thread is slow, it will cause the associated data not to be quickly output and displayed; conversely, if the number of occupied storage spaces in the queue is too small, it means that the processing speed of the first thread is less than that of the second thread. The speed at which the first thread transfers the associated data to the storage space in the queue is less than the speed at which the second thread retrieves the associated data from the storage space in the queue. In the case where the processing speed of the first thread is slow, it will cause the associated data related to the user input event not to be timely transferred to the storage space in the queue, and it will also cause the associated data related to the user input event not to be quickly output and displayed.
[0070] For example, please refer to Figure 5 As shown, if the user input event is a handwritten input event, when the user writes the character "大" on the terminal, assuming there are 5 frames of associated data related to the character "大", the first thread will transfer the 5 frames of associated data to 5 storage spaces in the queue, and then the second thread will retrieve the 5 frames of associated data from the 5 storage spaces respectively and display them. If the processing speed of the first thread is greater than that of the second thread, it may occur that the first thread has transferred the 5 frames of associated data to the 5 storage spaces in the queue, but the second thread has only processed the associated data in 3 of the 5 storage spaces, and the associated data in the remaining 2 storage spaces is still waiting to be processed. From the user's perspective, the writing fluency and followability of the user writing the character "大" are poor; conversely, if the processing speed of the first thread is less than that of the second thread, it may occur that after the user has finished writing the character "大", the first thread still has 2 frames of associated data not transferred to the storage space in the queue, and the second thread also has no associated data to process. From the user's perspective, the writing fluency and followability of the user writing the character "大" are still poor.
[0071] In the embodiment of the present disclosure, when the number of storage spaces is within the preset range, it means that the processing speeds of the first thread and the second thread do not match, and then the target thread with the slower processing speed among the first thread and the second thread will be controlled to increase its processing speed to the preset processing speed, so that the processing speeds of the first thread and the second thread match each other, and thus the associated data can be quickly displayed.
[0072] It can be understood that after a user input event occurs, multiple frames of image data will be displayed on the terminal screen. For example, when the user writes the character "大" (big), the character "一" (one) written by the user will be displayed on the terminal screen first, and then the character "人" (person) will be displayed. Through the coherent display of multiple frames of image data, the writing process of the user writing the character "大" can be presented on the terminal screen. During this process, each frame of image data in the multiple frames of image data will be stored in a different storage space. One storage space in the queue will store one frame of image data for the reading and writing of the first thread and the second thread. For example, if the character "大" written by the user generates 5 frames of image data, the first thread will sequentially store the 5 frames of image data in 5 storage spaces of the queue in the order of writing. Then, the second thread will sequentially read the 5 frames of image data from the 5 storage spaces in the first-in-first-out order and display them on the terminal screen, thereby realizing the display of the writing process of the character "大" on the terminal screen.
[0073] Through the above technical solution, when the number of storage spaces is within the preset number range, it means that the associated data related to the user input event cannot be quickly processed by the target thread, which will further cause the associated data not to be quickly displayed. At this time, the processing speed of the target thread can be increased to the preset processing speed, so that the target thread can quickly process the associated data related to the user input event, so that the associated data can be quickly displayed on the terminal screen.
[0074] For example, if the user input event is a click event, after detecting the click event, obtain the number of storage spaces occupied by the associated data related to the click event in the queue. If the number of storage spaces is within the preset number range, the processing speed of the target thread can be controlled to increase to the preset processing speed, so that the new page linked by the click event can be quickly displayed on the terminal screen, thereby improving the new page display speed.
[0075] Another example, if the user input event is a handwriting input event, after detecting the handwriting input event, obtain the number of storage spaces occupied by the associated data related to the handwriting input event in the queue. If the number of storage spaces is within the preset number range, the processing speed of the target thread can be controlled to increase to the preset processing speed, so that the patterns, characters and other graphics written by the user input event can be quickly displayed on the terminal screen, improving the followability and fluency of handwriting.
[0076] The following is an exemplary embodiment related to the above step S20 according to an exemplary embodiment, which is used to interpret different exemplary solutions for increasing the processing speed of the target thread when the number of storage spaces is within the preset number range.
[0077] In the first approach, if the amount of storage space is within the preset range, the processing frequency of the first processor where the target thread is located is increased to a first processing frequency.
[0078] The first processor can be the processor core of the Central Processing Unit (CPU) within the terminal. The CPU is the core component within the terminal, responsible for handling instructions and processing data for the computer programs within the terminal. A terminal can have one or more physical processors, and it can also contain multiple processor cores. These processor cores can be part of the same physical processor or distributed across different physical processors.
[0079] The multi-processor core design allows the terminal to handle multiple tasks simultaneously, improving performance and efficiency. For example, a terminal with an 8-core processor means that the processor within the terminal has 8 processor cores performing independent and different computing tasks.
[0080] A process runs on a processor core while processing data. It needs to use the processor core's processor resources to process data. Therefore, the first processor on which a process runs refers to the process running on the first processor and using the processor resources of the first processor to process data.
[0081] The processing frequency of the first processor is used to indicate the processing speed of the first processor. The faster the processing frequency of the first processor, the faster the processing speed of the first processor.
[0082] The first processing frequency is the processing frequency required by the first processor when processing the target frame data. The larger the amount of target frame data, the higher the first processing frequency. The target frame data is the associated data related to user input events that the first processor is currently processing.
[0083] The processing frequency of the first processor can be increased to the first processing frequency by calculating the frequency difference between the first processing frequency and the current processing frequency of the first processor, and then increasing the frequency difference based on the current processing frequency of the first processor.
[0084] Optionally, if the number of storage spaces is within the preset range and the maximum processing frequency that the first processor where the target thread is located can provide is greater than or equal to the first processing frequency, the processing frequency of the first processor where the target thread is located is controlled to be increased to the first processing frequency.
[0085] Different processor cores can provide different maximum processing frequencies. For example, processor core A can provide a maximum processing frequency of 2GHz, which means that processor core A can process related data with a frequency of up to 2GHz; processor core B can provide a maximum processing frequency of 2.3GHz, which means that processor core B can process related data with a frequency of up to 2.3GHz.
[0086] If the amount of storage space is within a preset range, and the maximum processing frequency that the first processor where the target thread is located can provide is greater than or equal to the first processing frequency required by the first processor to process the target frame data, it means that the first processor where the target thread is located can meet the requirements for processing the target frame data. That is, the target thread can process the target frame data with the help of the processor resources of the first processor. Therefore, the processing frequency of the first processor where the target thread is located can be increased from its current processing frequency to the required first processing frequency.
[0087] In the second approach, if the amount of storage space is within the preset range, the processor where the target thread is located is switched from the first processor to the second processor; the processing speed of the second processor is greater than that of the first processor.
[0088] When the amount of storage space is within a preset range, the target thread can also be controlled to switch from the slow first processor to the fast second processor, so that the target thread can use the faster second processor to process the target frame data.
[0089] Optionally, if the amount of storage space is within the preset range and the maximum processing frequency that the first processor where the target thread is located can provide is less than the first processing frequency, the processor where the target thread is located is controlled to be transferred from the first processor to the second processor; the first processing frequency is the processing frequency required by the first processor to process the target frame data.
[0090] If the amount of storage space is within the preset range, and the maximum processing frequency that the first processor where the target thread is located can provide is less than the first processing frequency, it means that the first processor where the target thread is located cannot meet the requirements for processing the target frame data. That is, the target thread can no longer process the target frame data with the help of the processor resources of the first processor. At this time, the processor where the target thread is located can be controlled to be transferred from the first processor to the second processor, so that the target thread can use the second processor with more powerful processing capabilities to process the target frame data.
[0091] With the above technical solution, when the amount of storage space is within a preset range, the processing frequency of the first processor where the target thread is located can be increased to the first processing frequency, thereby speeding up the processing speed of the target thread to process the target frame data; when the processing frequency of the first processor where the target thread is located cannot be increased to the first processing frequency, that is, when the maximum processing frequency of the first processor where the target thread is located is less than the first processing frequency, the target thread is transferred from running on the first processor to running on the second processor, so that the target thread can use the second processor with a more powerful running speed to process the target frame data.
[0092] During this process, since transferring the processor where the target thread resides from the first processor to the second processor would cause the associated data in the storage space of the previous queue to become invalid, the associated data needs to be reloaded onto the new second processor. Furthermore, the processor migration would bring unnecessary power consumption to the terminal. Therefore, the priority is to increase the processing frequency of the first processor to the first processing frequency. Only when the maximum processing frequency of the first processor cannot reach the required first processing frequency will the solution of transferring the processor where the target thread resides from the first processor to the second processor be adopted, thereby reducing terminal power consumption and avoiding the secondary loading of associated data.
[0093] Figure 6 This is an exemplary embodiment of the present disclosure, which illustrates the process of selecting a second processor, and includes the following steps:
[0094] In step S30, for each of the multiple candidate processors, the computing power ratio between the first processor and the candidate processor is determined.
[0095] The alternative processor is a processor with higher computing power than the first processor. The computing power ratio is the ratio between the computing power of the first processor and the computing power of the alternative processor. The larger the ratio, the weaker the computing power of the first processor is compared to the alternative processor. This computing power is determined by factors such as the system architecture of each processor core, and this disclosure does not impose any limitations on it.
[0096] For example, if the computing power ratio is 1:0.8, it means that the first processor requires 1 computing power to process the target frame data, while the alternative processor requires 0.8 computing power to process the target frame data. The alternative processor can process the target frame data with less computing power than the first processor.
[0097] In step S40, a second processing frequency required by the alternative processor to process the target frame data is obtained based on the ratio of the first processing frequency to the computing power.
[0098] The product of the first processing frequency and the ratio of computing power can be used as the second processing frequency required by the alternative processor to process the target frame data.
[0099] In step S50, if the second processing frequency is less than or equal to the maximum processing frequency that the alternative processor can provide, the alternative processor is selected as the second processor.
[0100] If the second processing frequency is less than or equal to the maximum processing frequency that the alternative processor can provide, it means that the target thread can process the target frame data with the help of the alternative processor. In this case, the alternative processor can be used as the second processor, the processor where the target thread is located can be transferred from the first processor to the second processor, and the processing frequency of the second processor used by the target thread will also be switched to the second processing frequency, which is the processing frequency required by the second processor to process the target frame data.
[0101] The second processing frequency is lower than the first processing frequency. Since the computing power of the second processor is more powerful than that of the first processor, the second processor can process the target frame data faster even if it uses a lower second processing frequency than the first processor uses a higher first processing frequency.
[0102] In some scenarios, taking a first processor with a maximum processing frequency of 2 GHz and a candidate processor with a maximum processing frequency of 2.4 GHz as an example, when the target thread uses the first processor to process the previous frame of data at a processing frequency of 1.8 GHz, since 1.8 GHz is less than the first processor's maximum processing frequency of 2 GHz, the target thread can utilize the first processor's processor resources to process the previous frame of data. However, when the target thread uses the first processor to process the next frame of data at a first processing frequency of 2.3 GHz, since 2.3 GHz is greater than the first processor's maximum processing frequency, the target thread cannot utilize the first processor's resources to process the previous frame of data. Since the first processor has a frequency of 2 GHz, it is no longer able to meet the requirements for processing the next frame of data. At this time, the first processing frequency of 2.3 GHz can be multiplied by the computing power ratio of 0.8 to obtain the second processing frequency of 1.84 GHz required by the alternative processor to process the next frame of data. Since the second processing frequency of 1.84 GHz is less than the maximum processing frequency of 2.4 GHz that the alternative processor can provide, the second processor can meet the requirements for processing the next frame of data. Therefore, the processor where the target thread is located can be transferred from the first processor to the second processor, and the processing frequency of the target thread on the second processor can be switched to 1.84 GHz.
[0103] It is understood that the first processor, alternative processor and second processor proposed in any embodiment of this disclosure are processor cores in a central processing unit.
[0104] Using the above technical solution, it is possible to determine whether to use a candidate processor as the second processor to be migrated to the target thread by analyzing whether the processing frequency of each candidate processor when processing the target frame data is greater than its own maximum processing frequency.
[0105] Figure 7 and Figure 8 These are different exemplary solutions involved in step S20 above. These exemplary solutions are used to interpret different scenarios where the number of storage spaces is within a preset range. The number of storage spaces being within the preset range includes at least one of the following scenarios: the number of storage spaces is less than a first preset number and the number of storage spaces is greater than a second preset number. These include the following two scenarios:
[0106] In the first scenario, when the amount of storage space is less than a first preset amount, the processing speed of the first thread is increased to a first processing speed.
[0107] The first thread is used to respond to the user input event and transfer the associated data related to the user input event to the storage space in the queue. The first thread may be a rendering thread.
[0108] Optionally, if the amount of storage space occupied in the queue is less than a first preset amount, the processing frequency of the first thread is increased to a first processing frequency.
[0109] For example, if the amount of storage space occupied in the queue is less than a first preset amount, and it is determined that the maximum processing frequency that the first processor where the first thread is located can provide is greater than or equal to the first processing frequency, the processing frequency of the first processor where the first thread is located is controlled to be increased to the first processing frequency.
[0110] Optionally, if the amount of storage space occupied in the queue is less than a first preset amount, the processor controlling the first thread is transferred from the first processor to the second processor.
[0111] For example, if the amount of storage space occupied in the queue is less than a first preset amount, and it is determined that the maximum processing frequency that the first processor where the first thread is located can provide is less than the first processing frequency, the processor where the first thread is located is controlled to be transferred from the first processor to the second processor.
[0112] For example, taking a first preset quantity of 1 as an example, see [link / reference]. Figure 7As shown, if the number of occupied storage spaces in the queue is less than 1, meaning that the queue is entirely free storage space, it indicates that the processing speed of the first thread is slow, resulting in the inability to quickly input the associated data related to the user input event into the queue's storage space. In this case, the processing speed of the first thread can be increased by increasing the processing frequency of the first processor where the first thread resides to the first processing frequency, or by transferring the processor where the first thread resides from the first processor to the second processor. This will enable the associated data related to the user input event to be delivered to the queue's storage space in a timely manner, ensuring that there is storage space occupied by associated data in the queue.
[0113] In the second scenario, when the amount of storage space is greater than the second preset amount, the processing speed of the second thread is increased to the second processing speed.
[0114] The second thread is used to retrieve the associated data from the storage space and display the associated data. The second thread can be a display thread.
[0115] The second preset quantity is greater than or equal to the first preset quantity. For example, if the first preset quantity is 1, the second preset quantity can also be 1; or if the first preset quantity is 1, the second preset quantity can be 2.
[0116] Optionally, if the amount of storage space occupied in the queue is greater than the second preset amount, the processing frequency of the second thread is increased to the first processing frequency.
[0117] For example, if the amount of storage space occupied in the queue is greater than the second preset amount, and it is determined that the maximum processing frequency that the first processor where the second thread is located can provide is greater than or equal to the first processing frequency, the processing frequency of the first processor where the second thread is located is controlled to be increased to the first processing frequency.
[0118] Optionally, if the amount of storage space occupied in the queue is greater than the second preset amount, the processor controlling the second thread is transferred from the first processor to the second processor.
[0119] For example, if the amount of storage space occupied in the queue is greater than the second preset amount, and it is determined that the maximum processing frequency that the first processor where the second thread is located can provide is less than the first processing frequency, the processor where the second thread is located is controlled to be transferred from the first processor to the second processor.
[0120] For example, taking a first preset quantity of 1 as an example, see [link / reference]. Figure 8If the number of occupied storage spaces in the queue is greater than 1 and the number of occupied storage spaces is 3, it indicates that the processing speed of the second thread is slow, which makes it impossible to quickly retrieve and display the associated data in the occupied storage space. At this time, the processing speed of the second thread can be improved by increasing the processing frequency of the first processor where the second thread is located to the first processing frequency, or by transferring the processor where the second thread is located from the first processor to the second processor. This will enable the associated data to be quickly retrieved and processed from the storage space, so that the associated data related to the user input event can be displayed on the terminal screen in a timely manner.
[0121] Understandably, after all the associated data related to the user input event has been displayed on the terminal screen, the acceleration of the first thread and / or the second thread can be canceled, for example, by controlling the first thread and / or the second thread to resume running on the first processor from running on the second processor, or by controlling the first thread and / or the second thread to resume running on the first processor from the second processing frequency.
[0122] Through the above technical solution, firstly, when the amount of storage space occupied in the queue is small, the processing speed of the first thread can be increased to output the associated data related to the user input event to the storage space more quickly; secondly, when the amount of storage space occupied in the queue is large, the processing speed of the second thread can be increased to retrieve the associated data from the storage space and display it on the terminal screen more quickly. By increasing the processing speed of the first thread and / or the second thread, the processing speeds of the first thread and the second thread are matched, and both are at a relatively fast processing speed level, enabling the associated data to be displayed faster.
[0123] The following is an exemplary embodiment involved in step S20, which is used to interpret different schemes for obtaining the target thread, including the following two exemplary schemes:
[0124] In the first approach, if the amount of storage space is within a preset range and the target thread wakes up the third thread, the processing speed of the third thread is controlled to be increased to the preset processing speed.
[0125] The target thread is the main thread, responsible for handling user input events. The third thread is a child thread, a secondary thread used for handling user input events. When the target thread is processing other tasks and cannot handle user input events, it will wake up the secondary third thread to process the user input events. Therefore, when it is detected that the target thread has woken up the third thread, it can be determined that the third thread is the critical thread for handling user input events, and thus its processing speed can be controlled to be increased to a preset speed.
[0126] For example, assuming the target thread is the rendering thread, the rendering thread will perform tasks such as listening to dynamic resources and handling user input events. When the rendering thread is listening to dynamic resources, it can wake up a third thread associated with the rendering thread, which will then handle the user input events.
[0127] Optionally, the processing frequency of the third thread can be increased to the first processing frequency, or the processor where the third thread resides can be switched from the first processor to the second processor.
[0128] Optionally, if the number of storage spaces is within a preset range, the target thread wakes up the third thread, and the target thread is in a dormant state, the processing speed of the third thread is controlled to be increased to a preset processing speed.
[0129] The second approach involves controlling the processing speed of the fourth thread to be increased to the preset processing speed when the amount of storage space is within a preset range and the system resources acquired by the target thread are occupied by the fourth thread.
[0130] The fourth thread is a child thread, a secondary thread used to handle user input events. When the target thread is processing other tasks and cannot handle user input events, it wakes up the secondary fourth thread and transfers the system resources required by the target thread to handle user input events to the fourth thread. This allows the fourth thread to occupy the system resources. Therefore, when it is detected that the system resources acquired by the target thread are occupied by the fourth thread, it can be determined that the fourth thread is the critical thread for handling user input events, and its processing speed can be increased to the preset processing speed.
[0131] System resources include lock resources and input / output (I / O) resources. The fourth thread and the third thread can be the same thread or different threads; this disclosure does not impose any restrictions on this.
[0132] Optionally, the processing frequency of the fourth thread can be increased to the first processing frequency, or the processor where the fourth thread is located can be switched from the first processor to the second processor.
[0133] It is understandable that if the target thread neither wakes up the third thread nor has the system resources acquired by the target thread been occupied by the fourth thread, the user input event will still be handled by the target thread. Therefore, the processing speed of the target thread will be increased to the preset processing speed.
[0134] Increasing the processing speed of the target thread to a preset processing speed includes at least one of the following methods: increasing the processing frequency of the target thread to a first preset frequency, or transferring the processor where the target thread is located from a first processor to a second processor.
[0135] The above technical solution identifies key threads, such as the third and fourth threads, that process user input events, thereby improving their processing speed. This targeted approach enhances the processing speed of these key threads. Firstly, a higher processor frequency and faster processing speed mean greater processor resource consumption. Therefore, focusing on improving the processing speed of key threads avoids increasing the processing speed of non-key threads, thus reducing processor resource consumption. Secondly, improving the processing speed of key threads ensures that related data can be promptly delivered to storage and retrieved from storage for immediate display on the screen, enabling rapid display of associated data.
[0136] Figure 9 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment. (Refer to...) Figure 9 The data processing device 900 includes an acquisition module 900 and a control module 910.
[0137] The acquisition module 900 is configured to acquire the amount of storage space occupied in the queue when a user input event is detected.
[0138] The control module 910 is configured to increase the processing speed of the target thread to a preset processing speed when the number of storage spaces is within a preset range; the target thread is the processing thread triggered by the user input event.
[0139] Optionally, the target thread includes a first thread; the control module 910 is further configured to control the processing speed of the first thread to increase to a first processing speed when the number of storage spaces is less than a first preset number; the first thread is used to respond to the user input event by transmitting the associated data related to the user input event to the storage space in the queue.
[0140] Optionally, the target thread includes a second thread; the control module 910 is further configured to control the processing speed of the second thread to increase to a second processing speed when the number of storage spaces is greater than a second preset number; the second thread is used to obtain the associated data from the storage space.
[0141] Optionally, the control module 910 is further configured to, when the number of storage spaces is within the preset range, control the processing frequency of the first processor where the target thread is located to be increased to a first processing frequency.
[0142] Optionally, the control module 910 is further configured to control the processing frequency of the first processor where the target thread is located to be increased to the first processing frequency when the number of storage spaces is within the preset number range and the maximum processing frequency that the first processor where the target thread is located can provide is greater than or equal to the first processing frequency.
[0143] Optionally, the control module 910 is further configured to, when the number of storage spaces is within the preset range, control the processor where the target thread is located to be transferred from the first processor to the second processor; the processing speed of the second processor is greater than that of the first processor.
[0144] Optionally, the control module 910 is further configured to control the processor where the target thread is located to switch from the first processor to the second processor when the number of storage spaces is within the preset number range and the maximum processing frequency that the first processor where the target thread is located can provide is less than the first processing frequency; the first processing frequency is the processing frequency required by the first processor to process the target frame data.
[0145] Optionally, the data processing apparatus 900 further includes:
[0146] The computing power ratio module is configured to determine the computing power ratio between the first processor and the alternative processor;
[0147] The second processing frequency module is configured to obtain the second processing frequency required by the alternative processor to process the target frame data based on the ratio of the first processing frequency to the computing power.
[0148] The second processor module is configured to use the alternative processor as the second processor when the second processing frequency is less than or equal to the maximum processing frequency that the alternative processor can provide.
[0149] Optionally, the control module 910 is further configured to control the processing speed of the third thread to be increased to the preset processing speed when the number of storage spaces is within a preset range and the target thread wakes up the third thread.
[0150] Optionally, the control module 910 is further configured to control the processing speed of the fourth thread to increase to the preset processing speed when the number of storage spaces is within a preset range and the system resources acquired by the target thread are occupied by the fourth thread.
[0151] Optionally, the user input event includes at least one of the following:
[0152] Screen touch events, keyboard input events, mouse input events, stylus input events, and voice command events.
[0153] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0154] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of the data processing method provided in this disclosure.
[0155] Figure 10 This is a block diagram illustrating a data processing apparatus 1000 according to an exemplary embodiment. For example, apparatus 1000 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0156] Reference Figure 10 The device 1000 may include one or more of the following components: a processing component 1002, a memory 1004, a power supply component 1006, a multimedia component 1008, an audio component 1010, an input / output interface 1012, a sensor component 1014, and a communication component 1016.
[0157] Processing component 1002 typically controls the overall operation of device 1000, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 1002 may include one or more processors 1020 to execute instructions to complete all or part of the steps of the data processing method described above. Furthermore, processing component 1002 may include one or more modules to facilitate interaction between processing component 1002 and other components. For example, processing component 1002 may include a multimedia module to facilitate interaction between multimedia component 1008 and processing component 1002.
[0158] Memory 1004 is configured to store various types of data to support the operation of device 1000. Examples of such data include instructions for any application or method operating on device 1000, contact data, phonebook data, messages, pictures, videos, etc. Memory 1004 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0159] Power supply component 1006 provides power to various components of device 1000. Power supply component 1006 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 1000.
[0160] The multimedia component 1008 includes a screen that provides an output interface between the device 1000 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 1008 includes a front-facing camera and / or a rear-facing camera. When the device 1000 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0161] Audio component 1010 is configured to output and / or input audio signals. For example, audio component 1010 includes a microphone (MIC) configured to receive external audio signals when device 1000 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1004 or transmitted via communication component 1016. In some embodiments, audio component 1010 also includes a speaker for outputting audio signals.
[0162] Input / output interface 1012 provides an interface between processing component 1002 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, start buttons, and lock buttons.
[0163] Sensor assembly 1014 includes one or more sensors for providing state assessments of various aspects of device 1000. For example, sensor assembly 1014 may detect the on / off state of device 1000, the relative positioning of components such as the display and keypad of device 1000, changes in the position of device 1000 or a component of device 1000, the presence or absence of user contact with device 1000, the orientation or acceleration / deceleration of device 1000, and temperature changes of device 1000. Sensor assembly 1014 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1014 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1014 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0164] Communication component 1016 is configured to facilitate wired or wireless communication between device 1000 and other devices. Device 1000 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 1016 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1016 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0165] In an exemplary embodiment, the apparatus 1000 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the data processing method described above.
[0166] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1004 including instructions, which can be executed by the processor 1020 of the device 1000 to complete the above-described data processing method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0167] In another exemplary embodiment, a computer program product is also provided, which includes a computer program executable by a programmable device, the computer program having a code portion for performing the data processing method described above when executed by the programmable device.
[0168] Some embodiments of this disclosure also provide a chip system, such as Figure 11 As shown, the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 are interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 1102 can be used to send signals to other devices (e.g., the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in memory and send those instructions to the processor 1101. When the instructions are executed by the processor 1101, they can cause a data processing device to perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and some embodiments of this disclosure do not specifically limit this.
[0169] In some embodiments of this disclosure, the interface circuit 1102 can acquire data, program instructions, and / or information from the internal storage area of the chip system; it can also acquire data, program instructions, and / or information from outside the chip system.
[0170] Those skilled in the art will also understand that the various illustrative logical blocks and steps listed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. Whether such functionality is implemented through hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can implement the described functionality using various methods for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of this application.
Claims
1. A data processing method, characterized in that, include: Upon detecting a user input event, retrieve the amount of storage space in the queue; When the amount of storage space is within a preset range, the processing speed of the target thread is increased to a preset processing speed. The target thread is the processing thread triggered by the user input event.
2. The method according to claim 1, characterized in that, The target thread includes a first thread; the step of controlling the processing speed of the target thread to increase to a preset processing speed when the amount of storage space is within a preset range includes: If the number of storage spaces is less than a first preset number, the processing speed of the first thread is increased to a first processing speed; the first thread is used to respond to the user input event and transmit the associated data related to the user input event to the storage space in the queue.
3. The method according to claim 1, characterized in that, The target thread includes a second thread; the step of controlling the processing speed of the target thread to increase to a preset processing speed when the amount of storage space is within a preset range includes: If the number of storage spaces is greater than a second preset number, the processing speed of the second thread is increased to a second processing speed; the second thread is used to retrieve the associated data from the storage space.
4. The method according to claim 1, characterized in that, When the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes: When the amount of storage space is within the preset range, the processing frequency of the first processor where the target thread is located is increased to the first processing frequency.
5. The method according to claim 4, characterized in that, When the amount of storage space is within the preset range, controlling the processing frequency of the first processor where the target thread resides to be increased to a first processing frequency includes: If the amount of storage space is within the preset range, and it is determined that the maximum processing frequency that the first processor where the target thread is located can provide is greater than or equal to the first processing frequency, the processing frequency of the first processor where the target thread is located is controlled to be increased to the first processing frequency.
6. The method according to claim 1, characterized in that, When the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes: When the amount of storage space is within the preset range, the processor where the target thread is located is controlled to be transferred from the first processor to the second processor; the processing speed of the second processor is greater than that of the first processor.
7. The method according to claim 6, characterized in that, When the amount of storage space is within the preset range, controlling the processor where the target thread resides to switch from the first processor to the second processor includes: If the amount of storage space is within the preset range, and the maximum processing frequency that the first processor where the target thread is located can provide is less than the first processing frequency, the processor where the target thread is located is controlled to be transferred from the first processor to the second processor; the first processing frequency is the processing frequency required by the first processor to process the target frame data.
8. The method according to claim 7, characterized in that, The method further includes: Determine the computing power ratio between the first processor and the candidate processor; Based on the ratio of the first processing frequency to the computing power, a second processing frequency required by the alternative processor to process the target frame data is obtained; If the second processing frequency is less than or equal to the maximum processing frequency that the alternative processor can provide, the alternative processor shall be used as the second processor.
9. The method according to claim 1, characterized in that, When the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes: If the amount of storage space is within a preset range and the target thread wakes up the third thread, control the processing speed of the third thread to be increased to the preset processing speed.
10. The method according to claim 1, characterized in that, When the amount of storage space is within a preset range, controlling the processing speed of the target thread to increase to a preset processing speed includes: If the amount of storage space is within a preset range, and the system resources acquired by the target thread are occupied by the fourth thread, control the processing speed of the fourth thread to be increased to the preset processing speed.
11. The method according to any one of claims 1 to 10, characterized in that, The user input event includes at least one of the following: Screen touch events, keyboard input events, mouse input events, stylus input events, and voice command events.
12. A data processing apparatus, characterized in that, include: The acquisition module is configured to acquire the amount of storage space occupied in the queue when a user input event is detected. The control module is configured to increase the processing speed of the target thread to a preset processing speed when the number of storage spaces is within a preset range. The target thread is the processing thread triggered by the user input event.
13. A data processing apparatus, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured as follows: Perform the steps of the method described in any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1 to 11.
15. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
16. A chip system, characterized in that, The chip system includes a processing unit and an interface circuit. The processing unit obtains program instructions through the interface circuit, and the program instructions are executed by the processing unit. The processing unit is used to perform the steps of the method as described in any one of claims 1 to 11.