Application program thread processing method and electronic equipment
By increasing the scheduling priority of specific application threads in electronic devices according to user operations, the interface lag and slow response problems caused by low priority of background application threads are solved, and the user experience is improved.
Patent Information
- Application Number
- CN202311101897.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-02-28
AI Technical Summary
In electronic devices, the thread processing priority of background applications is low, resulting in interface lag and slow response, affecting the user experience.
By receiving user operation instructions, increase the thread scheduling priority of the corresponding application, such as scheduling threads of the wallet application as real-time threads, or reduce the scheduling priority of non-critical threads to balance the device load.
It improves the processing priority of background application threads, reduces interface lag and response delay, and improves user experience.
Smart Images

Figure CN119536965A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method for processing an application thread and an electronic device. Background Art
[0002] With the development of electronic technology, electronic devices (such as mobile phones, tablet computers or smart watches) have more and more functions. With the increase of functions in electronic devices, the computing power requirements of the central processing unit (CPU) for applications on electronic devices have increased simultaneously. However, the computing power resources of the CPU are limited.
[0003] In related technologies, electronic devices often prioritize the processing of threads of foreground applications (user-visible applications) and postpone the processing of threads of background applications (user-invisible applications). The computing power supply of background applications is greatly limited. This computing supply method may cause problems such as stuck interfaces and slow responses of electronic devices, resulting in poor user experience. Summary of the invention
[0004] The present application provides an application thread processing method and an electronic device, which can solve the problems of application interface freeze and slow terminal device response, and improve the user experience.
[0005] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions:
[0006] In a first aspect, the present application provides a method for processing an application thread, which is executed by a terminal device, and includes: receiving a first indication, the first indication being used to instruct the terminal device to display a first application running in the background on the terminal device; increasing the scheduling priority of a first thread corresponding to the first application; processing the first thread according to the increased scheduling priority of the first thread; and displaying the interface of the first application.
[0007] In this way, the scheduling priority of the first thread of the first application can be increased, and the interface check of the first application is quickly displayed in the terminal device interface to improve the user experience.
[0008] Exemplarily, when the wallet application (first application) is in the background, it receives (detects) a trigger operation of the user, wakes up the wallet application (first indication), indicates to display the wallet card of the wallet application, and can increase the scheduling priority of the wallet card thread (first thread), call the wallet card thread after the scheduling priority is increased, and display the following Figure 2 Interface 403 is shown.
[0009] In a possible implementation manner, receiving the first indication includes: detecting an operation performed by a user on a terminal device.
[0010] In a possible implementation, the first application is a wallet application, the first indication is an operation of waking up the wallet application, and the first thread is a wallet card thread.
[0011] In a possible implementation, the first application is a call application, and receiving the first indication includes: the terminal device obtains incoming call information.
[0012] Optionally, the calling application may include a telephone application, a WeChat application, and other applications that can make calls.
[0013] For example, when the mobile phone receives an incoming call signal (first indication), at this time, the phone application is running in the background of the mobile phone, and the scheduling priority of the incoming call card of the phone application can be increased, and the incoming call card can be quickly pulled up according to the adjusted scheduling priority of the incoming call card. In this way, the scheduling priority of the incoming call card thread in the phone application can be increased, and the incoming call card can be quickly displayed in the mobile phone interface to improve the user experience.
[0014] In a possible implementation, improving the scheduling priority of the first thread corresponding to the first application includes: adjusting the first thread corresponding to the first application from a common thread to a real-time thread. The scheduling priority of the real-time thread is higher than the scheduling priority of the common thread, so that the calling priority of the first thread can be improved.
[0015] In a possible implementation, improving the scheduling priority of the first thread corresponding to the first application includes: determining a calling priority of the first thread according to a task type of the first thread.
[0016] Exemplarily, the task type of the first thread may include an execution interface display task type, an execution cleanup task type, etc. Among them, the thread that executes the interface display task type has a high calling priority and is an important thread; the thread that executes the cleanup task has a low calling priority and is an unimportant thread.
[0017] In a possible implementation, the first application also corresponds to a third thread, the third thread is related to the first thread, and improving the scheduling priority of the first thread corresponding to the first application includes: improving the scheduling priority of the first thread corresponding to the first application and the third thread.
[0018] In a second aspect, the present application provides a method for processing an application thread, which is executed by a terminal device, and includes: receiving a second instruction; starting a second thread related to a second application according to the second instruction; reducing the scheduling priority of the second thread; and processing the second thread according to the reduced scheduling priority of the second thread. In this way, the load of the terminal device can be balanced and the user experience can be improved.
[0019] Exemplarily, the mobile phone manager application (second application) receives an operation (second indication) from the user to click on a cleaning control, starts a cleaning thread (second thread), lowers the scheduling priority of the cleaning thread, calls the cleaning thread after the scheduling priority is lowered, and completes the cleaning task.
[0020] As another example, the browser application (second application) in the mobile phone receives an operation from the user to open the browser application (second instruction), starts the browser's loading sub-tap page thread (second thread), lowers the scheduling priority of the loading sub-tap page thread, and calls the loading sub-tap page thread after the scheduling priority is lowered to complete the loading task.
[0021] In a possible implementation, receiving the second indication includes: detecting an operation performed by a user on a terminal device, for example, a click operation performed by a user on a mobile phone.
[0022] In a possible implementation, the second application is a mobile phone manager application, and the second thread is a cleanup thread.
[0023] In a possible implementation, the second application includes a first page and a second page, the second indication is used to display the first page; the second thread is a thread for loading the second page; the scheduling priority of the second thread is lower than the scheduling priority of the thread for loading the first page. In this way, the scheduling priority of the thread for loading the first page is higher, the speed of displaying the first page is increased, and the user experience is improved.
[0024] Exemplarily, the browser application (second application) includes all tab pages (first page) and video tab page (second page), all tab pages are primary tap pages, and video tab page is secondary tap page. The second thread is for loading the video tab page, and the scheduling priority of the thread for loading the video tab page is lower than the scheduling priority of the thread for loading all tab pages, which reduces the load on the mobile phone and increases the display speed of all tab pages.
[0025] In a possible implementation, the method further includes: receiving a third indication, the third indication being used to display a second page; increasing the scheduling priority of the second thread and decreasing the scheduling priority of the first thread; processing the second thread according to the increased scheduling priority of the second thread, and processing the first thread according to the decreased scheduling priority of the first page thread. If there are many threads in the foreground browser application, the scheduling priority of some threads that have a smaller impact on the user experience can be decreased, thereby reducing the load on the mobile phone, ensuring the scheduling priority of the main thread, and improving the user experience.
[0026] Exemplarily, the browser application in the mobile phone receives the user's operation of clicking on the video control (the third indication), displays the video interface (the second page), and can restore (improve) the scheduling priority of the thread loading the video tap page (the second thread) and reduce the scheduling priority of the thread loading all tap pages (the first thread).
[0027] In one possible implementation, the method also includes: after receiving the second indication, starting a third thread related to the second application according to the second indication, the third thread being a thread for loading a third page; lowering the scheduling priority of the third thread; processing the third thread according to the lowered scheduling priority of the third thread; and after receiving the third indication, not adjusting the scheduling priority of the third thread.
[0028] Exemplarily, the third thread may be a thread for loading a news tab page, a thread for loading a map tab page, or a thread for loading more tab pages. When the mobile phone displays a video tap page, the browser application does not actively instruct to adjust the scheduling priority of the third thread.
[0029] In a possible implementation, lowering the scheduling priority of the second thread corresponding to the second application includes: adjusting the second thread from the first group to the second group, and the CPU resources used by the first group and / or the time of using the CPU resources are higher than those of the second group. In this way, the CPU resources that can be used by the second thread and / or the time of using the CPU resources are reduced, and the scheduling priority of the second thread can be lowered, the load on the mobile phone is reduced, and the user experience is improved.
[0030] Exemplarily, the second thread can adjust the BG group from the top-app group. The group of the second thread can also be adjusted to other groups that can use CPU resources or have a smaller thread run time, such as the restricted group, which is not specifically limited in the embodiments of the present application.
[0031] In a possible implementation, the second thread is a common thread, and lowering the scheduling priority of the second thread corresponding to the second application includes: lowering the priority ranking of the second thread. In this way, the scheduling priority of the second thread can be lowered, the load of the mobile phone can be reduced, and the user experience can be improved.
[0032] The optional second thread is a normal thread. For example, the scheduling priority of the second thread can be reduced from 120 to 130.
[0033] In a third aspect, the present application provides a computer-readable storage medium, which includes a computer program or instructions. When the computer program or instructions are executed on a business processing device, the business processing device executes the methods described in the first aspect to the second aspect.
[0034] In a fourth aspect, the present application provides a chip system comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor, and when the at least one processor executes the instructions, the at least one processor executes a method as described in any one of the first to second aspects above.
[0035] In a fifth aspect, the present application also provides a computer program product, comprising instructions, which, when executed on a computer, enables the computer to execute the method as described in any one of the first to second aspects.
[0036] In a sixth aspect, an embodiment of the present application provides a circuit system, the circuit system includes a processing circuit, and the processing circuit is configured to execute the method of any one of the implementations in the first aspect or the first to second aspects.
[0037] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the memory being coupled to the processor, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes the method of any one of the implementations in the first aspect or the first to the second aspects.
[0038] The technical effects corresponding to the third to seventh aspects and any one of the implementation methods in the third to seventh aspects can be referred to the technical effects corresponding to the first to second aspects and any one of the implementation methods in the first to second aspects mentioned above, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1A It is a structural schematic diagram of a mobile phone provided in an embodiment of the present application.
[0040] Figure 1B It is a software structure block diagram of a mobile phone provided in an embodiment of the present application.
[0041] Figure 2 This is a schematic diagram of an interface provided in an embodiment of the present application.
[0042] Figure 3 It is a flow chart of a method for processing an application thread provided in an embodiment of the present application.
[0043] Figure 4 This is a flow chart of another method for processing application threads provided in an embodiment of the present application.
[0044] Figure 5 This is a scheduling classification diagram provided in an embodiment of the present application.
[0045] Figure 6This is a schematic diagram of CPU time occupied by a thread provided in an embodiment of the present application.
[0046] Figure 7 This is another interface schematic diagram provided in an embodiment of the present application.
[0047] Figure 8 This is a flow chart of another method for processing application threads provided in an embodiment of the present application.
[0048] Fig. 9 This is another interface schematic diagram provided in an embodiment of the present application.
[0049] Fig.10 This is a flow chart of another method for processing application threads provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The terms "including" and "having" and any variations thereof mentioned in the description of the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0051] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0052] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more. The "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0053] In some embodiments, the electronic device can add the thread identifier of the independent rendering thread corresponding to the application running in the foreground to a high priority scheduling group, and the thread corresponding to the thread identifier in the high priority scheduling group can be scheduled by the electronic device first. The electronic device can schedule the independent rendering thread of the application running in the foreground first to ensure that the independent rendering thread can render and draw the display image of the application in time, thereby improving the display effect of the application page.
[0054] However, this method is only applicable to independent rendering threads in foreground applications, and cannot solve the problem of heavy load on electronic devices or other interface freezes, resulting in a poor user experience.
[0055] In order to solve the above technical problems, the embodiment of the present application proposes a method for processing application threads and an electronic device. In this method, the terminal device can notify the thread information management module of the thread that needs to adjust the scheduling priority by calling the thread scheduling SDK interface. The thread information management module sends the command to the thread scheduling management module, and the thread scheduling management module adjusts the thread scheduling priority. Specifically, for application threads related to user experience, the scheduling priority of the thread is increased by means of RealTimeScheduler (RT scheduler); for application threads that are irrelevant to user experience, the scheduling priority of the thread is reduced by changing the scheduling priority of the thread in the application or the control group (controlgroups, cgroups) of the thread. In this way, the embodiment of the present application can balance the load of terminal devices, solve the problem of application interface jamming, and improve the user experience.
[0056] Among them, the application in the embodiment of the present application can be an embedded application (i.e., a system application of the terminal device) or a downloadable application installed in the terminal device (electronic device). Among them, the embedded application is an application provided as part of the implementation of the terminal device (such as a mobile phone). A downloadable application is an application that can provide its own Internet Protocol Multimedia Subsystem (IMS) connection. The downloadable application can be an application pre-installed in the terminal or a third-party application that can be downloaded and installed in the terminal by the user.
[0057] Exemplarily, the above application may be an embedded application installed in the terminal (i.e., a system application of the terminal). For example, the above application may be a mobile phone manager application, a wallet application, an album application, etc. Alternatively, the above application may also be a downloadable application. For example, the above application may be a shopping application, a food delivery application, etc.
[0058] Optionally, the electronic terminal device in the embodiment of the present application can be a personal computer (PC), a mobile phone, a tablet computer (Pad), a laptop computer, a desktop computer, a laptop computer, a computer with a transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a gateway in smart home, an access point device, a home appliance, a wearable device, a vehicle-mounted device, and other terminal devices. The embodiment of the present application does not impose any special restrictions on the specific form of the terminal device.
[0059] In a possible implementation, the terminal device is taken as a mobile phone. Figure 1A , is a schematic diagram of the hardware structure of a mobile phone provided in an embodiment of the present application. The mobile phone may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a camera 293, and a display screen 294, etc. Optionally, the mobile phone may also include a mobile communication module 250, etc.
[0060] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone. In other embodiments, the mobile phone 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.
[0061] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0062] The controller can be the nerve center and command center of the mobile phone. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0063] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 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 210, and thus improves the efficiency of the system.
[0064] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a USB interface, etc.
[0065] The charging management module 240 is used to receive charging input from the charger. While the charging management module 240 is charging the battery 242, it can also power the mobile phone through the power management module 241. The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 can also receive input from the battery 242 to power the mobile phone.
[0066] The wireless communication function of the mobile phone can be realized through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor and baseband processor.
[0067] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the mobile phone can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0068] When the mobile phone includes a mobile communication module 250, the mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the mobile phone. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0069] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 250 or other functional modules.
[0070] The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (IR), etc., which are applied to mobile phones. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0071] In some embodiments, the antenna 1 of the mobile phone is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the mobile phone can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0072] The mobile phone realizes the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 294 and the application processor. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.
[0073] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can 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. In some embodiments, the mobile phone may include 1 or N display screens 294, where N is a positive integer greater than 1.
[0074] The mobile phone can realize the shooting function through the ISP, the camera 293, the video codec, the GPU, the display screen 294 and the application processor, etc. In some embodiments, the mobile phone can include 1 or N cameras 293, where N is a positive integer greater than 1.
[0075] The external memory interface 220 can be used to connect an external memory card to expand the storage capacity of the mobile phone. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0076] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the mobile phone by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 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.
[0077] The mobile phone can realize audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the earphone interface 270D, and the application processor.
[0078] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain 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.
[0079] Optionally, the execution subject of the thread scheduling method provided in the present application may be a thread scheduling device, which may be Figure 1A The terminal device shown. At the same time, the execution device can also be the central processing unit (CPU) of the terminal device, or the graphics processing unit (GPU) of the terminal device, or the network processor (neural-network processing units, NPU) of the terminal device, or a thread scheduling management module for thread scheduling in the terminal device. In the embodiment of the present application, the scheduling method of executing threads by a terminal device is taken as an example to illustrate the thread scheduling method provided in the embodiment of the present application.
[0080] Figure 1B: is a software structure diagram of a mobile phone in an embodiment of the present invention. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime), the hardware abstraction layer and the kernel layer.
[0081] The application layer can include a series of application packages.
[0082] like Figure 1B As shown, the application package may include applications such as camera, mobile manager, shopping, wallet, short message, food delivery, navigation, Bluetooth, video, etc.
[0083] The application layer may also include a thread scheduling software development kit (SDK) interface, and the thread scheduling SDK interface is used to send the application thread that needs to adjust the scheduling information to the thread information management module.
[0084] 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.
[0085] 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, a thread information management module, and the like.
[0086] 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.
[0087] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0088] 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.
[0089] The phone manager is used to provide the communication functions of the mobile phone, such as the management of call status (including answering, hanging up, etc.).
[0090] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0091] 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. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text. The notification manager can also be a notification that appears on the screen in the form of a dialog window.
[0092] The thread information management module is used to receive application thread adjustment commands from the thread scheduling SDK, and send the application thread adjustment commands to the thread scheduling management module.
[0093] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0094] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0095] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0096] The hardware abstraction layer may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0097] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0098] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0099] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0100] A 2D graphics engine is a drawing engine for 2D drawings.
[0101] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, thread scheduling management module, audio driver, and sensor driver.
[0102] The thread scheduling management module is used to receive the application thread adjustment command from the thread information management module and adjust the application thread scheduling priority.
[0103] In one embodiment, if some threads of the background application have a greater impact on the user experience, the scheduling priority of some threads of the background application may be increased to improve the user experience.
[0104] Optionally, the wallet card (swipe card) interface of the background wallet application is displayed when the foreground application is a video application as an example for introduction. The video application running in the foreground means that the interface displayed by the mobile phone is the display interface of the video application.
[0105] For example, Figure 2 As shown, the video application interface 401 is a foreground application, and the thread scheduling priority of the video application is high. The user can double-click the mobile phone power button 402. In response to the user's double-clicking of the mobile phone power button 402, the mobile phone displays the wallet card interface 403. The wallet application is a background application, and the thread scheduling priority of the wallet application is low. The speed of displaying the wallet card interface 403 is slow.
[0106] The processing method of the application program thread in the embodiment of the present application can improve the scheduling priority of launching the wallet card thread in the wallet application.
[0107] Optional, such as Figure 3 As shown, after the user double-clicks the power button, the wallet card thread of the background wallet application can be started. Afterwards, the embodiment of the present application increases the scheduling priority of the wallet card thread by calling the thread scheduling SDK interface, and displays the wallet card on the mobile phone interface.
[0108] For details, please refer to Figure 4 Steps S101-S108 shown:
[0109] S101: Detect a trigger operation of a user.
[0110] Optionally, the user can double-click the power button of the mobile phone to control the mobile phone to display the wallet card of the wallet application.
[0111] Optionally, the user can also control the mobile phone to display the wallet card of the wallet application through other methods set by the mobile phone system, for example, by long pressing the power button to control the mobile phone to display the wallet application or controlling the mobile phone to display the wallet card of the wallet application during NFC payment. The embodiments of the present application do not impose specific restrictions on this.
[0112] S102: The input module identifies the user's triggering operation and sends it to the activity manager service (AMS).
[0113] S103. AMS pulls up the wallet card of the wallet application.
[0114] Optionally, after receiving the trigger operation from the input module, the AMS identifies the wallet card corresponding to the double-clicking of the power button operation to launch the wallet application. Afterwards, the AMS may send a wallet card launch instruction to the wallet application.
[0115] In other embodiments, different user triggering modes may be set in the AMS to correspond to awakened applications, for example, by long pressing the power button to pull up the wallet application.
[0116] S104: The wallet application determines the priority of the wallet card.
[0117] Optionally, after receiving the wallet card pull-up instruction from the AMS, the wallet application may pull up a wallet card thread, which may be a newly created wallet card thread or may reuse an existing wallet card thread. Exemplarily, the name of the wallet card thread may be mainThread.
[0118] Optionally, the wallet application can determine the priority of the thread according to the task type of the thread execution task, etc. If the thread priority is high, the thread is determined to be an important thread, and the thread information management module is instructed to increase the calling priority of the thread.
[0119] Exemplarily, the name of the wallet card thread is mainThread. The wallet application can determine the priority of the thread corresponding to mainThread according to the name of the wallet card thread mainThread. For example, according to the high priority of the mainThread thread, the thread is judged to be an important thread. The embodiment of the present application does not impose specific restrictions on this.
[0120] Among them, the task type of the thread execution task may include the execution interface display task type, the execution cleanup task type, etc. Among them, the thread that executes the interface display task type has a high calling priority and is an important thread, and the thread that executes the cleanup task type has a high calling priority and is an unimportant thread. Exemplarily, the wallet card thread is the execution interface display task. The wallet application can determine that the wallet card thread is an important thread based on the task type of the wallet card thread execution task, and instruct the thread information management module to increase the calling priority of the wallet card thread.
[0121] In addition, the priority of the thread can also be determined based on the association relationship between threads, and the thread associated with the important thread is a thread with a high priority. For example, other threads associated with the mainThread are important threads with a high priority.
[0122] S105. The wallet application sends an instruction to the thread information management module to increase the scheduling priority of the wallet card thread.
[0123] Optionally, the wallet application may set a priority change flag in the instruction for increasing the scheduling priority of the wallet card thread to indicate that the priority of the thread is changed.
[0124] Optionally, the instruction for increasing the scheduling priority of the wallet card thread may include a priority change flag ChangePriority. When ChangePriority is 1, it indicates that the thread scheduling priority is increased. When ChangePriority is 0, it indicates that the thread scheduling priority is not changed. Optionally, the flag used to indicate the priority in the instruction for increasing the scheduling priority of the wallet card thread is not limited to ChangePriority, but may also include other flags to indicate whether to update or increase or decrease the thread scheduling priority. The embodiment of the present application does not impose specific restrictions on this.
[0125] Exemplarily, the instruction for increasing the scheduling priority of the wallet card thread may include a change priority flag ChangePriority, where ChangePriority is 1, indicating that the scheduling priority of mainThread is increased.
[0126] Optionally, the wallet application can call the thread scheduling SDK interface to send an instruction to the thread information management module to increase the scheduling priority of the wallet card thread.
[0127] For example, mainThread is an important (critical) thread, and the wallet application can call the thread scheduling SDK interface to send an instruction to the thread information management module to increase the scheduling priority of mainThread.
[0128] S106. The thread information management module increases the scheduling priority of the wallet card thread.
[0129] Optionally, after receiving an instruction from the wallet application to increase the scheduling priority of the wallet card thread, the thread information management module may increase the scheduling priority of the wallet card thread through the RT scheduler.
[0130] Exemplarily, the instruction to increase the scheduling priority of the wallet card thread includes a change priority mark ChangePriority, where ChangePriority is 1, indicating to change the scheduling priority of mainThread. The thread information management module determines to increase the scheduling priority of mainThread according to the change priority mark ChangePriority.
[0131] Exemplarily, the thread information management module may adjust the scheduling priority of mainThread from a common thread to a real-time thread, for example, from the original 120 to 96.
[0132] Optional, such as Figure 5 As shown in the figure, the scheduling class has the following five scheduling modes: Stop scheduler, Deadline scheduler, RT scheduler, CFS scheduler, and IDLE-Task scheduler.
[0133] Among them, the Stop scheduler is the scheduling class with the highest scheduling priority. It can preempt all other threads but cannot be preempted by other threads. This scheduler is only used by the kernel. The Deadline scheduler uses a red-black tree to sort threads according to their absolute deadlines and select the smallest thread for scheduling. The RT scheduler is a real-time scheduler that manages real-time threads. The CFS scheduler is a completely fair scheduler that uses a completely fair scheduling algorithm to manage ordinary threads. The IDLE-Task scheduler is an idle scheduler. Each CPU has an idle thread. When there are no other threads to schedule, the idle thread is scheduled and run. This scheduler is only used by the kernel.
[0134] Optionally, threads can be divided into two categories: "real-time threads" and "normal threads". The CFS scheduler schedules normal threads, and the normal thread scheduling priority can be between 100-139. The RT scheduler schedules real-time threads, and the real-time thread scheduling priority can be between 0-99.
[0135] Optionally, the CFS scheduler distributes CPU time fairly. For example, if two tasks with the same scheduling priority run on one CPU, each task will be allocated half of the CPU's running time.
[0136] Specifically, if a machine has one CPU and multiple (computationally intensive) threads, then when using the CFS scheduler, for example, Figure 6 As shown in (a), when the CPU has two threads, thread A and thread B, each thread will occupy 50% of the CPU time; Figure 6 As shown in (b), when the CPU has four threads, thread A, thread B, thread C and thread D, each thread will occupy 25% of the CPU time.
[0137] Optionally, the RT scheduler can complete real-time processing tasks. The scheduling priority of real-time threads is higher than that of ordinary threads. If there is a real-time thread in the execution queue of the current system, the RT scheduler will give priority to executing the real-time thread.
[0138] like Figure 6 As shown in (c), thread A is a real-time thread, and threads B, C, and D are normal threads. Thread A takes up 50% of the CPU time, and threads B, C, and D take up the remaining 50% of the CPU time. When thread A finishes executing, the CPU executes other normal threads.
[0139] Optionally, before the scheduling priority of the wallet card thread is adjusted, the wallet card thread is a common thread, the thread information management module does not change the scheduling priority of the wallet card thread, the wallet card thread is scheduled by the CFS scheduler, and the wallet card thread execution time is longer.
[0140] Optionally, after the scheduling priority of the wallet card thread is adjusted, the thread information management module adjusts the scheduling priority of the wallet card thread through the RT scheduler, adjusts the wallet card thread to a real-time thread, increases the scheduling priority of the wallet card thread, and reduces the execution time of the wallet card thread.
[0141] Exemplarily, the thread information management module can adjust the scheduling priority of mainThread through the RT scheduler. If the original scheduling priority of mainThread is 120, the adjusted scheduling priority of mainThread can be 96.
[0142] Specifically, the real-time thread may include thread 1, thread 2, etc. When the thread information management module adjusts mainThread to a real-time thread, the real-time thread also includes mainThread. The real-time thread scheduling priority is higher than the scheduling priority of the ordinary thread, so that the scheduling priority of mainThread can be improved, the execution time of the wallet card thread can be reduced, and the startup time of the wallet card can be reduced.
[0143] Optionally, the thread information management module sends the mainThread with the increased scheduling priority to the thread scheduling management module.
[0144] S107: The thread scheduling management module calls the wallet card thread with increased scheduling priority.
[0145] Optionally, after receiving mainThread with increased scheduling priority from the thread information management module, the thread scheduling management module calls mainThread according to the increased scheduling priority.
[0146] S108. The mobile phone displays the wallet card.
[0147] For example, when the mobile phone completes processing of the mainThread thread, the mobile phone may display the following Figure 2 Wallet card 403 is shown.
[0148] This can improve the scheduling priority of the wallet card thread of the background wallet application, and the wallet card is quickly displayed in the mobile phone interface to improve the user experience.
[0149] In another embodiment, the background application can also be a phone application (or other applications that can receive incoming calls, such as WeChat applications). When the mobile phone receives an incoming call signal (such as an incoming call indication from a base station), the phone application runs in the background of the mobile phone. The scheduling priority of the incoming call card of the phone application can be increased, and the incoming call card can be quickly pulled up according to the adjusted scheduling priority of the incoming call card. In this way, the scheduling priority of the incoming call card thread in the phone application can be increased, and the incoming call card can be quickly displayed in the mobile phone interface to improve the user experience.
[0150] In another embodiment, if some threads of the foreground application have little impact on the user experience and the correlation between the threads of the foreground application and the response delay is less than a first threshold, the scheduling priority of some threads of the foreground application can be reduced to improve the user experience.
[0151] Optionally, the foreground application is taken as an example of a mobile phone manager application, wherein the mobile phone manager application running in the foreground means that the interface displayed by the mobile phone is the display interface of the mobile phone manager application, such as the cleaning interface of the mobile phone manager.
[0152] For example, Figure 7 As shown in (a), the interface 501 of the mobile phone manager application is shown. The mobile phone manager application is the foreground application and has a higher thread scheduling priority. The user can click the cleaning acceleration control 502 on the mobile phone manager interface 501 to clean the phone. In response to the user clicking the cleaning acceleration control 502, the mobile phone can display the following Figure 7 The interface 503 shown in (b) of FIG. 5 includes the used memory space of the mobile phone, the total memory space, and the recommended contents to be cleaned up: junk files, online videos, pictures, application data, etc. The user can click the "Clean Up Now" control 504 for junk files. In response to the user clicking the "Clean Up Now" control 504 for junk files, the mobile phone cleans up the junk files, such as Figure 7 As shown in (c) of FIG. 5 , the “Clean Now” control 504 changes to the “Clean Up” control 504′, and junk files are being reduced (from Figure 7 The 445MB in (b) becomes Figure 7400MB in (c)).
[0153] Optionally, while cleaning junk files, the user can also click on the "go to clean" control 505 of the picture. In response to the user clicking on the "go to clean" control 505 of the picture, the mobile phone displays the following Figure 7 (d) shows a picture cleaning interface 506, which includes recently taken pictures. The user can select the pictures to be cleaned and click the delete control 507 to delete the selected pictures.
[0154] Optionally, the mobile phone manager application is a foreground application. When junk files are being cleaned, the cleaning thread has a high load, occupies more CPU resources, and the user does not perceive the cleaning effect clearly. When junk files are being cleaned, if the user clicks other controls (such as the "go to clean" control 505 of the photo) or slides the mobile phone interface, the mobile phone response speed may slow down, affecting the user experience.
[0155] The embodiment of the present application can reduce the scheduling priority of the cleaning thread to ensure the user's operating experience. Figure 8 Steps S201-S206 shown:
[0156] S201. The user clicks on the cleanup control in the mobile manager application.
[0157] Optionally, the user can click the cleanup control to clean up the phone's memory.
[0158] Exemplarily, the user can click on the "Clean Up Now" control 504 of the junk files in the mobile phone manager application. In response to the user clicking on the "Clean Up Now" control 504 of the junk files, the mobile phone can clean up the junk files.
[0159] S202: The mobile phone manager application determines the priority of the cleaning thread.
[0160] Optionally, in response to the operation of clicking the cleanup control, the mobile phone manager application may start a cleanup thread, which may be a newly created cleanup thread or may reuse an existing cleanup thread. Exemplarily, the name of the cleanup thread may be cleanThread.
[0161] The mobile phone manager application can determine whether the thread calling priority is low, that is, whether it is an unimportant thread, according to the task type of the thread execution task, and instruct the thread information management module to lower the calling priority of the thread.
[0162] Exemplarily, the mobile phone manager application can determine that the calling priority of the cleaning thread is low and it is an unimportant thread according to the task type of the task executed by the cleaning thread, and instruct the thread information management module to lower the calling priority of the cleaning thread.
[0163] In addition, the priority of the thread can also be determined based on the association relationship between threads, and the thread associated with the important thread is a thread with a high priority. For example, other threads associated with the cleanThread are important threads with a high priority.
[0164] As another example, the mobile phone manager application may determine that the calling priority of the traffic management thread is high according to the task type of the task executed by the traffic management thread, and does not instruct the thread information management module to adjust the priority of the traffic management thread.
[0165] Optionally, the mobile phone manager application can also confirm that cleanThread has a high calling priority over other threads associated with it, and this embodiment of the application does not impose any specific restrictions on this.
[0166] In addition, the priority of the thread can also be determined based on the association relationship between threads, and the thread associated with the important thread is a thread with a high priority. For example, other threads associated with the traffic management thread are important threads with a high priority.
[0167] S203: The mobile phone manager application sends an instruction to the thread information management module to reduce the scheduling priority of the cleaning thread.
[0168] Optionally, the mobile phone manager application may set a priority change flag in the instruction for reducing the scheduling priority of the cleanup thread to indicate that the priority of the thread is changed.
[0169] Optionally, the instruction for reducing the scheduling priority of the cleanup thread may include a priority reduction flag DecreasePriori ty, when Decrease Priori ty is 1, it indicates that the thread scheduling priority is reduced, and when Decrease Priority is 0, it indicates that the thread scheduling priority is not changed. Optionally, the flag used to indicate the priority in the instruction for reducing the scheduling priority of the cleanup thread is not limited to Decrease Priori ty, and may also include other flags to indicate whether to update or increase or reduce the thread scheduling priority, and the embodiment of the present application does not impose specific restrictions on this.
[0170] Exemplarily, the instruction for reducing the scheduling priority of the clean thread may include a priority reduction flag, Decrease Priority, where Decrease Priority is 1, indicating that the scheduling priority of cleanThread is increased.
[0171] Optionally, the mobile phone manager application can call the thread scheduling SDK interface to send an instruction to reduce the scheduling priority of cleanThread to the thread information management module.
[0172] S204: The thread information management module lowers the scheduling priority of the cleaning thread.
[0173] Optionally, after receiving an instruction from the mobile phone manager application to lower the scheduling priority of cleanThread, the thread information management module may lower the scheduling priority of cleanThread by lowering the scheduling priority of cleanThread in ordinary threads.
[0174] Exemplarily, cleanThread includes a priority reduction flag, Decrease Priority, where DecreasePriority is 1, indicating that the scheduling priority of cleanThread is reduced.
[0175] Optionally, cleanThread is a common thread, which is scheduled by the CFS scheduler. The thread information management module can appropriately reduce the priority of cleanThread.
[0176] Exemplarily, the thread information management module may reduce the scheduling priority of cleanThread from 120 to 130.
[0177] Optionally, the mobile phone manager application may also adjust the scheduling priority of cleanThread and other threads associated with it, and this embodiment of the application does not impose any specific restrictions on this.
[0178] Optionally, after receiving the instruction to lower the scheduling priority of cleanThread from the mobile phone manager application, the thread information management module can lower the scheduling priority of cleanThread by adjusting the control group of cleanThread.
[0179] Exemplarily, according to the instructions of the thread management module, the control group of cleanThread is adjusted. For example, the grouping of the clean thread is adjusted from the top-app grouping to the BG grouping. The grouping of the clean thread can also be adjusted to other groups that can use CPU resources or have a smaller running time for the grouped threads, such as the restricted group. The embodiments of the present application do not impose specific restrictions on this.
[0180] Optionally, a control group is a mechanism provided by the kernel to limit, record, and isolate the physical resources used by process groups (threads). This mechanism can integrate (or separate) a series of system tasks and their subtasks into different groups divided by resource levels as needed. Tasks in different groups can be allocated controllable proportions of CPU resources under high load, thus providing a unified framework for system resource management.
[0181] Optionally, the Cgroup grouping may include CPUset (cpu affinity set) and CPUct l (cpucontrol). CPUset and CPUct l are tools related to CPU scheduling and management, which can control and allocate CPU resources. The thread information management module can limit the CPU resources used by threads through CPUset and CPUct l.
[0182] Optionally, the grouping of CPUsets in the mobile phone can limit the CPU resources that can be used by threads in each group. The grouping of CPUsets can include application background (BG) grouping, application foreground (foreground) grouping, system (system) BG grouping, top-app grouping, restricted grouping, etc.
[0183] Optionally, taking a quad-core CPU as an example, the CPU includes small core CPU0, medium core CPU1, medium core CPU2, and large core CPU3. Among them, threads in the BG group only run on small core CPU0; threads in the foreground group can run on small core CPU0 or medium core CPU1 or medium core CPU2; threads in the system BG group can run on small core CPU0 or medium core CPU1 or medium core CPU2; threads in the top-app group can run on small core CPU0 or medium core CPU1 or medium core CPU2 or large core CPU3; restricted group can run on small core CPU0 or medium core CPU1.
[0184] Optionally, Cpuct l can limit the time that threads in each group can run. Exemplarily, threads in the top-app group can obtain a higher proportion of CPU time slices than threads in other groups, and threads can call CPU resources within the obtained CPU time slices. Threads in the BG group can only obtain a lower proportion of CPU time slices than threads in other groups, and threads can only call CPU resources within the obtained CPU time slices. Among them, the time slice is the time allocated by the CPU to each thread (or threads). The time period allocated to each thread can be called a time slice of the thread, that is, the time allowed for the thread to run.
[0185] For example, the CPU group includes two groups, the top-app group and the BG group. The time control parameter corresponding to the top-app group can be 200, and the time control parameter corresponding to the BG group can be 100. Then, the time ratio of the applications in the top-app group and the applications in the BG group that can occupy the CPU resources is 3:2. When the idle time slices of the CPU resources are 300, when allocating the CPU idle time slices, 200 of the 300 time slices can be allocated to the applications in the top-app group, and the remaining 100 time slices can be allocated to the applications in the BG group.
[0186] After the cleanup thread is created, that is, before the grouping of the cleanup thread is adjusted, it is located in the top-app grouping and can run in the small-core CPU0 or the medium-core CPU1 or the medium-core CPU2 or the large-core CPU3. The time control parameter corresponding to the top-app grouping can be 200, and more CPU resources can be used, and the running time of the cleanup thread is longer. After the grouping of the cleanup thread is adjusted, the thread information management module can adjust the CPUset grouping of the cleanup thread to the BG grouping, restricting the cleanup thread to run only on the small-core CPU or the medium-core CPU1 or the medium-core CPU2, and limiting the running time of the cleanup thread in the BG grouping to 100, thereby reducing the scheduling priority of the cleanup thread, and letting other threads use the medium-core or large-core CPU resources as much as possible, ensuring the smooth operation of other operations and improving the user experience.
[0187] Optionally, the thread information management module sends the cleanThread with the scheduling priority reduced to the thread scheduling management module.
[0188] S205: The thread scheduling management module calls the cleanup thread after the scheduling priority is lowered.
[0189] Optionally, the thread scheduling management module receives the cleanThread with the scheduling priority reduced from the thread information management module and may call the cleanThread according to the reduced scheduling priority.
[0190] S206: The mobile phone manager application executes the cleanup thread according to the reduced scheduling priority.
[0191] Optional, such as Figure 7 As shown in (b), the user clicks the clean up immediately control 504, and the mobile phone manager application responds to the user clicking the clean up immediately control 504 and displays the following Figure 7 Interface 503 shown in (c) of FIG. 503 is displayed, and junk files are cleaned up. The time for the mobile phone manager application to perform the cleaning operation is extended. In this way, the scheduling priority of the cleaning thread of the mobile phone manager application in the foreground can be reduced, the CPU load can be reduced, and the process execution of other threads can be guaranteed to improve the user experience. For example, Figure 7 As shown in (c), after the user clicks the cleanup control 505, the mobile manager application displays the following Figure 7 In interface 506 shown in (d), when the scheduling priority of cleanThread is lowered, the time for the mobile phone manager application to perform the cleaning operation is extended, the priority of the related threads displayed in interface 506 is correspondingly increased or occupies more CPU resources, the display time is reduced, and the user experience is improved.
[0192] In another embodiment, if there are many threads in the foreground application, the scheduling priority of some threads that have less impact on user experience can be lowered, that is, some threads in the foreground application whose correlation with response delay is greater than a first threshold can be lowered to improve user experience.
[0193] For example, if the foreground application includes a main tap page and at least one secondary tab page, when multiple tab pages are loaded at the same time, the CPU load is heavy, and the embodiment of the present application can reduce the scheduling priority of the secondary tab page loading thread to reduce the CPU load. The main tap page is the tab page that the foreground application is currently displaying or jumping to display, and the secondary tap page is the tap page that the foreground application is not currently displaying.
[0194] Optionally, the foreground application is a browser application as an example for introduction. Optionally, the foreground application can also be other applications, such as a shopping application, etc., and the embodiment of the present application does not make specific restrictions on this.
[0195] For example, Fig. 9 As shown in (a), it is the main interface 601 of the mobile phone. Among them, the main interface 601 can be the interface displayed after the mobile phone 1 is turned on, but it is not limited to other interfaces, such as the background interface, such as the negative one screen. The main interface 601 can include various applications (apps) installed on the mobile phone. For example, it can include icons of APPs that come with the mobile phone, such as clock, calendar, gallery (album) application, memo, file management, email, music player, calculator, video player, sports health, weather, browser 602, camera, phone, information, address book, etc. For another example, it can also include third-party APPs, such as online games, chat software, etc.
[0196] Optionally, the user can click on the browser application 602 of the mobile phone main interface 601. In response to the user clicking on the browser application 602, the mobile phone can display the following Fig. 9The interface 603 shown in (b) of FIG. 6 shows that the browser application is a foreground application, and the thread scheduling priority of the browser application is higher. Optionally, the interface 603 of the browser application includes five tab pages: all tab pages, news tab pages, video tab pages, map tab pages, and more tab pages.
[0197] Optionally, when the user opens the browser application, the mobile phone interface displays the interface of all tab pages 603. At this time, the main tap page is the all tab page, and the secondary tap page is the news tab page, the video tab page, the map tab page and the more tab page.
[0198] Optionally, the user can click on the video control 604. In response to the user clicking on the video control 604, the mobile phone displays the following Fig. 9 (c) shows the video tab page interface 605. At this time, the main tap page is the video tab page, and the secondary tap pages are the all tab page, the news tab page, the map tab page, and the more tab page.
[0199] The embodiment of the present application can reduce the scheduling priority of the secondary tap page thread and reduce the CPU load. Fig.10 Steps S301-S306 and S311-S316 shown:
[0200] S301: The user opens a browser application.
[0201] Optionally, the user clicks on the browser application to open the browser application.
[0202] Exemplarily, the user may click on the browser application 602. In response to the user clicking on the browser application 602, the mobile phone may display an interface 603 of the browser application.
[0203] S302: The browser application determines the priority of the thread for loading the tab page.
[0204] Optionally, in response to the operation for clicking the browser application, the browser application may pull up a thread for loading all tab pages, a thread for loading news tab pages, a thread for loading videos tab pages, a thread for loading maps tab pages, and a thread for loading more tab pages. The multiple threads for loading tab pages may be newly created or may reuse existing threads for loading tab pages.
[0205] Optionally, the browser application may determine that the priority of the thread for loading the secondary tap page is low and is an unimportant thread according to the task types of the tasks executed by the multiple loading threads, and instruct the thread information management module to lower the calling priority of the thread for loading the secondary tap page.
[0206] Exemplarily, the thread for loading a secondary tap page may be a thread for loading a news tab page, a thread for loading a video tab page, a thread for loading a map tab page, and a thread for loading more tab pages.
[0207] Optionally, the browser application may also determine that other low-priority threads associated with multiple loading tab threads are unimportant threads, and the embodiments of the present application do not impose any specific restrictions on this.
[0208] S303: The browser application sends an instruction to the thread information management module to reduce the scheduling priority of the thread loading the secondary tap page.
[0209] Optionally, the browser application may set a priority change flag in the instruction for reducing the scheduling priority of the thread for loading the secondary tap page to indicate that the priority of the thread is changed.
[0210] Optionally, the instruction for reducing the scheduling priority of the thread for loading the secondary tap page may include a priority reduction flag, Decrease Priority, where Decrease Priority is 1, indicating that the scheduling priority of the thread for loading the secondary tab page is reduced.
[0211] Exemplarily, loading the news tab page thread, loading the video tab page thread, loading the map tab page thread, and loading more tab page threads may include a priority change flag, a priority reduction flag, Decrease Priori ty, where Decrease Priori ty is 1; indicating that the scheduling priority of loading the news tab page thread, loading the video tab page thread, loading the map tab page thread, and loading more tab page threads is reduced.
[0212] Optionally, the browser application may call a thread scheduling SDK interface to send an instruction to the thread information management module to reduce the scheduling priority of the thread for loading the secondary tap page.
[0213] S304: The thread information management module lowers the scheduling priority of the thread that loads the secondary tap page.
[0214] Optionally, after the thread information management module receives an instruction from the browser application to lower the scheduling priority of the thread loading the secondary tap page, it can lower the scheduling priority of the thread loading the secondary tap page by adjusting the scheduling priority of the thread loading the secondary tap page in ordinary threads or adjusting the control group of the thread loading the secondary tap page.
[0215] Exemplarily, the instruction for reducing the scheduling priority of the thread for loading the secondary tap page includes a priority reduction flag Decrease Priority, where Decrease Priority is 1, indicating that the scheduling priority of the thread for loading the secondary tap page is reduced.
[0216] Optionally, the thread for loading the secondary tap page is a common thread, which is scheduled by the CFS scheduler. The thread information management module can appropriately reduce the priority of the thread for loading the secondary tap page.
[0217] Exemplarily, the thread information management module may reduce the scheduling priority of the thread for loading the secondary tap page from 120 to 130.
[0218] For details, please refer to the method of lowering the scheduling priority of the cleaning thread in step S204 above, which will not be described in detail here.
[0219] After the loading tap page thread is pulled up, that is, before the grouping of the loading tap page thread is adjusted, it is located in the top-app group and can run in the small core CPU0 or the medium core CPU1 or the medium core CPU2 or the large core CPU3. The time control parameter corresponding to the top-app group can be 200, and more CPU resources can be used, and the running time of the loading tap page thread is longer. After the grouping of the loading tap page thread is adjusted, the thread information management module can set the CPUset grouping of the loading tap page thread to the BG grouping, restricting the loading tap page thread to run only on the small core CPU or the medium core CPU1 or the medium core CPU2, and limiting the running time of the loading tap page thread in the BG grouping to 100, thereby reducing the scheduling priority of the loading tap page thread, and letting the medium core or large core CPU resources be used by the loading main tap page thread as much as possible, ensuring the smooth operation of the loading tap page thread and improving the user experience.
[0220] Optionally, the grouping adjustment of the threads loading the secondary tap pages is not limited to adjusting the BG grouping from the top-app grouping. The groups loading the secondary tap pages can also be adjusted to other groups that can use CPU resources or have a smaller thread running time, such as restricted groups. The embodiments of the present application do not impose specific restrictions on this.
[0221] Optionally, the thread information management module sends the thread for loading the secondary tap page after reducing the scheduling priority to the thread scheduling management module.
[0222] S305: The thread scheduling management module calls the thread for loading the secondary tap page after reducing the scheduling priority.
[0223] Optionally, the thread scheduling management module receives the thread for loading the secondary tap page after the scheduling priority is reduced from the thread information management module, and can call the thread for loading the secondary tap page according to the reduced scheduling priority.
[0224] S306: The browser application displays the main tap page.
[0225] Optionally, after the browser application completes processing of the multiple tap page loading threads, the browser application may display the main tap page. Fig. 9 Interface 603 shown in (b).
[0226] Optionally, when the user clicks the control to control the browser application to display other secondary tap pages, the thread scheduling management module can reduce the scheduling priority of the thread loading all tap pages and restore the scheduling priority of the secondary tap page.
[0227] For example, the video tap page displayed by the browser application is used as an example for introduction. For details, please refer to Fig.10 Steps S311-S316 shown:
[0228] S311. The user clicks a video control.
[0229] Optionally, the user clicks on the video control to control the browser application to display the video interface.
[0230] Exemplarily, the user may click on the video control 604. In response to the user clicking on the video control 604, the mobile phone displays an interface 605 of the video application.
[0231] S312: The browser application determines the priority of the thread for loading the video tab page.
[0232] Optionally, at this time, the video tap page is the primary tap page, and all tap pages are secondary tap pages.
[0233] The browser application can confirm that the priority of the thread for loading all tab pages is low and is an unimportant thread, and call the thread scheduling SDK interface to lower the scheduling priority of the thread for loading all tab pages and restore the priority of the thread for loading the video tab page.
[0234] S313. The browser application sends an instruction to the thread information management module to restore the scheduling priority of the thread loading the video tap page and to reduce the scheduling priority of the thread loading all tap pages.
[0235] Optionally, the instruction may include a recovery priority identifier RecoveryPriority. When RecoveryPriority is 1, it indicates that the thread scheduling priority is restored. When RecoveryPriority is 0, it indicates that the thread scheduling priority is not restored.
[0236] Exemplarily, the instruction includes a recovery priority identifier RecoveryPriority, and RecoveryPriority is 1, indicating the scheduling priority of the thread for recovering the video tab page.
[0237] Optionally, the instruction may include a priority reduction flag, Decrease Priority, where Decrease Priority is 1, indicating that the scheduling priority of the thread for loading all tap pages is reduced.
[0238] Optionally, the browser application may call the thread scheduling SDK interface to send an instruction to the thread information management module to restore the scheduling priority of the thread for loading the video tap page and to reduce the scheduling priority of the thread for loading all tap pages.
[0239] S314. The thread information management module restores the scheduling priority of the thread for loading the video tap page, and reduces the scheduling priority of the thread for loading all tap pages.
[0240] Optionally, after receiving the instruction from the browser application to resume the scheduling priority of the thread for loading the video tap page and lower the scheduling priority of the thread for loading all tap pages, the thread information management module can adjust the scheduling priority of the thread for loading the secondary tap page in the ordinary thread or adjust the control group of the thread for loading all tap pages to lower the scheduling priority of the thread for loading all tap pages. For details, please refer to the content of the above step S304.
[0241] Optionally, the thread information management module sends the thread for loading the video tap page after the scheduling priority is restored and the thread for loading all tap pages after the scheduling priority is lowered to the thread scheduling management module.
[0242] S315. The thread scheduling management module calls the thread for loading the video tap page after restoring the scheduling priority, and the thread for loading all tap pages after lowering the scheduling priority.
[0243] S316: The browser application displays the video tap page.
[0244] Optionally, after the browser application completes processing of the multiple tap page loading threads, the browser application may display the following: Fig. 9 (c) shows the video tap page interface 605.
[0245] In this way, if there are many threads in the foreground browser application, the scheduling priority of some threads that have less impact on user experience can be reduced to ensure the scheduling priority of the main thread, so as to improve user experience.
[0246] It should be noted that some operations in the processes of the above-mentioned method embodiments are optionally combined, and / or the order of some operations is optionally changed. In addition, the execution order between the steps of each process is only exemplary and does not constitute a limitation on the execution order between the steps. There may be other execution orders between the steps. It is not intended to indicate that the execution order is the only order in which these operations can be performed. A person of ordinary skill in the art will think of a variety of ways to reorder the operations described herein. In addition, it should be noted that the process details involved in a certain embodiment of this invention are also applicable to other embodiments in a similar manner, or different embodiments can be used in combination.
[0247] In addition, some steps in the method embodiment may be equivalently replaced by other possible steps. Alternatively, some steps in the method embodiment may be optional and may be deleted in certain usage scenarios. Alternatively, other possible steps may be added to the method embodiment.
[0248] Furthermore, the above method embodiments may be implemented separately or in combination.
[0249] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected through lines. For example, the interface circuit can be used to receive signals from other devices. For another example, the interface circuit can be used to send signals to other devices. Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the terminal device can execute the various steps executed by the mobile phone in the above embodiment. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiment of the present application.
[0250] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a terminal device, the terminal device executes the above-mentioned related method steps to implement the health assessment method in the above-mentioned embodiment.
[0251] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the health assessment method in the above-mentioned embodiment.
[0252] In addition, an embodiment of the present application also provides a device, which may specifically be a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory so that the device executes the health assessment method in the above-mentioned method embodiments.
[0253] Among them, the terminal device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0254] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0255] In the several embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. For example, the terminal device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another 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, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.
[0256] The units described 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.
[0257] 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.
[0258] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on 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 readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned readable storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program instructions.
[0259] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing an application thread, characterized in that: The method is executed by a terminal device, and includes: receiving a first indication, wherein the first indication is used to instruct a terminal device to display a first application running in the background on the terminal device; Increasing the scheduling priority of the first thread corresponding to the first application; Processing the first thread according to the increased scheduling priority of the first thread; The interface of the first application is displayed.
2. The method according to claim 1, characterized in that The receiving a first indication comprises: An operation performed by a user on the terminal device is detected.
3. The method according to any one of claims 1 to 2, characterized in that: The first application is a wallet application, the first indication is an operation of waking up the wallet application, and the first thread is a wallet card thread.
4. The method according to claim 1, characterized in that: The first application is a call application, and receiving the first indication includes: The terminal device obtains incoming call information.
5. The method according to any one of claims 1 to 4, characterized in that: The step of increasing the scheduling priority of the first thread corresponding to the first application includes: The first thread corresponding to the first application is adjusted from a common thread to a real-time thread.
6. The method according to any one of claims 1 to 5, characterized in that: The step of increasing the scheduling priority of the first thread corresponding to the first application includes: Determine a calling priority of the first thread according to a task type of the first thread.
7. The method according to any one of claims 1 to 6, characterized in that: The first application further corresponds to a third thread, the third thread is related to the first thread, and the step of increasing the scheduling priority of the first thread corresponding to the first application includes: The scheduling priorities of the first thread and the third thread corresponding to the first application are increased.
8. A method for processing an application thread, characterized in that: The method is executed by a terminal device, and includes: receiving a second instruction; Starting a second thread related to a second application according to the second instruction; Lowering the scheduling priority of the second thread; The second thread is processed according to the reduced scheduling priority of the second thread.
9. The method according to claim 8, characterized in that The receiving the second indication comprises: An operation performed by a user on the terminal device is detected.
10. The method according to claim 8 or 9, characterized in that: The second application is a mobile phone manager application, and the second thread is a cleaning thread.
11. The method according to claim 8 or 9, characterized in that: The second application includes a first page and a second page, the second indication is used to display the first page; the second thread is the thread for loading the second page; the scheduling priority of the second thread is lower than the scheduling priority of the thread for loading the first page.
12. The method according to claim 11, characterized in that The method further comprises: receiving a third instruction, where the third instruction is used to display the second page; Raising the scheduling priority of the second thread and lowering the scheduling priority of the first thread; The second thread is processed according to the increased scheduling priority of the second thread, and the first thread is processed according to the decreased scheduling priority of the first page thread.
13. The method according to any one of claims 8 to 12, characterized in that: The lowering of the scheduling priority of the second thread corresponding to the second application includes: The second thread is adjusted from a first group to a second group, the CPU resources used by the first group and / or the time for using the CPU resources being higher than those of the second group.
14. The method according to any one of claims 8 to 12, characterized in that: The second thread is a common thread, and lowering the scheduling priority of the second thread corresponding to the second application includes: lowering the priority ranking of the second thread.
15. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on a terminal device, enable the terminal device to execute the method as claimed in any one of claims 1 to 7, or execute the method as claimed in any one of claims 8 to 14.
16. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor reads the computer instructions from the memory, so that the electronic device executes the method as described in any one of claims 1-7, or executes the method as described in any one of claims 8-14.
Citation Information
Cited By
Priority allocation method, reply rule matching method and device, electronic equipment and program product
CN120541276A