Web core-based thread scheduling method and electronic device

By adjusting the thread scheduling priority and processing unit utilization, the problem of large rendering response delay under high frame rate and high load based on web kernel applications is solved, and the rendering response delay is reduced and the user experience is improved.

WO2025152444A1PCT designated stage expired Publication Date: 2025-07-24HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/115272
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-18
Filing Date
2024-08-28
Publication Date
2025-07-24

AI Technical Summary

Technical Problem

Under high frame rates and high loads, the rendering response delay of the web kernel based application is large, which is difficult to meet user needs.

Method used

By adjusting thread scheduling priority, the scheduling priority of the rendering thread is promoted to a high priority, and migrate or insert it into the idle processing unit to run when necessary, ensuring that the rendering thread and data transmission thread are scheduled in a timely manner.

Benefits of technology

Reduces the rendering response delay, improves the user experience, and ensures the timely and effective completion of the rendering scene.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024115272_24072025_PF_FP_ABST
    Figure CN2024115272_24072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a web core-based thread scheduling method and an electronic device. The method comprises: receiving a first operation, the first operation being used for triggering an electronic device to enter a rendering scenario of a first application; in response to the first operation, updating a scheduling priority of a first target thread from a first preset level to a first level, and updating a scheduling priority of a second target thread from a second preset level to a second level; and scheduling the first target thread on the basis of the first level, and scheduling the second target thread on the basis of the second level, wherein the first preset level is a default scheduling priority of the first target thread, and the second preset level is a default scheduling priority of the second target thread. According to the method, the scheduling priority of the first target thread and the scheduling priority of the second target thread are correspondingly adjusted, respectively, such that the first target thread and the second target thread can be scheduled preferentially, thereby facilitating reduction of a rendering response delay.
Need to check novelty before this filing date? Find Prior Art

Description

A thread scheduling method and electronic device based on web kernel

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on January 18, 2024, with application number 202410075227.6 and application name "A thread scheduling method and electronic device based on web kernel", the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of terminal technology, and in particular to a thread scheduling method and electronic device based on a web kernel. Background Art

[0004] With the rapid development of electronic devices (such as smart phones), 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 on the electronic devices.

[0005] For example, some applications developed using web components installed on electronic devices (such as negative-one-screen applications or mobile phone skills applications, etc.) have a large rendering response delay under high frame rate (such as 120HZ) and high load requirements because the rendering thread of the application developed with web components is preempted by other threads, making it difficult to meet user needs.

[0006] Summary of the Invention

[0007] The present application provides a thread scheduling method and electronic device based on a web kernel, which are used to implement priority scheduling of rendering threads so as to reduce rendering response latency.

[0008] In the first aspect, the present application provides a thread scheduling method based on a web kernel, which 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, the following takes an electronic device executing a thread scheduling method based on a web kernel as an example. The 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 the first application. Thereafter, the electronic device, in response to the first operation, 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. Then, the electronic device may schedule the first target thread according to the first level, and may schedule the second target thread according to the second level, wherein 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.

[0009] In this method, by responding to the first operation (that is, recognizing that the electronic device enters the rendering scene of the first application through the first operation), the scheduling priority of the first target thread and the scheduling priority of the second target thread are adjusted accordingly. In this way, the first target thread and the second target thread can be scheduled preferentially, which helps to reduce the rendering response delay, thereby meeting user needs well and improving user experience.

[0010] In one possible design, the method also includes: after a first period of time, the electronic device can 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 can also restore the scheduling priority of the second target thread from the second level to the second preset level.

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

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

[0013] 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 using different operating resources for scheduling. 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 ensure that the rendering response delay can meet the needs of users, the thread used to assist in data transfer between web rendering pipeline threads is also allocated with other corresponding operating resources for priority scheduling.

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

[0015] 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 insufficient to support the second target thread, the electronic device can migrate the second target thread to an idle processing unit for priority execution, or can insert the second target thread before a third target thread with a lower scheduling priority than the second target thread. In this way, the design can prioritize the scheduling of both the first target thread and the second target thread, thereby facilitating the timely and efficient completion of the rendering process of the rendering scene and effectively preventing the target thread used to render the scene from being scheduled in a timely manner due to its running resources being preempted.

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

[0017] In the above design, by configuring the first target thread and the second target thread to respectively execute different tasks of rendering the scene, the first target thread and the second target thread can effectively cooperate to jointly complete the rendering process of the rendering scene.

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

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

[0020] In a possible design, the rendering scenario is one of the following scenarios: a web page loading scenario, a click scenario, a sliding scenario, an application window resize scenario, or a tab switch focus scenario.

[0021] In the above design, after the electronic device recognizes any of the above scenarios triggered by the user on the first application on the electronic device, it can promptly start the update process of the scheduling priority of the first target thread and the second target thread involved in the scenario.

[0022] In a second aspect, an embodiment of the present application further provides an electronic device, comprising modules / units for executing the method in the first aspect and any possible scenario of the first aspect. These modules / units may be implemented in hardware, or corresponding software implementations may be executed in hardware.

[0023] In a third aspect, embodiments of the present application provide an electronic device comprising a processor and a memory. Optionally, the electronic device may further comprise a display screen. The display screen is configured to display a user interface; the memory is configured to store one or more computer programs, each of which comprises computer instructions that, when executed by the processor, cause the electronic device to perform the method of the first aspect and any possible design of the first aspect.

[0024] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium, which includes a computer program. When the computer program runs on an electronic device, the electronic device executes the above-mentioned first aspect and any possible design method of the first aspect.

[0025] In a fifth aspect, an embodiment of the present application further provides a method comprising a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the above-mentioned first aspect and any possible design of the first aspect.

[0026] In a sixth aspect, the present application provides a chip, which is located on an electronic device, and which may include a processor and a memory (or the chip is coupled to the memory). The chip executes program instructions in the memory to enable the electronic device to perform the method of the first aspect and any possible design of the first aspect. "Coupled" refers to the direct or indirect combination of two components, such as electrical connection between two components.

[0027] In a seventh aspect, the present application further provides a chip system, which is located on an electronic device. The chip system may include a processor for supporting the electronic device to implement the above-mentioned first aspect and any possible design method of the first aspect. In one possible design, the chip system also includes a memory for storing the necessary programs and data for the computer device. The chip system may be composed of a chip, or may include a chip and other discrete devices.

[0028] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] FIG1 exemplarily shows a hardware structure diagram of an electronic device provided in an embodiment of the present application;

[0030] FIG2 exemplarily shows a schematic diagram of a layered software structure of an electronic device provided in an embodiment of the present application;

[0031] FIG3 exemplarily shows a flow chart of a thread scheduling method based on a web kernel provided in an embodiment of the present application;

[0032] FIG4 exemplarily shows a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The thread scheduling method provided in the embodiments of the present application can be applied to electronic devices. The electronic devices, which can also be referred to as user equipment (UE), mobile stations (MS), mobile terminals (MT), etc., are devices that provide voice or data connectivity to users, and can also be Internet of Things devices. For example, the electronic devices include handheld devices with wireless connectivity, in-vehicle devices, etc. Currently, electronic devices can include: mobile phones, tablets, laptops, PDAs, mobile internet devices (MIDs), wearable devices (such as smart watches, smart bracelets, pedometers, etc.), in-vehicle devices (such as cars, bicycles, electric vehicles, airplanes, ships, trains, high-speed trains, etc.), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, smart home devices (such as refrigerators, televisions, air conditioners, electricity meters, etc.), intelligent robots, workshop equipment, wireless terminals in self-driving cars, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and flying devices (such as intelligent robots, hot air balloons, drones, airplanes). Electronic devices can also be devices that function as terminals in device-to-device (D2D) communication. The electronic device involved in the embodiment of the present application may be a foldable electronic device, such as a foldable mobile phone, a foldable tablet computer, etc., and the present application does not limit this. In addition, exemplary embodiments of electronic devices include but are not limited to devices equipped with Or other electronic devices with operating systems.

[0034] Below, some terms in this application are explained to facilitate understanding by those skilled in the art.

[0035] (1) A process (job, task) is a computer program's activity on a set of data, performing resource allocation and scheduling. It is the foundation of the operating system structure. When an application starts, its process is created. Each process is assigned a process identifier (PID) to facilitate process identification and tracking.

[0036] (2) A thread is a unit that the operating system can use to schedule operations. It is contained within a process and is the actual operating unit within the process. A thread refers to a single sequential flow of control within a process. A process can have multiple threads running concurrently, each executing different tasks in parallel. Multiple threads within the same process will share the system resources of that process, such as virtual address space, file descriptors, and signal processing.

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

[0038] (3) Application (APP): abbreviated as application, which is a software program that can realize one or more specific functions. Generally, multiple applications can be installed in an electronic device. For example, browser applications, camera applications, SMS applications, email applications, video applications, music applications, etc. The applications mentioned below can be applications that are installed on the electronic device when it leaves the factory, or applications that the user downloads from the Internet or obtains from other electronic devices while using the electronic device.

[0039] The application can be an instant app (IAPP), which does not require explicit installation or uninstallation. An IAPP does not require explicit installation and is installed by the system framework backend, allowing it to be used immediately. The system framework backend can manage the uninstallation of the IAPP. In some examples, IAPPs include quick apps, mini-programs, and service cards.

[0040] It should be noted that in the description of this application, "at least one" refers to one or more, and "plurality" refers to 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: the existence of A alone, the existence of A and B at the same time, and the existence of B 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 refers to any combination of these items, including any combination of single or plural items. For example, "at least one of A, B and C" includes A, B, C, AB, AC, BC or ABC. And, unless otherwise specified, the ordinal numbers such as "first", "second", and "third" mentioned in the embodiments of this application are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects. In addition, the terms "including", "comprising", "having" and their variations appearing in this application all mean "including but not limited to" unless otherwise specifically emphasized.

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

[0042] FIG1 exemplarily shows a hardware structure diagram of an electronic device provided in an embodiment of the present application. Based on the structure shown in FIG1 , other variant structures may also exist. As shown in FIG1 , the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 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: pressure sensor 180A, gyroscope sensor 180B, air pressure sensor 180C, magnetic sensor 180D, acceleration sensor 180E, distance sensor 180F, proximity light sensor 180G, fingerprint sensor 180H, temperature sensor 180J, touch sensor 180K, ambient light sensor 180L, bone conduction sensor 180M, etc.

[0043] The following is a detailed introduction to the components of the electronic device 100 shown in FIG1 .

[0044] 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). Different processing units may be independent devices or integrated into one or more processors. In some embodiments, the electronic device 100 may also include one or more processors 110. The processor is the nerve center and command center of the electronic device 300. The processor may generate an operation control signal based on the instruction opcode and the timing signal to complete the control of instruction fetching and execution.

[0045] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory, thereby avoiding repeated accesses and reducing processor 110 latency, thereby improving system efficiency.

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

[0047] The charging management module 140 is configured to receive charging input from a charger. The power management module 141 is configured 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 through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor.

[0048] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

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

[0050] The modem processor may include a modulator and a demodulator. 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. The demodulator then 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 passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0051] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate 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 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

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

[0053] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The display screen 194 is used to display images, videos, etc. The display screen 194 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), 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 one.

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

[0055] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0056] The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and an application 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 instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0057] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0058] Although not shown in FIG. 1 , 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 are not described in detail here.

[0059] It is understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in FIG1 , or may combine or separate certain components, or may have different component arrangements. The components shown in FIG1 may be implemented in hardware, software, or a combination of software and hardware.

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

[0061] The software system of the electronic device can adopt a layered architecture, event-driven architecture, micro-core architecture, micro-service architecture, or cloud architecture. The software structure of the electronic device 100 is illustrated by taking the system as an example. It should be understood that the system in the embodiment of the present application can also be This application does not limit this.

[0062] Figure 2 illustrates a schematic diagram of the layered software architecture of an electronic device provided by an embodiment of the present application. The layered architecture divides the software system of an electronic device into several layers, each with distinct roles and divisions of labor. Layers communicate with each other via software interfaces.

[0063] In some embodiments, the operating system can be divided into four layers: application layer (applications), application framework layer (application framework), native C / C++ library (such as musl) and 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 also adds the hardware layer of the electronic device based on the Android system.

[0064] The application layer is the top layer of the operating system, including native applications of the operating system, such as desktop, browser, gallery, calendar, map, call, music, video, short message, etc., and may also include third-party applications. The application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can realize one or more specific functions. Typically, multiple applications can be installed in an electronic device, such as mailbox applications, learning applications, etc. The applications mentioned below can be system applications that are installed on the electronic device when it leaves the factory, or they can be third-party applications that the user downloads from the Internet or obtains from other electronic devices while using the electronic device.

[0065] Of course, developers can write applications and install them into this layer. In one possible implementation, applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can use the application framework to interact with the underlying layer of the operating system (such as the kernel layer) and develop their own applications.

[0066] When an app runs, the electronic device creates a process for the app to perform all tasks within the app (such as accessing the network, displaying the user interface, refreshing the user interface, etc.). Multiple tasks within the app are assigned to threads within the process for execution. A process can include both a UI thread and a rendering thread.

[0067] The application framework layer provides the application API and programming framework. It includes predefined functions such as a window manager, content provider, view system, notification manager, resource scheduler, web core, meta-capability components, and an application incubation component (also known as an app spawner).

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

[0069] Content providers are used to store and retrieve data and make it accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0070] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0071] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

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

[0073] The web kernel, also known as the rendering engine, is the key 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 the web page's Hypertext Markup Language (HTML), cascading style sheets (CSS) (or cascading style sheets), and JavaScript codes, and converting them into pages that can be displayed in the browser. (2) Rendering pages: Based on the parsing of web page content, the web kernel will calculate the layout and display method of the page, and then render the page into the final appearance that the user can see. (3) Responding to user operations: The web kernel will also respond to user interactive behaviors, such as responding to user clicks, dragging, and other operations, to achieve real-time interaction with the page. The web kernel is an indispensable part of the browser. It allows users to see rich and colorful web page content in the browser and interact with this content.

[0074] The meta-capability component is responsible for the application life cycle, such as startup and interface switching.

[0075] The application incubation component is responsible for accepting application commands to incubate application processes, setting their corresponding permissions, and calling the entry point of the application framework.

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

[0077] The system's core library consists of two parts: one containing the Java language's callable functions and the other the system's core library. The application layer and application framework layer run within a virtual machine. For example, in Java, the virtual machine executes Java files from the application and framework layers as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0078] The native C / C++ library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), 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 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.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.

[0079] The kernel layer provides core operating system services, such as security, memory management, process management, network protocol stacks, and driver models. These services are all implemented at the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to electronic devices, primarily display drivers, camera drivers, audio drivers, process scheduling, memory management, I / O scheduling, and system-on-chip (SOC) drivers.

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

[0081] The following is a detailed introduction to the specific implementation of the thread scheduling method based on the web kernel in the embodiment of the present application in conjunction with the accompanying drawings. It can be understood that the present application uses an electronic device as an example to illustrate the execution subject of the thread scheduling method based on the web kernel, but the present application does not limit the illustrated execution subject. For example, the method executed by the electronic device in the present application can also be executed by a module (such as a chip, a chip system, or a processor) applied to the electronic device, and can also be implemented by a logical node, a logical module or software that can realize all or part of the functions of the electronic device.

[0082] FIG3 exemplarily illustrates a flow diagram of a thread scheduling method based on a web kernel provided in an embodiment of the present application. The method is applicable to electronic devices, such as the electronic device 100 shown in FIG1 . As shown in FIG3 , the flow of the method includes:

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

[0084] Exemplarily, rendering scenarios may include, but are not limited to, web page loading (loadURL) scenarios, click scenarios, slide scenarios (for example, following a hand slide or flicking will recognize multiple slide events), application window resize scenarios, or tab page switching focus (visibility) scenarios (or tab page change focus scenarios). For example, the response time specification for the web page loading scenario may be 10,000ms; the response time specification for the click scenario may be 2,000ms; the response time specification for the slide scenario may be 500ms; the response time specification for the application window resize scenario may be 500ms; and the response time specification for the tab page switching focus scenario may be 500ms.

[0085] It is understandable that the first operation may refer to a click operation performed by a user on a first application (e.g., a web application), a sliding operation triggered by a user on the interface of the first application, a webpage loading operation triggered by a user on the interface of the first application, an adjustment operation performed by a user on the window size of the first application, or a tab switching operation triggered by a user on the interface of the first application. For example, the first application may be a web-based application.

[0086] For example, let's assume that the first operation is a web page loading operation triggered by a user on the interface of a first application, and the first application is a web application (such as a web browser). When a user needs to use a web browser on an electronic device, the user can click the web browser icon installed on the electronic device. The electronic device receives the click operation and, in response to the click operation, launches the web browser. After launching the web browser, the electronic device displays the web browser's user interface. Optionally, the user interface may include a URL input box, back / forward buttons, a bookmark directory, etc. The user can then choose to enter a URL (such as a uniform resource locator (URL)) to be queried in the URL input box included in the web browser's user interface and confirm the entry. The web browser can then send a Hypertext Transfer Protocol (HTTP) request to a web server based on 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.

[0087] It is understandable that the rendering scenario in which the electronic device enters the first application can be understood as an operation scenario triggered by the user using the first application. The operation scenario triggered by the user using the first application needs to involve multiple processes (such as browser process, rendering process, etc.) during the rendering process. Among them, the browser process can be used to manage the creation and destruction of tabs, the display of pages, the download of resources, etc.; the rendering process can be used to be responsible for the parsing, execution and rendering of page documents.

[0088] For example, a browser process may include multiple threads, such as a main thread, an IO thread, an audio thread, a VizCompositorThread thread, a Mali-cmar-backe thread, a CompositorGpuThread thread, a Chrome_InProcGp thread, a NetworkService thread, an EventRunner thread, etc. For example, an IO thread may include a Chrome_IOThread thread, a Chrome_ChildIOT thread, etc. An audio thread may include an AudioThread thread, an AudioServiceClient thread, etc.

[0089] In some examples, the main thread can be used to handle input events, load URLs, draw tab pages, and other UI controls.

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

[0091] In some examples, the VizCompositorThread thread can be responsible for receiving vertical synchronization signals (vsync) and generating GPU instructions using addDrawOp. For example, the VizCompositorThread thread is responsible for parsing web page content and rendering pages. Parsing web page content includes parsing the HTML, CSS, and JavaScript codes of the web page, and converting them into rendering instructions that the browser can understand. Rendering the page includes calculating the layout and display mode of the page after the VizCompositorThread thread completes the parsing of the web page content, and then rendering the page into the final appearance that the user can see.

[0092] In some examples, the Mali-cmar-backe thread is used as a Mali-related thread and can be used to be responsible for separate rendering.

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

[0094] In some examples, the Chrome_InProcGp thread can be responsible for rasterization.

[0095] In some examples, a NetworkService thread may be responsible for obtaining network data.

[0096] In some examples, an EventRunner thread can be responsible for distributing vsync.

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

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

[0099] In some examples, the main thread can be responsible for measuring and laying out a hierarchical tree, and paint generating drawing instructions.

[0100] In some examples, the Compositor thread can be responsible for dividing layers into smaller tiles and passing them to the Rasterizer thread for rasterization. Specifically, the Compositor thread can be responsible for parsing and rendering web page content, compositing pages, receiving vertical synchronization signals, and handling user input events. For example, parsing and rendering web page content includes parsing the HTML, CSS, and JavaScript code of the web page and converting them into rendering instructions that the browser can understand; calculating the layout and display of the page; and then rendering the page into the final appearance visible to the user. Compositing the page includes compositing the rendering results of each layer to generate the final page image and output it to the screen. Receiving vertical synchronization signals includes receiving vsync signals from the browser, which indicate the end of the previous frame and the beginning of the next frame. Handling user input events includes receiving user interaction events from the operating system, such as scrolling, typing, clicks, and mouse movements, and processing the page accordingly.

[0101] In some examples, the CompositorTileWorker thread can be responsible for image decoding, block GPU instruction generation, and rendering of visible areas first. For example, the CompositorTileWorker thread is a thread in the Chromium rendering engine that is responsible for 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 to GPU data, which greatly improves rendering efficiency. In addition, the CompositorTileWorker thread can also process multiple rasterization tasks in parallel, which can further improve rendering performance.

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

[0103] In some examples, an AudioOutputDevice thread can be responsible for audio-related operations.

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

[0105] 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 perform rendering tasks of the rendering scene, and one or more second target threads can be used to perform data communication tasks of the rendering scene.

[0106] In an embodiment of the present application, in response to the first operation, the electronic device may update the scheduling priority of one or more first target threads from a first preset level to a first level, and update the scheduling priority of one or more second target threads from a second preset level to a second level. It should be understood that the electronic device responding to the first operation can be understood as the electronic device recognizing, through the first operation, that the electronic device has entered the rendering scene of the first application.

[0107] For example, the scheduling priority of the target thread is represented by a priority value, and there is a first target thread and a second target thread as an example. A target thread corresponds to a scheduling priority, and the higher the scheduling priority, the more priority it will be allocated to corresponding operating 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, and vice versa, the smaller the priority value, the higher the scheduling priority. Assuming that the priority value of the second target thread is 100 and the priority value of the first target thread is 80, the scheduling priority of the first target thread is higher than the scheduling priority of the second target thread. Optionally, when CPU resources are limited, the first target thread will be allocated corresponding operating resources first, and it is easy to preempt the operating resources of the second target thread.

[0108] It should be understood that the embodiments of the present application do not limit the corresponding relationship between the priority value and the scheduling priority. In some other embodiments, the larger the priority value of the target thread, the higher the scheduling priority; conversely, the smaller the priority value of the target thread, the lower the scheduling priority.

[0109] It is understood that the first preset level and the second preset level may be the same or different. For example, taking the first preset level and the second preset level as the same, the default scheduling priority of one or more first target threads and the default scheduling priority of 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 a completely fair scheduler (CFS) thread, and the CFS thread has the lowest scheduling priority.

[0110] Optionally, in an embodiment of the present application, the first level and the second level may be the same, or may be different. For example, take a first target thread and a second target thread as an example. When the first level is the same as the second level, the first target thread needs to compete with the second target thread for scheduling. When the first level is different from the second level, if the first level is higher than the second level, the first target thread is scheduled before the second target thread, and the first target thread will be preferentially allocated corresponding operating resources. If the first level is lower than the second level, the second target thread is scheduled before the first target thread, and the second target thread will be preferentially allocated corresponding operating 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 VIP scheduling) of the second target thread.

[0111] For example, the scheduling priority update form 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.

[0112] Table 1

[0113] It should be understood that Table 1 is an example, which is provided for the purpose of explaining 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.

[0114] For example, taking the rendering scenario as a web page loading scenario, 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 scenario involves multiple first target threads and multiple second target threads, and the default scheduling priority of the multiple first target threads is the same as the default scheduling priority of the multiple second target threads (for example, the default scheduling priority of the multiple first target threads and the default scheduling priority of the multiple second target threads are both cfs levels). Among them, the RT level is used to indicate the highest scheduling priority, and the vip level is used to indicate a higher scheduling priority. It can be understood that the RT level is used to indicate the scheduling priority of the real-time (RT) thread, and the vip level is used to indicate the scheduling priority of the critical thread. Among them, the RT level is higher than the vip level, and the vip level is higher than the cfs level.

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

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

[0117] In some examples, multiple first target threads can be understood as web rendering pipeline threads, with a scheduling priority of full real-time scheduling. Multiple second target threads can be understood as threads used to assist in data transmission (or data transfer) between multiple first target threads (such as multiple web rendering pipeline threads), with a scheduling priority of VIP scheduling. In addition, multiple second target threads with VIP scheduling priority have the ability to dynamically migrate cores.

[0118] For example, a thread with a scheduling priority of VIP level runs on a certain processing unit (or can be understood as a certain core). If the processing unit is preempted by a thread with a scheduling priority of RT level at a certain time (or a certain moment), then if the thread with a scheduling priority of VIP level has the ability to dynamically migrate cores, the thread with a scheduling priority of VIP level can be migrated to other processing units to continue running.

[0119] It is understandable that the above-mentioned update process can be executed by the web kernel included in the application framework layer in the electronic device. For example, after the web kernel recognizes that the rendering scene of the electronic device entering the first application is a web page loading scene based on the user's web page loading operation, the identifiers (or indexes or names) of the multiple threads involved in the web page loading scene can be sent to the resource scheduler. After receiving the identifiers of the multiple threads involved in the web page loading scene, the resource scheduler can call the process management capability of the kernel layer to update the scheduling priority of the first target thread and the scheduling priority of the second target thread included in the multiple threads involved in the web page loading scene accordingly.

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

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

[0122] For example, if the first level is higher than the second level, the electronic device may prioritize scheduling one or more first target threads. In other words, the electronic device may prioritize allocating corresponding operating resources to the one or more first target threads, so that the one or more first target threads are prioritized for scheduling.

[0123] Taking a first target thread and a second target thread, where the first level is higher than the second level, as an example, the scheduling of the first target thread and the second target thread is described through the following several possible examples.

[0124] 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 assigned) on the same processing unit (e.g., 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 insufficient to support the second target thread, the electronic device may migrate the second target thread to an idle processing unit for priority execution, or may insert the second target thread before the second target thread in a waiting state on another non-idle processing unit for execution. The scheduling priority of the third target thread is lower than the second level.

[0125] 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 into the first processing unit for priority execution, and can insert the second target thread into the second processing unit for priority execution. It should be understood that the priority execution of the first target thread when inserted into the first processing unit can be understood as the first target thread being queued up to be executed before the thread with a lower scheduling priority than the first level to be executed on the first processing unit, and the priority execution of the second target thread when inserted into the second processing unit can be understood as the second target thread being queued up to be executed before the thread with a lower scheduling priority than the second level to be executed on the second processing unit.

[0126] In an embodiment of the present application, when a first time period (for example, 10s) has passed after the electronic device schedules one or more first target threads, 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 a second time period (for example, 10s) has passed after the electronic device schedules one or more second target threads, 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 time period can be understood as the effective duration (or validity period or effective duration) of the updated (or adjusted) scheduling priority of the first target thread or the second target thread, and the second time period can be understood as the effective duration of the updated scheduling priority of the second target thread.

[0127] For example, a first target thread is a VizCompositorThread thread, a second target thread is a NetworkService thread, the first preset level and the second preset level are both cfs levels, the first level is RT level, the second level is vip level, the first duration is 10s, and the second duration is 10s. After 10 seconds have passed since the electronic device scheduled the VizCompositorThread thread, the scheduling priority of the VizCompositorThread thread can be restored from RT level to cfs level. After 10 seconds have passed since the electronic device scheduled the NetworkService thread, the scheduling priority of the NetworkService thread can be restored from vip level to cfs level.

[0128] It can be seen from the above steps 301 to 303 that by responding to the first operation (that is, recognizing that the electronic device enters the rendering scene of the first application through the first operation), the scheduling priority of the first target thread and the scheduling priority of the second target thread are adjusted accordingly. In this way, the first target thread and the second target thread can be scheduled preferentially, which helps to reduce the rendering response delay, thereby meeting user needs well and improving user experience.

[0129] It should be noted that the specific implementation processes provided in the above embodiments are only examples of the method processes applicable to 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.

[0130] In the embodiments provided in the present application above, the methods provided in the embodiments of the present application are introduced from the perspective of an electronic device as an execution subject. In order to implement the various functions in the methods provided in the embodiments of the present application above, 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 hardware structure plus a software module. Whether a function of the above functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.

[0131] Based on the same concept, an embodiment of the present application also provides an electronic device for implementing the web kernel-based thread scheduling method provided in an embodiment of the present application. As shown in Figure 4, 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-mentioned devices can be coupled via one or more communication buses 403. Optionally, the electronic device 400 may also include a display screen 404.

[0132] In particular, the memory 401 stores one or more computer programs (codes), each of which includes computer instructions; and one or more processors 402 invoke the computer instructions stored in the memory 401, causing the electronic device 400 to execute the web-kernel-based thread scheduling method provided in the above-described embodiment of the present application. For example, the electronic device 400 may perform the following steps: the electronic device 400 enters a page switching scenario of a first application. The first application may be a web-kernel-based application. Thereafter, the electronic device 400 may update the scheduling priority of the first target thread from a first preset level to a first level, and may update the scheduling priority of the second target thread from a second preset level to a 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. The electronic device 400 may then schedule the first target thread according to the first level and schedule the second target thread according to the second level. Exemplarily, the page switching scenario may be one of the following scenarios: a web page loading scenario, a sliding scenario, an application window resizing scenario, or a tab switching focus scenario. It should be understood that the page switching scenario may be a form of a rendering scenario.

[0133] 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 can store an operating system (hereinafter referred to as system), such as an embedded operating system such as Android, IOS, WINDOWS, or LINUX. The memory 401 can be used to store the implementation program of the embodiment of the present application. The memory 401 can also store a network communication program, which can be used to communicate with one or more additional devices, one or more user devices, and one or more network devices.

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

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

[0136] It should be noted that Figure 4 is only one implementation of the electronic device 400 provided in an embodiment of the present application. In actual applications, the electronic device 400 may also include more or fewer components. For details, please refer to the specific structure and description shown in Figure 1, and no limitation is made here.

[0137] Based on the same concept, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program runs on an electronic device, the electronic device executes the method provided in the above embodiment.

[0138] Based on the same concept, an embodiment of the present application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the method provided in the above embodiment.

[0139] Based on the same concept, an embodiment of the present application further provides a chip, which 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 program instructions in the memory to enable the electronic device to perform the method provided in the above embodiment. Wherein, "coupling" refers to the direct or indirect connection between two components. For example, coupling can refer to an electrical connection between two components.

[0140] The methods provided in the embodiments of the present application may be implemented in whole or in part through software, hardware, firmware, or any combination thereof. When implemented using software, they may be implemented in whole or in part in the form of a computer program product. A 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 device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. A computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital video discs (DVDs), or semiconductor media (e.g., SSDs), etc.

[0141] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is 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, wherein The method further includes: Running the first target thread on a first processing unit, migrating the second target thread to a free processing unit to run, or inserting the second target thread before a third target thread to run, 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 in data transmission between the first target threads.

7. The method according to any one of claims 1-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, characterized in that, 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, wherein When the computer instructions are executed by the processor, the electronic device is further caused to perform: 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, where the scheduling priority of the third target thread is 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, characterized in that, 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, The computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are executed by the electronic device, the electronic device is caused to perform 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 instructions, and when the computer program or instructions run on the electronic device, the electronic device is caused to perform the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method for adjusting thread priority, terminal and computer readable storage medium

    CN114461353A

  • Thread scheduling method and electronic equipment

    CN115016706A

  • Thread acceleration processing method and device

    CN117130774A

  • Inter-process rendering pipeline for shared process remote web content rendering

    US11089081B1