Application program startup method and electronic device

By reasonably allocating tasks and states in the multi-processor system of electronic devices, avoiding processor resource preemption, solving the problem of lag when starting the application, and achieving smooth startup of the application and improving user experience.

CN118409839BActive Publication Date: 2024-12-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410503389.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-24
Publication Date
2024-12-27
Estimated Expiration
2044-04-24

AI Technical Summary

Technical Problem

Existing electronic devices may experience lag when the application starts, resulting in poor user experience.

Method used

By allocating tasks between the first processor and the second processor, ensuring the reasonable operating status of worker threads and applications, avoiding preemption of processor resources, executing and displaying image data processing tasks in advance, and ensuring the dynamic picture and interface images Display in time.

Benefits of technology

It effectively avoids lag when the application starts, improves the user experience, ensures timely display of multiple images and interface images, and improves system fluency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118409839B_ABST
    Figure CN118409839B_ABST
Patent Text Reader

Abstract

The present application provides an application startup method and an electronic device, the method is applied to an electronic device, the method comprising: in response to a startup operation of a first application, performing a first process on first data through a desktop application, and performing a second process on second data through the first application; in the process of performing the second process on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to run on the first processor; when the working thread finishes executing the first task, multiple first images are displayed, and when the display of multiple first images is finished, the second image is displayed. Thus, the present application can avoid the situation of freezing when the first application is started, and improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to an application startup method and an electronic device. Background Art

[0002] Mobile phones and other electronic devices have become indispensable tools in users' lives. Through mobile phones and other electronic devices, users can engage in leisure, entertainment, communication and other activities. Usually, users have relatively high requirements for the smoothness of using electronic devices.

[0003] Currently, when an application receives a launch operation, the interface of the electronic device can display an animated picture related to the icon of the launched application. After the display is completed, the interface of the application is displayed, thereby launching the application. However, the electronic device may experience lag from the time it receives the launch operation to the time it displays the interface of the application, resulting in a poor user experience. Summary of the invention

[0004] The present application provides an application startup method and an electronic device, which can avoid freezes when the application is started as much as possible and improve the user experience.

[0005] In a first aspect, the present application provides an application startup method, which is applied to an electronic device, wherein the electronic device includes a desktop application, a first application, a working thread, a first processor, and a second processor, and the method includes:

[0006] In response to the start-up operation of the first application, the first data is first processed by the desktop application, and the second data is second processed by the first application. When the first application performs the second processing on the second data, the first application is in a running state on the first processor, and the first data is used to generate image data for displaying a dynamic effect screen when the first application is started, and the second data is used to generate image interface data displayed after the first application is started; wherein, in the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application continues to run on the first processor, the ready state is a state of waiting to run, the first task is a task that the working thread runs and executes on the first processor when the first application runs on the first processor and performs the second processing on the second data; when the working thread finishes executing the first task, multiple first images corresponding to the dynamic effect screen are displayed, and when the multiple first images are displayed, the second image is displayed, the multiple first images are obtained by performing the first processing on the first data, and the second image is obtained by performing the second processing on the second data.

[0007] The first application may be any one of a plurality of applications in the electronic device.

[0008] In the above method, during the second processing of the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, and the first application and the working thread do not need to preempt the first processor. Thus, the working thread can complete the execution of the first task in advance. In this way, when the desktop application processes the first data and obtains multiple first images, the multiple first images can be displayed in advance. When the display of the multiple first images is completed, the second image can be displayed in time, thereby avoiding the visual freeze of the user caused by the failure to display the multiple first images and the second images in time.

[0009] Moreover, during the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application continues to run on the first processor. Thus, the working thread can complete the first task in advance. At the same time, if the desktop application completes the processing of the first data and displays multiple first images, the second image is usually obtained when the display of the multiple first images is completed, and the second image can be displayed in time, thereby avoiding the visual freeze of the user caused by the failure to display the multiple first images and the second images in time.

[0010] In combination with the first aspect, in some implementations of the first aspect, during the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor and waits to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to be run on the first processor, including:

[0011] During the second processing of the second data, if the working thread is in a ready state on the first processor, it waits to execute the first task and determines whether the second processor is in an idle state; when the second processor is in an idle state, the first application and the working thread are run on the first processor and the second processor respectively; when the second processor is not in an idle state, the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to run on the first processor.

[0012] In the above method, when the second processor is in an idle state, the first application and the working thread are respectively run on the first processor and the second processor, which can avoid affecting the thread originally running on the second processor.

[0013] When the second processor is not idle, the first application and the working thread can be run on the first processor, and when the working thread finishes executing the first task, the first application can be continued to run on the first processor to avoid the first application and the working thread from occupying the first processor, causing the startup of the first application to be stuck.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, running the first application and the working thread on the first processor and the second processor respectively includes:

[0015] The state of the first application on the first processor is switched from the running state to the ready state, so that the state of the working thread on the first processor is switched from the ready state to the running state; the first application is switched to the second processor for execution; and the state of the first application on the second processor is switched from the ready state to the running state.

[0016] In the above method, in one implementation, the first application program may be switched to run on the second processor, and the working thread may remain running on the first processor.

[0017] Specifically, it is necessary to first switch the state of the first application on the first processor from the running state to the ready state, then switch the first application to the second processor for execution, and then switch the state of the first application on the second processor from the ready state to the running state, so as to switch the first application to run on the second processor, and keep the working thread running on the first processor.

[0018] In combination with the first aspect, in some implementations of the first aspect, after switching the state of the first application on the second processor from the ready state to the running state, the method further includes:

[0019] When the duration of the first application being in the running state on the second processor is greater than or equal to a first duration, the state of the first application on the second processor is switched from the running state to the ready state, where the first duration is determined based on the duration of a single run of the working thread; the first application is switched to the first processor for execution; and the state of the first application on the first processor is switched from the ready state to the running state.

[0020] In the above method, when the time length of time that the first application is in the running state on the second processor is greater than or equal to the first time length, the working thread completes execution of the first task on the first processor, and the first application can be switched back to running on the first processor. By returning the first application to run on the first processor again, the optimal operating state of the first application can be guaranteed, and the second processor can be guaranteed to normally execute other tasks that need to be executed on the second processor.

[0021] In conjunction with the first aspect, in some implementations of the first aspect, running the first application and the working thread on the first processor and the second processor respectively includes:

[0022] Switch the working thread to the second processor for execution; switch the state of the working thread on the second processor from a ready state to a running state.

[0023] In the above method, in one implementation, the working thread can be switched to the second processor for execution, and the first application program remains running on the first processor. Since the running time of the working thread is short, the working thread can be directly executed and completed on the second processor without switching back to the first processor. The first processor can run the first application program normally.

[0024] In conjunction with the first aspect, in some implementations of the first aspect, running the work thread on the first processor, and continuing to run the first application on the first processor when the work thread finishes executing the first task, includes:

[0025] Switch the state of the first application on the first processor from the running state to the ready state, so that the state of the working thread on the first processor is switched from the ready state to the running state; when the time length of the time length of the state of the first application on the first processor being the ready state is greater than or equal to a second time length, switch the state of the first application on the first processor from the ready state to the running state, and the second time length is determined based on the time length of a single running of the working thread.

[0026] In the above method, when the working thread is in the running state on the first processor for a period of time greater than or equal to the second period of time, the working thread completes execution of the first task on the first processor, and the first application can continue to run the first application on the first processor. At the same time, multiple first images corresponding to the dynamic effect screen can be displayed to ensure that the multiple first images are displayed in advance, and the second processing is performed on the first application to obtain the second image, and when the display of the multiple second images is completed, the second image is displayed, thereby avoiding the lag phenomenon when starting the first application.

[0027] In combination with the first aspect, in some implementations of the first aspect, determining whether the second processor is in an idle state includes:

[0028] Determine the duration of time that the first application is in a running state on the first processor; when the duration of time that the first application is in a running state on the first processor is greater than or equal to a third duration, determine whether the second processor is in an idle state, and the third duration is determined based on the duration of the electronic device displaying two frames of images.

[0029] In the above method, since the user can only perceive that there is a lag in the operation of the electronic device when the electronic device usually loses more than two frames of images, when the first application on the first processor is in the running state for a time period greater than or equal to the third time period, it is determined whether the second processor is in an idle state, so as to execute relevant steps according to the idle state to prevent lag, and it can avoid unnecessary subsequent switching of the first application to the second processor to run as much as possible, thereby saving the scheduling overhead caused by switching processors.

[0030] In combination with the first aspect, in certain implementations of the first aspect, when a startup operation for a first application is received, a thread queue is obtained, the thread queue including all threads in a running state and a ready state on the first processor; the length of time that the first application is in a running state on the first processor is determined, including: when the thread queue includes the first application and a working thread, determining whether the thread of the first application is a real-time thread, a real-time thread is a thread that needs to be completed within a preset time; when the thread of the first application is a real-time thread, determining whether the first application is in a running state on the first processor; when the first application is in a running state on the first processor, determining the length of time that the first application is in a running state on the first processor.

[0031] In the above method, since the real-time thread is a thread that needs to run and end within a preset time period and has a higher running priority, when the thread queue includes the first application and the working thread, there is a problem of the first application and the working thread preempting the first processor. Therefore, it is possible to determine whether the thread of the first application is a real-time thread, so that when the thread of the first application is a real-time thread, subsequent steps can be executed, and unnecessary subsequent switching of the first application to run on the second processor can be avoided as much as possible, thereby saving the scheduling overhead caused by switching processors.

[0032] In combination with the first aspect, in some implementations of the first aspect, the first processing includes image drawing processing and image rendering processing, and the first processing is performed on the first data through the desktop application, including:

[0033] The first data is subjected to image drawing processing and image rendering processing through a desktop application.

[0034] In the above method, after receiving the start operation of the first application, it is necessary to perform image drawing processing and image rendering processing on the first data.

[0035] In combination with the first aspect, in some implementations of the first aspect, the second processing includes image drawing processing and image rendering processing, and performing the second processing on the second data through the first application includes:

[0036] The second data is subjected to image drawing processing and image rendering processing through the first application program.

[0037] In the above method, after receiving the start operation of the first application, it is necessary to perform image drawing processing and image rendering processing on the second data.

[0038] In combination with the first aspect, in some implementations of the first aspect, the plurality of first images are obtained by performing a first synthesis process on the plurality of third images, and the second image is obtained by performing a second synthesis process on the fourth image;

[0039] The plurality of third images are obtained by performing a first processing on the first data, and the fourth image is obtained by performing a second processing on the second image.

[0040] In the above method, after the first data is subjected to image drawing processing and image rendering processing, the obtained multiple third images need to be synthesized to obtain the first image; after the second data is subjected to image drawing processing and image rendering processing, the obtained fourth image needs to be synthesized to obtain the second image.

[0041] In a second aspect, the present application provides an electronic device, the electronic device comprising: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method in the first aspect and any possible implementation of the first aspect.

[0042] In a third aspect, the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions to enable the electronic device to execute the method in the first aspect and any possible implementation of the first aspect.

[0043] In a fourth aspect, the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes the method in the first aspect and any possible implementation of the first aspect.

[0044] In a fifth aspect, the present application provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the method in the first aspect and any possible implementation manner of the first aspect.

[0045] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A human-computer interaction interface diagram provided by the prior art;

[0047] Figure 2 A human-computer interaction interface diagram provided by the prior art;

[0048] Figure 3 A flowchart of an application startup method provided by the prior art;

[0049] Figure 4 A flowchart of an application startup method provided by the prior art;

[0050] Figure 5 A schematic diagram of the relationship between a rendering thread and a working thread of an application 1 provided in the prior art;

[0051] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;

[0052] Figure 7 A schematic diagram of a software architecture of an electronic device provided in one embodiment of the present application;

[0053] Figure 8 A flowchart of an application startup method provided in one embodiment of the present application;

[0054] Fig. 9 A schematic diagram of a scheduling relationship between two processors provided in one embodiment of the present application;

[0055] Fig.10 A schematic diagram of a scheduling relationship between two processors provided in one embodiment of the present application;

[0056] Fig.11 A schematic diagram of a scheduling relationship between two processors provided in one embodiment of the present application;

[0057] Fig.12 A schematic diagram of the scheduling relationship between two processors provided in one embodiment of the present application. DETAILED DESCRIPTION

[0058] In this application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c alone can represent: a, b, c, a and b, a and c, or a, b, and c, where a, b, and c can be single or multiple. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0059] To facilitate understanding, some of the examples given are provided for reference to the description of concepts related to the embodiments of the present application.

[0060] 1. Hot start

[0061] When an application is already running in the background, the application is started again as a hot start. During a hot start, the application process still exists and can be quickly restored to its previous state, so the startup speed is faster and the user experience is better. During a hot start, the application can usually directly load the previous data and state without reinitializing everything.

[0062] 2. Cold start

[0063] When an application is completely closed or has been running in the background for too long, the next time the application is started, it is called a cold start. During the cold start process, the application process needs to be recreated and initialized, and the application needs to reload data and set status, so the startup speed is slow. During a cold start, the application may need to reload resources, make network requests, and other operations.

[0064] 3. Real-time threads

[0065] A real-time thread (RT) is a thread that runs in a real-time operating system. An RT thread has strict time constraints and needs to complete its task within a specified time. In other words, a real-time thread is a thread that needs to run and end within a preset time.

[0066] RT threads are usually scheduled to run preferentially by electronic devices. RT threads are used in application scenarios that require fast response and real-time performance, such as application image rendering, audio processing, video stream processing, robot control, etc.

[0067] In a real-time operating system, different priorities, scheduling strategies and other parameters can be set to ensure that the RT thread completes its task within a specific time requirement while avoiding interruptions by other ordinary threads or interrupts. This ensures the real-time performance and stability of the system and meets the needs of specific applications.

[0068] 4. Worker Threads

[0069] A worker thread may also be referred to as an IO kworker thread, and is one of the worker threads used to process input / output (I / O) operations in a system of an electronic device.

[0070] Worker threads are used to asynchronously process tasks in the work queue, including processing hardware interrupts, file system IO events, managing system memory, etc. They are necessary key tasks during application startup.

[0071] Worker threads usually handle the aforementioned tasks in the background so as not to block user space processes.

[0072] Mobile phones and other electronic devices have become indispensable tools in users' lives. Through mobile phones and other electronic devices, users can engage in leisure, entertainment, communication and other activities. Usually, users have relatively high requirements for the smoothness of using electronic devices.

[0073] Currently, when an application receives a start-up operation, an interface of the electronic device may display an animated picture related to the icon of the started application. After the display is completed, the interface of the application is displayed, thereby starting the application.

[0074] For example, Figure 1 Middle (a), Figure 1 Middle (b), Figure 2 (a) and Figure 2 In the human-computer interaction interface diagram (b), when the icon of the gallery application receives the start operation indicated by the user, Figure 1 As shown in (a), the interface of the electronic device may display an animated picture related to the icon of the gallery application, such as Figure 1 As shown in (b) Figure 2 As shown in (a), the dynamic screen is used to display the effect that the icon of the gallery application is first reduced and then enlarged to cover the entire screen. After the display is completed, the interface of the gallery application is displayed, such as Figure 2 As shown in (b), the gallery application is launched.

[0075] However, the electronic device may experience a freeze in the process from receiving a startup operation to displaying the interface of the application, resulting in a poor user experience.

[0076] The electronic device includes a desktop application, an application 1, a working thread, a binder thread, a surface flinger thread and a display screen.

[0077] The application 1 may be any application installed in the electronic device; the application 1 may include a main thread and a rendering thread; and the desktop application may include a main thread and a rendering thread.

[0078] Specifically, if Figure 3 As shown in S11-S26 in the illustrated embodiment, currently, in a possible implementation, the application startup method includes the following steps:

[0079] S11. The desktop application receives a start operation for application 1.

[0080] S12: The desktop application sends a drawing request to application 1.

[0081] The drawing request is used to request application 1 to draw the interface data of application 1 .

[0082] S13. The desktop application performs image drawing on the multiple image data through the main thread of the desktop application to obtain multiple images 1.

[0083] The electronic device stores a plurality of image data related to the startup of the application 1. When receiving the startup operation of the application 1, the desktop application can draw the plurality of image data through the main thread of the desktop application.

[0084] The electronic device can obtain multiple images 1 based on multiple image data, and the electronic device can also display the multiple images 1 on a display screen, so that the user can perceive that a dynamic effect picture is displayed when the application 1 is started.

[0085] S14. The desktop application performs image rendering on each of the multiple images 1 through a rendering thread of the desktop application to obtain multiple rendered images 1.

[0086] S12 and S14 may be executed simultaneously or sequentially. S15: Application 1 draws an image of the interface data of application 1 through the main thread of application 1 to obtain image 2.

[0087] The electronic device may obtain the image 2 according to the interface data, and the electronic device may also display the image 2 after the display screen finishes displaying the above-mentioned multiple images 1 (animated effect pictures).

[0088] Image 2 is the image corresponding to interface 1, and interface 1 is the first frame interface that application 1 needs to display after displaying the end animation screen; for example, interface 1 can be the main interface or home page interface of application 1.

[0089] S16 . Application 1 renders image 2 through a rendering thread of application 1 to obtain a rendered image 2 .

[0090] S17. The working thread executes task 1.

[0091] Task 1 may be a task temporarily sent by the system of the electronic device to the working thread during the process in which the rendering thread of the application 1 renders the image 2.

[0092] Task 1 may be any task in the electronic device, for example, a task of sending data of application 2 to display screen 1 .

[0093] The working thread and the rendering thread of the application 1 are usually run on a processor (Central Processing Unit, CPU) of the electronic device, and the rendering thread of the application 1 has a higher priority than the working thread.

[0094] Therefore, after the rendering thread of application 1 renders image 2 and obtains the rendered image 2, the working thread can execute task 1. After task 1 is executed, the rendering thread of application 1 can send request 1 to the binding thread, which can delay the synthesis and display process of the rendered image 2 and the rendered multiple images 1, resulting in multiple images 1 and image 2 cannot be displayed in time, causing a jamming phenomenon.

[0095] S18. Application 1 sends request 1 to the binding thread through the rendering thread of application 1.

[0096] Request 1 is used to request the binding thread to obtain the rendered image 2 from the rendering thread of the application 1, and to obtain the rendered multiple images 1 from the rendering thread of the desktop application.

[0097] Under normal circumstances, application 1 renders image 2 through the rendering thread of application 1. After obtaining the rendered image 2, application 1 can send request 1 to the binding thread through the rendering thread of application 1.

[0098] Combination Figure 4, when the rendering thread of application 1 runs on a CPU and renders image 2, the electronic device temporarily sends task 1 to the working thread. The rendering thread of application 1 and the working thread are on the same CPU. Since the running priority of the rendering thread of application 1 is higher than that of the working thread, the rendering thread of application 1 is in a running state and the working thread is in a ready state. The working thread can only be in a running state on the CPU and execute task 1 after the rendering thread of application 1 obtains image 2. After the execution of task 1 is completed, the rendering thread of application 1 can send request 1 to the bound thread.

[0099] That is to say, because the electronic device temporarily sends task 1 to the working thread, it prevents the rendering thread of application 1 from sending request 1 to the binding thread, which causes the backward execution of S18, and further causes the delayed display of the dynamic picture (the synthesized multiple images 1) and interface 1 (the synthesized image 2), causing the startup of application 1 to be stuck.

[0100] S19. The binding thread sends request 2 to the desktop application.

[0101] Request 2 is used to request the desktop application to send multiple rendered images 1 to the interface synthesis thread.

[0102] S20. The desktop application sends the rendered multiple images 1 to the interface composition thread.

[0103] S21 . The interface synthesis thread performs synthesis processing on each image 1 in the rendered multiple images 1 to obtain multiple synthesized images 1 .

[0104] S22. The interface synthesis thread sends the synthesized multiple images 1 to the display screen.

[0105] S23, the binding thread sends request 3 to application 1.

[0106] Request 3 is used to request application 1 to send rendered image 2 to the interface synthesis thread.

[0107] S24, application 1 sends the rendered image 2 to the interface composition thread.

[0108] S25 . The interface synthesis thread performs synthesis processing on the rendered image 2 to obtain a synthesized image 2 .

[0109] S26. The interface synthesis thread sends the synthesized image 2 to the display screen.

[0110] Combined with the above description, and Figure 5As can be seen from S301-S307 in the figure, after receiving the start operation of application 1, the process of drawing and rendering multiple image data to obtain multiple rendered images 1, and drawing and rendering interface data to obtain rendered image 2 can be executed. As shown in S301-S303, if the rendering thread of application 1 is rendering image 2, the system of the electronic device temporarily sends task 1 to the working thread. At this time, the rendering thread of application 1 is in a running state, and the working thread is in a ready state. After the rendering thread of application 1 finishes rendering image 2, the working thread can execute the working thread. The working thread performs task 1 required by the program, as shown in S304. After the working thread completes task 1, it can call multiple images 1 and image 2, as shown in S305, and perform the steps of synthesis and display, as shown in S306-S307. It can be seen that the running of the working thread causes the task of the rendering thread of application 1 to send request 1 to the binding thread to be blocked by task 1, and further causes the task of the binding thread to call the rendered multiple images 1 and image 2 to the interface synthesis thread to be blocked, thereby causing the display screen to time out from receiving the synthesized multiple images 1 and image 2, and the display screen cannot display the synthesized multiple images 1 and image 2 in time, causing the startup of application 1 to be stuck.

[0111] In view of the above problems, the present application can provide an application startup method, an electronic device, a chip system, a computer-readable storage medium and a computer program product. When the working thread is in a ready state on the first processor and is waiting to execute task 1, the rendering thread of application 1 can be migrated to another CPU for execution. In this way, the rendering thread and the working thread of application 1 can be run at the same time, so that the working thread ends early, and further the subsequent synthesis and display processes can be executed in advance; or, the running of the rendering thread of application 1 can be paused, and the working thread can be run first. After the end, the running of the rendering thread of application 1 can be continued. Since the running time of the working thread is short, it can end early. During the process of the rendering thread of application 1 continuing to run, the rendering thread of application 1 can send request 1 to the binding thread, so that the subsequent synthesis and display processes can be executed faster; in this way, multiple images 1 and image 2 can be displayed in advance, avoiding the visual freeze phenomenon of the user caused by the failure to display multiple images 1 and image 2 in time.

[0112] The above-mentioned electronic device may be an electronic device having display screen hardware and corresponding software support.

[0113] The electronic device may be a mobile phone, a tablet computer, a vehicle-mounted device, a laptop computer, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart car, a smart TV, a robot, or other devices.

[0114] It should be pointed out that in some possible implementations, the electronic device may also be called a terminal device, user equipment (UE), etc., which is not limited in the embodiments of the present application.

[0115] For ease of explanation, Figure 6 In the description, the electronic device 100 is taken as a mobile phone as an example.

[0116] like Figure 6 As shown, in some embodiments, the electronic device 100 may include a processor 101, a communication module 102, a display screen 103, a camera 104, a sensor 105, an internal memory 106, a USB interface 107, an external memory interface 108, a charging management module 109, a power management module 110, and a battery 111, etc.

[0117] The processor 101 may include one or more processing units, for example, the processor 101 may include an application processor (AP), a modem processor, a graphics processor, an image signal processor (ISP), a controller, a memory, a video stream codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated in one or more processors 101.

[0118] The processor 101 may include multiple sub-processors for running multiple threads in the electronic device. For example, the processor 101 includes 8 sub-processors, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7.

[0119] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0120] The processor 101 may also be provided with a memory for storing instructions and data.

[0121] The communication module 102 may include antenna 1 and antenna 2, a mobile communication module, and / or a wireless communication module.

[0122] The display screen 103 is used to display images or videos in the human-computer interaction interface. The display screen 103 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), MiniLED, MicroLED, Micro-OLED, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 103, where N is a positive integer greater than 1.

[0123] Optionally, the electronic device 100 may further include peripheral devices, such as a mouse, buttons, indicator lights, a keyboard, a speaker, a microphone, etc.

[0124] It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100 .

[0125] In other embodiments, the electronic device 100 may include more or fewer components than shown, or combine some components, or separate some components, or arrange the components differently. The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0126] Please refer to Figure 7 , is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application. The application startup method provided in an embodiment of the present application is applied to Figure 6 When the electronic device 100 is shown, the software in the electronic device 100 can be divided into the following Figure 7 The illustrated application layer 201 , application framework layer (framework, FWK) 202 , hardware abstraction layer (hardware abstraction layer, HAL) 203 and driver layer 204 .

[0127] Multiple applications may be installed in the application layer 201, for example, a desktop application and a gallery application.

[0128] The application framework layer 202 provides a set of basic functions and services for the application layer 201 to call and use.

[0129] The application framework layer 202 may include a working thread, a scheduling module, a binding thread, and an interface synthesis thread.

[0130] Worker threads are used to process tasks in various kernel work queues.

[0131] The bound thread is the thread responsible for handling inter-process communication (IPC) in the system.

[0132] The bound thread is used to pass data and messages between processes to other processes or services. For example, the desktop application is notified to send the rendered multiple images 1 obtained by the desktop application to the interface composition thread. For another example, application 1 is notified to send the rendered image 2 obtained by application 1 to the interface composition thread.

[0133] The scheduling module is used to schedule threads running on multiple sub-processors included in the processor 101.

[0134] The interface synthesis thread is responsible for synthesizing the application interface, graphics and other contents, and finally displays them on the display screen 103 of the electronic device.

[0135] The interface composition thread is responsible for compositing the graphic contents of different applications to facilitate the display of the interface. For example, the content of each image 1 in the rendered multiple images 1 is composited. For example, the content of the rendered image 2 is composited.

[0136] The interface synthesis thread may be connected to the display screen 103 of the electronic device, and the synthesized image may be sent to the display screen 103 for display by the display screen 103 .

[0137] The hardware abstraction layer 203 is a software located between the operating system kernel and the hardware circuit, and is usually used to abstract the hardware to achieve the interaction between the operating system and the hardware circuit at the logic layer.

[0138] The driver layer 204 may be installed with a plurality of drivers for driving the hardware.

[0139] In the embodiment of the present application, the driver layer 204 may include a microphone driver. The microphone driver may be connected to the operating system and the microphone respectively, and the operating system may control the microphone driver to drive the microphone to pick up sound.

[0140] It should be noted that the application layer 201, the application framework layer 202, the hardware abstraction layer 203 and the driver layer 204 may also include other contents, which are not specifically limited here.

[0141] Based on the description of the above scenario description, the application startup method provided in the embodiment of the present application is described in detail below in combination with the accompanying drawings and application scenarios.

[0142] See also Figure 8 , Figure 8 A flow chart of a method for starting an application program provided in an embodiment of the present application is shown.

[0143] like Figure 8 As shown, the application startup method provided by the present application may include:

[0144] S31: The desktop application receives a start operation for application 1.

[0145] The application 1 may be any one of a plurality of applications in the electronic device.

[0146] For example, application 1 is a photo application.

[0147] For another example, application 1 is a camera application.

[0148] This application does not limit the type of application 1.

[0149] The desktop (launcher) application may receive the launch operation of the application 1 in a variety of ways.

[0150] In some embodiments, the startup operation can be an operation on the icon of application 1; specifically, an interface of the electronic device includes the icon of application 1, and the startup operation can be an operation triggered by the user on the icon of application 1 (such as a click, double-click, or long press operation, etc.).

[0151] In other embodiments, the startup operation may be a voice operation on application 1; specifically, a voice assistant is added to the electronic device, and the startup operation may be an operation of opening application 1 after the desktop application receives a specific wake-up word input by the user's voice, and after the voice assistant is woken up, the received user voice input is input.

[0152] For example, the voice assistant may be YOYO. After receiving the user's voice input of "Hello, YOYO", YOYO can be woken up. And after receiving the user's voice input of the voice instruction "Open application 1", the desktop application can determine that a startup operation for application 1 has been received.

[0153] This application does not limit the specific implementation method of the startup operation of application 1.

[0154] In addition, the above-mentioned startup of the application 1 can be a hot start or a cold start; this application does not limit this.

[0155] S32: The desktop application sends a drawing request to application 1.

[0156] The drawing request is used to request the application 1 to draw the image 2 according to the interface data of the application 1 .

[0157] It should be understood that after application 1 is started, interface 1 of application 1 needs to be displayed. After receiving the start operation of application 1, the desktop application needs to notify application 1 to draw image 1 displayed in interface 1.

[0158] Based on this, after receiving the start operation of the application 1, the desktop application can send a drawing request to the application 1 to request the application 1 to draw the image 1 corresponding to the interface 1 that needs to be displayed after the application 1 is started.

[0159] S33. The desktop application sends a data acquisition request to the scheduling module.

[0160] The data acquisition request is used to request the scheduling module to acquire the thread queue on the first CPU.

[0161] It should be noted that an electronic device usually includes multiple CPUs, and each CPU unit is responsible for different tasks to improve the performance and efficiency of the electronic device. The first CPU can be any one of the multiple CPUs.

[0162] Multiple CPUs in electronic devices are usually divided into three levels, namely low-performance CPU, medium-performance CPU and high-performance CPU.

[0163] The low-performance CPU is used to handle low-load tasks to save power and extend battery life. The low-performance CPU usually plays a role when the electronic device is in standby or light use.

[0164] Mid-performance CPUs are designed to provide high performance when needed without consuming too much power.

[0165] High-performance CPUs are used to handle tasks that require a lot of computing resources, such as running complex applications, games, or multimedia tasks.

[0166] In some embodiments, the first CPU is a high performance CPU.

[0167] For example, the electronic device is a mobile phone, which includes 8 CPUs, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7. Among the 8 CPUs, CPU0, CPU1, CPU2 are low-performance CPUs, CPU3 and CPU4 are medium-performance CPUs, CPU5, CPU6 and CPU7 are high-performance CPUs, and the first CPU is CPU7.

[0168] S34. The desktop application performs image drawing on the multiple image data through the main thread of the desktop application to obtain multiple images 1.

[0169] The main thread of the desktop application is a thread used to draw images of image data related to the desktop application.

[0170] It should be noted that when application 1 is started, it is usually necessary to display an animated picture to achieve a transition from the desktop to the interface of application 1.

[0171] For example, the animated picture may be a picture in which the icon of application 1 is first reduced and then enlarged to fill the entire screen.

[0172] This application does not limit the specific type of animation effect screen.

[0173] The duration of the dynamic effect picture is preset. For example, the duration of the dynamic effect picture is 500ms.

[0174] This application does not limit the duration of the animation screen.

[0175] The dynamic effect picture is a picture when multiple images 1 obtained by drawing, rendering and synthesizing multiple image data arranged in a preset order are displayed.

[0176] The number of the plurality of image data is preset, for example, the number of the plurality of image data is 10 (groups).

[0177] This application does not limit the amount of image data.

[0178] The present application can pre-store multiple image data in an electronic device and / or a storage device, making it convenient for a desktop application to call the multiple image data for image drawing.

[0179] This application does not limit the storage method and specific type of multiple image data.

[0180] Each of the multiple image data may include pixel information of the image, that is, the color value and brightness value of the image at each position in space.

[0181] Generally, each image data can be grayscale image data or color image data. Grayscale image data only contains brightness information, while color image data contains information of different color channels such as red, green, and blue.

[0182] Image rendering is the process of converting image data into a form of image that can be recognized by users.

[0183] After receiving the start operation of the application 1 , the desktop application can read the multiple image data in the electronic device through the main thread of the desktop application, and perform image drawing on the multiple image data to obtain multiple images 1 .

[0184] S35 . The desktop application performs image rendering on each of the multiple images 1 through a rendering thread of the desktop application to obtain multiple rendered images 1 .

[0185] The rendering thread of the desktop application is a thread used for performing image rendering on image data related to the desktop application.

[0186] The rendering thread of a desktop application does not usually run on the same CPU as the rendering thread of application 1, and the worker threads.

[0187] For example, the electronic device is a mobile phone, which includes 8 CPUs, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7. Among the 8 CPUs, CPU0, CPU1 and CPU2 are low-performance CPUs, CPU3 and CPU4 are medium-performance CPUs, CPU5, CPU6 and CPU7 are high-performance CPUs, the rendering thread and working thread of application 1 run on CPU7, and the rendering thread of the desktop application runs on CPU4.

[0188] Among them, image rendering is the process of optimizing, enhancing or modifying the original image; through image rendering, the quality and aesthetics of the image can be improved or used in specific application scenarios.

[0189] For example, a desktop application optimizes the image textures of the plurality of images 1 through a rendering thread to obtain the plurality of rendered images 1 .

[0190] For another example, a desktop application performs color enhancement processing on multiple images 1 through a rendering thread to obtain multiple rendered images 1.

[0191] This application does not limit the specific implementation method of image rendering of Image 1.

[0192] Based on the above description, the desktop application performs image rendering on each of the multiple images 1 through a rendering thread, and the rendered multiple images 1 can be images with better quality and aesthetics, thereby ensuring better display effects of the multiple images 1 when displayed.

[0193] It should be understood that when the desktop application performs image rendering on each image 1 of the multiple images 1 through the rendering thread, the image rendering is performed on each image 1 of the multiple images 1 in sequence.

[0194] S36 , application 1 draws an image of the interface data of application 1 through the main thread of application 1 to obtain image 2 .

[0195] The main thread of the application 1 is a thread used for performing image drawing on image data related to the application 1 .

[0196] It should be noted that, when the application 1 is started up, it is usually necessary to display the interface 1 of the application 1 to achieve the transition from the dynamic effect screen to the interface of the application 1.

[0197] In some embodiments, when the current startup of the application 1 is a cold startup, when the startup of the application 1 ends, the interface 1 of the application 1 that needs to be displayed can be the home page interface of the application 1.

[0198] In other embodiments, when the current startup of the application 1 is a hot startup, when the startup of the application 1 ends, the interface 1 of the application 1 that needs to be displayed can be the interface displayed before the application 1 runs in the background.

[0199] The specific implementation method of the interface 1 of the application 1 of this application is not limited.

[0200] The interface 1 of the application 1 is obtained by drawing, rendering and synthesizing the interface data.

[0201] In some embodiments, the interface 1 of the application 1 to be displayed is the home page interface of the application 1 , and the interface data is the interface data corresponding to the home page interface of the application 1 .

[0202] In other embodiments, the interface 1 of the application 1 to be displayed is the interface displayed before the application 1 runs in the background, and the interface data is the interface data corresponding to the interface displayed before the application 1 runs in the background.

[0203] The present application can pre-store the interface data in the electronic device and / or storage device, so that the desktop application can call the interface data to draw the image.

[0204] This application does not limit the storage method and specific type of interface data.

[0205] The interface data may include pixel information of an image corresponding to the interface 1 , that is, color values ​​and brightness values ​​of the image corresponding to the interface 1 at various positions in space.

[0206] Generally, the interface data can be grayscale image data or color image data. Grayscale image data only contains brightness information, while color image data contains information of different color channels such as red, green, and blue.

[0207] After receiving the drawing request, the application 1 can read the interface data in the electronic device through the main thread of the application 1, and perform image drawing on the interface data to obtain the image 2.

[0208] S37 . Application 1 renders image 2 through a rendering thread of application 1 to obtain a rendered image 2 .

[0209] The rendering thread of application 1 is a thread used for performing image rendering on image data related to application 1 .

[0210] In some embodiments, the thread number of the rendering thread of application 1 can be render thread

[27899] .

[0211] This application does not limit the thread number of the rendering thread of application 1.

[0212] Among them, the priority value of the rendering thread of application 1 is usually 97; the smaller the priority value, the higher the priority, and the larger the priority value, the lower the priority.

[0213] Application 1 renders image 2 through the rendering thread of application 1, and the rendered image 2 obtained may be an image with better quality and aesthetics, thereby ensuring a better display effect of image 1 when displayed.

[0214] It should be noted that, in the electronic device, the rendering thread of the application 1 runs on the first CPU and runs in the background to render the image 2 to obtain the rendered image 2.

[0215] S38. The working thread executes task 1.

[0216] It should be noted that, in the electronic device, the working thread runs on the first CPU and in the background to process the above tasks.

[0217] For example, the electronic device is a mobile phone, which includes 8 CPUs, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7. Among the 8 CPUs, CPU0, CPU1 and CPU2 are low-performance CPUs, CPU3 and CPU4 are medium-performance CPUs, CPU5, CPU6 and CPU7 are high-performance CPUs, and the first CPU is CPU7, that is, the rendering thread and working thread of application 1 need to run on CPU7.

[0218] In some embodiments, the thread number of the worker thread may be kworker / 7:0H

[25058] .

[0219] This application does not limit the thread number of the working thread.

[0220] The priority value of the working thread is usually 100; the priority of the rendering thread of application 1 is higher than the priority of the working thread.

[0221] When the rendering thread of application 1 runs on the first CPU and renders image 2, the system of the electronic device may send task 1 to the working thread. Since the first CPU cannot run multiple threads at the same time and the priority of the rendering thread of application 1 is higher than that of the working thread, after the working thread receives task 1, the electronic device can arrange the task of the working thread to execute task 1 on the first CPU after the task of rendering image 2 by the rendering thread of application 1.

[0222] At this time, the rendering thread of application 1 is in a running state, the working thread is in a ready state, and the working thread waits for the rendering thread of application 1 to render image 2.

[0223] When the rendering thread of application 1 renders image 2 and obtains the rendered image 2, the working thread can execute task 1.

[0224] Among them, task 1 can be of various types.

[0225] For example, Task 1 may be a data loading task.

[0226] For another example, task 1 may be a file reading and writing task.

[0227] This application does not limit the specific type of Task 1.

[0228] That is to say, when the rendering thread of application 1 runs on the first CPU and renders image 2, if the system of the electronic device sends task 1 to the working thread, application 1 renders image 2 through the rendering thread of application 1, and after obtaining the rendered image 2, the task (S53) of sending request 1 by the rendering thread of application 1 to the binding thread is interrupted, and the working thread needs to run on the first CPU first to execute task 1.

[0229] S39. The scheduling module obtains the thread queue on the first CPU through the B thread.

[0230] Among them, thread B is a thread that helps the scheduling module to perform thread scheduling management by providing a thread queue to the scheduling module.

[0231] The thread queue includes all threads in a running state and a ready state on the first CPU.

[0232] In some embodiments, there may be only one thread in a running state on the first CPU of the electronic device.

[0233] In other embodiments, while a thread is running on the first CPU, the electronic device may issue tasks to one or more other threads that need to run on the first CPU, so that there is a thread in a running state and one or more threads in a ready state on the first CPU.

[0234] Based on the above description, it can be known that the thread queue may include only one thread in the running state on the first CPU, or may include one thread in the running state on the first CPU and one or more threads in the ready state on the first CPU.

[0235] After receiving the data acquisition request, the scheduling module can first obtain the thread queue through the B thread, so as to prepare data for the execution of subsequent steps.

[0236] S40: The scheduling module determines whether the rendering thread of the application 1 is a real-time thread.

[0237] Among them, the smaller the priority value, the higher the priority, and the larger the priority value, the lower the priority.

[0238] The priority value of a real-time thread is usually less than or equal to 97, and the priority value of a worker thread is usually greater than or equal to 100. The running priority of a real-time thread is higher than the running priority of a worker thread.

[0239] When the rendering thread of application 1 is a real-time thread, the priority of the rendering thread of application 1 is higher than that of the working thread. The rendering thread of application 1 needs to run on the first CPU first, and there is a problem that the rendering thread of application 1 and the working thread preempt the first CPU.

[0240] Based on this, when the rendering thread of the application 1 is a real-time thread, the scheduling module can execute S41.

[0241] Usually, the real-time thread runs on the first CPU. When the rendering thread of application 1 is not a real-time thread, the rendering thread of application 1 does not run on the first CPU, and there is no problem of the rendering thread and working thread of application 1 occupying the first CPU.

[0242] Based on this, when the rendering thread of application 1 is not a real-time thread, the working thread can run on the first CPU and execute S38 normally, that is, execute task 1; after executing S37, the rendering thread of application 1 executes S53 normally.

[0243] It should be understood that the rendering thread of application 1 runs when application 1 is started, and needs to complete the data rendering of the first frame image displayed after application 1 is started within a preset time. Usually, the rendering thread of application 1 is a real-time thread.

[0244] S41. The scheduling module determines whether the rendering thread of application 1 is in a running state.

[0245] If the rendering thread of application 1 runs earlier than the working thread, and the rendering thread of application 1 is rendering image 2, then the rendering thread of application 1 is in a running state and the working thread is in a ready state.

[0246] When the rendering thread of application 1 is in the running state, the priority of the rendering thread of application 1 is higher than the priority of the working thread, and there is a problem that the rendering thread of application 1 and the working thread preempt the first CPU.

[0247] Based on this, when the rendering thread of the application 1 is in the running state, the scheduling module can execute S42.

[0248] If the rendering thread of application 1 is in the ready state, the working thread has not received task 1, and the rendering thread of application 1 has not rendered image 2, then the rendering thread of application 1 is not in the running state.

[0249] If the rendering thread of application 1 is in the ready state, the working thread receives task 1 and is also in the ready state, and the rendering thread of application 1 has not yet rendered image 2, then the rendering thread of application 1 is not in the running state.

[0250] When the rendering thread of the application 1 is not in the running state, there is no problem that the rendering thread of the application 1 and the working thread compete for the first CPU.

[0251] Based on this, when the rendering thread of the application 1 is not in the running state, the rendering thread of the application 1 waits to execute S37, that is, until the rendering thread of the application is in the running state.

[0252] S42: The scheduling module starts timer 1.

[0253] Among them, S42 and S43 are optional steps.

[0254] When the rendering thread of application 1 is in the running state, the scheduling module starts timer 1 to monitor the running time of the rendering thread of application 1 on the first CPU.

[0255] The timing duration of timer 1 is preset; the timing duration of timer 2 is determined according to the duration of the electronic device displaying two frames of images.

[0256] In some embodiments, the refresh rate of the display screen of the electronic device is generally 120 Hz, a single frame image display requires 8.3 ms, and the timing duration of timer 1 is 16.6 ms.

[0257] S43: The scheduling module determines whether the duration for which the rendering thread of application 1 is in the running state is greater than or equal to duration 1.

[0258] Among them, duration 1 is the timing duration of timer 1.

[0259] In some embodiments, the timing duration of timer 1 is 16.6 ms, so duration 1 is 16.6 ms.

[0260] It should be understood that the refresh rate of the display screen of an electronic device is usually 120Hz, and it takes 8.3ms to display a single frame of image. If three frames of image are dropped continuously, that is, more than 24.9ms, the user will usually feel the freeze visually. Otherwise, the user will hardly feel the freeze visually.

[0261] If the rendering thread of application 1 runs for more than 16.6ms, there is a risk of dropping 2 frames, and thus the probability of a jam is high. Based on this, the timing duration of timer 1 can be set to 16.6ms, so that when the rendering thread of application 1 is in the running state for a time greater than or equal to 16.6ms, the subsequent process of avoiding jams can be executed.

[0262] When the rendering thread of application 1 is in the running state for a time period greater than or equal to time period 1, there is a risk of losing 2 frames. The user may feel that there is a lag in the startup of application 1. It is necessary to avoid the rendering thread of application 1 and the working thread from occupying the first CPU as much as possible.

[0263] Based on this, when the duration of the rendering thread of application 1 being in the running state is greater than or equal to duration 1, the scheduling module may execute S44.

[0264] When the duration that the rendering thread of application 1 is in the running state is less than duration 1, there is no risk of losing 2 frames, and the user can hardly perceive that there is a lag in the startup of application 1. Application 1 can continue to run on the first CPU through the rendering thread of application 1 to render image 2. After obtaining the rendered image 2, the working thread runs on the first CPU to execute S38, that is, execute task 1. After the execution of S38 is completed, the rendering thread of application 1 can execute S53.

[0265] Based on the above description, when it is determined that the rendering thread of application 1 is in a running state, the scheduling module starts timer 1 to determine whether the duration for which the rendering thread of application 1 is in a running state is greater than or equal to duration 1. When it is greater than or equal to duration 1, the scheduling module executes subsequent processes, which can avoid unnecessary subsequent switching of the rendering thread of application 1 to the second CPU for operation as much as possible, thereby saving the scheduling overhead caused by switching CPUs.

[0266] S44: The scheduling module determines the idle state of the second CPU.

[0267] In combination with S33, the second CPU may be any one of the multiple CPUs except the first CPU.

[0268] In some embodiments, the first CPU is a high-performance CPU. When the first CPU is a high-performance CPU, the second CPU is any one of the high-performance CPUs among the plurality of CPUs except the first CPU.

[0269] For example, the electronic device is a mobile phone, which includes 8 CPUs, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7. Among the 8 CPUs, CPU0, CPU1 and CPU2 are low-performance CPUs, CPU3 and CPU4 are medium-performance CPUs, CPU5, CPU6 and CPU7 are high-performance CPUs, the first CPU is CPU7, and the second CPU is CPU6.

[0270] It is understandable that if a thread runs on a CPU with stronger performance, it can complete the task faster, and vice versa, it may take longer to perform the same task. CPUs with different performance may have differences in the number of processor cores, cache size, memory bandwidth, etc., resulting in different CPU resource allocation and processing speed when the same thread runs on CPUs with different performance.

[0271] In other words, the frequencies between CPUs with the same performance are close, that is, the performance is close; the processing speed and resource allocation of the same thread running on CPUs with different performances are different, and the processing speed and resource allocation of the same thread running on CPUs with similar performances are similar, making the thread running process almost indistinguishable.

[0272] In this way, when the first CPU is a high-performance CPU and the second CPU is also a high-performance CPU, the scheduling module can migrate the rendering thread of application 1 running on the first CPU to run on the second CPU to ensure that the processing speed and resource allocation of the rendering thread of application 1 are relatively small when running on the first CPU and running on the second CPU.

[0273] Based on the above description, when considering whether the rendering thread of application 1 can be migrated to the second CPU for execution, it is also necessary to consider whether the second CPU is in an idle state.

[0274] When no other threads are running on the second CPU, the scheduling module can determine that the second CPU is in an idle state; when other threads are running on the second CPU, the scheduling module can determine that the second CPU is not in an idle state.

[0275] It can be seen that the second CPU may be in an idle state or may not be in an idle state. When the second CPU is in a running state, the scheduling module can solve the problem of the rendering thread and the working thread of application 1 preempting the CPU by implementing method 1. When the second CPU is not in an idle state, the scheduling module can solve the problem of the rendering thread and the working thread of application 1 preempting the CPU by implementing method 2.

[0276] Implementation method 1: When the second CPU is in running state, the scheduling module can migrate the rendering thread of application 1 to the second CPU to run, so that the working thread runs on the first CPU, and the rendering thread and working thread of application 1 run at the same time to solve the problem of the rendering thread and working thread of application 1 preempting the CPU.

[0277] Implementation method 2: When the second CPU is not idle, the rendering thread of application 1 is switched from the running state to the ready state, so that the working thread runs preferentially on the first CPU, to solve the problem of the rendering thread and the working thread of application 1 preempting the CPU.

[0278] Among them, the specific process of implementation method 1 can refer to the subsequent steps S45-S48, and the specific process of implementation method 2 can refer to the subsequent steps S49-S52.

[0279] S45. The scheduling module starts timer 2.

[0280] When the second CPU is in an idle state, the scheduling module starts timer 2 to facilitate subsequent monitoring of the duration that application 1 is in a running state on the second CPU, that is, monitoring of the duration that the working thread is in a running state on the first CPU.

[0281] Among them, the timing duration of timer 2 is preset; the timing duration of timer 2 is determined according to the duration of a single operation of the previous working thread.

[0282] For example, the timing duration of timer 2 is 1 ms.

[0283] Usually, the single running time of the working thread is within several hundred us. The timing time of timer 2 is set to 1 ms. The working thread can execute the end task 1 on the first CPU.

[0284] S46. The scheduling module switches the rendering thread of the application 1 from being in a running state on the first CPU to being in a running state on the second CPU, so that the working thread on the first CPU is switched from a ready state to a running state.

[0285] Generally, if a thread in a running state is migrated from one CPU to another CPU for execution, it is necessary to first switch the thread from the running state to the ready state, then migrate the thread from one CPU to another CPU, and then switch the state of the thread from the ready state to the running state.

[0286] Based on this, the scheduling module can first switch the rendering thread of application 1 from the running state to the ready state, then migrate the rendering thread of application 1 from the first CPU to the second CPU, and then switch the rendering thread of application 1 from the ready state to the running state.

[0287] After the scheduling module adjusts the rendering thread of the application 1 running on the first CPU to run on the second CPU, the working thread in the ready state on the first CPU can automatically switch from the ready state to the running state, that is, the working thread runs on the first CPU.

[0288] At this time, the rendering thread of application 1 runs on the second CPU, and at the same time, the working thread runs on the first CPU. The rendering thread and the working thread of application 1 do not need to preempt the first CPU.

[0289] For example, Fig. 9 As shown, the rendering thread of application 1 runs on CPU 6 , and at the same time, the working thread runs on CPU 7 , and the rendering thread and the working thread of application 1 do not need to preempt CPU 7 .

[0290] S47: The scheduling module determines whether the duration for which the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2.

[0291] Among them, S47-S48 are optional steps.

[0292] Among them, duration 2 is the timing duration of timer 2.

[0293] If the duration that the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2, it means that the execution of task 1 by the working thread on the first CPU is completed.

[0294] If the duration that the rendering thread of application 1 is in the running state on the second CPU is less than duration 2, it means that the worker thread may not have finished executing task 1.

[0295] Based on this, when the duration that the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2, the scheduling module can execute S48; when the duration that the rendering thread of application 1 is in the running state on the second CPU is less than duration 2, the scheduling module can continue to execute the step of determining whether the duration that the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2.

[0296] S48. The scheduling module switches the rendering thread of the application 1 to be in a running state on the first CPU.

[0297] Among them, S48 is an optional step.

[0298] When the duration of the rendering thread of application 1 being in the running state on the second CPU is greater than or equal to duration 2, the worker thread finishes executing task 1 on the first CPU, and the scheduling module can adjust the rendering thread of application 1 to run on the first CPU.

[0299] For example, duration 2 is 1ms, and the duration of a single run of the working thread is 300us, that is, the process of the working thread executing task 1 takes 300us. Then, when the rendering thread of application 1 is in the running state on the second CPU for 1ms, the working thread finishes executing task 1 on the first CPU.

[0300] Specifically, if the scheduling module adjusts the rendering thread of application 1 to run on the first CPU, the rendering thread of application 1 can be switched from the running state to the ready state first, and then the rendering thread of application 1 can be migrated from the second CPU to the first CPU, and then the rendering thread of application 1 can be switched from the ready state to the running state.

[0301] Based on the above description, when the duration that the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2, the working thread completes execution of task 1 on the first CPU, and the scheduling module can switch the rendering thread of application 1 to the running state on the first CPU again. By returning the rendering thread of application 1 to run on the first CPU again, the optimal operating state of the rendering thread can be guaranteed, and the second CPU can be guaranteed to normally execute other tasks that need to be executed on the second CPU.

[0302] That is to say, when the rendering thread of application 1 is in the running state on the second CPU for a time period greater than or equal to time period 2, the scheduling module adjusts the rendering thread of application 1 to run on the first CPU, temporarily borrows the adjacent idle CPU to perform tasks, and then migrates it back to the original CPU to ensure that it does not affect the thread tasks that need to be executed later on the adjacent idle CPU.

[0303] S49, the scheduling module starts timer 3.

[0304] When the second CPU is not in an idle state, the scheduling module starts timer 3 to facilitate subsequent monitoring of the duration that the working thread is in a running state on the first CPU.

[0305] Among them, the timing duration of timer 3 is preset; the timing duration of timer 3 is determined according to the duration of a single operation of the previous working thread.

[0306] For example, the timing duration of timer 3 is 1 ms.

[0307] Usually, the single running time of the working thread is within several hundred us. The timing time of timer 3 is set to 1 ms. The working thread can execute the end task 1 on the first CPU.

[0308] In some embodiments, the timing duration of timer 2 and the timing duration of timer 3 may be the same.

[0309] S50: The scheduling module switches the state of the rendering thread of the application 1 from the running state to the ready state, so that the working thread on the first CPU switches from the ready state to the running state.

[0310] Usually, the rendering thread of application 1 renders image 2, and the process of obtaining the rendered image 2 is relatively long. If after obtaining the rendered image 2, the working thread executes task 1, after the working thread completes the execution of task 1, the rendering thread of application 1 sends request 1 to the binding thread, that is, executes S53 and subsequent steps.

[0311] Considering that the above process will cause a lag in the startup of application 1, and the running time of the rendering thread of application 1 is longer than that of the working thread, such as Fig.10 As shown, the scheduling module can switch the state of the rendering thread of application 1 on the first CPU from the running state to the ready state during the running of the rendering thread of application 1, so that the working thread on the first CPU is switched from the ready state to the running state, so as to allow the working thread to run and execute task 1 in advance.

[0312] For example, Fig.10 As shown, the scheduling module can switch the state of the rendering thread of application 1 on CPU7 from the running state to the ready state, so that the working thread on CPU7 is switched from the ready state to the running state, so as to allow the working thread to run and execute task 1 in advance.

[0313] S51. The scheduling module determines whether the duration for which the first application is in the ready state on the first CPU is greater than or equal to duration 3.

[0314] Among them, duration 3 is the timing duration of timer 3.

[0315] If the duration that the first application is in the ready state on the first CPU is greater than or equal to duration 3, it indicates that the execution of task 1 by the working thread on the first CPU is completed.

[0316] If the duration that the first application is in the ready state on the first CPU is less than the duration 3, it means that the execution of task 1 by the working thread may not be completed.

[0317] Based on this, when the duration that the first application is in the ready state on the first CPU is greater than or equal to duration 3, the scheduling module can execute S52; when the duration that the first application is in the ready state on the first CPU is less than duration 3, the scheduling module can continue to execute the step of determining whether the duration that the first application is in the ready state is greater than or equal to duration 3.

[0318] S52: The scheduling module switches the state of the rendering thread of the application 1 from the ready state to the running state.

[0319] When the rendering thread of application 1 is in the ready state on the first CPU for a period greater than or equal to period 3, the working thread completes execution of task 1 on the first CPU, and the scheduling module can switch the state of the rendering thread of application 1 from the ready state to the running state, so that the rendering thread of application 1 continues to run on the first CPU and executes the process of rendering image 2 until the rendered image 2 is obtained.

[0320] For example, duration 3 is 1 ms, and the duration of a single run of the working thread is 300 us, that is, the process of the working thread executing task 1 takes 300 us. Then, when the rendering thread of application 1 is in the ready state on the first CPU for 1 ms, the working thread finishes executing task 1 on the first CPU.

[0321] S53. The rendering thread of application 1 sends request 1 to the binding thread.

[0322] In some embodiments, the thread number of the bound thread may be binder:1951_2

[1951] .

[0323] This application does not limit the thread number of the binding thread.

[0324] The bound thread usually does not run on the same CPU as the rendering thread of application 1 and the worker thread.

[0325] For example, the electronic device is a mobile phone, which includes 8 CPUs, namely CPU0, CPU1, CPU2, CPU3, CPU4, CPU5, CPU6 and CPU7. Among the 8 CPUs, CPU0, CPU1 and CPU2 are low-performance CPUs, CPU3 and CPU4 are medium-performance CPUs, CPU5, CPU6 and CPU7 are high-performance CPUs, and the rendering thread and working thread of application 1 run on CPU7, and the binding thread runs on CPU5.

[0326] Request 1 is used to request the binding thread to obtain image 2 from the rendering thread of application 1, and to obtain multiple rendered images 1 from the rendering thread of the desktop application.

[0327] The wakeup process among the rendering thread, the working thread and the binding thread of the application 1 is as follows: the rendering thread of the application 1 can wake up the working thread, and the working thread can wake up the binding thread.

[0328] When the worker thread finishes executing task 1, the worker thread can wake up the bound thread so that the bound thread can receive request 1.

[0329] Among them, S53 and S52 are executed simultaneously.

[0330] When the rendering thread of application 1 is in the ready state on the first CPU for a period greater than or equal to period 3, the working thread completes execution of task 1 on the first CPU. At this time, the scheduling module can switch the state of the rendering thread of application 1 from the ready state to the running state, so that the rendering thread of application 1 continues to run on the first CPU and executes the process of rendering image 2. At the same time, the rendering thread of application 1 can send request 1 to the binding thread, so that S53-S58 are executed in advance to avoid startup jams of application 1.

[0331] Assume that the rendering thread of application 1 renders image 2, the process of obtaining the rendered image 2 is 33ms, the process of the working thread executing task 1 is 300us, and the duration 3 is 1ms.

[0332] If the rendering thread of application 1 runs on the first CPU and renders image 2, after the process of obtaining the rendered image 2 is completed, the working thread runs on the first CPU to execute task 1, and after the working thread completes task 1, the process of S53-S61 is executed. In this case, the time from when the electronic device receives the start operation of application 1 to when it starts to display the dynamic effect picture is 33ms+300us, and the user may be able to perceive that there is a lag in the startup of application 1.

[0333] If the rendering thread of application 1 runs on the first CPU and the process of image rendering of image 2 is executed for 16ms, the state of the rendering thread of application 1 is switched to the ready state, and the working thread runs on the first CPU. After the duration reaches 1ms, the process of S53-S58 is executed, that is, the working thread completes task 1 ahead of schedule, and S53-S58 can be executed ahead of schedule. Then, the time from the electronic device receiving the startup operation for application 1 to the start of displaying the dynamic effect picture is 16ms+1ms, and the user may not be able to perceive the lag in the startup of application 1.

[0334] It should be noted that since interface 1 of application 1 is displayed after the dynamic effect picture is displayed, S53-S57 are executed in advance to display the dynamic effect picture (the synthesized multiple images 1), which does not affect the rendering thread of application 1 to continue rendering image 2. After the rendering thread of application 1 obtains image 2, S59-S61 can be executed to display interface 1 of application 1 (the synthesized image 2).

[0335] In addition, when the scheduling module determines whether the duration that the first application is in the ready state on the first CPU is greater than or equal to duration 3, the scheduling module may notify the rendering thread of the application 1 to execute S53.

[0336] Based on the above description, the scheduling module can switch the state of the rendering thread of application 1 from the running state to the ready state, so that the working thread on the first CPU is switched from the ready state to the running state, and the rendering thread of application 1 with a longer running time briefly gives up the running state and switches to the ready state, so that the working thread with a shorter running time switches from the ready state to the running state to execute task 1 as soon as possible, avoiding the rendering thread and the working thread of application 1 from occupying the first CPU, thereby allowing the working thread to complete the execution of task 1 ahead of schedule, ensuring the early execution of S53-S57 to avoid the startup jam of application 1.

[0337] When the rendering thread of application 1 is not a real-time thread, the working thread can run on the first CPU and execute S38 normally, that is, execute task 1; after executing S37, the rendering thread of application 1 can execute S53 normally.

[0338] When the rendering thread of the application 1 is not in the running state, the rendering thread of the application 1 waits to execute S37, that is, until the rendering thread of the application is in the running state.

[0339] When the length of time that the rendering thread of application 1 is in the running state is less than length 1, there is no risk of losing 2 frames, and the user can hardly perceive that there is a lag in the startup of application 1. Application 1 runs on the first CPU through the rendering thread of application 1 to render image 2. After obtaining the rendered image 2, the rendering thread of application 1 wakes up the working thread, so that the working thread runs on the first CPU and executes S38, that is, executes task 1. After the execution of S38 is completed, the rendering thread of application 1 can execute S53, that is, send request 1 to the binding thread, so that the binding thread can obtain multiple rendered images 1 from the desktop application and obtain the rendered image 2 from application 1.

[0340] When the second CPU is in an idle state, the scheduling module adjusts the rendering thread of application 1 to run on the second CPU, so that the working thread on the first CPU switches from the ready state to the running state, thereby achieving that the rendering thread of application 1 runs on the second CPU while the working thread runs on the first CPU. The working thread can execute S38 in advance, that is, the execution of task 1 ends. After the execution of S38 ends, the rendering thread of application 1 can execute S53, that is, send request 1 to the binding thread, so that the binding thread can obtain the rendered multiple images 1 from the desktop application, and obtain the rendered image 2 from application 1.

[0341] When the second CPU is not in an idle state, the scheduling module can switch the state of the rendering thread of application 1 from a running state to a ready state, so that the working thread on the first CPU is switched from a ready state to a running state, and the rendering thread of application 1 with a longer running time briefly gives up the running state and switches to the ready state, so that the working thread with a shorter running time switches from the ready state to the running state to execute task 1 as soon as possible. In this way, the working thread can execute S38 in advance, that is, the execution of task 1 ends. After the execution of S38 ends, the rendering thread of application 1 can execute S53, that is, send request 1 to the binding thread, so that the binding thread can obtain the rendered multiple images 1 from the desktop application, and obtain the rendered image 2 from application 1.

[0342] S54. The binding thread sends request 2 to the desktop application.

[0343] Request 2 is used to request the desktop application to send multiple rendered images 1 to the interface synthesis thread.

[0344] After receiving request 1, the binding thread may send request 2 to the desktop application to request the desktop application to send multiple rendered images 1 to the interface synthesis thread, so that the interface synthesis thread can perform synthesis processing on each of the multiple images 1.

[0345] S55. The desktop application sends the rendered multiple images 1 to the interface composition thread.

[0346] After receiving the request 2 , the desktop application may send the rendered multiple images 1 to the interface synthesis thread, so that the interface synthesis thread can perform synthesis processing on each of the rendered multiple images 1 .

[0347] S56 . The interface synthesis thread synthesizes each image in the rendered multiple images 1 to obtain multiple synthesized images 1 .

[0348] Among them, image synthesis (compositing) is the process of superimposing multiple image elements or layers together to produce a complete image.

[0349] The synthesis process can adjust the transparency, position, fusion mode and other properties of each layer so that the layers can be correctly integrated to form a natural visual effect.

[0350] Since each image 1 in the rendered multiple images 1 may include multiple layers, after receiving the rendered multiple images 1, image synthesis processing can be performed on each image 1 in the rendered multiple images 1, and the multiple layers of each image 1 can be merged together to obtain the synthesized multiple images 1.

[0351] It should be understood that when the interface synthesis thread performs image synthesis processing on each of the multiple rendered images 1, it is necessary to perform image synthesis processing on each of the multiple rendered images 1 in sequence.

[0352] S57. The interface synthesis thread sends the synthesized multiple images 1 to the display screen.

[0353] After obtaining the synthesized multiple images 1, the interface synthesis thread can send the synthesized multiple images 1 to the display screen in sequence. After receiving the multiple images 1, the display screen can display the multiple images 1 in sequence so that the display screen displays a dynamic effect picture.

[0354] S58. The binding thread sends request 3 to application 1.

[0355] Request 3 is used to request application 1 to send rendered image 2 to the interface synthesis thread.

[0356] After receiving request 1 , the binding thread may send request 3 to application 1 to request application 1 to send rendered image 2 to the interface synthesis thread, so that the interface synthesis thread can perform synthesis processing on the rendered image 2 .

[0357] Among them, the execution order of S54 and S58 is not particular, and they can be executed simultaneously or sequentially. When executed sequentially, the bound thread can execute S54 first and then S58, or can execute S58 first and then S54.

[0358] S59, application 1 sends the rendered image 2 to the interface composition thread.

[0359] After receiving the request 3 , the application 1 may send the rendered image 2 to the interface synthesis thread, so that the interface synthesis thread can perform synthesis processing on the image 2 .

[0360] S60 , the interface synthesis thread performs image synthesis on the rendered image 2 to obtain a synthesized image 2 .

[0361] After receiving the rendered image 2 , the interface synthesis thread can perform image synthesis processing on the rendered image 2 to obtain a synthesized image 2 .

[0362] S61. The interface synthesis thread sends the synthesized image 2 to the display screen.

[0363] After obtaining the synthesized image 2, the interface synthesis thread can send the synthesized image 2 to the display screen. After receiving the image 2, the display screen can display multiple images 1, so that after the display screen displays the dynamic effect picture, it displays the image 2, thereby completing the startup process of the application 1.

[0364] The application startup method of the present application, combined with Fig.11 After receiving the start operation of application 1, the process of drawing and rendering multiple image data to obtain multiple rendered images 1, and drawing and rendering interface data to obtain rendered image 2 can be executed, as shown in S401-S403. If the rendering thread of application 1 is rendering image 2, the system of the electronic device temporarily sends task 1 to the working thread, as shown in S404, and the thread queue on the first CPU can be obtained. As shown in S405, when the thread queue includes the working thread and the rendering thread of application 1, it can be determined whether the rendering thread of application 1 is a real-time thread. As shown in S406, since the real-time thread is a thread that needs to run and end within a preset time, it has a higher running priority. When the thread queue includes the first application and the working thread, there is a problem that the first application and the working thread preempt the first processor. Therefore, it can be determined whether the thread of the first application is a real-time thread, so that when the thread of the first application is a real-time thread, the subsequent steps can be executed, and it can be avoided as much as possible to switch the first application to the second CPU for operation unnecessarily, thereby saving the scheduling overhead caused by switching processors.

[0365] When the rendering thread of application 1 is a real-time thread and the rendering thread of application 1 is in a running state, timer 1 can also be started to determine whether the duration for which the rendering thread of application 1 is in a running state is greater than or equal to duration 1. When the duration is greater than or equal to duration 1, it is determined whether the first CPU is in an idle state, and subsequent steps are performed accordingly, as shown in S407-S409. This can avoid unnecessary subsequent switching of the rendering thread of application 1 to run on the second CPU as much as possible, thereby saving the scheduling overhead caused by switching the CPU.

[0366] When the second CPU is in an idle state, timer 2 is turned on, and the rendering thread of application 1 is adjusted to run on the second CPU, so that the working thread on the first CPU switches from a ready state to a running state, as shown in S410-S412. This achieves that while the rendering thread of application 1 runs on the second CPU, the working thread runs on the first CPU. The rendering thread and the working thread of application 1 do not need to preempt the first CPU, so that the working thread can complete task 1 in advance. In this way, multiple rendered images 1 can be called in advance and synthesized and displayed, and after the rendered image 2 is obtained, it can be synthesized, and after the display of multiple images 1 is completed, the synthesized image 2 can be displayed, as shown in S419-S420, thereby avoiding the visual freeze phenomenon of the user caused by the failure to display multiple images 1 and 2 in time.

[0367] Furthermore, when the duration that the rendering thread of application 1 is in the running state on the second CPU is greater than or equal to duration 2, the working thread completes execution of task 1 on the first CPU, and the rendering thread of application 1 can be readjusted to be in the running state on the first CPU, as shown in S413-S414. By returning the rendering thread of application 1 to run on the first CPU again, the optimal operating state of the rendering thread can be guaranteed, and the second CPU can be guaranteed to normally execute other tasks that need to be executed on the second CPU.

[0368] When the second CPU is not in an idle state, timer 3 can be started, and the state of the rendering thread of application 1 can be switched from the running state to the ready state, so that the state of the working thread on the first CPU is switched from the ready state to the running state, as shown in S415-S416. When the duration of the rendering thread of application 1 in the ready state on the first CPU is greater than or equal to duration 3, the working thread finishes executing task 1 on the first CPU, and the rendering thread of application 1 can be switched from the ready state to the running state, as shown in S417-S418. When the rendering thread of application 1 is switched from the ready state to the running state, if multiple rendered threads are obtained, Image 1 can call multiple images 1, synthesize and display them, and synthesize after obtaining the rendered image 2, and display the synthesized image 2 after the display of multiple images 1 is completed, as shown in S419-S420, by briefly giving up the running state and switching to the ready state through the rendering thread of application 1 with a longer running time, so that the working thread with a shorter running time switches from the ready state to the running state to execute task 1 as soon as possible, avoiding the rendering thread and the working thread of application 1 from occupying the first CPU, thereby avoiding the visual freeze of the user caused by the failure to display multiple images 1 and image 2 in time by executing task 1 in advance.

[0369] Based on some of the aforementioned embodiments, the application startup method provided by the present application is introduced below.

[0370] Exemplarily, the present application provides a method for starting an application.

[0371] For the sake of convenience, the application startup method of the present application can be Figure 6 The electronic device 100 is used to execute.

[0372] The electronic device 100 may include a desktop application, a first application, a working thread, a first processor, and a second processor.

[0373] The first application may be any one of the multiple applications in the electronic device. The specific implementation of the first application may be found in Figure 8The relevant description about application 1 in S31 is not repeated here.

[0374] For the specific implementation of the working thread, see Figure 8 The description of the working thread in S38 is not repeated here.

[0375] For specific implementations of the first processor and the second processor, see Figure 8 The relevant descriptions about the first processor and the second processor are not repeated here.

[0376] See also Fig.12 , Fig.12 A flow chart of a method for starting an application program provided in an embodiment of the present application is shown.

[0377] like Fig.12 As shown, the application startup method provided by the present application may include:

[0378] S501. In response to a startup operation of a first application, a first process is performed on first data through a desktop application, and a second process is performed on second data through the first application. When the first application performs the second process on the second data, the first application is in a running state on the first processor. The first data is used to generate image data for displaying a dynamic effect screen when the first application is started, and the second data is used to generate image interface data for display after the first application is started.

[0379] The first process may include image drawing process and rendering process, and the second process may include image drawing process and rendering process.

[0380] The specific implementation of the first data can be found in Figure 8 The description of the plurality of image data in S34 in Fig.11 The description of the multiple image data in S402 will not be repeated here.

[0381] The specific implementation method of the second data can be found in Figure 8 The description of interface data in S35 of , and Fig.11 The description of the interface data in S403 is not repeated here.

[0382] In some embodiments, the first data is subjected to a first processing through a desktop application, including: performing image drawing processing and image rendering processing on the first data through a desktop application.

[0383] In some embodiments, performing a second process on the second data through the first application includes: performing image drawing process and image rendering process on the second data through the first application.

[0384] Among them, multiple first images are obtained by performing a first synthesis process on multiple third images, and the second image is obtained by performing a second synthesis process on the fourth image; multiple third images are obtained by performing a first process on the first data, and the fourth image is obtained by performing a second process on the second image.

[0385] The specific implementation of S501 can be found in Figure 8 The relevant descriptions of S31-S37 in Fig.11 The relevant description of S401-S403 in will not be repeated here.

[0386] S502. During the second processing of the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application continues to run on the first processor. The ready state is a state waiting to run, and the first task is a task that the working thread runs on the first processor and executes when the first application runs on the first processor and finishes executing the second processing of the second data.

[0387] The specific implementation of S502 can be found in Figure 8 The relevant descriptions of S38-S52 in Fig.11 The relevant descriptions of S404-S418 in are not repeated here.

[0388] S503. When the working thread finishes executing the first task, multiple first images corresponding to the dynamic effect screen are displayed, and when the display of the multiple first images is completed, the second image is displayed. The multiple first images are obtained by performing a first processing on the first data, and the second image is obtained by performing a second processing on the second data.

[0389] The specific implementation of multiple first images can be found in Figure 8 The description of the synthesized multiple images 1 in S56, and Fig.11 The description of the synthesized multiple images 1 in S420 is not repeated here.

[0390] The specific implementation method of the second image can be found in Figure 8 The description of the synthesized image 2 in S60, and Fig.11 The description of the synthesized image 2 in S420 is not repeated here.

[0391] The specific implementation of S503 can be found in Figure 8The relevant descriptions of S53-S61 in Fig.11 The relevant descriptions of S419-S421 in are not repeated here.

[0392] The application startup method of the present application, during the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor and waits to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, and the first application and the working thread do not need to preempt the first processor, so that the working thread can complete the execution of the first task in advance. In this way, when the desktop application processes the first data and obtains multiple first images, the multiple first images can be displayed in advance, and when the display of the multiple first images is completed, the second image can be displayed in time, thereby avoiding the visual freeze phenomenon of the user caused by the failure to display the multiple first images and the second images in time.

[0393] Moreover, during the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application continues to run on the first processor. Thus, the working thread can complete the first task in advance. At the same time, if the desktop application completes the processing of the first data and displays multiple first images, the second image is usually obtained when the display of the multiple first images is completed, and the second image can be displayed in time, thereby avoiding the visual freeze of the user caused by the failure to display the multiple first images and the second images in time.

[0394] In some embodiments, the application startup method provided by the present application may include:

[0395] During the second processing of the second data, if the working thread is in a ready state on the first processor, it waits to execute the first task and determines whether the second processor is in an idle state; when the second processor is in an idle state, the first application and the working thread are run on the first processor and the second processor respectively; when the second processor is not in an idle state, the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to run on the first processor.

[0396] The specific implementation of the above steps can be found in Figure 8 The relevant descriptions of S44-S52 in Fig.11 The relevant description of S410-S418 in will not be repeated here.

[0397] In some embodiments, the application startup method provided by the present application may include:

[0398] The state of the first application on the first processor is switched from the running state to the ready state, so that the state of the working thread on the first processor is switched from the ready state to the running state; the first application is switched to the second processor for execution; and the state of the first application on the second processor is switched from the ready state to the running state.

[0399] The specific implementation of the above steps can be found in Figure 8 The relevant description of S46 in Fig.11 The relevant description of S412 in is not repeated here.

[0400] In some embodiments, the application startup method provided by the present application may include:

[0401] When the duration of the first application being in the running state on the second processor is greater than or equal to a first duration, the state of the first application on the second processor is switched from the running state to the ready state, where the first duration is determined based on the duration of a single run of the working thread; the first application is switched to the first processor for execution; and the state of the first application on the first processor is switched from the ready state to the running state.

[0402] The specific implementation method of the first duration can be found in Figure 8 The description of duration 2 in S47, and Fig.11 The description of duration 2 in S413 is not repeated here.

[0403] The specific implementation of the above steps can be found in Figure 8 The relevant descriptions of S47-S48 in Fig.11 The relevant description of S413-S414 in will not be repeated here.

[0404] In some embodiments, the application startup method provided by the present application may include:

[0405] Switch the working thread to the second processor for execution; switch the state of the working thread on the second processor from a ready state to a running state.

[0406] As another implementation method, the working thread can be switched to the second processor for execution, and the first application program can remain running on the first processor. Since the running time of the working thread is short, the working thread can be executed and completed directly on the second processor without switching back to the first processor. The first processor can run the first application program normally.

[0407] In some embodiments, the application startup method provided by the present application may include:

[0408] Switch the state of the first application on the first processor from the running state to the ready state, so that the state of the working thread on the first processor is switched from the ready state to the running state; when the time length of the time length of the state of the first application on the first processor being the ready state is greater than or equal to a second time length, switch the state of the first application on the first processor from the ready state to the running state, and the second time length is determined based on the time length of a single running of the working thread.

[0409] The specific implementation of the second duration can be found in Figure 8 The relevant description of duration 3 in S51 of Fig.11 The description of duration 3 in S417 is not repeated here.

[0410] The specific implementation of the above steps can be found in Figure 8 The relevant description of S50-S52 in Fig.11 The description of S416-S418 in the description will not be repeated here.

[0411] In some embodiments, the application startup method provided by the present application may include:

[0412] Determine the duration of time that the first application is in a running state on the first processor; when the duration of time that the first application is in a running state on the first processor is greater than or equal to a third duration, determine whether the second processor is in an idle state, and the third duration is determined based on the duration of the electronic device displaying two frames of images.

[0413] The specific implementation method of the third duration can be found in Figure 8 The relevant description of duration 1 in S43 of Fig.11 The description of duration 1 in S409 is not repeated here.

[0414] The specific implementation of the above steps can be found in Figure 8 The relevant descriptions of S42-S44 in Fig.11 The relevant description of S408-S410 in will not be repeated here.

[0415] In some embodiments, the application startup method provided by the present application may include:

[0416] When a start operation for a first application is received, a thread queue is obtained, where the thread queue includes all threads in a running state and a ready state on the first processor; a duration in which the first application is in a running state on the first processor is determined, including: when the thread queue includes the first application and a working thread, determining whether the thread of the first application is a real-time thread, where a real-time thread is a thread that needs to be completed within a preset duration; when the thread of the first application is a real-time thread, determining whether the first application is in a running state on the first processor; when the first application is in a running state on the first processor, determining a duration in which the first application is in a running state on the first processor.

[0417] The specific implementation of the thread queue can be found in Figure 8 The description of thread queues in S39 in , and Fig.11 The description of the thread queue in S405 is not repeated here.

[0418] The specific implementation of the above steps can be found in Figure 8 The relevant description of S40-S42 in Fig.11 The relevant descriptions of S405-S408 in are not repeated here.

[0419] Exemplarily, the present application provides an electronic device, including a processor; when the processor executes computer code or instructions in the memory, the electronic device executes the application startup method in the above embodiment.

[0420] Exemplarily, the present application provides an electronic device, comprising: a memory and a processor; the memory is coupled to the processor, and the memory is used to store program codes or instructions; the processor is used to call the program codes or instructions in the memory so that the electronic device executes the application startup method in the previous embodiment.

[0421] Exemplarily, the present application provides a chip system, which is applied to an electronic device including a memory, a display screen and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through lines; the interface circuit is used to receive signals from the memory and send signals to the processor, and the signals include computer code or instructions stored in the memory; when the processor executes the computer code or instructions, the electronic device executes the application startup method in the previous embodiment.

[0422] Exemplarily, the present application provides a computer-readable storage medium, in which codes or instructions are stored. When the codes or instructions are executed on an electronic device, the electronic device implements the application startup method in the foregoing embodiment when executing.

[0423] Exemplarily, the present application provides a computer program product, which, when executed on a computer, enables an electronic device to implement the application startup method in the foregoing embodiment.

[0424] In the above embodiments, all or part of the functions can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer codes or instructions. When the computer program code or instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer code or instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state disk (SSD)), etc.

[0425] A person skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: a read-only memory (ROM) or a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

Claims

1. A method for starting an application, characterized in that: Applied to an electronic device, the electronic device includes a desktop application, a first application, a working thread, a first processor and a second processor, and the method includes: In response to a start-up operation of a first application, a first process is performed on first data through the desktop application, and a second process is performed on second data through the first application. When the first application performs the second process on the second data, the first application is in a running state on the first processor. The first data is used to generate image data for displaying a dynamic effect screen when the first application is started, and the second data is used to generate image interface data displayed after the first application is started. Wherein, in the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to be run on the first processor, the ready state is a state of waiting to be run, and the first task is a task that the working thread runs and executes on the first processor when the first application finishes running the second processing on the second data on the first processor; When the working thread finishes executing the first task, multiple first images corresponding to the dynamic effect screen are displayed, and when the display of the multiple first images is completed, a second image is displayed, the multiple first images are obtained by performing the first processing on the first data, and the second image is obtained by performing the second processing on the second data.

2. The method according to claim 1, characterized in that In the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor and waits to execute the first task, the first application and the working thread are respectively run on the first processor and the second processor, or the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to be run on the first processor, including: In the process of performing the second processing on the second data, if the working thread is in a ready state on the first processor, waiting to execute the first task, determining whether the second processor is in an idle state; When the second processor is in an idle state, running the first application and the working thread on the first processor and the second processor respectively; When the second processor is not in an idle state, the working thread is run on the first processor, and when the working thread finishes executing the first task, the first application is continued to be run on the first processor.

3. The method according to claim 2, characterized in that The step of running the first application and the working thread on the first processor and the second processor respectively includes: Switching the state of the first application on the first processor from a running state to a ready state, so that the state of the working thread on the first processor is switched from a ready state to a running state; Switching the first application to the second processor for execution; Switching the state of the first application on the second processor from a ready state to a running state.

4. The method according to claim 3, characterized in that After switching the state of the first application on the second processor from a ready state to a running state, the method further includes: When the duration of the first application program being in the running state on the second processor is greater than or equal to a first duration, switching the state of the first application program on the second processor from the running state to the ready state, wherein the first duration is determined according to the duration of a single run of the working thread; Switching the first application to the first processor for execution; The state of the first application on the first processor is switched from a ready state to a running state.

5. The method according to claim 2, characterized in that: The step of running the first application and the working thread on the first processor and the second processor respectively includes: Switching the working thread to the second processor for execution; The state of the working thread on the second processor is switched from a ready state to a running state.

6. The method according to any one of claims 2 to 5, characterized in that The step of running the working thread on the first processor and continuing to run the first application on the first processor when the working thread finishes executing the first task includes: Switching the state of the first application on the first processor from a running state to a ready state, so that the state of the working thread on the first processor is switched from a ready state to a running state; When the time duration that the first application is in a ready state on the first processor is greater than or equal to a second time duration, the state of the first application on the first processor is switched from a ready state to a running state, and the second time duration is determined based on the time duration of a single run of the working thread.

7. The method according to any one of claims 2 to 5, characterized in that The determining whether the second processor is in an idle state comprises: Determining a length of time that the first application is in a running state on the first processor; When the time duration of the first application in the running state on the first processor is greater than or equal to a third time duration, determine whether the second processor is in an idle state, and the third time duration is determined based on the time duration for the electronic device to display two frames of images.

8. The method according to claim 7, characterized in that The method further comprises: When receiving a start operation for a first application, obtaining a thread queue, the thread queue including all threads in a running state and a ready state on the first processor; The determining a duration during which the state of the first application on the first processor is a running state includes: When the thread queue includes the first application and the working thread, determining whether the thread of the first application is a real-time thread, wherein the real-time thread is a thread that needs to run and end within a preset time period; When the thread of the first application is the real-time thread, determining whether the state of the first application on the first processor is a running state; When the state of the first application on the first processor is a running state, determine a duration for which the first application is in the running state on the first processor.

9. The method according to any one of claims 1 to 8, characterized in that The first processing includes image drawing processing and image rendering processing, and the first processing performed on the first data by the desktop application includes: The image drawing process and the image rendering process are performed on the first data through the desktop application.

10. The method according to any one of claims 1 to 8, characterized in that The second processing includes image drawing processing and image rendering processing, and the performing the second processing on the second data by the first application program includes: The image drawing process and the image rendering process are performed on the second data through the first application.

11. The method according to any one of claims 1 to 10, characterized in that The plurality of first images are obtained by performing a first synthesis process on the plurality of third images, and the second image is obtained by performing a second synthesis process on the fourth image; The plurality of third images are obtained by performing the first processing on the first data, and the fourth image is obtained by performing the second processing on the second image.

12. An electronic device, characterized in that: The electronic device includes: one or more processors, and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method as claimed in any one of claims 1 to 11.

13. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises instructions, and when the instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 11.