Web kernel-based thread scheduling method and electronic equipment

By adjusting thread scheduling priority and resource allocation, the problem of rendering thread being preempted is solved, the rendering response delay is reduced and the user experience is improved, ensuring timely and effective rendering of the rendering scene.

CN120335941APending Publication Date: 2025-07-18HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410075227.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-18
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

Under high frame rates and high loads, applications developed using web components have a large rendering response delay, which is difficult to meet user needs because the rendering thread is preempted by other threads.

Method used

By adjusting thread scheduling priorities, the priority of the rendering thread is raised to a higher level, and migrating or inserting it to an idle processing unit when necessary to run, ensuring that the rendering thread is scheduled first, and at the same time allocating other resources to the auxiliary threads to achieve coordinated work between rendering and data transmission.

Benefits of technology

Reduces the rendering response delay, improves the user experience, ensures timely and efficient rendering of the rendering scene, and avoids other threads waiting too long due to resource preemption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335941A_ABST
    Figure CN120335941A_ABST
Patent Text Reader

Abstract

The invention provides a thread scheduling method based on a web kernel and electronic equipment. The method comprises the steps that first operation is received, the first operation is used for triggering the electronic equipment to enter a rendering scene of a first application, in response to the first operation, the scheduling priority of a first target thread is updated to a first level from a first preset level, and the scheduling priority of a second target thread is updated to a second level from a second preset level, the first target thread is scheduled according to the first level, the second target thread is scheduled according to the second level, the first preset level is the default scheduling priority of the first target thread, and the second preset level is the default scheduling priority of the second target thread. According to the method, by correspondingly adjusting the scheduling priority of the first target thread and the scheduling priority of the second target thread, the first target thread and the second target thread can be scheduled preferentially, and the rendering response time delay can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminals, and in particular, to a thread scheduling method based on a web kernel and an electronic device. Background Art

[0002] With the rapid development of electronic devices (such as smart phones), the applications installed on electronic devices are becoming more and more diverse. Among them, the applications installed on electronic devices need to meet the relevant requirements of the operating system (OS) configured by the electronic device.

[0003] For example, some applications developed using web components installed on an electronic device (such as a negative one-screen application or a play machine skills application, etc.) have a problem that the rendering thread is preempted by other threads under high frame rates (such as 120HZ) and high load requirements. Therefore, the rendering response delay of applications developed using web components is relatively large, making it difficult to meet user needs. Summary of the Invention

[0004] This application provides a thread scheduling method based on a web kernel and an electronic device, so as to achieve preferential scheduling of the rendering thread, thereby reducing the rendering response delay.

[0005] In a first aspect, this application provides a thread scheduling method based on a web kernel. This method can be executed by an electronic device or a component in the electronic device (such as a processor, a processing unit, or a chip, etc.). Exemplarily, hereinafter, taking the electronic device executing the thread scheduling method based on the web kernel as an example. This method may include the following steps: The electronic device receives a first operation, and the first operation is used to trigger the electronic device to enter the rendering scene of a first application. After that, in response to the first operation, the electronic device can update the scheduling priority of a first target thread from a first preset level to a first level, and can update the scheduling priority of a second target thread from a second preset level to a second level. Then, the electronic device can schedule the first target thread according to the first level, and can schedule the second target thread according to the second level, where the first preset level is the default scheduling priority of the first target thread, and the second preset level is the default scheduling priority of the second target thread.

[0006] In this method, by responding to the first operation (that is, by recognizing through the first operation that the electronic device enters the rendering scene of the first application), the scheduling priorities of the first target thread and the second target thread are respectively adjusted accordingly. In this way, the first target thread and the second target thread can be preferentially scheduled, which helps to reduce the rendering response delay, and thus can well meet user needs, so as to improve the user experience.

[0007] In one possible design, the method also includes: after a first period of time, the electronic device may restore the scheduling priority of the first target thread from the first level to the first preset level, and after a second period of time, the electronic device may also restore the scheduling priority of the second target thread from the second level to the second preset level.

[0008] In the above design, by configuring an effective duration for the updated scheduling priorities of the first target thread and the second target thread, it is possible to ensure that the rendering scene is rendered fully and effectively while ensuring that other threads are scheduled in a timely and effective manner, thereby effectively avoiding the scheduling of the first target thread and the second target thread taking up too long, and effectively avoiding the situation where other threads have to wait too long due to the preemption of running resources.

[0009] In one possible design, the first level is higher than the second level.

[0010] In the above design, by configuring the first level to be higher than the second level, the first target thread and the second target thread can be staggered in scheduling under limited operating resources, so that the first target thread and the second target thread can be prioritized in scheduling using different operating resources. For example, the first target thread is a web rendering pipeline thread, and the second target thread is a thread used to assist in data transfer between the first target threads. When the first level is higher than the second level, the web rendering pipeline thread can be preferentially allocated operating resources so as to be preferentially scheduled. Moreover, in order to make the rendering response delay meet the needs of users, the thread used to assist in data transfer between web rendering pipeline threads is also allocated to be preferentially scheduled using other corresponding operating resources.

[0011] In one possible design, the method also includes: running the first target thread on the first processing unit, the electronic device can migrate the second target thread to an idle processing unit for priority execution, or the electronic device can insert the second target thread before the third target thread for execution, wherein the scheduling priority of the third target thread is lower than the second level.

[0012] In the above design, if the first level is higher than the second level, when the first target thread has been scheduled to run on the first processing unit, if the available resources on the first processing unit are not sufficient to support the second target thread to run, the electronic device can migrate the second target thread to a free processing unit to run preferentially, or can insert the second target thread before the third target thread whose scheduling priority is lower than that of the second target thread to run. In this way, this design can make both the first target thread and the second target thread be preferentially scheduled, which can help to complete the rendering process of the rendering scene in a timely and effective manner, and can effectively avoid the situation that the target thread for rendering the scene is preempted to obtain running resources and thus is scheduled in a timely manner.

[0013] In a possible design, the first target thread can be used to execute the rendering task of the rendering scene, and the second target thread can be used to execute the data communication task of the rendering scene.

[0014] In the above design, by configuring the first target thread and the second target thread to execute different tasks of the rendering scene respectively, this can enable the first target thread and the second target thread to work effectively in cooperation and jointly complete the rendering process of the rendering scene.

[0015] In a possible design, the first target thread is a web rendering pipeline thread, and the second target thread is a thread used to assist in data transmission between the first target threads (such as web rendering pipeline threads).

[0016] In the above design, the first target thread is responsible for executing the rendering task of the rendering scene, and the second target thread is responsible for executing the data transmission task of the rendering scene, which can ensure that the rendering scene is rendered in a timely and effective manner.

[0017] In a possible design, the rendering scene is one of the following scenes: web page loading scene, click scene, sliding scene, application window size adjustment scene or tab page focus switching scene.

[0018] In the above design, after the electronic device recognizes any one of the above several scenes triggered by the user on the first application on the electronic device, it can immediately start the update process of the scheduling priorities of the first target thread and the second target thread involved in this scene.

[0019] In a second aspect, an embodiment of the present application further provides an electronic device, and this electronic device includes modules / units that execute the methods in the above first aspect and any possible scenario in the first aspect. These modules / units can be implemented by hardware or by hardware executing corresponding software.

[0020] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. Optionally, the electronic device may further include a display screen. The display screen is configured to display a user interface; the memory is used to store one or more computer programs, and the one or more computer programs include computer instructions. When the computer instructions are executed by the processor, the electronic device is caused to execute the methods in the first aspect and any possible design of the first aspect.

[0021] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which includes a computer program. When the computer program runs on an electronic device, the electronic device is caused to execute the methods in the above-mentioned first aspect and any possible design of the first aspect.

[0022] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program or instruction. When the computer program or instruction runs on an electronic device, the electronic device is caused to execute the methods in the above-mentioned first aspect and any possible design of the first aspect.

[0023] In a sixth aspect, the present application provides a chip. The chip is located on an electronic device. The chip may include a processor and may further include a memory (or the chip is coupled to a storage). The chip executes program instructions in the storage to cause the electronic device to execute the methods in the above-mentioned first aspect and any possible design of the first aspect. Herein, "coupled" means that two components are directly or indirectly combined with each other. For example, coupling may refer to an electrical connection between two components.

[0024] In a seventh aspect, the present application further provides a chip system. The chip system is located on an electronic device. The chip system may include a processor, which is used to support the electronic device to implement the methods in the above-mentioned first aspect and any possible design of the first aspect. In a possible design, the chip system further includes a memory, which is used to store necessary programs and data of the computer device. The chip system may be composed of chips or may include chips and other discrete devices.

[0025] Based on the implementation manners provided in the above aspects of the present application, further combinations may be made to provide more implementation manners. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application is exemplarily shown;

[0027] Figure 2 A schematic diagram of the hierarchical software structure of an electronic device provided by an embodiment of the present application is exemplarily shown;

[0028] Figure 3 Exemplarily shown is a schematic flow chart of a thread scheduling method provided by an embodiment of the present application based on a web kernel;

[0029] Figure 4 Exemplarily shown is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0030] The thread scheduling method provided by the embodiment of the present application can be applicable to an electronic device. Among them, the electronic device, also known as a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc., is a device that provides voice or data connectivity to a user, and can also be an Internet of Things device. For example, the electronic device includes a handheld device with a wireless connection function, a vehicle-mounted device, etc. Currently, the electronic device can be: a mobile phone, a tablet computer, a laptop computer, a handheld computer, a mobile internet device (MID), a wearable device (such as a smart watch, a smart bracelet, a pedometer, etc.), a vehicle-mounted device (such as a car, a bicycle, an electric vehicle, an airplane, a ship, a train, a high-speed train, etc.), a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a smart home device (such as a refrigerator, a television, an air conditioner, an electric meter, etc.), a smart robot, a workshop device, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, or a wireless terminal in a smart home, a flight device (such as a smart robot, a hot air balloon, a drone, an airplane), etc. The electronic device can also be a device that serves as a terminal function in device-to-device (D2D) communication. The electronic device involved in the embodiment of the present application can be a foldable electronic device, such as a foldable mobile phone, a foldable tablet computer, etc., and the present application does not make any limitations in this regard. Moreover, exemplary embodiments of the electronic device include, but are not limited to, those equipped with HarmonyOS or other operating systems.

[0031] The following explains some terms in this application to facilitate understanding by those skilled in the art.

[0032] (1) Process (process, job, task): It is the running activity of a program in a computer with respect to a certain data set, for resource allocation and scheduling, and is the basis of the operating system structure. When an application program starts, a process of the application program is created. Each process is assigned a process identifier (PID) to specify and track the process.

[0033] (2) Thread: It is the unit that the operating system can perform operation scheduling on. It is contained within a process and is the actual operating unit within the process. A thread refers to the single sequential control flow within a process. Multiple threads can be concurrent within a process, and each thread executes different tasks in parallel. Multiple threads within the same process will share the system resources within that process, such as the virtual address space, file descriptors, and signal handling, etc.

[0034] In some examples, for the thread scheduling method provided in the following embodiments, the application corresponding to the thread can be an application built based on a web kernel.

[0035] (3) Application program (application, APP): Abbreviated as application, it is a software program that can implement one or more specific functions. Usually, multiple applications can be installed in an electronic device. For example, browser applications, camera applications, messaging applications, email applications, video applications, music applications, etc. The applications mentioned below can be applications pre-installed when the electronic device leaves the factory, or applications downloaded from the network or obtained from other electronic devices by the user during the use of the electronic device.

[0036] Among them, the application program can be an instant application (instant APP, IAPP). An instant application does not require explicit installation / uninstallation. An instant application does not require explicit installation and can be used after being installed in the background by the system program framework. The uninstallation of an instant application can be controlled by the system program framework in the background. In some examples, instant applications include fast applications, mini-programs, service cards, etc.

[0037] It should be noted that in the description of this application, "at least one" means one or more, and "multiple" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single items or plural items. For example, "at least one of A, B, and C" includes A, B, C, AB, AC, BC, or ABC. Also, unless otherwise specified, the ordinal numbers such as "first", "second", "third", etc. mentioned in the embodiments of this application are used to distinguish multiple objects and are not used to limit the order, time sequence, priority, or importance of multiple objects. In addition, the terms "include", "comprise", "have" and their variants appearing in this application all mean "including but not limited to", unless otherwise particularly emphasized in other ways.

[0038] The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0039] Figure 1 An exemplary hardware structure diagram of an electronic device provided by an embodiment of this application is shown. On the basis shown, Figure 1 there may also be other variant structural forms. As Figure 1 shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include one or more of the following: a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0040] Next, for Figure 1A detailed introduction is given to the components of the illustrated electronic device 100.

[0041] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (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. Among them, different processing units may be independent devices or integrated in one or more processors. In some embodiments, the electronic device 100 may also include one or more processors 110. Among them, the processor is the nerve center and command center of the electronic device 300. The processor may generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0042] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory, thus avoiding repeated access, reducing the waiting time of the processor 110, and thus improving the efficiency of the system.

[0043] In some embodiments, the processor 110 may include one or more interfaces. For example, the interfaces 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 subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a structural limitation on the electronic device 100.

[0044] The charging management module 140 is configured to receive a charging input from a charger. The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.

[0045] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed 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.

[0046] The mobile communication module 150 may provide a solution for wireless communication including 2G / 3G / 4G / 5G, etc., which is applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, perform processing such as filtering and amplification on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.

[0047] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.

[0048] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive the signals to be sent from the processor 110, frequency-modulate them, amplify them, and convert them into electromagnetic waves through the antenna 2 for radiation.

[0049] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technologies.

[0050] The electronic device 100 implements the display function through the GPU, the display screen 194, the application processor, etc. The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel may adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

[0051] In some other embodiments, the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.

[0052] The external memory interface 120 may be used to connect to an external memory card, such as a Micro SD card, to implement the storage capacity expansion of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.

[0053] The internal memory 121 may be used to store computer-executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.

[0054] The electronic device 100 may implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, and an application processor, etc. For example, music playback, recording, etc.

[0055] Although Figure 1 not shown in the figure, the electronic device 100 may further include a Bluetooth device, a positioning device, a flashlight, a micro projection device, a near field communication (NFC) device, etc., which will not be elaborated herein.

[0056] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In some other embodiments of the present application, the electronic device 100 may include more or fewer components than Figure 1 shown in the figure, or combine certain components, or split certain components, or have different component arrangements. Figure 1 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0057] The following embodiments can all be implemented in the electronic device 100 having the above hardware structure.

[0058] The software system of an electronic device may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present application, a software system with a layered architecture (such as the Android system) is taken as an example to exemplarily illustrate the software structure of the electronic device 100. It should be understood that the system in the embodiments of the present application may also be not limited in this regard by the present application.

[0059] Figure 2 Exemplarily shown is a schematic diagram of the layered software structure of the electronic device provided in the embodiments of the present application. The layered architecture divides the software system of the electronic device into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces.

[0060] In some embodiments, the operating system can be divided into four layers, namely the application layer (applications), the application framework layer (application framework), the native C / C++ libraries (such as musl), and the kernel layer (kernel). The embodiments of the present application do not limit the layering of the software structure of the electronic device. It should be understood that Figure 2 on the basis of the Android system, a hardware layer in the electronic device is further added.

[0061] The application layer is the top layer of the operating system, including the native applications of the operating system, such as the desktop, browser, gallery, calendar, map, call, music, video, short message, etc., and may also include third-party applications. The application involved in the embodiments of the present application is simply referred to as an application (application, APP), which is a software program capable of implementing one or more specific functions. Generally, multiple applications can be installed in the electronic device, such as an email application, a learning application, etc. The applications mentioned hereinafter may be system applications pre-installed when the electronic device leaves the factory, or third-party applications downloaded from the network or obtained from other electronic devices by the user during the use of the electronic device.

[0062] Of course, for developers, they can write application programs and install them in this layer. In one possible implementation, the application program can be developed using the Java language and completed by calling the application programming interface (API) provided by the application framework layer. Developers can interact with the underlying layer of the operating system (such as the kernel layer, etc.) through the application framework to develop their own application programs.

[0063] When an application runs, the electronic device creates a process for the application to execute all tasks in the application (such as accessing the network, displaying the user interface, refreshing the user interface, etc.). Multiple tasks in the application are allocated to each thread in the process for specific execution. A process can include a UI thread and a rendering thread.

[0064] The application framework layer is the API and programming framework for the application layer. The application framework layer can include some predefined functions. The application framework layer can include a window manager, a content provider, a view system, a notification manager, a resource scheduler, a web core, a meta-capability component, an application spawning component (or can be called an application incubator) (appspawn), etc.

[0065] Among them, the window manager provides a window manager service (WMS), and the WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.

[0066] The content provider is used to store and obtain data, and make this data accessible to the application. The data can include videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.

[0067] The view system includes visible controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build an application. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon can include a view for displaying text and a view for displaying pictures.

[0068] The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is complete, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of a background-running application, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompting text information in the status bar, emitting a prompt tone, vibrating the electronic device, flashing the indicator light, etc.

[0069] The resource scheduler is responsible for the management of system resources (such as the central processing unit (CPU), input / output (I / O, can be abbreviated as IO), memory, cache, etc.).

[0070] The web kernel, also known as the rendering engine, is a crucial part of the browser responsible for parsing and displaying web page content. Its main functions include parsing web page content, rendering pages, and responding to user operations. Among them, (1) Parsing web page content: The web kernel is responsible for parsing codes such as HyperText Markup Language (HTML), cascading style sheets (CSS), and JavaScript of web pages, and converting them into pages that can be displayed in the browser. (2) Rendering pages: Based on the parsed web page content, the web kernel calculates the layout and display method of the page, and then renders the page into the final appearance that users can see. (3) Responding to user operations: The web kernel also responds to user interaction behaviors, such as responding to user clicks, drags, etc., to achieve real-time interaction with the page. The web kernel is an essential part of the browser, which enables users to view rich and colorful web page content in the browser and interact with this content.

[0071] The meta-capability component is responsible for the life cycle of the application, such as starting the application and switching interfaces.

[0072] The application incubation component is responsible for accepting the commands of the application to incubate the application process, setting its corresponding permissions, and calling the entry of the application framework.

[0073] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.

[0074] The core library of the system consists of two parts: one part is the functional functions that the Java language needs to call, and the other part is the core library of the system. The application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files in the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as the management of object life cycles, stack management, thread management, security and exception management, and garbage collection.

[0075] The native C / C++ library can include multiple functional modules. For example: a surface manager, a media library, a 3D graphics processing library (e.g., OpenGL ES), a 2D graphics engine (e.g., SGL), an image processing library, etc. The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media library supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0076] The kernel layer is used to provide the core system services of the operating system. For example, security, memory management, process management, network protocol stack, and driver model, etc. are all implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. There are many driver programs related to electronic devices in this layer. The main drivers include: display driver, camera driver, audio driver, process scheduling, memory management, I / O scheduling, or system on chip (SOC) driver, etc.

[0077] It should be understood that the functional services described above are only examples. In actual applications, electronic devices can also be divided into more or fewer functional services according to other factors, or the functions of each service can be divided in other ways, or the functional services can be not divided but work as a whole.

[0078] The following will introduce in detail the specific implementation of the thread scheduling method based on the web kernel in the embodiments of the present application with reference to the accompanying drawings. It can be understood that in the present application, an electronic device is taken as an example of the execution subject of the thread scheduling method based on the web kernel for illustration, but the present application does not limit the illustrated execution subject. For example, the methods executed by the electronic device in the present application can also be executed by modules applied to the electronic device (such as chips, chip systems, or processors), and can also be implemented by logical nodes, logical modules, or software that can implement all or part of the functions of the electronic device.

[0079] Figure 3 An exemplary flowchart of a thread scheduling method based on the web kernel provided by the embodiments of the present application is shown. This method is applicable to electronic devices, such as Figure 1 the illustrated electronic device 100. As Figure 3 shown, the process of this method includes:

[0080] Step 301: The electronic device receives a first operation. The first operation is used to trigger the electronic device to enter the rendering scene of the first application.

[0081] Exemplarily, the rendering scenarios may include, but are not limited to: web page loading (loadURL) scenarios, click scenarios, slide scenarios (such as follow-up sliding and throw sliding, where multiple sliding events will be recognized), application window resizing (resize) scenarios, or tab page (tab) focus switching (visible) scenarios (or can be called tab page focus change scenarios), etc. For example, the specification of the response duration corresponding to the web page loading scenario can be 10,000 ms; the specification of the response duration corresponding to the click scenario can be 2,000 ms; the specification of the response duration corresponding to the slide scenario is 500 ms; the specification of the response duration corresponding to the application window resizing scenario can be 500 ms; the specification of the response duration corresponding to the tab page focus switching scenario can be 500 ms.

[0082] It can be understood that the first operation may refer to a click operation by the user on the first application (such as a certain web application), a sliding operation triggered by the user on the interface of the first application, a web page loading operation triggered by the user on the interface of the first application, an operation for adjusting the window size of the first application by the user, or a tab page focus switching operation triggered by the user on the interface of the first application, etc. For example, the first application may be an application based on a web kernel.

[0083] For example, taking the first operation as a web page loading operation triggered by the user on the interface of the first application, and the first application as a certain web application (such as a web browser) as an example. When a certain user needs to use the web browser on the electronic device, the user can click on the icon of the web browser installed on the electronic device. The electronic device receives the click operation and, in response to the click operation, starts the web browser. After the electronic device starts the web browser, it displays the user interface of the web browser. Optionally, the user interface may include a URL input box, back / forward buttons, bookmark directories, etc. Then, the user can choose to enter a certain URL (such as a uniform resource locator (URL)) that needs to be queried in the URL input box included in the user interface of the web browser and confirm. Then, the web browser can send a hyper text transfer protocol (HTTP) request to the web server according to the URL entered by the user. After receiving the HTTP request, the web server processes the HTTP request and returns an HTML response. After receiving the HTML response, the web browser processes the HTML response and displays the corresponding web page.

[0084] It can be understood that the electronic device entering the rendering scene of the first application can be regarded as the operation scene triggered by the user using the first application. The operation scene triggered by the user using the first application involves multiple processes during the rendering process (such as the browser process, the rendering process, etc.). Among them, the browser process can be responsible for managing the creation and destruction of tab pages, the display of pages, resource downloading, etc.; the rendering process can be responsible for page document parsing and execution and rendering.

[0085] For example, the browser process can include multiple threads, such as the main thread, the IO thread, the audio thread, the VizCompositorThread thread, the Mali-cmar-backe thread, the CompositorGpuThread thread, the Chrome_InProcGp thread, the NetworkService thread, the EventRunner thread, etc. Exemplarily, the IO thread can include the Chrome_IOThread thread, the Chrome_ChildIOT thread, etc. The audio thread can include the AudioThread thread, the AudioServiceClient thread, etc.

[0086] In some examples, the main thread can be responsible for input event handling, LoadURL, and drawing ui controls such as tab pages.

[0087] In some examples, both the Chrome_IOThread thread and the Chrome_ChildIOT thread can be used to be responsible for inter process communication (IPC) between the browser process and the rendering process to transfer frame information. For example, the frame information can include the layer content rendered by the web rendering pipeline.

[0088] In some examples, the VizCompositorThread thread can be used to receive the vertical synchronization signal (vsync) and generate GPU instructions by addDrawOp. For example, the VizCompositorThread thread is responsible for parsing web page content and rendering pages. Among them, parsing web page content includes: parsing HTML, CSS, JavaScript and other codes of the web page and converting them into rendering instructions that the browser can understand. Rendering the page includes: after the VizCompositorThread thread completes the parsing of the web page content, it can calculate the layout and display method of the page, and then render the page into the final appearance that the user can see.

[0089] In some examples, the Mali-cmar-backe thread, as a Mali-related thread, can be used to be responsible for offloading rendering.

[0090] In some examples, the CompositorGpuThread thread can be used to be responsible for submitting to the GPU for rendering and then giving the buffer to the render_service. Specifically, the CompositorGpuThread thread is used to be responsible for hardware-accelerated rendering and compositing pages. Among them, hardware-accelerated rendering includes: utilizing the parallel computing power of the GPU to allocate rendering tasks to the GPU for hardware acceleration, thereby improving rendering performance and efficiency. Compositing pages includes: being responsible for compositing the rendering results of each layer (Layer) to generate the final page image and outputting it to the screen.

[0091] In some examples, the Chrome_InProcGp thread can be used to be responsible for rasterization.

[0092] In some examples, the NetworkService thread can be used to be responsible for obtaining network data.

[0093] In some examples, the EventRunner thread can be used to be responsible for distributing vsync.

[0094] In some examples, both the AudioThread thread and the AudioServiceClient thread can be used to be responsible for audio-related operations.

[0095] The rendering process can include multiple threads, such as the main thread, the Compositor thread, the CompositorTileWorker thread, the IO thread, the audio thread, etc. Exemplarily, the IO thread can include the Chrome_ChildIOT thread, and the audio thread can include the AudioOutputDevice thread.

[0096] In some examples, the main thread can be used to be responsible for measuring, laying out to generate the hierarchical tree, and painting to generate drawing instructions.

[0097] In some examples, the Compositor thread can be used to divide layers into smaller tiles and pass them to the raster thread for rasterization. Specifically, the Compositor thread can be used to parse and render web page content, compose the page, receive vertical synchronization signals, and process user input events. For example, parsing and rendering web page content includes: being responsible for parsing codes such as HTML, CSS, and JavaScript of the web page and converting them into rendering instructions that the browser can understand; calculating the layout and display method of the page, and then rendering the page into the final appearance that users can see. Composing the page includes: being responsible for composing the rendering results of each layer to generate the final page image and outputting it to the screen. Receiving vertical synchronization signals includes: being responsible for receiving vsync signals transmitted by the browser, which indicate the end of the previous frame and the start of a new frame. Processing user input events includes: receiving user interaction events transmitted by the operating system, such as scrolling, input, clicking, mouse movement, etc., and performing corresponding processing on the page according to these events.

[0098] In some examples, the CompositorTileWorker thread can be used to be responsible for image decoding, generating chunked GPU instructions, and giving priority to rendering the visible area. For example, the CompositorTileWorker thread is a thread in the Chromium rendering engine, and it is responsible for the work of rasterization. Rasterization is the process of converting graphic data into pixel data for display on the screen. Moreover, the CompositorTileWorker thread can also process graphic data from CPU data into GPU data, which greatly improves the rendering efficiency. In addition, the CompositorTileWorker thread can process multiple rasterization tasks in parallel, thereby further improving the rendering performance.

[0099] In some examples, the Chrome_ChildIOT thread can be used to be responsible for IPC communication between the rendering process and the browser process.

[0100] In some examples, the AudioOutputDevice thread can be used to be responsible for audio-related operations.

[0101] Step 302: In response to the first operation, the electronic device updates the scheduling priority of the first target thread from the first preset level to the first level, and updates the scheduling priority of the second target thread from the second preset level to the second level.

[0102] Among them, the first preset level is the default scheduling priority (or can be understood as the initial scheduling priority) of one or more first target threads, and the second preset level is the default scheduling priority of one or more second target threads. One or more first target threads and one or more second target threads can be used to complete the rendering process of the rendering scene. For example, one or more first target threads can be used to execute the rendering tasks of the rendering scene, and one or more second target threads can be used to execute the data communication tasks of the rendering scene.

[0103] In the embodiment of the present application, in response to the first operation, the electronic device can update the scheduling priority of one or more first target threads from the first preset level to the first level, and update the scheduling priority of one or more second target threads from the second preset level to the second level. It should be understood that the electronic device's response to the first operation can be understood as the electronic device recognizing that the electronic device enters the rendering scene of the first application through the first operation.

[0104] For example, taking the scheduling priority of the target thread being represented by a priority value, and there being one first target thread and one second target thread as an example. One target thread corresponds to one scheduling priority, and the higher the scheduling priority, the more likely it is to be preferentially allocated the corresponding running resources (such as CPU resources (or can be understood as processing unit resources), memory resources, etc.). For example, each target thread can correspond to a priority value. The larger the priority value, the lower the scheduling priority. On the contrary, the smaller the priority value, the higher the scheduling priority. Suppose the priority value of the second target thread is 100 and the priority value of the first target thread is 80, then the scheduling priority of the first target thread is higher than that of the second target thread. Optionally, when the CPU resources are limited, the first target thread will be preferentially allocated the corresponding running resources and is likely to preempt the running resources of the second target thread.

[0105] It should be understood that the embodiment of the present application does not limit the correspondence between the size of the priority value and the level of the scheduling priority. In some other embodiments, the larger the priority value of the target thread, the higher the scheduling priority; on the contrary, the smaller the priority value of the target thread, the lower the scheduling priority.

[0106] It can be understood that the first preset level and the second preset level can be the same or can also be different. For example, taking the first preset level and the second preset level being the same as an example, the default scheduling priorities of one or more first target threads and one or more second target threads are both set to the CFS level. It should be understood that the CFS level is used to represent the scheduling priority of the completely fair scheduler (CFS) threads, and the scheduling priority of the CFS threads is the lowest.

[0107] Optionally, in the embodiments of the present application, the first level and the second level may be the same or different. For example, taking a first target thread and a second target thread as an example. When the first level and the second level are the same, the first target thread needs to compete with the second target thread for scheduling. When the first level and the second level are different, if the first level is higher than the second level, the first target thread is scheduled prior to the second target thread, and the first target thread will be preferentially allocated corresponding running resources. If the first level is lower than the second level, the second target thread is scheduled prior to the first target thread, and the second target thread will be preferentially allocated corresponding running resources. For example, when the first level is higher than the second level, the first level is used to represent the level of real-time scheduling of the first target thread, and the second level is used to represent the level of critical scheduling (or can be called vip scheduling) of the second target thread.

[0108] For example, the form of update of the scheduling priorities of one or more first target threads and one or more second target threads involved in the rendering scene can be seen in Table 1 below.

[0109] Table 1

[0110]

[0111] It should be understood that Table 1 is an example, and is for facilitating the description of the technical solutions in the embodiments of the present application, and does not constitute a limitation on the technical solutions in the embodiments of the present application.

[0112] For example, taking the rendering scene as a web page loading scene, the first level is higher than the second level (for example, the first level is the RT level and the second level is the vip level), the web page loading scene involves multiple first target threads and multiple second target threads, and the default scheduling priorities of the multiple first target threads and the default scheduling priorities of the multiple second target threads are the same (for example, the default scheduling priorities of the multiple first target threads and the default scheduling priorities of the multiple second target threads are both the cfs level). Among them, the RT level is used to represent the highest scheduling priority, and the vip level is used to represent a relatively high scheduling priority. It can be understood that the RT level is used to represent the scheduling priority of real-time (RT) threads, and the vip level is used to represent the scheduling priority of critical threads. Among them, the RT level is higher than the vip level, and the vip level is higher than the cfs level.

[0113] The multiple first target threads may include the VizCompositorThread thread, Mali-cmar-backe thread, CompositorGpuThread thread, Chrome_InProcGp thread in the browser process, and the main thread, Compositor thread, CompositorTileWorker thread in the rendering process.

[0114] The multiple second target threads may include the IO threads (such as the Chrome_IOThread thread, Chrome_ChildIOT thread), NetworkService thread, EventRunner thread in the browser process, and the IO thread (such as the Chrome_ChildIOT thread) in the rendering process. In response to the user's web page loading operation, the electronic device may update the scheduling priorities of the VizCompositorThread thread, Mali-cmar-backe thread, CompositorGpuThread thread, Chrome_InProcGp thread in the browser process, and the main thread, Compositor thread, CompositorTileWorker thread in the rendering process from the cfs level to the RT level, and may update the scheduling priorities of the IO threads (such as the Chrome_IOThread thread, Chrome_ChildIOT thread), NetworkService thread, EventRunner thread in the browser process, and the IO thread (such as the Chrome_ChildIOT thread) in the rendering process from the cfs level to the vip level.

[0115] In some examples, the multiple first target threads can all be understood as web rendering pipeline threads, and the scheduling priority is at the full real-time scheduling level. The multiple second target threads can be understood as threads for assisting in data transfer (or can be called data passing) among the multiple first target threads (such as multiple web rendering pipeline threads), and the scheduling priority is at the vip scheduling level. In addition, the multiple second target threads with the vip level scheduling priority have the ability to dynamically migrate cores.

[0116] For example, a thread with the vip level scheduling priority runs on a certain processing unit (or can be understood as a certain core). If this processing unit is preempted by a thread with the RT level scheduling priority at a certain time (or a certain moment), in the case where the thread with the vip level scheduling priority has the ability to dynamically migrate cores, the thread with the vip level scheduling priority can migrate to other processing units and continue to run.

[0117] It can be understood that the above update process can be executed by the web kernel included in the application framework layer of the electronic device. For example, after the web kernel recognizes that the electronic device enters the rendering scenario of the first application as the web page loading scenario based on the user's web page loading operation, it can send the identifiers (or indexes or names) of multiple threads involved in the web page loading scenario to the resource scheduler. After receiving the identifiers of multiple threads involved in the web page loading scenario, the resource scheduler can call the process management capabilities of the kernel layer to correspondingly update the scheduling priorities of the first target thread and the second target thread included in the multiple threads involved in the web page loading scenario.

[0118] Step 303: The electronic device schedules the first target thread according to the first level and schedules the second target thread according to the second level.

[0119] Optionally, after the electronic device updates the scheduling priorities of one or more first target threads from the first preset level to the first level and updates the scheduling priorities of one or more second target threads from the second preset level to the second level, it can schedule one or more first target threads according to the first level and can schedule one or more second target threads according to the second level.

[0120] For example, taking the first level being higher than the second level as an example. When the first level is higher than the second level, the electronic device can preferentially schedule one or more first target threads. That is to say, the electronic device can preferentially allocate corresponding running resources to one or more first target threads so that one or more first target threads are preferentially scheduled.

[0121] Next, taking one first target thread, one second target thread, and the first level being higher than the second level as an example, the scheduling situations of the first target thread and the second target thread are introduced through the following several possible examples.

[0122] Example 1: When the first level is higher than the second level and the first target thread and the second target thread are configured (or allocated) on the same processing unit (such as the first processing unit), if the first target thread has been scheduled to run on the first processing unit and the available resources on the first processing unit are not sufficient to support the second target thread to run, the electronic device can migrate the second target thread to a free processing unit to run preferentially, or can also insert the second target thread before the second target thread in the pending running state on other non-free processing units. Among them, the scheduling priority of the third target thread is lower than the second level.

[0123] Example 2: When the first level is higher than the second level and the first target thread and the second target thread are configured on different processing units (for example, the first target thread is configured on the first processing unit and the second target thread is configured on the second processing unit), the electronic device can insert the first target thread to run preferentially on the first processing unit and can insert the second target thread to run preferentially on the second processing unit. It should be understood that inserting the first target thread to run preferentially on the first processing unit can be understood as the first target thread cutting in line to run before the thread with a scheduling priority lower than the first level that is waiting to run on the first processing unit, and inserting the second target thread to run preferentially on the second processing unit can be understood as the second target thread cutting in line to run before the thread with a scheduling priority lower than the second level that is waiting to run on the second processing unit.

[0124] In an embodiment of the present application, when the electronic device schedules one or more first target threads and after a first duration (such as 10 s), the electronic device can restore the scheduling priority of the one or more first target threads from the first level to the first preset level. When the electronic device schedules one or more second target threads and after a second duration (such as 10 s), the electronic device can restore the scheduling priority of the one or more second target threads from the second level to the second preset level. It can be understood that the first duration can be understood as the effective duration (or can be called the validity period or effective length) of the updated (or can be called adjusted) scheduling priority of the first target thread or the second target thread, and the second duration can be understood as the effective duration of the updated scheduling priority of the second target thread.

[0125] For example, taking one first target thread as the VizCompositorThread thread, one second target thread as the NetworkService thread, the first preset level and the second preset level are both cfs levels, the first level is the RT level, the second level is the vip level, the first duration is 10 s, and the second duration is 10 s as an example. After 10 s when the electronic device schedules the VizCompositorThread thread, the electronic device can restore the scheduling priority of the VizCompositorThread thread from the RT level to the cfs level. After 10 s when the electronic device schedules the NetworkService thread, the electronic device can restore the scheduling priority of the NetworkService thread from the vip level to the cfs level.

[0126] As can be seen from the above steps 301 to 303, by responding to the first operation (that is, by recognizing that the electronic device enters the rendering scene of the first application), the scheduling priorities of the first target thread and the second target thread are respectively adjusted accordingly. In this way, the first target thread and the second target thread can be preferentially scheduled, which helps to reduce the rendering response latency, so as to well meet the user's needs and improve the user experience.

[0127] It should be noted that the specific implementation processes provided in the above embodiments are only examples of the applicable method processes of the embodiments of the present application. The execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added, or some steps can be reduced, etc.

[0128] In the above embodiments provided by the present application, the method provided by the embodiments of the present application is introduced from the perspective of the electronic device as the execution subject. In order to implement each function in the method provided by the above embodiments of the present application, the electronic device may include a hardware structure and / or a software module, and implement the above functions in the form of a hardware structure, a software module, or a combination of a hardware structure and a software module. Whether a certain function among the above functions is executed in the form of a hardware structure, a software module, or a combination of a hardware structure and a software module depends on the specific application and design constraint conditions of the technical solution.

[0129] Based on the same concept, the embodiments of the present application also provide an electronic device, which is used to implement the thread scheduling method based on the web kernel provided by the embodiments of the present application. As Figure 4 shown, the electronic device 400 may include: a memory 401, one or more processors 402, and one or more computer programs (not shown in the figure). The above components may be coupled through one or more communication buses 403. Optionally, the electronic device 400 may further include a display screen 404.

[0130] Among them, one or more computer programs (codes) are stored in the memory 401, and the one or more computer programs include computer instructions; the one or more processors 402 call the computer instructions stored in the memory 401, so that the electronic device 400 executes the web kernel-based thread scheduling method provided in the embodiments of the present application. For example, the electronic device 400 may perform the following steps: The electronic device 400 enters the page switching scenario of the first application. Among them, the first application may be an application based on the web kernel. After that, the electronic device 400 may update the scheduling priority of the first target thread from the first preset level to the first level, and may update the scheduling priority of the second target thread from the second preset level to the second level. Among them, the first preset level is the default scheduling priority of the first target thread, and the second preset level is the default scheduling priority of the second target thread. Then, the electronic device 400 may schedule the first target thread according to the first level, and may schedule the second target thread according to the second level. Exemplarily, the page switching scenario may be one of the following scenarios: web page loading scenario, sliding scenario, application window size adjustment scenario, or tab page switching focus scenario. It should be understood that the page switching scenario may be a form of the rendering scenario.

[0131] In a specific implementation, the memory 401 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices. The memory 401 may store an operating system (hereinafter referred to as the system), such as Android, IOS, WINDOWS, or an embedded operating system such as LINUX. The memory 401 may be used to store the implementation program of the embodiments of the present application. The memory 401 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, and one or more network devices.

[0132] The one or more processors 402 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application solution.

[0133] The display screen 404 is used to display application interfaces (such as the interface of the first application) and other related user interfaces.

[0134] It should be noted that Figure 4 This is only one implementation manner of the electronic device 400 provided in the embodiments of the present application. In practical applications, the electronic device 400 may further include more or fewer components. Specifically, reference may be made toFigure 1 There is no limitation on the specific structure and description shown herein.

[0135] Based on the same concept, an embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program runs on an electronic device, the electronic device is enabled to execute the method provided in the above embodiment.

[0136] Based on the same concept, an embodiment of this application further provides a computer program product. The computer program product includes a computer program or instructions. When the computer program or instructions run on an electronic device, the electronic device is enabled to execute the method provided in the above embodiment.

[0137] Based on the same concept, an embodiment of this application further provides a chip. The chip is located on an electronic device. The chip may include a processor and may also include a memory (or the chip is coupled to the memory). The chip executes the program instructions in the memory so that the electronic device executes the method provided in the above embodiment. Herein, "coupled" means that two components are directly or indirectly combined with each other. For example, coupling may refer to an electrical connection between two components.

[0138] In the method provided in the embodiment of this application, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital video disc (DVD)), or a semiconductor medium (such as an SSD), etc.

[0139] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these modifications and variations.

Claims

1. A thread scheduling method based on a web kernel, characterized in that The method is applied to an electronic device, and the method includes: Receiving a first operation for triggering the electronic device to enter a rendering scene of a first application; In response to the first operation, updating the scheduling priority of a first target thread from a first preset level to a first level, and updating the scheduling priority of a second target thread from a second preset level to a second level, where the first preset level is the default scheduling priority of the first target thread, and the second preset level is the default scheduling priority of the second target thread; Scheduling the first target thread according to the first level and scheduling the second target thread according to the second level.

2. The method according to claim 1, wherein The method further includes: After a first duration, restoring the scheduling priority of the first target thread from the first level to the first preset level; After a second duration, restoring the scheduling priority of the second target thread from the second level to the second preset level.

3. The method according to claim 1 or 2, characterized in that, The first level is higher than the second level.

4. The method according to any one of claims 1-3, characterized in that The method further includes: Running the first target thread on a first processing unit, migrating the second target thread to an idle processing unit for running, or inserting the second target thread before a third target thread for running, where the scheduling priority of the third target thread is lower than the second level.

5. The method according to any one of claims 1-4, characterized in that, The first target thread is used to execute the rendering task of the rendering scene, and the second target thread is used to execute the data communication task of the rendering scene.

6. The method according to claim 5, wherein The first target thread is a web rendering pipeline thread, and the second target thread is a thread for assisting data transmission between the first target threads.

7. The method according to any one of claims 1 to 6, characterized in that, The rendering scene is one of the following scenes: a web page loading scene, a click scene, a sliding scene, an application window size adjustment scene, or a tab page focus switching scene.

8. An electronic device, characterized in that, Comprising a processor and a memory; The memory is used to store one or more computer programs, and the one or more computer programs include computer instructions; when the computer instructions are executed by the processor, the electronic device is caused to execute: Entering a page switching scene of a first application, where the first application is an application based on a web kernel; Updating the scheduling priority of a first target thread from a first preset level to a first level, and updating the scheduling priority of a second target thread from a second preset level to a second level, where the first preset level is the default scheduling priority of the first target thread, and the second preset level is the default scheduling priority of the second target thread; Scheduling the first target thread according to the first level and scheduling the second target thread according to the second level.

9. The electronic device according to claim 8, wherein When the computer instructions are executed by the processor, the electronic device is further caused to execute: After a first duration, restoring the scheduling priority of the first target thread from the first level to the first preset level; After a second duration, restoring the scheduling priority of the second target thread from the second level to the second preset level.

10. The electronic device according to claim 8 or 9, characterized in that, The first level is higher than the second level.

11. The electronic device according to any one of claims 8-10, characterized in that When the computer instructions are executed by the processor, the electronic device is further caused to execute: Run the first target thread on the first processing unit, migrate the second target thread to a free processing unit for preferential execution, or insert the second target thread to run before a third target thread, the scheduling priority of the third target thread being lower than the second level.

12. The electronic device according to any one of claims 8-11, characterized in that, The first target thread is used to execute the rendering task of the page switching scenario, and the second target thread is used to execute the data communication task of the page switching scenario.

13. The electronic device according to claim 12, wherein, The first target thread is a web rendering pipeline thread, and the second target thread is a thread for assisting in data transmission between the first target threads.

14. The electronic device according to any one of claims 8-13, characterized in that, The page switching scenario is one of the following scenarios: a web page loading scenario, a sliding scenario, an application window size adjustment scenario, or a tab page switching focus scenario.

15. A computer-readable storage medium, characterized in that, A computer program or instruction is stored in the computer-readable storage medium. When the computer program or instruction is executed by the electronic device, the electronic device is caused to execute the method according to any one of claims 1-7.

16. A computer program product, characterized in that, The computer program product includes a computer program or instruction. When the computer program or instruction runs on the electronic device, the electronic device is caused to execute the method according to any one of claims 1-7.