Thread priority adjustment method and related equipment

By identifying and adjusting the associated thread priority of child process threads, the problem of inability to effectively adjust the priority of child process threads in the existing technology is solved, which improves the system response speed and performance and improves the user experience.

CN119917280AActive Publication Date: 2025-05-02HUAWEI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510062801.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2025-05-02
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

The prior art cannot effectively adjust the thread priority of the child process, resulting in limited system response speed and performance, affecting user experience.

Method used

By identifying the thread-associated threads of the main process from the threads of the child process, and adjusting the priority of these associated threads when the application run state changes, the trend is consistent with the priority adjustment of the main thread.

Benefits of technology

It realizes the rational adjustment of child process thread priority according to user needs, improves system response speed and performance, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917280A_ABST
    Figure CN119917280A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a thread priority adjustment method and related equipment which are applied to electronic equipment, and the electronic equipment runs a first application. A first process of the first application comprises a plurality of first threads; identifying an associated thread of the first thread from the threads of the second process; the second process is a process which is operated by the electronic equipment, except the first process and the resident process and provides service for the first application; when it is detected that the running state of the first application is changed, the priority of the first thread is adjusted, the priority of the associated thread is adjusted, and the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread. By adopting the embodiment of the invention, the response speed and performance of the system can be improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202410700693.9, and the original application date is May 30, 2024. The entire contents of the original application are incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of intelligent terminal technology, and in particular to a thread priority adjustment method and related equipment. Background Art

[0003] There are a large number of applications (APPs) in the current terminal scenarios. When the terminal device runs the main process of the APP, it will create one or more sub-processes for it to work with the main process to provide services for the APP. Since a process can include multiple threads, each thread has a different user interaction relationship, that is, the user expects different response delays. For example, the UI thread of the user interaction task needs to be completed in time, the thread of the page loading task needs to be as fast as possible, and the threads of download and backup related tasks can be postponed to a later time. Therefore, different threads have different priorities. It is necessary to reasonably allocate the priority of threads according to user needs. Setting the threads of important tasks to a higher priority can ensure that these tasks are processed in time, thereby improving the response speed and performance of the system. Summary of the invention

[0004] The embodiments of the present application provide a thread priority adjustment method and related devices, which can improve the response speed and performance of the system, thereby improving the user experience.

[0005] In a first aspect, an embodiment of the present application provides a thread priority adjustment method, which is applied to an electronic device, and the method includes: running a first application; the first process of the first application includes multiple first threads; identifying an associated thread of the first thread from the threads of the second process; the second process is a process that is run by the electronic device other than the first process and the resident process and provides services for the first application; detecting that the running state of the first application has changed, adjusting the priority of the first thread, and adjusting the priority of the associated thread, and the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread.

[0006] In an embodiment of the present application, when the electronic device runs the main process (i.e., the first process) of the first application, it will also run one or more sub-processes (i.e., the second process) to work with the main process to provide services for the first application. Since a process may include multiple threads, each thread corresponds to a different user interaction relationship, that is, the user expects a different response delay, so the priorities of different threads are different, and it is necessary to reasonably adjust the priorities of the threads according to user needs. Setting the threads of important tasks to a higher priority can ensure that these tasks are processed in a timely manner. The application can adjust the priority of each first thread of the main process according to the application scenario requirements. However, for multiple sub-processes, multiple sub-processes are processes pulled up by the system, and the application cannot perceive the threads of the sub-processes, so it is impossible to adjust the priorities of the threads of the sub-processes, resulting in the inability to reasonably adjust the priorities of the threads of the sub-processes according to user needs. In the present application, by identifying the associated threads of the first thread from the threads of one or more sub-processes, and then when it is detected that the running state of the first application changes, that is, it can be understood that when the user needs change, the associated threads follow the first thread to adjust the priority. For multiple threads of the same child process, the first thread associated with each thread may be different. Therefore, when a change in the running status of the first application is detected, the priority adjustment trend of the multiple threads of the same child process is determined by the associated first thread and can be different, thereby avoiding the application being unable to perceive the thread of the child process, resulting in the inability to reasonably adjust the thread priority of the child process according to user needs, thereby improving the system's response speed and performance, and improving user experience.

[0007] In some embodiments, when the second process is created by the first process and the first thread is the main thread of the first process, identifying the associated thread of the first thread includes: identifying the main thread of the second process as the associated thread of the first thread.

[0008] In an embodiment of the present application, when a second process (i.e., a child process) is created for a first process (i.e., a main process), the main thread of the child process will inherit the main thread of the main process. The main thread of the child process will usually perform tasks similar to those of the main thread of the main process. Therefore, the main thread of the main process and the main thread of the child process can be identified as associated threads, and then the associated threads can follow the first thread for priority adjustment. Thread scheduling is performed according to the priority, which can ensure that important tasks can be processed in a timely manner, thereby improving the response speed and performance of the system and improving the user experience.

[0009] In some embodiments, identifying the associated thread of the first thread includes: identifying, from threads of the second process, a thread having the same task as that corresponding to the first thread as the associated thread of the first thread.

[0010] In an embodiment of the present application, a thread with the same task as that corresponding to the first thread is identified as an associated thread of the first thread from the threads of one or more child processes (i.e., the second thread), and the associated thread can then follow the first thread to adjust its priority, and the thread scheduling is performed according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that the task is responded to more quickly, thereby improving the response speed and performance of the system and improving the user experience.

[0011] In some embodiments, the first thread communicates with the first module, and the method further includes: determining the thread in the second process that communicates with the first module as a thread with the same task as that corresponding to the first thread.

[0012] In an embodiment of the present application, when multiple threads communicate with the same module (i.e., the first module), these threads are executing the same code logic, and they may perform the same task, so these threads can be associated, and then the associated threads can follow the first thread to adjust their priorities, and the threads are scheduled according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that the tasks are responded to faster, thereby improving the response speed and performance of the system and improving the user experience.

[0013] In some embodiments, the first module is a rendering module running on the electronic device; or, the first module is a window management module running on the electronic device; or, the first module is a component management module running on the electronic device.

[0014] In an embodiment of the present application, when the first thread accesses the rendering module, other threads interacting with the rendering module can be identified as associated threads of the first thread, and they are all performing the same or similar rendering tasks. When the first thread accesses the window management module, other threads interacting with the window management module can be identified as associated threads of the first thread, and they are all performing the same or similar window drawing tasks. When the first thread accesses the component management module, other threads interacting with the component management module can be identified as associated threads of the first thread, and they are all performing the same or similar drawing tasks. Furthermore, the associated threads can follow the first thread to adjust their priorities, and schedule threads according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that tasks are responded to faster, thereby improving the response speed and performance of the system and improving the user experience.

[0015] In some embodiments, when the first module is a window management module, the thread in the threads of the second process that communicates with the first module is determined to be a thread with the same task as the corresponding task of the first thread, including: from the threads of the second process, the thread that communicates with the window management module and executes the drawing task of the same window as the first thread is determined to be a thread with the same task as the corresponding task of the first thread.

[0016] In the embodiment of the present application, multiple threads communicating with the window management module may be drawing the same window or different windows. In order to more accurately identify the associated threads of the first thread, the thread that executes the drawing task of the same window as the first thread is determined as the thread with the same task as the first thread, that is, the threads drawing the same window are associated. Furthermore, the associated threads can follow the first thread to adjust the priority, and the threads are scheduled according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that the task is responded to faster, thereby improving the response speed and performance of the system and improving the user experience.

[0017] In some embodiments, before identifying the associated thread of the first thread, the method further includes: setting the priority of the first thread based on the first mapping table and the user interaction relationship value of the first thread; the first mapping table includes a mapping relationship between the user interaction relationship value and the priority.

[0018] In the embodiment of the present application, the first process may include multiple first threads, and the multiple first threads may perform different tasks. In different application scenarios, the application may set the user interaction relationship value of the first thread according to the requirements, and then the electronic device may set the priority of the first thread according to the first mapping table and the user interaction relationship value of the first thread, thereby realizing the reasonable configuration of the priority of the first thread according to the user requirements, and setting the threads of important tasks to a higher priority can ensure that these tasks are processed in time, thereby improving the user experience.

[0019] In some embodiments, after identifying an associated thread of the first thread, the method further includes: setting a priority of the associated thread based on the priority of the first thread.

[0020] In the embodiment of the present application, the priority of the associated thread can be adjusted based on the priority of the thread of the main process, wherein the priority of the thread of the main process is set based on user needs. Since the priority of the associated thread is determined by the priority of the thread of the main process, the priority of the associated thread can also meet user needs, avoiding the application being unable to perceive the thread of the sub-process, resulting in the inability to reasonably configure the thread priority of the sub-process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0021] In some embodiments, the method further includes: detecting that the running state of the first application changes, and modifying the user interaction relationship value of the first thread.

[0022] In an embodiment of the present application, when it is detected that the running state of the first application has changed, that is, when the user demand has changed, the first application can adjust the priority of the first thread by modifying the user interaction relationship value of the first thread, thereby adjusting the priority of the thread of the first process according to the user demand and improving the user experience.

[0023] In some embodiments, detecting that the running state of the first application has changed, adjusting the priority of the first thread, and adjusting the priority of the associated thread include: detecting that the running state of the first application has changed, and adjusting the priority of the first thread and the priority of the associated thread based on the modified user interaction relationship value of the first thread and the first mapping table.

[0024] In the embodiment of the present application, when it is detected that the running state of the first application has changed, that is, the user demand has changed, the first application can adjust the priority of the first thread based on the modified user interaction relationship value of the first thread. Further, the associated thread can follow the first thread to adjust the priority, so as to avoid the application being unable to perceive the thread of the child process, resulting in the inability to reasonably adjust the thread priority of the child process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0025] In some embodiments, a larger user interaction relationship value in the first mapping table indicates a higher priority of the corresponding thread; when the running state of the first application changes to the first application switching from the foreground state to the background state or the frozen state, the user interaction relationship value of the first thread decreases, and the priority of the first thread and the priority of the associated threads decrease; when the running state of the first application changes to the first application switching from the background state or the frozen state to the foreground state, the user interaction relationship value of the first thread increases, and the priority of the first thread and the priority of the associated threads increase.

[0026] In an embodiment of the present application, when the first application switches from the foreground state to the background state or the frozen state, the priority of the first thread and the priority of the associated thread can be lowered to ensure that the foreground application of the current electronic device can respond faster; when the first application switches from the background state or the frozen state to the foreground state, the priority of the first thread and the priority of the associated thread can be increased to ensure that the first application can respond faster, thereby improving the user experience.

[0027] In some embodiments, the electronic device includes a processor, and the method further includes: determining the aggregate load of the first thread and the associated threads, the aggregate load being the product of the current frequency of the processor and the first duty cycle; the first duty cycle being the proportion of the total duration of the first thread and the associated threads in the frequency modulation period of the processor; and adjusting the main frequency of the processor based on the aggregate load.

[0028] In an embodiment of the present application, after a thread is scheduled to run on a processor, the aggregate load can be calculated based on the total running duration of the thread and associated threads, and the main frequency of the processor can be adjusted based on the calculated aggregate load, thereby ensuring the running speed of the thread while saving energy and improving the user experience.

[0029] In some embodiments, adjusting the main frequency of the processor based on the aggregate load includes: determining whether the aggregate load is greater than a first threshold; when the aggregate load is greater than the first threshold and when the aggregate load is greater than the second threshold, increasing the main frequency of the processor; when the aggregate load is greater than the first threshold and the aggregate load is less than or equal to the second threshold, lowering or not adjusting the main frequency of the processor.

[0030] In an embodiment of the present application, the first threshold value may be a user-preset value or an empirical value, and the first threshold value may represent the frequency corresponding to the energy consumption that the system can accept. When the aggregate load is greater than the first threshold value, it means that the first thread and its associated threads correspond to high-load tasks, which are generally more important tasks. In this case, the system will be more inclined to ensure the performance of the first thread and its associated threads, and the main frequency of the processor may be adjusted based on the aggregate load. Furthermore, when the aggregate load is greater than the second threshold value, it means that the current processor is running the first thread and its associated threads most of the time, and the main frequency of the processor may be increased so that the processor can run the first thread and its associated threads faster; when the aggregate load is less than or equal to the second threshold value, it means that the current processor still has a lot of free time after running the first thread and its associated threads, and the main frequency of the processor may be lowered or not adjusted to save processor energy consumption.

[0031] In some embodiments, the method also includes: if the aggregate load is less than or equal to a first threshold, determining a first load of the first thread, the first load being the product of the current frequency of the processor and a second duty cycle; the second duty cycle being the proportion of the duration of the first thread in the frequency modulation cycle of the processor; and adjusting the main frequency of the processor based on the first load.

[0032] In an embodiment of the present application, when the aggregate load is less than or equal to the first threshold, it indicates that the first thread and its associated threads correspond to small-load tasks, which are generally ordinary tasks. The system will be more inclined to save processor energy consumption, and can calculate the first load based on the duration of the first thread's operation, and adjust the processor's main frequency based on the calculated first load, thereby saving processor energy consumption and improving user experience.

[0033] In a second aspect, a frequency modulation method is provided, which is applied to an electronic device, wherein the electronic device includes a processor, and the method includes: running a first application; the first process of the first application includes multiple first threads; identifying an associated thread of the first thread from the threads of the second process; the second process is a process that is run by the electronic device other than the first process and the resident process and provides services for the first application; determining an aggregate load of the first thread and the associated threads, wherein the aggregate load is the product of a current frequency of the processor and a first duty cycle; the first duty cycle is a proportion of the total duration of the first thread and the associated threads in the frequency modulation period of the processor; and adjusting the main frequency of the processor based on the aggregate load.

[0034] In an embodiment of the present application, after a thread is scheduled to run on a processor, the aggregate load can be calculated based on the total running duration of the thread and associated threads, and the main frequency of the processor can be adjusted based on the calculated aggregate load, that is, the frequency can be adjusted by comprehensively considering the running conditions of the first thread and the associated threads, thereby ensuring the running speed of the thread while saving energy and improving the user experience.

[0035] In some embodiments, adjusting the main frequency of the processor based on the aggregate load includes: determining whether the aggregate load is greater than a first threshold; if the aggregate load is greater than the first threshold, adjusting the main frequency of the processor based on the aggregate load.

[0036] In some embodiments, adjusting the processor's main frequency based on the aggregate load includes: when the aggregate load is greater than a second threshold, increasing the processor's main frequency; when the aggregate load is less than or equal to the second threshold, decreasing or not adjusting the processor's main frequency.

[0037] In some embodiments, the method also includes: if the aggregate load is less than or equal to a first threshold, determining a first load of the first thread, the first load being the product of the current frequency of the processor and a second duty cycle; the second duty cycle being the proportion of the duration of the first thread in the frequency modulation cycle of the processor; and adjusting the main frequency of the processor based on the first load.

[0038] According to a third aspect, a thread priority adjustment method is provided, which is applied to an electronic device, and the method includes: running a first application; the interface of the first application includes a first window corresponding to a first process and a second window corresponding to a second process, and the second window is nested in the first window; the first process is a process of the first application; the second process is a process of the first application or the second application; the UI thread of the second process is an associated thread of the UI thread of the first process; when a change in the running state of the first application is detected, the priority of the UI thread of the first process is adjusted, and the priority of the associated thread is adjusted, and the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the UI thread of the first process.

[0039] In an embodiment of the present application, the interface of the first application may include multiple windows, such as a first window and a second window, wherein the second window is nested in the first window. The first window needs to be rendered simultaneously with the second window, so the UI thread corresponding to the first window and the UI thread corresponding to the second window may be associated, that is, the UI thread of the second process is used as the associated thread of the UI thread of the first process, and then when the running state of the first application is detected to have changed, that is, it can be understood that when the user demand has changed, the UI thread of the second process follows the UI thread of the first process for priority adjustment, so as to avoid the application being unable to perceive the thread of the second process, resulting in the inability to reasonably adjust the thread priority of the second process according to user demand, thereby improving the response speed and performance of the system and improving the user experience.

[0040] In some embodiments, the component tree of the second process is mounted in the component tree of the first process. For example, the component tree of the first process has a node identifier, and the node identifier is used to mount the component tree of the second process. Thus, the electronic device can nest the interface of the second process in the interface of the first process.

[0041] In some implementations, the second process and the first process may belong to different applications.

[0042] In some implementations, the second process may be a process of the installation-free application.

[0043] In some implementations, the thread priority adjustment method provided in the third aspect may also implement some embodiments of the method provided in the first aspect, such as embodiments related to priority or user interaction relationship value, or embodiments related to aggregate load.

[0044] In a fourth aspect, a thread priority adjustment method is provided, which is applied to an electronic device, and the method includes: running a first application; the first process of the first application includes multiple first threads; identifying an associated thread of the first thread from the threads of the second process; wherein the first thread and the associated thread are used to jointly render the interface of the first application; detecting that the running state of the first application has changed, adjusting the priority of the first thread, and adjusting the priority of the associated thread, wherein the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread.

[0045] In an embodiment of the present application, since the threads that render the interface of the first application are performing similar tasks, the threads of different processes that render the interface of the first application can be associated, that is, the threads of the second process that render the interface of the first application together with the first thread are identified as associated threads. Then, when a change in the running state of the first application is detected, which can be understood as a change in user demand, the associated thread follows the first thread to adjust its priority, thereby avoiding the situation where the application cannot perceive the thread of the sub-process, resulting in the inability to reasonably adjust the thread priority of the sub-process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0046] In some embodiments, both the first thread and the associated thread are used to send rendering instructions to the rendering module.

[0047] In some implementations, the second process may be a rendering process based on a web kernel.

[0048] In some implementations, the second process and the first process may belong to the same application.

[0049] In some implementations, the application can use a framework such as flutter, vue, or react.

[0050] In some implementations, the thread priority adjustment method provided in the fourth aspect may also execute the methods of some embodiments provided in the first aspect, for example, embodiments related to priority or user interaction relationship value, or embodiments related to aggregate load.

[0051] In a fifth aspect, an electronic device is provided, comprising: a memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a method as in the first aspect or any one of the embodiments of the first aspect, execute a method as in the second aspect or any one of the embodiments of the second aspect, execute a method as in the third aspect or any one of the embodiments of the third aspect, and execute a method as in the fourth aspect or any one of the embodiments of the fourth aspect.

[0052] In a sixth aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, cause the electronic device to execute a method as in the first aspect or any one of the embodiments of the first aspect, or execute a method as in the second aspect or any one of the embodiments of the second aspect, execute a method as in the third aspect or any one of the embodiments of the third aspect, or execute a method as in the fourth aspect or any one of the embodiments of the fourth aspect.

[0053] In the seventh aspect, a computer program product is provided. When the computer program product runs on a computer, it enables the computer to execute a method as described in the first aspect or any one of the embodiments of the first aspect, or execute a method as described in the second aspect or any one of the embodiments of the second aspect, execute a method as described in the third aspect or any one of the embodiments of the third aspect, or execute a method as described in the fourth aspect or any one of the embodiments of the fourth aspect.

[0054] In the eighth aspect, a chip system is provided, which includes at least one processor for implementing the method of the first aspect or any one of the embodiments of the first aspect, or the method of the second aspect or any one of the embodiments of the second aspect, executing the method of the third aspect or any one of the embodiments of the third aspect, and executing the method of the fourth aspect or any one of the embodiments of the fourth aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1a A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0056] Figure 1b It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0057] Figure 2 It is a flowchart of a thread priority adjustment method provided in an embodiment of the present application.

[0058] Figure 3 A schematic diagram of a qos value of an interaction relationship between a first thread and a user provided in an embodiment of the present application.

[0059] Figure 4 A schematic diagram of a first mapping table provided in an embodiment of the present application.

[0060] Figure 5 A schematic diagram of a main process and sub-processes of a first application provided in an embodiment of the present application.

[0061] Figure 6 A schematic diagram of identifying associated threads provided in an embodiment of the present application.

[0062] Figure 7A schematic diagram of another method for identifying associated threads provided in an embodiment of the present application.

[0063] Figure 8 A schematic diagram of another method for identifying associated threads is provided in an embodiment of the present application.

[0064] Fig. 9 A schematic diagram of adjusting the thread priority of a subprocess provided in an embodiment of the present application.

[0065] Fig.10 A schematic diagram of adjusting the priority of a first thread and associated threads provided in an embodiment of the present application.

[0066] Fig.11 A schematic diagram of a first threshold value provided for the present application.

[0067] Fig.12 A schematic diagram of a thread priority scheduling method provided in an embodiment of the present application.

[0068] Fig.13 A flowchart of a frequency modulation method provided in an embodiment of the present application.

[0069] Fig.14 A flowchart of a thread priority adjustment method provided in an embodiment of the present application.

[0070] Fig.15 A schematic diagram of an interface of a first application provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] The embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0072] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0073] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0074] An embodiment of the present application provides a thread priority adjustment method, which can be applied to electronic devices. At present, some examples of electronic devices are: smart phones, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices (such as smart watches), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication functions, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (public land mobile The embodiments of the present application do not limit this.

[0075] Before introducing the method provided by the embodiment of the present application in detail, the electronic device provided by the embodiment of the present application is first introduced.

[0076] Figure 1a A schematic structural diagram of an electronic device 100 is shown.

[0077] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera module 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0078] Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0079] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic 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.

[0080] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a central processing unit (CPU), a graphics processing unit (GPU), a neural-network processing unit (NPU), a modem processor, an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0081] The processor 110 can load instructions or data stored in an external memory (such as a disk, etc.) into the internal memory 121, and call the instructions or data that need to be calculated to the processor 110 for calculation. After the calculation is completed, the processor 110 temporarily stores the result in the internal memory 121, and stores the instructions or data that need to be stored for a long time in the external memory through the controller. The processor 110 can run different types of software such as an operating system, a file system (such as a flash file system F2FS) or an application to control multiple hardware or software components connected to the processor 110, and can process various data and perform operations.

[0082] 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 circulated. 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 electronic device 100.

[0083] The display screen 194 is used to display user interfaces, images, videos, etc. The display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc.

[0084] The external memory interface 120 can be used to connect an external memory, that is, an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.

[0085] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can run the above instructions stored in the internal memory 121, so that the electronic device 100 executes the thread priority adjustment method provided in some embodiments of the present application, as well as various functional applications and data processing. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as Huawei videos, contacts, etc.). The data storage area can store data created during the use of the electronic device 100 (such as user configuration user interaction relationship information, 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.

[0086] Understandably, Figure 1a The electronic device structures described above are only some exemplary implementations provided by the embodiments of the present invention. The electronic devices in the embodiments of the present invention include but are not limited to the above implementations.

[0087] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes a mobile operating system with a layered architecture as an example to illustrate the software structure of the electronic device 100. The software system in the present application may also be a Hongmeng system, an Android system, an iOS system, and the like.

[0088] Figure 1b It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0089] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the mobile operating system is divided into four layers, from top to bottom, namely, the application layer, the framework layer, the system service layer, and the kernel layer.

[0090] The application layer can include a range of applications.

[0091] like Figure 1b As shown, the application package may include application 1 (APP1 may be a third-party application or a system application), gallery, calendar, call, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0092] Among them, when the electronic device 100 runs the main process of APP1, one or more sub-processes run by the electronic device 100 work together with the main process to provide services for APP1. Since a process can include multiple threads, each thread has a different user interaction relationship, that is, the user expects different response delays. For example, the UI thread of the user interaction task needs to be completed in time, the thread of the page loading task needs to be as fast as possible, and the threads of download and backup related tasks can be executed later. Therefore, different threads have different priorities. It is necessary to reasonably allocate the priority of threads according to user needs. Setting the threads of important tasks to higher priorities can ensure that these tasks are processed in time, thereby improving the response speed and performance of the system.

[0093] In some embodiments, the application (or user) may configure a corresponding user interaction relationship for each thread of the main process of APP1 according to application scenario requirements, and then determine the priority of the thread of the main process based on the user interaction relationship.

[0094] 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.

[0095] like Figure 1b As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0096] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0097] It should be noted that there is a parent-child relationship between window programs and applications (APP), that is, an application can contain one or more window programs. Window programs can be the basic unit of an application, used to display information and receive user input. Window programs are managed by the window manager, and applications are containers for window programs, which can contain multiple window programs to implement different functions and interactive interfaces.

[0098] In some embodiments, the window manager may be used to manage window drawing tasks, and the window drawing tasks may be tasks for drawing window 1, drawing window 2, drawing window 3, etc. The window manager may record thread calling information corresponding to each window, for example, thread calling information corresponding to drawing window 1 includes relevant information of all threads required to be called for drawing window 1, thread calling information corresponding to drawing window 2 includes relevant information of all threads required to be called for drawing window 2, and thread calling information corresponding to drawing window 3 includes relevant information of all threads required to be called for drawing window 3.

[0099] Content providers are used to store and retrieve data and make it accessible to applications. The data may include user's vital data, images, videos, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0100] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0101] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).

[0102] The resource manager provides various resources for the application, such as localized images, strings, icons, layout files, video files, and so on.

[0103] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0104] The system service layer can include multiple functional modules. For example: rendering module, system service, quality of service (QOS) management module, and Figure 1b Not shown are the surface manager (surfacemanager), media libraries (Media Libraries), 3D engine modules (e.g. OpenGL ES), 2D graphics engines (e.g. SGL, vulkan), etc.

[0105] Rendering modules can be used to determine how images or meshes of particles are transformed, shaded, and drawn, and overlaid by other particles.

[0106] In some embodiments, the rendering module may record thread access information within a preset time period, where the thread access information includes thread information that has accessed the rendering module within the preset time period, such as a thread identifier.

[0107] System services are software modules that manage and execute system-level functions, such as surface managers, media libraries, 3D engine modules, and 2D graphics engines. These system services are usually used to process specific types of data or perform specific types of operations to support the functionality and performance of applications.

[0108] In some embodiments, when the electronic device 100 runs the main process of APP1, the system service can launch one or more sub-processes to work with the main process to provide services for APP1.

[0109] In some embodiments, the system service may identify one or more sub-processes that work in conjunction with the main process of APP1 based on the system information.

[0110] Optionally, the sub-process in the embodiment of the present application may not include a resident process started by a system service, such as OpenGL ES.

[0111] The QoS management module can be used to manage the user interaction relationship information corresponding to multiple threads of the main process of the application. In this application, the QoS management module can also interact with the system service to obtain information about one or more sub-processes that work in conjunction with the main process of APP1 from the system service.

[0112] In some embodiments, the Qos management module can interact with the priority management module in the kernel layer, and send the user interaction relationship corresponding to each thread of the main process to the priority management module, and then the priority management module can determine the priority of the thread based on the user interaction relationship.

[0113] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0114] 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, G.264, MP3, AAC, AMR, etc.

[0115] 3D engine module, used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc.

[0116] A 2D graphics engine is a drawing engine for 2D drawings.

[0117] The kernel layer is the layer between hardware and software. The kernel layer at least includes a priority management module, an associated thread identification module, a load aggregation statistics module, and a frequency modulation module.

[0118] The associated thread identification module is a new module added to the thread priority adjustment method of this application, which is used to identify the associated threads of the main process thread from the threads of one or more sub-processes, so as to adjust the priority of the associated threads based on the threads of the main process in the future, so as to avoid the main process of the application being unable to perceive the threads of the sub-processes and being unable to allocate user interaction relationships for the multiple threads of the sub-processes, resulting in the inability to reasonably allocate the thread priorities of the sub-processes according to user needs, affecting the response speed and performance of the system, thereby improving the response speed and performance of the system and improving the user experience. How to identify the associated threads of the main process threads will be explained in detail later, so I will not go into details here.

[0119] The priority management module can store the mapping relationship between the user interaction relationship and the priority, and can determine the priority corresponding to the thread based on the user interaction relationship corresponding to the thread. The thread priority adjustment method provided by this application will be described in detail later, and will not be described in detail here.

[0120] The load aggregation statistics module is a new module added to this application, which can be used to calculate the aggregate load of threads. How to calculate the aggregate load will be described in detail later, so I will not go into details here.

[0121] The frequency modulation module can be used to adjust the main frequency point of the processor of the electronic device 100. How to adjust the main frequency point of the processor will be described in detail later, and will not be described in detail here.

[0122] Understandably, Figure 1b The software architectures in the embodiments are only some exemplary implementations provided by the embodiments of the present invention. The software architectures in the embodiments of the present invention include but are not limited to the above implementations.

[0123] The architecture of the embodiment of the present application is described above, and the method of the embodiment of the present application is described in detail below.

[0124] Please refer to Figure 2 As shown, Figure 2 1 is a flow chart of a thread priority adjustment method provided in an embodiment of the present application. Optionally, the method can be applied to the aforementioned electronic device 100. Figure 2The thread priority adjustment method shown may include step S201-step S206. It should be understood that for the convenience of description, this application is described in the order of step S201-step S206, and is not intended to limit the execution to the above order. The embodiment of the present application does not limit the execution order, execution time, execution number, etc. of the above one or more steps. The following description takes the execution subject of step S201-step S206 of the thread priority adjustment method as a smartphone as an example. This application is also applicable to other execution subjects such as servers, other electronic devices, etc. Steps S201-step S206 are as follows:

[0125] Step S201: Run the first application.

[0126] Specifically, the first process of the first application includes multiple first threads. The first application can be an application that comes with the mobile phone or an application downloaded by the user, such as Huawei Changlian. The first process is the main process of the first application. The multiple first threads are the execution units of the first process, and the multiple first threads can execute different tasks or the same task. For example, Figure 3 As shown, Figure 3 A schematic diagram of the qos value of the relationship between a first thread and a user interaction is provided in an embodiment of the present application. Multiple first threads may include a UI thread, a page loading thread, a document opening thread, a download thread, a backup thread, etc.

[0127] Optionally, step S202: setting the priority of a first thread corresponding to the first function based on the first mapping table and the user interaction relationship value for the first function provided by the first application.

[0128] Specifically, the first application may provide multiple functions, such as a rendering function, a page loading function, a document opening function, a downloading function, a backup function, etc. The first function may be one of the multiple functions. The first thread corresponding to the first function may be one or more threads among the multiple first threads. The user interaction relationship value may indicate the user's expected response delay. The user interaction relationship values ​​corresponding to different first threads may be different.

[0129] It should be noted that the user interaction relationship value in the present application can be represented by a quality of service (QoS) value.

[0130] In some embodiments, the lower the user's expected response delay, the larger the qos value.

[0131] For example, Figure 3As shown, multiple first threads may include a UI thread, a page loading thread, an open document thread, a download thread, and a backup thread. Among them, the user interaction relationship of the UI thread is a user interaction task, and the user expects a low response delay, so the qos value corresponding to the UI thread is the highest; the user interaction relationship of the page loading thread is the faster the better, and the user expects a low response delay, so the qos value of the page loading thread is lower than the qos value corresponding to the UI thread; the user interaction relationship of the open document thread is visible progress, so the qos value of the open document thread is lower than the qos value of the page loading thread; the user interaction relationship of the download thread is that no immediate response is required, so the qos value of the download thread is lower than the qos value of the open document thread; the user interaction relationship of the backup thread is invisible to the user, so the qos value of the backup thread is lower than the qos value of the download thread.

[0132] In other embodiments, the lower the user's expected response delay, the smaller the qos value may be.

[0133] The first mapping table includes a mapping relationship between qos values ​​and priorities.

[0134] Optionally, a higher qos value indicates that the user expects a lower response delay and a higher priority. Figure 4 As shown, Figure 4 A schematic diagram of a first mapping table provided for an embodiment of the present application, in which only 6 qos values ​​are illustrated, namely 0, 1, 2, 3, 4, and 5. Among them, the priority value corresponding to the qos value of 0 is 1, the priority value corresponding to the qos value of 1 is 10, the priority value corresponding to the qos value of 2 is 20, the priority value corresponding to the qos value of 3 is 30, the priority value corresponding to the qos value of 4 is 40, and the priority value corresponding to the qos value of 5 is 50. It should be noted that in this example, the larger the priority value, the higher the priority.

[0135] In the embodiment of the present application, the first process may include multiple first threads, and the multiple first threads may perform different tasks. In different application scenarios, the application may set the user interaction relationship qos value of the first function provided by the first application according to the requirements, and then the electronic device may set the priority of the first thread corresponding to the first function according to the first mapping table and the user interaction relationship qos value of the first function, thereby realizing the reasonable configuration of the priority of the first thread according to the user requirements, and setting the threads of important tasks to a higher priority can ensure that these tasks are processed in a timely manner, thereby improving the user experience.

[0136] In some embodiments, the priority of the first thread is set based on the first mapping table and the user interaction relationship value corresponding to each first thread in the plurality of first threads.

[0137] Step S203: identifying associated threads of the first thread from threads of the second process.

[0138] Specifically, the second process is a process that is run by the electronic device other than the first process and that provides services for the first application.

[0139] Optionally, the subprocess in the embodiment of the present application may not include a resident process started by a system service, such as OpenGL ES, etc. A resident process can be understood as a process that runs continuously and resides in memory, which is usually started when the system starts and runs until the system is shut down. In some embodiments, the electronic device automatically starts the resident process when it is turned on, and the operating system (OS) will not actively kill the resident process. Even if the resident process is killed, the operating system will start the resident process again.

[0140] For example, Figure 5 As shown, Figure 5 A schematic diagram of a main process and sub-processes of a first application provided in an embodiment of the present application. When an electronic device runs the first process (i.e., the main process) of the first application, the electronic device will create one or more sub-processes for it, which will work in conjunction with the main process to provide services for the first application.

[0141] Optionally, the multiple first threads of the main process and the threads of one or more sub-processes may all be set with default priorities in the initial state, and the default priorities of different threads may be the same or different.

[0142] For example, Figure 5The default priorities corresponding to the multiple first threads of the main process and the threads of one or more sub-processes are all 20. The application can configure qos values ​​for the multiple first threads of the main process according to user needs and the first mapping table. Assume that the main process includes three threads, namely thread 1, thread 2 and thread 3, the qos value corresponding to thread 1 is 5, the qos value corresponding to thread 2 is 2, and the qos value corresponding to thread 3 is 4. For example, the electronic device can update the priorities corresponding to the threads of the main process based on the first mapping table and the qos value, such as the priority corresponding to thread 1 is 50, the priority corresponding to thread 2 is 20, and the priority corresponding to thread 3 is 40. However, for sub-processes, such as sub-process 1 and sub-process 2, since these processes are pulled up by system services, the application cannot perceive the threads of the sub-processes, and therefore cannot adjust the priorities of the threads of the sub-processes, resulting in the inability to reasonably adjust the priorities of the threads of the sub-processes according to user needs. Therefore, in some examples of the present application, by identifying the associated threads of the first thread from the threads of one or more sub-processes, the associated threads can follow the first thread for priority adjustment. For multiple threads of the same child process, the first thread associated with each thread may be different. Therefore, the priority adjustment trend of multiple threads of the same child process is determined by the associated first thread and can be different, thereby avoiding the situation where the application cannot perceive the thread of the child process, resulting in the inability to reasonably adjust the thread priority of the child process according to user needs, thereby improving the system's response speed and performance, and improving user experience.

[0143] In some embodiments, when the second process is created by the first process and the first thread is the main thread of the first process, identifying the associated thread of the first thread includes: identifying the main thread of the second process as the associated thread of the first thread.

[0144] Specifically, the main process can call a system function, such as the fork() function, to create a new child process. When the second process (i.e., child process) is created for the first process (i.e., main process), the main thread of the child process will inherit the main thread of the main process. The main thread of the child process usually performs similar tasks as the main process. Therefore, the main thread of the child process can be identified as an associated thread of the main thread of the main process, and then the associated thread can follow the first thread for priority adjustment. Thread scheduling is performed according to the priority, which can ensure that important tasks are processed in a timely manner, thereby improving the system's response speed and performance, and improving user experience.

[0145] For example, Figure 6 As shown, Figure 6A schematic diagram for identifying associated threads is provided in an embodiment of the present application. Assuming that the main process creates a child process 1, the main thread of the child process 1 (i.e., thread 4) can be identified as an associated thread of the main thread of the main process (i.e., thread 1), and then thread 4 can follow thread 1 for priority adjustment, so that the priority of thread 4 is adjusted to 50. Thread scheduling is performed according to this priority, which can ensure that important tasks are processed in a timely manner, thereby improving the response speed and performance of the system and improving the user experience.

[0146] Optionally, the main thread of the child process is determined by reading the thread identifier from the thread of the child process.

[0147] In some embodiments, identifying the associated thread of the first thread includes: identifying, from threads of the second process, a thread having the same task as that corresponding to the first thread as the associated thread of the first thread.

[0148] Specifically, from the threads of one or more child processes (i.e., the second thread), the thread with the same task as the first thread is identified as an associated thread of the first thread, and then the associated thread can follow the first thread to adjust its priority, and the thread scheduling is performed according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that the task is responded to more quickly, thereby improving the system's response speed and performance, and improving the user experience.

[0149] In some embodiments, the first thread communicates with the first module, and the method further includes: determining the thread in the second process that communicates with the first module as a thread with the same task as that corresponding to the first thread.

[0150] Specifically, when multiple threads communicate with the same module (i.e., the first module), these threads are executing the same code logic and they may be performing the same task. Therefore, these threads can be associated, and then the associated threads can follow the first thread to adjust their priorities. Threads are scheduled according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that tasks are responded to faster, thereby improving the system's response speed and performance and improving user experience.

[0151] For example, Figure 7 As shown, Figure 7 Another schematic diagram of identifying associated threads provided in an embodiment of the present application, when the first module is a rendering module running on an electronic device, multiple threads can interact with the rendering module within a preset time period, such as thread 1, thread 4, and thread 6, and these threads work together to complete a rendering task. The thread can interact with the rendering module through an interface provided by the rendering module.

[0152] Optionally, the rendering module may record thread access information within a preset time period, and the thread access information records thread-related information that has accessed the rendering module within the preset time period, such as thread identifiers, etc. Further, based on the thread access information within the preset time period recorded by the rendering module, the threads that have accessed the rendering module within the preset time period may be determined, such as thread 1, thread 4, and thread 6. These threads are all executing the same code logic, and they may execute the same rendering task, so these threads may be associated, and then the associated threads (thread 4, thread 6) may follow the first thread (thread 1) for priority adjustment, and thread scheduling is performed according to the priority. All threads corresponding to the same rendering task can be scheduled to run on the processor at the same or similar time, which can ensure that the rendering task is responded to more quickly, thereby improving the response speed and performance of the system and improving the user experience.

[0153] In some embodiments, the first module is a rendering module running on the electronic device; or, the first module is a window management module running on the electronic device; or, the first module is a component management module running on the electronic device.

[0154] Specifically, the rendering module can be the above Figure 1b The rendering module described in; the window management module can be the above Figure 1b The window manager described in . In an embodiment of the present application, when the first thread accesses the rendering module, other threads interacting with the rendering module can be identified as associated threads of the first thread, and they are all executing the same or identical rendering tasks. When the first thread accesses the window management module, other threads interacting with the window management module can be identified as associated threads of the first thread, and they are all executing the same or identical window drawing tasks. When the first thread accesses the component management module, other threads interacting with the component management module can be identified as associated threads of the first thread, and they are all executing the same or identical drawing tasks. Furthermore, the associated threads can follow the first thread to adjust their priorities, and schedule threads according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that tasks can be responded to faster, thereby improving the response speed and performance of the system and improving the user experience.

[0155] In some embodiments, when the first module is a window management module, the thread in the threads of the second process that communicates with the first module is determined to be a thread with the same task as the corresponding task of the first thread, including: from the threads of the second process, the thread that communicates with the window management module and executes the drawing task of the same window as the first thread is determined to be a thread with the same task as the corresponding task of the first thread.

[0156] Specifically, multiple threads interacting with the window management module may be drawing the same window or different windows. Figure 8 As shown, Figure 8 A schematic diagram of another method for identifying associated threads provided in an embodiment of the present application is shown. Figure 8 It is assumed that a user interface 1 is displayed on the display screen of an electronic device. The user interface 1 actually includes multiple windows, such as window 1, window 2 and window 3. The multiple windows may be drawn at the same time or in a similar time period. In order to more accurately identify the associated threads of the first thread, the thread that executes the drawing task of the same window as the first thread is determined as the thread with the same task as the first thread, that is, the threads that draw the same window are associated. Assuming that thread 3, thread 5 and thread 7 need to execute the drawing task of drawing window 1, thread 3, thread 5 and thread 7 can be associated. Among them, thread 3 is the first thread, and thread 5 and thread 7 are associated threads. Furthermore, the associated threads can follow the first thread to adjust the priority, and the threads can be scheduled according to the priority. All threads corresponding to the same task can be scheduled to run on the processor at the same or similar time, which can ensure that the task is responded to faster, thereby improving the response speed and performance of the system and improving the user experience.

[0157] Optionally, the window management module may record thread call information corresponding to each window, for example, the thread call information corresponding to drawing window 1 includes relevant information of all threads required to be called for drawing window 1, the thread call information corresponding to drawing window 2 includes relevant information of all threads required to be called for drawing window 2, and the thread call information corresponding to drawing window 3 includes relevant information of all threads required to be called for drawing window 3. Further, multiple threads for drawing the same window may be determined based on the thread call information.

[0158] Step S204: Based on the priority of the first thread, the priority of the associated thread is set.

[0159] Specifically, after identifying the associated thread of the first thread, the priority of the associated thread can be adjusted based on the priority of the first thread, wherein the priority of the first thread is set based on user needs. Since the priority of the associated thread is determined by the priority of the first thread, the priority of the associated thread can also meet user needs, avoiding the situation where the application cannot perceive the thread of the child process, resulting in the inability to reasonably configure the thread priority of the child process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0160] For example, Fig. 9 As shown, Fig. 9A schematic diagram of adjusting the thread priority of a child process provided in an embodiment of the present application, exemplarily, by executing the above steps S201-S203, it can be determined that the associated threads of thread 1 are thread 4 and thread 6, and the associated threads of thread 3 are thread 5 and thread 7. The qos value of thread 1 is 5, and the qos value of thread 4 and thread 6 can be set to 5, and then the priority of thread 4 is updated to 50, and the priority of thread 6 is updated to 50; the qos value of thread 3 is 4, and the qos value of thread 5 and thread 7 can be set to 4, and then the priority of thread 5 is updated to 40, and the priority of thread 7 is updated to 40.

[0161] In some embodiments, a first interface may be created for each thread of the second process, and a qos value may be configured for the thread of the second process through the first interface. For example, based on the qos value of the first thread, the qos value of the associated thread may be configured through the first interface, thereby updating the priority of the associated thread. The first interface may be setThreadQos().

[0162] Step S205: Detecting that the running state of the first application has changed, adjusting the priority of the first thread, and adjusting the priority of the associated threads.

[0163] Specifically, the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread. The priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread, including: if the priority of the first thread is increased, the priority of the associated thread is increased; or, if the priority of the first thread is decreased, the priority of the associated thread is decreased; or, if the qos value of the first thread is changed, the priority of the associated thread is also changed to the priority corresponding to the changed qos value of the first thread.

[0164] In some embodiments, the method further includes: detecting that a running state of the first application changes, and modifying the qos value of the first thread.

[0165] Specifically, when it is detected that the running state of the first application has changed, that is, when user needs have changed, the first application can adjust the priority of the first thread by modifying the qos value of the first thread, thereby adjusting the priority of the thread of the first process according to user needs and improving user experience.

[0166] In some embodiments, detecting that the running state of the first application has changed, adjusting the priority of the first thread, and adjusting the priority of the associated thread include: detecting that the running state of the first application has changed, and adjusting the priority of the first thread and the priority of the associated thread based on the modified qos value of the first thread and the first mapping table.

[0167] In an embodiment of the present application, when it is detected that the running state of the first application has changed, that is, the user demand has changed, the first application can modify the qos value of the first thread according to the demand. For example, if the user currently hopes that the document opening function of the first application will be responded to as soon as possible, the qos value of the first thread corresponding to the function can be modified to a higher value, so that the priority of the first thread and the priority of the associated threads can be adjusted based on the modified qos value of the first thread and the first mapping table, that is, the associated threads follow the first thread to adjust their priorities, thereby avoiding the application being unable to perceive the thread of the sub-process, resulting in the inability to reasonably adjust the thread priority of the sub-process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0168] For example, Fig.10 As shown, Fig.10 A schematic diagram of adjusting the priority of a first thread and associated threads is provided for an embodiment of the present application. Assuming that the first application modifies the qos value of the first thread of the main process, for example, the qos value of thread 1 is modified to 4, the qos value of thread 2 is modified to 3, and the qos value of thread 3 is modified to 3, then the priority of thread 1 is adjusted to 40, and the priorities of associated threads (thread 4 and thread 6) are also adjusted to 40; the priority of thread 2 is adjusted to 30; the priority of thread 3 is adjusted to 30, and the priorities of associated threads (thread 5 and thread 7) are also adjusted to 30.

[0169] In some embodiments, a larger qos value in the first mapping table indicates a higher priority of the corresponding thread; when the running state of the first application changes to the first application switching from the foreground state to the background state or the frozen state, the qos value of the first thread decreases, and the priority of the first thread and the priority of the associated threads decrease; when the running state of the first application changes to the first application switching from the background state or the frozen state to the foreground state, the qos value of the first thread increases, and the priority of the first thread and the priority of the associated threads increase.

[0170] Specifically, when the first application switches from the foreground state to the background state or the frozen state, the priority of the first thread and the priority of the associated thread can be lowered to ensure that the foreground application of the current electronic device can respond faster; when the first application switches from the background state or the frozen state to the foreground state, the priority of the first thread and the priority of the associated thread can be increased to ensure that the first application can respond faster, thereby improving the user experience.

[0171] In some embodiments, when the first application is in the startup stage and the background stage, the priority of the associated thread is consistent with the priority of the first thread. For example, if the priority of the first thread is 50, the priority of the associated thread is also 50. When the first application is running in the foreground state, the priority of the first thread may be higher than the priority of the associated thread. For example, if the priority of the first thread is 50, the priority of the associated thread may be one level lower than the priority of the first thread, which is 40. Although the priorities of the first thread and the associated thread are inconsistent, when the running state of the first application changes, the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the first thread. If the first thread is increased, the associated thread is also increased; if the first thread is decreased, the associated thread is also decreased, thereby ensuring that the first thread can be timely transferred to the processor for operation.

[0172] Optionally, step S206: determining an aggregate load of the first thread and associated threads, and adjusting a main frequency point of the processor based on the aggregate load.

[0173] Specifically, the electronic device may include a processor, and the main frequency point of the processor is the operating frequency of the processor, such as 1000MHZ, 2000MHZ, etc. The processor is set with a frequency modulation period, for example, if the adjustment period is 4 milliseconds, the processor can set the main frequency point once every 4 milliseconds. When the thread is scheduled to run on the processor, the aggregate load can be calculated based on the total running duration of the thread and the associated threads, and then the main frequency point of the processor can be adjusted based on the calculated aggregate load, that is, the frequency is adjusted by comprehensively considering the running conditions of the first thread and the associated threads, so as to save energy while ensuring the running speed of the thread and improve the user experience.

[0174] Optionally, the running status information of the first thread and its associated threads is obtained by reading system information, such as trace information in an Android system.

[0175] In some embodiments, the aggregate load of the first thread and the associated threads may be determined according to Formula 1. Formula 1 is as follows:

[0176] L1=F*C1(Formula 1)

[0177] L1 represents the aggregate load, F represents the current frequency of the processor, and C1 represents the first duty cycle. The first duty cycle is the proportion of the total duration of the first thread and the associated threads in the frequency modulation cycle of the processor; the main frequency of the processor is adjusted based on the aggregate load.

[0178] Optionally, the first duty cycle is calculated according to the running conditions of the first thread and the associated threads in one frequency modulation cycle, or according to the running conditions of the first thread and the associated threads in multiple frequency modulation cycles.

[0179] In some embodiments, threads whose qos values ​​are greater than a preset value are determined, and aggregate loads of threads whose qos values ​​are greater than the preset value are determined; and the main frequency point of the processor is adjusted based on the aggregate load.

[0180] In some embodiments, adjusting the main frequency of the processor based on the aggregate load includes: determining whether the aggregate load is greater than a first threshold; if the aggregate load is greater than the first threshold, adjusting the main frequency of the processor based on the aggregate load.

[0181] Specifically, Fig.11 As shown, Fig.11 A schematic diagram of a first threshold value provided for the present application, the first threshold value may be a preset value of the electronic device, or a value updated by the electronic device from the cloud, or an empirical value obtained by the electronic device through machine learning, the first threshold value may represent the frequency point corresponding to the energy consumption acceptable to the system, for example, the first threshold value is 1200, 1250, 1300, 1350, 1400 or 1500, etc. When the aggregate load is greater than the first threshold value, it means that the first thread and its associated threads are performing heavy load tasks, which are generally more important tasks, then the system will be more inclined to ensure the performance of the first thread and the associated threads, and then the main frequency point of the processor can be adjusted based on the calculated aggregate load, thereby ensuring the running speed of the thread while saving energy consumption and improving the user experience.

[0182] In some embodiments, adjusting the processor's main frequency based on the aggregate load includes: when the aggregate load is greater than a second threshold, increasing the processor's main frequency; when the aggregate load is less than or equal to the second threshold, decreasing or not adjusting the processor's main frequency.

[0183] Specifically, when the aggregate load is greater than the second threshold, indicating that the current processor is running the first thread and related threads most of the time, the processor's main frequency can be increased so that the processor can run the first thread and related threads more quickly; when the aggregate load is less than or equal to the second threshold, indicating that the current processor has a lot of free time after running the first thread and related threads, the processor's main frequency can be lowered or not adjusted to save processor energy consumption.

[0184] In some embodiments, the method also includes: if the aggregate load is less than or equal to a first threshold, determining a first load of the first thread, the first load being the product of the current frequency of the processor and a second duty cycle; the second duty cycle being the proportion of the duration of the first thread in the frequency modulation cycle of the processor; and adjusting the main frequency of the processor based on the first load.

[0185] Specifically, when the aggregate load is less than or equal to the first threshold, it means that the first thread and its associated threads correspond to small-load tasks, which are generally ordinary tasks. The system will be more inclined to save processor energy consumption, and then calculate the first load based on the duration of the first thread's operation, and adjust the processor's main frequency based on the calculated first load, thereby saving processor energy consumption and improving user experience.

[0186] Optionally, the second duty cycle is calculated according to the running conditions of the first thread in one frequency modulation cycle, or the second duty cycle is calculated according to the running conditions of the first thread in multiple frequency modulation cycles.

[0187] For example, Fig.12 As shown, Fig.12 A schematic diagram of a thread priority scheduling method provided for an embodiment of the present application, wherein the application can actively mark the user interaction level of the thread and send it to the kernel through the Qos management module; the kernel can dynamically adjust the priority of the thread according to the user interaction relationship of the thread and the foreground and background status of the application. For multi-process collaborative application scenarios, the associated threads of the main process and the child process are identified through the thread creation relationship, the window status of the thread, and the interaction between the thread and key modules such as rendering. The associated threads of the main process and the child process are coordinated and adjusted, and the startup phase of the main process and the child process are both guaranteed by the same strategy. The priority change of the child process is consistent with that of the main process, but in the foreground state, the priority of the child process can be lower than that of the main process. The user interaction relationship of the main process thread can be passed to the associated thread of the child thread to collaboratively improve the processor supply of the thread. The kernel aggregates the load of threads with high user interaction relationships and uses it to calculate the frequency points. The kernel also uses the aggregated load to manage the processor power. If the aggregated load is lower than the first threshold, the frequency is adjusted normally to allow key threads to run at high-efficiency frequencies. If the aggregated load is higher than the threshold, the frequency is adjusted to allow key threads and their associated threads to run at high frequencies.

[0188] In summary, the actual usage scenarios of electronic devices require dynamic supply scheduling for threads with different user interaction relationships, with fast and high-performance supply for threads with high user interaction relationships, and low-power supply for threads with low user interaction relationships; the priorities of associated threads in multi-process collaboration are coordinated and adjusted, and the same strategy is used to ensure the priorities of the main process and sub-processes during the startup phase. During the running phase, the priority changes of the sub-process are consistent with those of the main process, but in the foreground state, the priority of the sub-process can be lower than that of the main process; the load of key threads with high user interaction relationships is aggregated and counted to accurately adjust the processor frequency.

[0189] See also Fig.13 , Fig.13A flow chart of a frequency modulation method provided in an embodiment of the present application is applied to an electronic device, the electronic device includes a processor, and the method includes:

[0190] Step S301: Run the first application.

[0191] Specifically, the first process of the first application includes multiple first threads.

[0192] Step S302: identifying associated threads of the first thread from threads of the second process.

[0193] Specifically, the second process is a process that is run by the electronic device other than the first process and that provides services for the first application.

[0194] Step S303: Determine the aggregate load of the first thread and the associated threads.

[0195] Specifically, the aggregate load is the product of the current frequency of the processor and the first duty cycle; the first duty cycle is the proportion of the total duration of the first thread and the associated threads in the frequency modulation cycle of the processor.

[0196] Step S304: adjusting the main frequency of the processor based on the aggregated load.

[0197] In some embodiments, adjusting the main frequency of the processor based on the aggregate load includes: determining whether the aggregate load is greater than a first threshold; if the aggregate load is greater than the first threshold, adjusting the main frequency of the processor based on the aggregate load.

[0198] In some embodiments, adjusting the processor's main frequency based on the aggregate load includes: when the aggregate load is greater than a second threshold, increasing the processor's main frequency; when the aggregate load is less than or equal to the second threshold, decreasing or not adjusting the processor's main frequency.

[0199] In some embodiments, the method also includes: if the aggregate load is less than or equal to a first threshold, determining a first load of the first thread, the first load being the product of the current frequency of the processor and a second duty cycle; the second duty cycle being the proportion of the duration of the first thread in the frequency modulation cycle of the processor; and adjusting the main frequency of the processor based on the first load.

[0200] In an embodiment of the present application, after a thread is scheduled to run on a processor, the aggregate load can be calculated based on the total running duration of the thread and associated threads, and the main frequency of the processor can be adjusted based on the calculated aggregate load, that is, the frequency can be adjusted by comprehensively considering the running conditions of the first thread and the associated threads, thereby ensuring the running speed of the thread while saving energy and improving the user experience.

[0201] See also Fig.14 , Fig.14A flowchart of a thread priority adjustment method provided in an embodiment of the present application is provided, which is applied to an electronic device, and the method includes:

[0202] Step S401: Run the first application.

[0203] Specifically, the interface of the first application includes a first window corresponding to the first process and a second window corresponding to the second process, and the second window is nested in the first window; the first process is the process of the first application; the second process is the process of the first application or the second application; the UI thread of the second process is an associated thread of the UI thread of the first process.

[0204] For example, Fig.15 As shown, Fig.15 A schematic diagram of an interface of a first application provided in an embodiment of the present application, assuming that the first application is a chat application, the electronic device displays a user interface 710, the user interface 710 is a chat dialogue interface, and there is a document 720 in the chat dialog box. The electronic device can receive and respond to the user's touch operation on the document 720 to open the document and display a user interface 711. The user interface 711 can be a document display interface, on which there can be at least two windows, wherein the first window is rendered by the main process of the first application, and the second window is rendered by other processes of the first application (i.e., the main process, or the system). Since the first window needs to be rendered at the same time as the second window, the UI thread corresponding to the first window can be associated with the UI thread corresponding to the second window, that is, the UI thread of the second process is used as the associated thread of the UI thread of the first process, so as to adjust the thread priority later.

[0205] Step S402: Detecting that the running state of the first application has changed, adjusting the priority of the UI thread of the first process, and adjusting the priority of the associated threads.

[0206] Specifically, the priority adjustment trend of the associated thread is consistent with the priority adjustment trend of the UI thread of the first process.

[0207] In some embodiments, the component tree of the second process is mounted in the component tree of the first process.

[0208] In an embodiment of the present application, the interface of the first application may include multiple windows, such as a first window and a second window, wherein the second window is nested in the first window. The first window needs to be rendered simultaneously with the second window, so the UI thread corresponding to the first window and the UI thread corresponding to the second window may be associated, that is, the UI thread of the second process is used as the associated thread of the UI thread of the first process, and then when the running state of the first application is detected to have changed, that is, it can be understood that when the user demand has changed, the UI thread of the second process follows the UI thread of the first process for priority adjustment, so as to avoid the application being unable to perceive the thread of the second process, resulting in the inability to reasonably adjust the thread priority of the second process according to user demand, thereby improving the response speed and performance of the system and improving the user experience.

[0209] A flow chart of a thread priority adjustment method provided in an embodiment of the present application is applied to an electronic device, the method comprising: running a first application; a first process of the first application comprising a plurality of first threads; identifying an associated thread of the first thread from threads of a second process; wherein the first thread and the associated thread are used to jointly render an interface of the first application; detecting a change in the running state of the first application, adjusting the priority of the first thread, and adjusting the priority of the associated thread, wherein a priority adjustment trend of the associated thread is consistent with a priority adjustment trend of the first thread.

[0210] In some embodiments, both the first thread and the associated thread are used to send rendering instructions to the rendering module.

[0211] In this scenario, the associated thread can be the main thread of the second process, or the Compositor thread, or the CompositorTileW thread, wherein the main thread can be used to measure (Measure), layout (layout) to generate a hierarchical tree, and paint (paint) to generate drawing instructions; the Compositor thread can be used to divide the layer into smaller tiles and pass them to the raster thread for rasterization; the CompositorTileW thread can be used for image decoding and block graphics processor (Graphic Processing Unit, GPU) instruction generation, and the visible area needs to be rendered first.

[0212] In an embodiment of the present application, since the threads that render the interface of the first application are performing similar tasks, the threads of different processes that render the interface of the first application can be associated, that is, the threads of the second process that render the interface of the first application together with the first thread are identified as associated threads. Then, when a change in the running state of the first application is detected, which can be understood as a change in user demand, the associated thread follows the first thread to adjust its priority, thereby avoiding the situation where the application cannot perceive the thread of the sub-process, resulting in the inability to reasonably adjust the thread priority of the sub-process according to user needs, thereby improving the response speed and performance of the system and improving the user experience.

[0213] The present application provides an electronic device, comprising: a memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute any one of the above-mentioned thread priority adjustment methods and execute any one of the above-mentioned frequency modulation methods.

[0214] The present application provides a computer-readable storage medium, including instructions. When the instructions are executed on an electronic device, the electronic device executes any one of the above-mentioned thread priority adjustment methods and any one of the above-mentioned frequency modulation methods.

[0215] The present application provides a computer program product. When the computer program product runs on a computer, the computer is enabled to execute any one of the above-mentioned thread priority adjustment methods and any one of the above-mentioned frequency modulation methods.

[0216] The present application provides a chip system, which includes at least one processor for implementing any of the above-mentioned thread priority adjustment methods and executing any of the above-mentioned frequency modulation methods.

[0217] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0218] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0219] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0220] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

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

[0222] If the above-mentioned 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 computer-readable storage medium. According to this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. Among them, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviated: ROM) or random access memory (Random Access Memory, abbreviated: RAM) and other media that can store program codes.

[0223] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A thread priority adjustment method, characterized in that: Applied to electronic equipment, the method comprises: Running a first application; a first process of the first application includes a plurality of first threads; Identify at least one associated thread of the first thread from a plurality of threads of a second process; wherein the second process is a process providing services for the first application, and a window of the second process is nested in a window of the first process; It is detected that the running state of the first application changes, the priority of at least one of the first threads is adjusted, and the priority of the associated threads is adjusted, and the priority adjustment trend of the associated threads is consistent with the priority adjustment trend of at least one of the first threads.

2. The method according to claim 1, characterized in that: When the second process is created by the first process, and at least one of the first threads includes a main thread of the first process, identifying an associated thread of at least one of the first threads includes: A main thread of the second process is identified as the associated thread.

3. The method according to claim 1, characterized in that: The identifying at least one associated thread of the first thread comprises: From the threads of the second process, a thread corresponding to the same task as at least one of the first threads is identified as the associated thread.

4. The method according to claim 3, characterized in that: At least one of the first threads communicates with the first module, and the method further includes: Among the threads of the second process, a thread that communicates with the first module is determined to be a thread having the same task as that corresponding to at least one of the first threads.

5. The method according to claim 4, characterized in that: The first module is a rendering module running on the electronic device; or, the first module is a window management module running on the electronic device; or, the first module is a component management module running on the electronic device.

6. The method according to claim 5, characterized in that When the first module is the window management module, determining, among threads of the second process, a thread that communicates with the first module as a thread having the same task as at least one of the first threads, includes: From the threads of the second process, a thread that communicates with the window management module and executes a drawing task of the same window as at least one of the first threads is determined as a thread having the same task as that corresponding to at least one of the first threads.

7. The method according to any one of claims 1 to 6, characterized in that: Before identifying at least one associated thread of the first thread, the method further includes: The priority of at least one of the first threads is set based on a first mapping table and a user interaction relationship value of at least one of the first threads; the first mapping table includes a mapping relationship between user interaction relationship values ​​and priorities.

8. The method according to claim 7, characterized in that: After identifying at least one associated thread of the first thread, the method further includes: The priority of the associated thread is set based on the priority of at least one of the first threads.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: It is detected that the running state of the first application changes, and the user interaction relationship value of at least one of the first threads is modified.

10. The method according to claim 9, characterized in that Detecting that the running state of the first application changes, adjusting the priority of at least one of the first threads and adjusting the priority of the associated threads include: It is detected that the running state of the first application changes, and based on the modified user interaction relationship value of at least one of the first threads and the first mapping table, the priority of at least one of the first threads and the priority of the associated threads are adjusted.

11. The method according to claim 9 or 10, characterized in that: A larger user interaction relationship value in the first mapping table indicates a higher priority of the corresponding thread; when the running state of the first application changes to the first application switching from a foreground state to a background state or a frozen state, the user interaction relationship value of at least one of the first threads decreases, and the priority of at least one of the first threads and the priority of the associated thread decrease; When the running state of the first application changes to the foreground state from the background state or the frozen state, the user interaction relationship value of at least one of the first threads increases, and the priority of at least one of the first threads and the priority of the associated threads increase.

12. The method according to any one of claims 1 to 11, characterized in that: The electronic device includes a processor, and the method further includes: Determine an aggregate load of at least one of the first threads and the associated threads, where the aggregate load is a product of a current frequency of the processor and a first duty cycle; the first duty cycle is a proportion of a total duration of at least one of the first threads and the associated threads in a frequency modulation period of the processor; The main frequency point of the processor is adjusted based on the aggregated load.

13. The method according to claim 12, characterized in that: The adjusting the main frequency point of the processor based on the aggregated load includes: Determining whether the aggregate load is greater than a first threshold; When the aggregate load is greater than the first threshold, and when the aggregate load is greater than the second threshold, increasing the main frequency of the processor; When the aggregate load is greater than the first threshold and the aggregate load is less than or equal to the second threshold, the main frequency point of the processor is lowered or not adjusted.

14. The method according to claim 13, characterized in that: The method further comprises: When the aggregate load is less than or equal to the first threshold, a first load of at least one of the first threads is determined, where the first load is the product of the current frequency of the processor and a second duty cycle; the second duty cycle is the proportion of the duration of at least one of the first threads in the frequency modulation period of the processor; The main frequency point of the processor is adjusted based on the first load.

15. An electronic device, characterized in that: include: A memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method as described in any one of claims 1-14.

Citation Information

Patent Citations

  • Resource scheduling method and electronic equipment

    CN112527476A

  • Thread execution method and device, electronic equipment and computer readable storage medium

    CN116932194A

  • Resource scheduling method, electronic equipment and storage medium

    CN117130771A

  • Image display method and related device

    CN117472483A

  • System, method and program for implementing priority inheritance in an operating system

    US20050060710A1