Thread scheduling optimization method and device and electronic equipment

By matching the priority queue scheduling and real-time scheduling types in the foreground process of the applet application, the response delay problem caused by the long rendering links and many threads of the applet application is solved, and the rendering speed and response speed are significantly improved.

CN119536942APending Publication Date: 2025-02-28VIVO MOBILE COMM CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411591330.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

Mini-program applications have long rendering links and many threads, resulting in long response delays.

Method used

By listening to the foreground process, if you find that there is a graphics processor process in the foreground process, the target threads related to rendering in the foreground process will match the priority queue scheduling and real-time scheduling types, and schedule according to the matching scheduling type.

Benefits of technology

It improves the rendering speed of applet applications, reduces the delay of applet applications, and makes its response speed close to native applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536942A_ABST
    Figure CN119536942A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a thread scheduling optimization method and device and electronic equipment, and belongs to the technical field of computer programs.The thread scheduling optimization method comprises the steps that a foreground process is monitored; under the condition that a graphics processor process exists in the foreground process, a scheduling type is matched for a target thread, the target thread is a rendering-related thread in the foreground process, and the scheduling type comprises priority queue jumping scheduling and real-time scheduling; and scheduling the target thread according to the matched scheduling type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer program technology, and specifically relates to a thread scheduling optimization method, device and electronic device. Background Art

[0002] In related technologies, in order to reduce development costs and improve compatibility, the pages of mini-program applications are usually implemented using a third-party architecture. However, this results in longer and more rendering links for mini-program applications, as well as more threads, which leads to longer response delays for mini-program applications. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a thread scheduling optimization method, device and electronic device, which can solve the technical problem of long response delay caused by long rendering links and more threads in small program applications in related technologies.

[0004] In a first aspect, an embodiment of the present application provides a thread scheduling optimization method, comprising:

[0005] Monitor foreground processes;

[0006] When there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread, the target thread is a thread related to rendering in the foreground process, and the scheduling type includes priority queue scheduling and real-time scheduling;

[0007] Schedule the target thread according to the matched scheduling type.

[0008] In a second aspect, an embodiment of the present application provides a thread scheduling optimization device, including:

[0009] Monitoring module, used to monitor the foreground process;

[0010] A matching module, used for matching a scheduling type for a target thread when there is a graphics processor process in the foreground process, the target thread being a thread in the foreground process related to rendering, and the scheduling type including priority queue interruption scheduling and real-time scheduling;

[0011] The execution module is used to schedule the target thread according to the matched scheduling type.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the thread scheduling optimization method provided in the first aspect are implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the thread scheduling optimization method provided in the first aspect are implemented.

[0014] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the steps of the thread scheduling optimization method provided in the first aspect.

[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the thread scheduling optimization method provided in the first aspect.

[0016] In an embodiment of the present application, the thread scheduling optimization method includes monitoring the foreground process to determine whether there is a graphics processor process in the foreground process. If there is a graphics processor process in the foreground process, it means that the current process belongs to a mini-program application. Therefore, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread related to rendering in the foreground process, where the scheduling type includes priority queue scheduling and real-time scheduling, and then scheduling is performed according to the scheduling type matched with the target thread.

[0017] As mentioned above, the thread scheduling optimization method provided by the present application, when there is a graphics processor process in the foreground process, that is, when the foreground process belongs to a mini-program application, matches the target thread related to rendering in the foreground process with a higher priority scheduling type, thereby improving the rendering speed of the mini-program application and reducing the delay of the mini-program application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 One of the flowcharts of the thread scheduling optimization method according to an embodiment of the present application is shown;

[0019] Figure 2 A schematic diagram showing the structure of a small program application to which the thread scheduling optimization method according to an embodiment of the present application is applied;

[0020] Figure 3 A second flowchart of the thread scheduling optimization method according to an embodiment of the present application is shown;

[0021] Figure 4 A structural block diagram of a thread scheduling optimization device according to an embodiment of the present application is shown;

[0022] Figure 5 A structural block diagram of an electronic device according to an embodiment of the present application is shown;

[0023] Figure 6 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application is shown. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0025] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0026] In conjunction with the accompanying drawings, a thread scheduling optimization method, device and electronic device provided in the embodiments of the present application are described below through specific embodiments and their application scenarios.

[0027] In a first aspect, an embodiment of the present application provides a thread scheduling optimization method. Figure 1 FIG. 1 shows one of the flow charts of the thread scheduling optimization method according to an embodiment of the present application. Figure 1 As shown, the thread scheduling optimization method includes:

[0028] Step 102: Monitor the foreground process.

[0029] Specifically, after the application is started, the life cycle of the application will be managed by the Activity Manager Server (AMS) of the System Server, and the information of the application process will be recorded and maintained in the Activity Manager Server.

[0030] Therefore, the foreground process can be monitored through the activity management service.

[0031] Step 104: When there is a graphics processor process in the foreground process, a scheduling type is matched for the target thread, the target thread is a thread in the foreground process related to rendering, and the scheduling type includes priority queue scheduling and real-time scheduling.

[0032] Specifically, all foreground processes are determined. If there is a graphics processing unit process (GPU process) in the foreground process, it means that the foreground process belongs to a mini-program application. In this case, the scheduling type is configured for the rendering-related threads in the foreground process, where the scheduling types include priority queue interruption (Very Important Person, VIP) scheduling and real-time (Real Time, RT) scheduling.

[0033] In the related art, the scheduling type of most rendering-related threads is Completely Fair Scheduler (CFS) scheduling, and the present application improves the scheduling priority of rendering-related threads in the foreground process by adjusting the scheduling type of the target thread.

[0034] like Figure 2 As shown in the figure, the process architecture related to the mini program application includes the main process (Browser Process), the rendering process (Renderder Process), the graphics processor process, the utility process (Utility Process) and the browser plug-in process (Plugin Process). The above processes related to rendering are the main process, the rendering process and the graphics processor process. Among them, the threads related to rendering refer to the key threads of the rendering link and the threads that assist the key threads for data transmission.

[0035] Optionally, the graphics processor process is a separate process.

[0036] Step 106: Schedule the target thread according to the matched scheduling type.

[0037] Specifically, the target thread is scheduled according to the scheduling type after the priority is adjusted, thereby improving the rendering speed of the application page.

[0038] Taking the web structure as an example, this application identifies the key threads and auxiliary threads in the rendering link of wed by combing, and performs real-time scheduling and priority queue scheduling in scenarios such as startup, sliding, and zooming, so that the performance of the mini-program application page can be close to that of the native application page in terms of startup and sliding, and optimizes the response delay, completion delay, and frame rate of the mini-program application. Of course, in other embodiments of this application, the mini-application still adopts the reactnative architecture and fultter architecture.

[0039] In an embodiment of the present application, the thread scheduling optimization method includes monitoring the foreground process to determine whether there is a graphics processor process in the foreground process. If there is a graphics processor process in the foreground process, it means that the current process belongs to a mini-program application. Therefore, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread related to rendering in the foreground process, where the scheduling type includes priority queue scheduling and real-time scheduling, and then scheduling is performed according to the scheduling type matched with the target thread.

[0040] As mentioned above, the thread scheduling optimization method provided by the present application, when there is a graphics processor process in the foreground process, that is, when the foreground process belongs to a mini-program application, matches the target thread related to rendering in the foreground process with a higher priority scheduling type, thereby improving the rendering speed of the mini-program application and reducing the delay of the mini-program application.

[0041] As a possible implementation, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread, including: when there is a graphics processor process in the foreground process, traversing the threads in the foreground process to determine the target thread; when the target thread is a network-related thread or an inter-process communication thread, matching the target thread as a priority queue scheduling; when the target thread is a rendering-critical thread, matching the target thread as a real-time scheduling.

[0042] Specifically, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread, including: when there is a graphics processor process in the foreground process, all threads in the foreground process are traversed, and the target thread is determined among all threads, and network-related threads or inter-process communication threads are configured as priority queue scheduling, and rendering key threads are configured as real-time scheduling, so as to ensure smooth communication and network, improve communication and network transmission speeds, and improve other rendering speeds to ensure the rendering speed of the pages of the mini-program application.

[0043] Among them, network-related threads and inter-process communication threads are threads that assist key threads in data transmission.

[0044] Among them, the thread name (Threadname) of the target thread, the process it belongs to, the main function, the scheduling type of the quality of service (Quality of Service, QoS) in the related technology and the adjusted scheduling type are shown in Table 1 below.

[0045] Table 1

[0046]

[0047] Table 1

[0048]

[0049] Specifically, as shown in Table 1 above, the scheduling types of threads related to rendering are all adjusted to real-time scheduling or priority queue-jumping scheduling. The threads in Table 1 are the most important threads related to the rendering link in the main process, rendering process, and graphics processor process, that is, the main target threads. This application mainly adjusts the scheduling type of the target thread, and follows two scheduling types, namely real-time scheduling and priority queue-jumping scheduling.

[0050] One is to set the rendering key thread in the target thread to real-time scheduling, that is, set the scheduling type of the threads named: UI, Render Thread, VizCompositorThead, CrRendererMain, Compositor, CompositorWorker, CrRendererMain, CompositorThread to real-time scheduling.

[0051] The second is to set the auxiliary key thread in the target thread that performs data transmission as priority queue scheduling, that is, set the scheduling type of the threads named: NetworkService and Chrome Child IO Thread to priority queue scheduling. Such threads are mainly used for auxiliary rendering.

[0052] As mentioned above, the performance of the Mini Program is greatly improved by adjusting the scheduling type of the target thread. The response and completion delays are measured from clicking the icon of the Mini Program application to the full launch of the Mini Program application and filling the full screen. The frame rate data is then measured by sliding up and down on the page of the Mini Program application. Through 20 sets of data measurements, the response and completion delays can be improved by an average of 10%, and the frame rate can be increased from 116hz to above 119hz.

[0053] As a possible implementation, when there is a graphics processor process in the foreground process, traverse the threads in the foreground process to determine the target thread, including: when there is a graphics processor process in the foreground process, traverse the threads in the foreground process; determine the target thread according to the thread name of the thread in the foreground process.

[0054] Specifically, when there is a graphics processor process in the foreground process, the threads in the foreground process are traversed to determine the target thread, including: when there is a graphics processor process in the foreground process, all threads in the foreground process are traversed, and the target thread is determined according to the thread name of the thread in the foreground process, each thread has a thread name, and whether the thread is the target thread is determined according to the thread name, so that all threads related to rendering in the foreground process can be determined, and the method has high accuracy and reliability.

[0055] The thread name may be determined by a thread identification (TID).

[0056] As a possible implementation, monitoring the foreground process includes: determining a process name (Processname) of the foreground process; and determining, according to the process name, whether the foreground process includes a graphics processor process.

[0057] Specifically, monitoring the foreground process includes: determining the process name of the foreground process, each process has a process name, and according to the process name, it can be determined whether the foreground process includes a graphics processor process. This method has high accuracy and reliability.

[0058] The process name may be determined by a process identification (PID).

[0059] As a possible implementation, scheduling the target thread according to the matched scheduling type includes: sending the matched scheduling type of the target thread to the kernel scheduler, so that the kernel scheduler schedules the target thread according to the scheduling type.

[0060] Specifically, the target thread is scheduled according to the matched scheduling type, including: sending the matched scheduling type of the target thread to the kernel scheduler, and then the kernel scheduler schedules the target thread according to the matched scheduling type, thereby improving the rendering speed.

[0061] The present application embodiment provides a thread scheduling optimization method, Figure 3 FIG. 2 shows a second flow chart of a thread scheduling optimization method according to an embodiment of the present application. Figure 3 As shown, the thread scheduling optimization method includes:

[0062] Step 302: The mini program application starts to start.

[0063] Step 304: The system service monitors the process identity of the foreground process of the foreground application.

[0064] Specifically, when a mini-program application is started, the activity management service of the system service will manage the life cycle of the application, and the process information started by the application will be recorded and saved in the activity management service.

[0065] Step 306: the system scheduler obtains the process identity and queries the activity management service for the thread identity of the thread related to the foreground thread.

[0066] Specifically, the Rate Monotonic Scheduling (RMS) scheduler obtains the relevant information of the application identification (User Identification, UID) of the foreground application and the process identification of the foreground process by monitoring the information change of the foreground process registered with the activity management service.

[0067] Step 308 : Determine whether the process name contains a graphics processor process. If so, execute step 310 ; if not, execute step 304 .

[0068] Specifically, by reading the process name in the process identifier of the foreground process, it is determined whether there is an independent process of the graphics processor in the foreground process, thereby determining whether the current application is a mini-program application.

[0069] Step 310: query the thread name by concatenating the character string, perform thread name matching, and match the scheduling type for the target thread.

[0070] Specifically, after determining that the application is the architecture of a mini-program application, the thread names are traversed by string concatenation, and by matching the thread names, the key threads of the rendering link and the auxiliary key threads for data transmission in the mini-program application are sorted out.

[0071] Step 312: Send the scheduling type of the target thread to the kernel scheduler and set a high priority.

[0072] Specifically, a list of thread identities and scheduling types is formed after matching, and sent to the kernel scheduler through the Java Native Interface (JNI) layer. The kernel scheduler performs real-time scheduling of the rendering pipeline, and gives priority to queue scheduling for the auxiliary rendering pipeline and threads doing data transmission.

[0073] The thread scheduling optimization method provided in the embodiment of the present application can be executed by a thread scheduling optimization device. In the embodiment of the present application, the thread scheduling optimization device provided in the embodiment of the present application is described by taking the thread scheduling optimization method executed by the thread scheduling optimization device as an example.

[0074] like Figure 4 As shown, the present application provides a thread scheduling optimization device 400, including: a monitoring module 402, used to monitor the foreground process; a matching module 404, used to match the scheduling type for the target thread when there is a graphics processor process in the foreground process, the target thread is a thread in the foreground process related to rendering, and the scheduling type includes priority queue scheduling and real-time scheduling; an execution module 406, used to schedule the target thread according to the matched scheduling type.

[0075] In an embodiment of the present application, the thread scheduling optimization method includes monitoring the foreground process to determine whether there is a graphics processor process in the foreground process. If there is a graphics processor process in the foreground process, it means that the current process belongs to a mini-program application. Therefore, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread related to rendering in the foreground process, where the scheduling type includes priority queue scheduling and real-time scheduling, and then scheduling is performed according to the scheduling type matched with the target thread.

[0076] As mentioned above, the thread scheduling optimization method provided by the present application, when there is a graphics processor process in the foreground process, that is, when the foreground process belongs to a mini-program application, matches the target thread related to rendering in the foreground process with a higher priority scheduling type, thereby improving the rendering speed of the mini-program application and reducing the delay of the mini-program application.

[0077] As a possible implementation, the matching module includes: a first determination submodule, which is used to traverse the threads in the foreground process and determine the target thread when there is a graphics processor process in the foreground process; a first matching submodule, which is used to match the target thread as a priority queue scheduling when the target thread is a network-related thread or an inter-process communication thread; and a second matching submodule, which is used to match the target thread as a real-time scheduling when the target thread is a rendering-critical thread.

[0078] As a possible implementation, the first determination submodule includes: a traversal unit, used to traverse the threads in the foreground process when there is a graphics processor process in the foreground process; and a determination unit, used to determine the target thread according to the thread name of the thread in the foreground process.

[0079] As a possible implementation, the monitoring module includes: a second determination submodule, used to determine the process name of the foreground process; and a third determination submodule, used to determine whether the foreground process includes a graphics processor process according to the process name.

[0080] As a possible implementation, the execution module includes: an execution submodule, which is used to send the matched scheduling type of the target thread to the kernel scheduler, so that the kernel scheduler schedules the target thread according to the scheduling type.

[0081] The thread scheduling optimization device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated path or chip. The electronic device can be a terminal, or other devices other than the electronic device. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a palm computer, a vehicle-mounted electronic device, a private network communication terminal device (such as a walkie-talkie), a mobile Internet device (Mobile Internet Device, MID), an augmented reality / virtual reality / mixed reality device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0082] The thread scheduling optimization device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0083] The thread scheduling optimization device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0084] The present application also provides an electronic device, Figure 5 A structural block diagram of an electronic device according to an embodiment of the present application is shown, such as Figure 5 As shown, the electronic device 500 includes a processor 502 and a memory 504. The memory 504 stores programs or instructions that can be executed on the processor 502. When the program or instruction is executed by the processor 502, the various steps of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0085] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0086] Figure 6 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.

[0087] The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610 and other components.

[0088] Those skilled in the art will appreciate that the electronic device 600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 610 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0089] The processor 610 is used to monitor the foreground process;

[0090] The processor 610 is used to match a scheduling type for a target thread when there is a graphics processor process in the foreground process, where the target thread is a thread in the foreground process related to rendering, and the scheduling type includes priority queue interruption scheduling and real-time scheduling;

[0091] The processor 610 is used to schedule the target thread according to the matched scheduling type.

[0092] In some embodiments, optionally, the processor 610 is configured to match a scheduling type for a target thread when there is a graphics processor process in the foreground process, including:

[0093] The processor 610 is used for traversing the threads in the foreground process and determining the target thread when there is a graphics processor process in the foreground process;

[0094] The processor 610 is used for matching the target thread to a priority queue-jumping scheduling when the target thread is a network-related thread or an inter-process communication thread;

[0095] The processor 610 is configured to match the target thread to real-time scheduling when the target thread is a rendering-critical thread.

[0096] In some embodiments, optionally, the processor 610 is configured to traverse threads in the foreground process and determine a target thread when there is a graphics processor process in the foreground process, including:

[0097] The processor 610 is used for traversing threads in the foreground process when there is a graphics processor process in the foreground process;

[0098] The processor 610 is configured to determine a target thread according to a thread name of a thread in a foreground process.

[0099] In some embodiments, optionally, the processor 610 is configured to monitor a foreground process, including:

[0100] Processor 610 is used to determine the process name of the foreground process;

[0101] The processor 610 is used to determine whether the foreground process includes a graphics processor process according to the process name.

[0102] In some embodiments, optionally, the processor 610 is configured to schedule the target thread according to the matched scheduling type, including:

[0103] The processor 610 is used to send the matched scheduling type of the target thread to the kernel scheduler, so that the kernel scheduler schedules the target thread according to the scheduling type.

[0104] In an embodiment of the present application, the thread scheduling optimization method includes monitoring the foreground process to determine whether there is a graphics processor process in the foreground process. If there is a graphics processor process in the foreground process, it means that the current process belongs to a mini-program application. Therefore, when there is a graphics processor process in the foreground process, the scheduling type is matched for the target thread related to rendering in the foreground process, where the scheduling type includes priority queue scheduling and real-time scheduling, and then scheduling is performed according to the scheduling type matched with the target thread.

[0105] As mentioned above, the thread scheduling optimization method provided by the present application, when there is a graphics processor process in the foreground process, that is, when the foreground process belongs to a mini-program application, matches the target thread related to rendering in the foreground process with a higher priority scheduling type, thereby improving the rendering speed of the mini-program application and reducing the delay of the mini-program application.

[0106] It should be understood that in the embodiment of the present application, the input unit 604 may include a graphics processor 6041 and a microphone 6042, and the graphics processor 6041 processes the image file of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 607 includes a touch panel 6071 and at least one of other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts: a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0107] The memory 609 can be used to store software programs and various files. The memory 609 may mainly include a first storage area for storing programs or instructions and a second storage area for storing files, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 609 may include a volatile memory or a non-volatile memory, or the memory 609 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 609 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0108] The processor 610 may include one or more processing units; optionally, the processor 610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 610.

[0109] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned thread scheduling optimization method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0110] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0111] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned thread scheduling optimization method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0112] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0113] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned thread scheduling optimization method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0114] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0115] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling an electronic device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0116] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A thread scheduling optimization method, characterized in that: include: Monitor foreground processes; In the case where there is a graphics processor process in the foreground process, matching a scheduling type for a target thread, the target thread being a thread in the foreground process that is related to rendering, and the scheduling type including priority queue interruption scheduling and real-time scheduling; The target thread is scheduled according to the matched scheduling type.

2. The thread scheduling optimization method according to claim 1, characterized in that: In the case where a graphics processor process is included in the foreground process, a scheduling type is matched for the target thread, including: In a case where the graphics processor process is included in the foreground process, traversing the threads in the foreground process to determine the target thread; When the target thread is a network-related thread or an inter-process communication thread, matching the target thread to the priority queue-jumping scheduling; When the target thread is a rendering critical thread, the target thread is matched to the real-time schedule.

3. The thread scheduling optimization method according to claim 2, characterized in that: In a case where the graphics processor process is included in the foreground process, traversing the threads in the foreground process to determine the target thread includes: In a case where the graphics processor process is included in the foreground process, traversing the threads in the foreground process; The target thread is determined according to the thread name of the thread in the foreground process.

4. The thread scheduling optimization method according to any one of claims 1 to 3, characterized in that: Monitor foreground processes, including: Determine the process name of the foreground process; According to the process name, it is determined whether the foreground process includes the graphics processor process.

5. The thread scheduling optimization method according to any one of claims 1 to 3, characterized in that: Scheduling the target thread according to the matched scheduling type includes: The scheduling type matched by the target thread is sent to the kernel scheduler, so that the kernel scheduler schedules the target thread according to the scheduling type.

6. A thread scheduling optimization device, characterized in that: include: Monitoring module, used to monitor the foreground process; A matching module, configured to match a scheduling type for a target thread when there is a graphics processor process in the foreground process, wherein the target thread is a thread in the foreground process related to rendering, and the scheduling type includes priority queue interruption scheduling and real-time scheduling; An execution module is used to schedule the target thread according to the matched scheduling type.

7. The thread scheduling optimization device according to claim 6, characterized in that: The matching module comprises: A first determining submodule, configured to, when the foreground process includes the graphics processor process, traverse the threads in the foreground process to determine the target thread; A first matching submodule, configured to match the target thread to the priority queue-jumping scheduling when the target thread is a network-related thread or an inter-process communication thread; The second matching submodule is used to match the target thread to the real-time scheduling when the target thread is a rendering key thread.

8. The thread scheduling optimization device according to claim 7, characterized in that: The first determining submodule includes: A traversal unit, configured to traverse threads in the foreground process when the foreground process has the graphics processor process; The determination unit is used to determine the target thread according to the thread name of the thread in the foreground process.

9. The thread scheduling optimization device according to any one of claims 6 to 8, characterized in that: The monitoring module comprises: A second determining submodule, used to determine the process name of the foreground process; The third determination submodule is used to determine whether the foreground process includes the graphics processor process according to the process name.

10. The thread scheduling optimization device according to any one of claims 6 to 8, characterized in that: The execution module includes: The execution submodule is used to send the scheduling type matched by the target thread to the kernel scheduler, so that the kernel scheduler can schedule the target thread according to the scheduling type.

11. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the thread scheduling optimization method according to any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • Thread priority control method and related device

    CN120630801A