Process scheduling method, electronic device and computer readable medium

By detecting and adjusting the priority of asynchronous tasks, the problem of blocking asynchronous tasks under the binder driver mechanism is solved, and the execution efficiency and system response speed of asynchronous tasks are improved.

CN118672754BActive Publication Date: 2025-01-10HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410925933.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2025-01-10
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

In the process of handling asynchronous tasks based on the binder driver mechanism, the service process needs to execute the received asynchronous tasks in serial execution, resulting in the implementation of the asynchronous tasks being blocked, especially when the service process executes a large number of asynchronous tasks or a long time.

Method used

By detecting whether the asynchronous task is a critical task and adjusting the priority of the asynchronous task executed by the service process, the time for the service process to execute the first asynchronous task is reduced to prevent it from being blocked. Specific methods include increasing the scheduling priority of the binder thread or adjusting the execution order of asynchronous tasks in the queue to ensure that key asynchronous tasks can be executed in a timely manner.

Benefits of technology

It effectively reduces the time required for the service process to execute asynchronous tasks, avoids tasks being blocked, and improves the system's response speed and user experience, especially in multi-asynchronous tasks scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672754B_ABST
    Figure CN118672754B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology, and specifically to a process scheduling method, an electronic device, and a computer-readable medium. The process scheduling method can determine whether the first asynchronous task sent by a client process to a service process is a critical asynchronous task. Among them, a critical asynchronous task refers to an asynchronous task that may affect the function implemented by the service process when the service process is blocked from executing the critical asynchronous task. If it is determined that the first asynchronous task sent by the client process to the service process is a critical asynchronous task, the time required for the service process to execute the first asynchronous task can be reduced, such as the time required from the client sending the first asynchronous task to the server executing and completing the first asynchronous task, thereby accelerating the service process to execute the first asynchronous task and avoiding the service process from being blocked from executing the first asynchronous task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a process scheduling method, electronic equipment and computer-readable medium. Background Art

[0002] Some tasks of electronic devices require the collaborative implementation of different processes. The collaborative implementation of tasks between processes includes synchronous task implementation and asynchronous task implementation. Among them, the asynchronous task implementation is mainly based on the binder driver mechanism.

[0003] However, in the process of processing asynchronous tasks based on the binder driver mechanism, according to the settings of the binder driver mechanism, the receiving process of the asynchronous task (hereinafter referred to as the service process) needs to serially execute the asynchronous tasks received before and after. Therefore, the asynchronous task sent by the sending process of an asynchronous task (hereinafter referred to as the client process) needs to wait for the service process of the receiving asynchronous task to serially execute the asynchronous tasks received before the asynchronous task before executing the asynchronous task.

[0004] Therefore, if the service process needs to execute a large number of asynchronous tasks serially before the asynchronous task, and / or the service process needs a long time to execute such asynchronous tasks, the implementation of the asynchronous task will be blocked. Summary of the invention

[0005] The present application provides a process scheduling method, an electronic device and a computer-readable medium, which avoids the service process from being blocked in executing the first asynchronous task by reducing the time required for the service process to execute the first asynchronous task.

[0006] In a first aspect, the present application provides a process scheduling method, comprising: detecting that a first asynchronous task sent by a first process to a second process satisfies an adjustment condition; reducing the execution time of the second process to execute the first asynchronous task by adjusting the priority of at least one asynchronous task executed by the second process, wherein the at least one asynchronous task includes the first asynchronous task, the second asynchronous task currently executed by the second process, and at least one of one or more unexecuted third asynchronous tasks received by the second process before the first asynchronous task.

[0007] Here, the adjustment condition may be a preset condition for determining a critical asynchronous task below. If it is detected that the first asynchronous task sent by the first process to the second process meets the adjustment condition, it means that the first asynchronous task is a critical asynchronous task. Furthermore, the execution time of the first asynchronous task executed by the second process may be reduced by adjusting the priority of at least one asynchronous task executed by the second process to avoid the execution of the first asynchronous task being blocked.

[0008] Here, the first process may be the client process hereinafter, and the second process may be the service process hereinafter. The execution time of the second process to execute the first asynchronous task may be the time required for the service process hereinafter to execute the first asynchronous task, for example, the time required for the first asynchronous task to be sent from the client to the server to be executed and completed.

[0009] The second asynchronous task and the third asynchronous task are both asynchronous tasks that the second process has received before receiving the first asynchronous task. Therefore, by adjusting the priority of the second asynchronous task and / or the third asynchronous task, the time required for the service process to execute the second asynchronous task and / or the third asynchronous task can be shortened. Furthermore, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task can be shortened. It can be understood that at this time, the time required for the service process to execute the first asynchronous task will be reduced, avoiding the service process from being blocked in executing the first asynchronous task.

[0010] By adjusting the priority of the first asynchronous task, the time required for the second process to start executing the first asynchronous task and complete the first asynchronous task can be reduced. It can be understood that at this time, the time required for the service process to execute the first asynchronous task will be reduced to avoid the service process from being blocked in executing the first asynchronous task.

[0011] In a possible implementation of the first aspect above, reducing the execution time of the second process to execute the first asynchronous task includes: corresponding to at least one asynchronous task including the first asynchronous task, determining a first thread in the second process for executing the first asynchronous task; and increasing a first priority corresponding to the first thread to a second priority.

[0012] Here, the first thread used to execute the first asynchronous task in the second process may be a binder thread used to execute the first asynchronous task in the service process. The priority corresponding to the first thread may be the scheduling priority corresponding to the binder thread described below. The first priority may be a non-RT priority corresponding to a non-real-time scheduling policy, and the second priority may be an RT priority corresponding to a real-time scheduling policy. Increasing the first priority corresponding to the first thread to the second priority may be to increase the non-RT priority corresponding to the binder thread executing the first asynchronous task to an RT priority, so that the binder thread can obtain CPU resources with priority, thereby avoiding interruption of the execution of the first asynchronous task, and further reducing the time required for the second process to start executing the first asynchronous task and complete the execution of the first asynchronous task.

[0013] In a possible implementation of the first aspect above, increasing the first priority corresponding to the first thread to a second priority includes: adjusting the scheduling policy corresponding to the first thread to a real-time scheduling policy, wherein the real-time scheduling policy corresponds to the second priority.

[0014] Here, the priority level of the first thread can be adjusted to the second priority level by adjusting the scheduling policy corresponding to the first thread to the real-time scheduling policy, so that the first thread can obtain CPU resources preferentially, avoiding the interruption of the execution of the first asynchronous task, and further reducing the time required for the second process to execute the first asynchronous task from the start to the completion of the first asynchronous task.

[0015] In a possible implementation of the first aspect above, after the first asynchronous task is executed, the method further includes: restoring the second priority level corresponding to the first thread to the first priority level.

[0016] Here, after the first asynchronous task is executed, the priority corresponding to the first thread can be restored to the first priority by restoring the scheduling policy corresponding to the first thread to the non-real-time scheduling policy, so that the first thread can execute other non-critical asynchronous tasks or synchronous tasks based on the non-real-time scheduling policy.

[0017] In a possible implementation of the first aspect above, reducing the execution time of the second process to execute the first asynchronous task includes: corresponding to at least one asynchronous task including a second asynchronous task, determining a second thread in the second process for executing the second asynchronous task; and increasing the third priority corresponding to the second thread to a fourth priority.

[0018] Here, the second thread used to execute the second asynchronous task in the second process may be a binder thread used to execute the second asynchronous task in the service process. The priority corresponding to the second thread may be a scheduling priority corresponding to the binder thread. The third priority may be a non-RT priority corresponding to a non-real-time scheduling policy, and the fourth priority may be an RT priority corresponding to a real-time scheduling policy. Increasing the third priority corresponding to the second thread to the fourth priority may be to increase the non-RT priority of the binder thread executing the second asynchronous task to an RT priority, so that the binder thread can obtain CPU resources with priority, avoid interruption of the execution of the second asynchronous task, and reduce the time required for the second process to execute the second asynchronous task. Thus, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task is shortened. Furthermore, the execution time of the second process to execute the first asynchronous task is reduced.

[0019] In a possible implementation of the first aspect above, increasing the third priority corresponding to the second thread to a fourth priority includes: adjusting the scheduling policy corresponding to the second thread to a real-time scheduling policy, wherein the real-time scheduling policy corresponds to the fourth priority.

[0020] Here, the priority level corresponding to the second thread can be adjusted to the fourth priority level by adjusting the scheduling policy corresponding to the second thread to the real-time scheduling policy. This allows the second thread to obtain CPU resources with priority, avoids the execution of the second asynchronous task from being interrupted, and reduces the time required for the second process to execute the second asynchronous task. Thus, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task is shortened. Furthermore, the execution time of the second process to execute the first asynchronous task is reduced.

[0021] In a possible implementation of the first aspect above, after the second asynchronous task is executed, the method further includes: restoring the fourth priority level corresponding to the second thread to the third priority level.

[0022] Here, after the second asynchronous task is executed, the priority corresponding to the second thread can be restored to the third priority by restoring the scheduling policy corresponding to the second thread to the non-real-time scheduling policy, so that the second thread can execute other non-critical asynchronous tasks or synchronous tasks based on the non-real-time scheduling policy.

[0023] In a possible implementation of the first aspect above, the third asynchronous tasks are stored in a first queue corresponding to the second process, and each third asynchronous task has a corresponding fifth priority in the first queue, wherein reducing the execution time of the second process to execute the first asynchronous task includes: corresponding to at least one asynchronous task including one or more third asynchronous tasks, reducing the fifth priority corresponding to at least one third asynchronous task among the one or more third asynchronous tasks to a sixth priority.

[0024] Here, the first queue may be an asynchronous queue corresponding to the service process. The priority corresponding to each third asynchronous task in the first queue may be the execution priority described below. The fifth priority may be the execution priority corresponding to each third asynchronous task before the first asynchronous task joins the first queue. Since the third asynchronous task is earlier than the first asynchronous task, the fifth priority of the third asynchronous task is higher than the execution priority of the first asynchronous task. Among them, the sixth priority is lower than the execution priority of the first asynchronous task. Therefore, reducing the fifth priority corresponding to at least one third asynchronous task to the sixth priority means that at least one third asynchronous task will be adjusted to be executed after the first asynchronous task. Thereby, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task is shortened, and then, the execution time of the second process to execute the first asynchronous task is reduced.

[0025] In a possible implementation of the first aspect above, the fifth priority corresponding to at least one third asynchronous task among one or more third asynchronous tasks is reduced to the sixth priority, including: adding the first asynchronous task to the head of the first queue to reduce the priority corresponding to each third asynchronous task.

[0026] Here, the asynchronous task at the head of the first queue has the highest execution priority. Therefore, adding the first asynchronous task to the head of the first queue can make the execution priority corresponding to the first asynchronous task the highest, and then, the execution priority corresponding to all third asynchronous tasks can be reduced, for example, it can be reduced from the fifth priority to the sixth priority. Therefore, this method can adjust all third asynchronous tasks to be executed after the first asynchronous task. Thereby, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task is shortened, and then, the execution time of the second process to execute the first asynchronous task is reduced.

[0027] In a possible implementation of the first aspect above, the fifth priority corresponding to at least one third asynchronous task among one or more third asynchronous tasks is reduced to a sixth priority, including: corresponding to at least one third asynchronous task not satisfying the adjustment condition, the first asynchronous task is added before at least one third asynchronous task to reduce the priority corresponding to the at least one third asynchronous task.

[0028] Here, at least one third asynchronous task that does not meet the adjustment condition can be determined among one or more third asynchronous tasks. Among them, the third asynchronous task that does not meet the adjustment condition is equivalent to a third asynchronous task that is determined to be a non-critical asynchronous task. Furthermore, adding the first asynchronous task before at least one third asynchronous task is equivalent to reducing the execution priority of the third asynchronous task that is determined to be a non-critical asynchronous task, and it is lower than the execution priority of the first asynchronous task. Therefore, this method can postpone the execution of the third asynchronous task as a non-critical asynchronous task to after the first asynchronous task, while all third asynchronous tasks as critical asynchronous tasks are still executed before the first asynchronous task. It is equivalent to that the execution order of all critical asynchronous tasks in the asynchronous queue remains unchanged. Thereby, the time required for the first process to send the first asynchronous task to the second process to start executing the first asynchronous task can be shortened, and the waiting execution time of other critical asynchronous tasks can be avoided from being prolonged due to increasing the execution priority of the first asynchronous task.

[0029] It can be understood that the third asynchronous task that is postponed to be executed after the first asynchronous task can be all the third asynchronous tasks in the first queue that are non-critical asynchronous tasks, or can be part of the third asynchronous tasks in the first queue that are non-critical asynchronous tasks.

[0030] In a second aspect, the present application provides an electronic device comprising: one or more processors; one or more memories; one or more memories storing one or more programs, and when the one or more programs are executed by one or more processors, the electronic device executes the process scheduling method provided by the above-mentioned first aspect and various possible implementations of the above-mentioned first aspect.

[0031] In a third aspect, the present application provides a computer-readable medium having instructions stored thereon, which, when executed on a computer, causes the computer to execute the process scheduling method provided by the first aspect and various possible implementations of the first aspect.

[0032] In a fourth aspect, the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the process scheduling method provided by the above-mentioned first aspect and various possible implementations of the above-mentioned first aspect.

[0033] The beneficial effects of the second to fourth aspects mentioned above can be referred to the relevant descriptions in the first aspect mentioned above and various possible implementations of the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1a The figure shows a scenario schematic diagram of a blocked implementation of an asynchronous task provided by the present application;

[0035] Figure 1b The figure is a schematic diagram of a process of releasing an image buffer provided by an embodiment of the present application;

[0036] Figure 1c The figure is a schematic diagram of a process of executing an asynchronous task provided by an embodiment of the present application;

[0037] Figure 2 The figure shows a software structure block diagram of an electronic device provided in an embodiment of the present application;

[0038] Figure 3a The figure shows a flow chart of executing a first asynchronous task based on a binder driving mechanism provided by an embodiment of the present application;

[0039] Figure 3b The figure shows a timing diagram of frame drop in a picture display process provided by an embodiment of the present application;

[0040] Figure 4 The figure is a schematic diagram of a process of executing a first asynchronous task provided by an embodiment of the present application;

[0041] Figure 5a The figure shows a flow chart of executing a key asynchronous task in a scenario provided by an embodiment of the present application;

[0042] Figure 5b The figure shows an operation diagram of a user clicking an application icon provided by an embodiment of the present application;

[0043] Figure 6a The figure is a flow chart of executing a key asynchronous task in another scenario provided by an embodiment of the present application;

[0044] Figure 6b The figure shows an operation diagram of a user sliding a list provided in an embodiment of the present application;

[0045] Figure 7a The figure is a schematic diagram of a process for executing a key asynchronous task in another scenario provided by an embodiment of the present application;

[0046] Figure 7b Shown is a schematic diagram of a video playback operation provided by an embodiment of the present application;

[0047] Figure 8 Shown is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0049] It can be understood that the process scheduling method of each embodiment of the present application can be applicable to electronic devices including but not limited to mobile phones, tablet computers, desktops, laptops, handheld computers, netbooks, and augmented reality (AR) and virtual reality (VR) devices, smart TVs, smart watches and other wearable devices, servers, mobile email devices, car equipment, portable game consoles, portable music players, reader devices, televisions embedded or coupled with one or more processors, etc.

[0050] Based on the above, Figure 1a A schematic diagram of a scenario in which the implementation of an asynchronous task A is blocked is provided.

[0051] See also Figure 1a , the client process sends asynchronous task A to the service process at time t0. However, the service process may have received asynchronous tasks B, C to H before time t0. Specifically, at time t0, the service process is executing asynchronous task B. Until time t1, after the service process finishes executing asynchronous task B, it starts to execute asynchronous tasks C to H serially from time t1 to time t2.

[0052] Therefore, the service process cannot start executing asynchronous task A until time t2, when it has serially executed asynchronous tasks B to H received before asynchronous task A.

[0053] It can be understood that from time t0 to time t2, asynchronous task A is always in a state of waiting to be executed. If the time interval between time t0 and time t2 is too long, that is, the time asynchronous task A waits for execution is too long, the implementation of asynchronous task A may be blocked.

[0054] For example, in a scenario where an electronic device displays a picture, the electronic device usually displays multiple frames of continuous pictures. Moreover, based on multiple processes, the pictures to be displayed are drawn, rendered, synthesized, and displayed frame by frame. This process usually includes several tasks, for example, the aforementioned asynchronous task A. In this scenario, asynchronous task A may be to release the image buffer. At this time, the client process corresponding to asynchronous task A may be the process of the layer synthesis engine (surfaceflinger) (hereinafter referred to as the "layer synthesis process"), and the service process corresponding to asynchronous task A may be the process of the application program that displays the picture (hereinafter referred to as the "application process").

[0055] It should also be stated that the steps in the methods and processes in the embodiments of the present application are numbered for ease of reference, rather than to limit the order of precedence. If there is an order between the steps, the text description shall prevail.

[0056] Specifically, Figure 1b Provides a process for releasing image buffers.

[0057] See also Figure 1b , the process of releasing the image buffer may include the following steps:

[0058] 100: The application process draws 10 frames.

[0059] Exemplarily, the application process 10 may perform a frame drawing operation. Specifically, the application process 10 may draw pictures to be displayed in several image buffers.

[0060] 101 : The application process 10 sends the drawing result to the layer synthesis process 11 .

[0061] Exemplarily, the application process 10 may send the drawing result to the layer synthesis process 11 .

[0062] 102: Layer synthesis process 11 synthesis frame.

[0063] Exemplarily, the specific process of synthesizing frames performed by the image synthesis process 11 may include the layer synthesis process 11 synthesizing the drawn screen content based on a plurality of image buffers to generate a frame of display screen.

[0064] 103: The layer synthesis process 11 sends the display to the display driver 12 for display.

[0065] Exemplarily, the process of the layer synthesis process 11 sending the display image to the display driver 12 for display may include the layer synthesis process 11 sending a synthesized frame of display image to the display driver 12 for display.

[0066] 104: The display driver 12 displays the frame.

[0067] Exemplarily, the process of the display driver 12 displaying a frame may include the display driver 12 displaying a frame of a display picture synthesized by the layer synthesis process 11 .

[0068] 105: The layer synthesis process 11 notifies the application process 10 to release the image buffer.

[0069] Exemplarily, in order to display the next screen, the layer synthesis process 11 needs to send a notification of releasing the image buffer to the application process 10 after synthesizing a frame of display screen based on the aforementioned step 102. The notification may instruct the application process 10 to release the image buffer.

[0070] 106: The application process 10 releases the image buffer.

[0071] Exemplarily, the process of releasing the image buffer by the application process 10 may include the application process 10 clearing the image content that has been drawn in the image buffer, and drawing the next image to be displayed based on the cleared image buffer.

[0072] It can be understood that in this scenario, if the application process 10 needs to execute a large number of asynchronous tasks in series before releasing the image buffer, and / or the application process 10 takes a long time to execute such asynchronous tasks, the image buffer will wait for too long to be released, which is equivalent to the implementation of releasing the image buffer being blocked. Obviously, if the implementation of releasing the image buffer is blocked, the application process will be unable to draw the next screen to be displayed, which may cause the electronic device to display the screen in a stuck state, drop frames, and other problems, seriously affecting the user experience.

[0073] It is understandable that the aforementioned screen display scenario is only an example, and this application does not make a restrictive description on the scenario where asynchronous task A is blocked. In addition, the layer synthesis process, application process, and image buffer release are also only examples, and this application does not make a restrictive description on the client process, service process, and blocked asynchronous task A in the screen display scenario.

[0074] It can be understood that the process scheduling method provided in this application is applicable to process scheduling in the process of implementing functions of various applications. Among them, the application can be a third-party application or a system application. For example, the application can be a desktop application, a text message application, a camera application, an audio player, a video player, a browser, an instant messaging application, a navigation application, a shopping application, and other applications. This application does not make a restrictive description of the application to which the process scheduling method is applicable.

[0075] In order to solve the aforementioned technical problems, the present application provides a process scheduling method. If a client process sends a first asynchronous task to a service process, it can be determined whether the first asynchronous task is a critical asynchronous task. Among them, a critical asynchronous task refers to an asynchronous task that may affect the functions implemented by the service process when the service process is blocked from executing the critical asynchronous task. If it is determined that the first asynchronous task sent by the client process to the service process is a critical asynchronous task, the time required for the service process to execute the first asynchronous task can be reduced, such as the time required from the client sending the first asynchronous task to the server executing and completing the first asynchronous task, thereby accelerating the service process to execute the first asynchronous task and avoiding the service process from being blocked from executing the first asynchronous task.

[0076] In some embodiments, the execution time required for an asynchronous task (hereinafter referred to as a second asynchronous task) currently executed by the service process may be reduced to reduce the time required for the service process to execute the first asynchronous task.

[0077] For example, the binder thread used to execute the second asynchronous task in the service process can be first determined, and the scheduling priority corresponding to the binder thread can be increased so that the binder thread can obtain CPU resources first, avoiding the execution of the second asynchronous task from being interrupted, thereby reducing the execution time required for the second asynchronous task. Here, the second asynchronous task can be a critical asynchronous task or a non-critical asynchronous task. The method for determining the critical asynchronous task and the non-critical asynchronous task can be found below and will not be elaborated here.

[0078] Here, the scheduling priority can be used to indicate the order in which the processes are scheduled, and the scheduling priority can be the priority corresponding to different types of scheduling strategies. For example, different types of scheduling strategies can include real time (RT) scheduling strategies and non-real time scheduling strategies. Among them, the real-time scheduling strategy can include rate-monotonic scheduling (RMS) strategy, deadline-monotonic scheduling (DMS) strategy, earliest deadline first (EDF) scheduling strategy, least slack time first (LST) scheduling strategy, fixed priority scheduling (FPS) strategy, etc. Non-real-time scheduling strategies can include fair share scheduling strategy, round robin (RR) strategy, shortest job first (SJF) scheduling strategy, etc. Correspondingly, the scheduling priority can include RT priority corresponding to the real-time scheduling strategy and non-RT priority corresponding to the non-real-time scheduling strategy. Among them, the RT priority is higher than the non-RT priority. Therefore, the scheduling priority of the binder thread executing the second asynchronous task may be changed to the RT priority, so that the binder thread may obtain CPU resources preferentially.

[0079] In some embodiments, the execution time required for the asynchronous task (hereinafter referred to as the third asynchronous task) waiting for the service process to execute before the first asynchronous task can be reduced to reduce the time required for the service process to execute the first asynchronous task.

[0080] For example, the execution priority of the first asynchronous task in the asynchronous queue may be increased so that the first asynchronous task can be executed by the service process without waiting for all third asynchronous tasks to be completed.

[0081] Here, the asynchronous queue may be a queue for storing asynchronous tasks waiting to be executed by the service process. It is understood that the asynchronous queue includes one or more third asynchronous tasks and the first asynchronous task. The execution priority may be used to indicate the order in which the asynchronous tasks in the asynchronous queue are executed by the service process. Without adjusting the execution priority, the earlier the asynchronous task is added to the asynchronous queue, the closer its position in the asynchronous queue is to the head of the queue, and the higher its corresponding execution priority.

[0082] Therefore, in an example method of increasing the execution priority of the first asynchronous task, the first asynchronous task can be added to the head of the asynchronous queue corresponding to the service process. It can be understood that at this time, the execution priority of the first asynchronous task in the asynchronous queue is the highest, and the service process can execute the first asynchronous task first, and then execute each third asynchronous task. Therefore, in this way, the execution time required for the third asynchronous task before the first asynchronous task can be reduced to 0.

[0083] In another example method of increasing the execution priority of the first asynchronous task, it can be determined whether there is a critical asynchronous task among all the third asynchronous tasks. If not, the first asynchronous task can be added to the head of the asynchronous queue corresponding to the service process. On the contrary, if it exists, the first asynchronous task can be added before all non-critical asynchronous tasks and after all critical asynchronous tasks. It can be understood that this example method can make the execution priority of the first asynchronous task higher than all non-critical asynchronous tasks in the third asynchronous tasks, and lower than all critical asynchronous tasks in the third asynchronous tasks. It can be understood that this method keeps the execution order between critical asynchronous tasks unchanged while increasing the execution priority of the first asynchronous task. Thereby, it is avoided that the waiting execution time of other critical asynchronous tasks becomes longer due to increasing the execution priority of the first asynchronous task. It can be understood that this method can effectively reduce the execution time required for the third asynchronous task before the first asynchronous task.

[0084] In some embodiments, the time required for the service process to execute the first asynchronous task can be reduced.

[0085] For example, if the service process has completed the second asynchronous task and the third asynchronous task with a higher execution priority than the first asynchronous task, the binder thread used by the service process to execute the first asynchronous task can be determined, and the scheduling priority of the binder thread can be increased. For example, the scheduling priority of the binder thread can be adjusted to the RT priority so that the binder thread can obtain CPU resources first, avoiding the interruption of the execution of the first asynchronous task, thereby shortening the time required for the service process to execute the first asynchronous task.

[0086] In addition, in an example method for determining a critical asynchronous task, the asynchronous task can be determined as a critical asynchronous task when the same asynchronous task meets one or more preset conditions. The aforementioned preset conditions may include: whether the number of applications executing the same asynchronous task exceeds a preset threshold among multiple applications; whether the number of times the asynchronous task is executed exceeds a preset threshold within a preset time in an application executing the same asynchronous task; if the time required to execute the asynchronous task exceeds a preset threshold in an application executing the same asynchronous task, whether it will cause the application to freeze, display frame drops, etc., resulting in consequences that affect the function of the application. Conversely, if the same asynchronous task does not meet one or more preset conditions, the asynchronous task can be determined as a non-critical asynchronous task.

[0087] It can be understood that based on the aforementioned process scheduling method provided in the present application, the electronic device can avoid the first asynchronous task being blocked due to the serial execution of asynchronous tasks.

[0088] For example, Figure 1c A schematic diagram of a process for executing a first asynchronous task based on the process scheduling method provided by the present application is shown.

[0089] Here, the asynchronous task A may be the first asynchronous task determined as a critical asynchronous task, the asynchronous task B may be the second asynchronous task, and the asynchronous tasks C to F may be a plurality of third asynchronous tasks that are non-critical asynchronous tasks.

[0090] See also Figure 1c , the client process sends an asynchronous task A to the service process at time t0. Figure 1a Based on the above process scheduling method, since the electronic device increases the scheduling priority of the binder thread used by the service process to execute the asynchronous task B, the service process can complete the execution of the asynchronous task B at the time t1' which is earlier than the time t1. The time required to execute the asynchronous task B is significantly shortened, which is equivalent to shortening the time that the asynchronous task A waits to be executed, thereby reducing the time required for the service process to execute the asynchronous task A.

[0091] Furthermore, the electronic device can put asynchronous task A at the head of the asynchronous queue of the service process based on the aforementioned process scheduling method. Therefore, the service process can start executing asynchronous task A at time t1' after executing asynchronous task B, without waiting for asynchronous tasks C to H to be completed, which significantly reduces the time required for the service process to execute asynchronous task A.

[0092] Furthermore, based on the aforementioned process scheduling method, the electronic device can increase the scheduling priority of the binder thread of the service process for executing asynchronous task A when the execution order of asynchronous task A is reached. Therefore, the service process can complete the execution of asynchronous task A at time t2', which significantly reduces the time required for the service process to execute asynchronous task A.

[0093] Therefore, the process scheduling method provided in the embodiment of the present application can significantly reduce the time required for the service process to execute the asynchronous task A. For example, the time for the asynchronous task A to wait for execution by the service process is calculated by the above Figure 1a The time from t0 to t2 is shortened to Figure 1c Therefore, it is possible to effectively avoid the situation where the asynchronous task A is blocked due to the service process executing the asynchronous tasks serially.

[0094] It can be understood that in the aforementioned display screen scenario, based on the scheduling method provided in the embodiment of the present application, the electronic device can avoid problems such as freezes and frame drops in the display screen caused by the blocking of asynchronous task A.

[0095] Below, the process scheduling method provided in the embodiment of the present application will be described in detail with reference to the accompanying drawings.

[0096] First, to facilitate understanding of the process scheduling method provided in the embodiment of the present application, the software structure of an electronic device applicable to the implementation of the process scheduling method will be described in detail below.

[0097] Figure 2 A software structure block diagram of an electronic device is shown.

[0098] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, Android TM The system is divided into four layers, from top to bottom: application layer, application framework layer, system library, and kernel layer.

[0099] The application layer can include a series of application packages.

[0100] like Figure 2 As shown, the application package may include applications such as a desktop application 200 , a text messaging application 201 , and a video player 202 .

[0101] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0102] like Figure 2 As shown, the application framework layer may include a component module 203 and a process scheduling module 204 .

[0103] The component module 203 may include multiple components in the Android system architecture for building applications, such as a window manager server (WMS) 203a, a system UI 203b, a media codec 203c, and a view framework 203d.

[0104] The window management service 203a is responsible for managing windows displayed by the electronic device, for example, it can be used to add, create, manage and draw windows, etc. In the embodiment of the present application, the window management service 203a can be used to add the following window for displaying transition effects (hereinafter referred to as "startup window").

[0105] The system interface 203b includes several user interface components, such as a status bar, a navigation bar, a lock screen, a volume control, etc. In the embodiment of the present application, the system interface 203b may also include a startup window for displaying the following transition effects.

[0106] The media codec 203c may be used to encode, decode, and convert the format of audio data and video data. In the embodiment of the present application, the media codec 203c may be used to decode the video stream. The media codec 203c may include the video codec described below.

[0107] The view framework 203d is responsible for defining and processing user interface components in the application interface, such as lists, buttons, text input boxes, etc. In the embodiment of the present application, the view framework 203d can be used to receive a user's sliding operation on the following list, calculate the position of the view displayed in the list on the screen, and redraw the list based on the sliding operation.

[0108] The process scheduling module 204 includes several custom modules related to the process scheduling method provided in the embodiment of the present application. For example, the process scheduling module 204 may include a configuration management module 204a and a feature management module 204b.

[0109] The configuration management module 204a can be used to parse the configuration file related to the process scheduling method provided in the embodiment of the present application during initialization. The configuration file includes configuration data of the switch parameters. The switch parameters are used to start the process scheduling method provided in the embodiment of the present application. Specifically, based on the switch parameters, the electronic device can accelerate the service process to perform the first asynchronous task based on the following steps 400 to 411. The aforementioned initialization can be triggered by the power-on operation of the electronic device, and the present application does not make a restrictive description on the timing of initialization.

[0110] The feature management module 204b is used to obtain the switch parameters parsed by the configuration management module 204a, and send the switch parameters to the system library.

[0111] System libraries can include the Android runtime (Android TM Runtime) 205 and library files 206.

[0112] Among them, Android TM Runtime205 includes core libraries and virtual machines.

[0113] Android TM Runtime205 is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library.

[0114] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0115] The library file 206 may include a layer composition engine 206 a and a processing module 206 b .

[0116] The layer synthesis engine 206a is responsible for managing and synthesizing the image data submitted by all applications and the system user interface. After receiving these image data, the layer synthesis engine 206a synthesizes them into an overall image. The overall image can be a transition image in a dynamic effect, a list image displayed when the user slides the list, or a video image during the video playback process.

[0117] In an example manner, the process of the layer synthesis engine 206a (layer synthesis process) can send an asynchronous task to the binder driver as a client process, so that the binder driver sends the asynchronous task to the service process based on the binder driver mechanism. In an embodiment of the present application, the layer synthesis process can send a key asynchronous task to the binder driver, and the service process can process the key asynchronous task based on the binder driver. The key asynchronous task can be the aforementioned first asynchronous task.

[0118] The processing module 206b is used to receive the switch parameters sent by the feature management module 204b, and send the switch parameters to the kernel layer.

[0119] The kernel layer is a layer between hardware and software and includes at least a display driver 207 , a binder driver 208 , and a kernel extension subsystem 209 .

[0120] The display driver 207 is used to present the entire image synthesized by the layer synthesis engine 206a on the display screen.

[0121] Binder driver 208 can implement asynchronous tasks between the service process and the client process based on the binder driver mechanism. In the embodiment of the present application, binder can accelerate the service process to execute the first asynchronous task after receiving the key asynchronous task (eg, the first asynchronous task) sent by the client process.

[0122] The kernel extension subsystem 209 may include the execution code of the process scheduling method provided in the embodiment of the present application. When the kernel extension subsystem 209 receives the switch parameters sent by the processing module 206b, it can execute the process scheduling method provided in the embodiment of the present application based on the execution code of the process scheduling method provided in the embodiment of the present application.

[0123] Below, in order to facilitate understanding of the process scheduling method provided in the embodiment of the present application, the process of an electronic device executing an asynchronous task based on a binder driving mechanism is first described.

[0124] Figure 3a The figure is a flow chart of an electronic device executing a first asynchronous task based on a binder driving mechanism.

[0125] See also Figure 3a The process of the electronic device executing the first asynchronous task based on the binder driving mechanism may include the following steps:

[0126] 300 : The client process 30 sends a first asynchronous task to the binder driver 208 .

[0127] Exemplarily, in order for the service process 31 to receive the first asynchronous task, the client process 30 may first send the first asynchronous task to the binder driver 208 , so that the binder driver 208 forwards the first asynchronous task to the service process 31 based on the following steps 301 to 304 .

[0128] 301: The binder driver 208 determines that the service process 31 does not have a binder thread capable of executing the first asynchronous task.

[0129] Exemplarily, the binder driver 208 may determine that there is no binder thread in the binder thread pool of the service process 31 that can execute the first asynchronous task.

[0130] Specifically, the situation that the service process 31 does not have a binder thread capable of executing the first asynchronous task may be that all binder threads in the binder thread pool are in a non-idle state, which is equivalent to all binder threads executing tasks and there is no idle binder thread that can execute the first asynchronous task.

[0131] The situation where the service process 31 does not have a binder thread capable of executing the first asynchronous task may also be that there is a binder thread executing the second asynchronous task in the binder thread pool of the service process 31 .

[0132] 302: The binder driver 208 adds the first asynchronous task to the asynchronous queue.

[0133] Exemplarily, if the binder driver 208 determines based on the aforementioned step 301 that the service process 31 does not have a binder thread capable of executing the first asynchronous task, the first asynchronous task may be added to the asynchronous queue corresponding to the service process 31 .

[0134] 303: The binder driver 208 determines that all asynchronous tasks before the first asynchronous task have been completed.

[0135] Exemplarily, the asynchronous tasks before the first asynchronous task include the second asynchronous task and / or one or more third asynchronous tasks. If the binder driver 208 determines that the asynchronous tasks before the first asynchronous task have all been executed, the first asynchronous task may be forwarded to the service process 31 based on the following step 304 .

[0136] 304 : The binder driver 208 sends the first asynchronous task to the service process 31 .

[0137] Exemplarily, if the binder driver 208 determines based on the aforementioned step 303 that all asynchronous tasks before the first asynchronous task have been executed, the first asynchronous task can be forwarded to the service process 31 so that the service process 31 can execute the first asynchronous task based on the idle binder thread.

[0138] 305: The service process 31 executes the first asynchronous task based on the binder thread.

[0139] Exemplarily, after receiving the first asynchronous task based on the aforementioned step 304, the service process 31 may execute the first asynchronous task based on an idle binder thread.

[0140] Based on the above steps 300 to 305, it can be known that if the service process 31 takes too long to execute the asynchronous task before the first asynchronous task, it will take too long to execute the first asynchronous task. For example, if the number of third asynchronous tasks with a higher execution priority than the first asynchronous task in the asynchronous queue of the service process 31 is too large, or the service process 31 takes too long to execute the second asynchronous task, it will take too long for the service process 31 to execute the first asynchronous task, which may cause the first asynchronous task to be blocked.

[0141] For example, taking the scenario of an electronic device displaying a screen as an example, when the first asynchronous task is a critical asynchronous task, if the application process takes too long to execute the second asynchronous task, it may cause problems such as freezes and frame drops in the screen display process of the application.

[0142] Specifically, Figure 3b In the scenario where an electronic device displays a picture, a timing diagram corresponding to frame drops occurs during the picture display process.

[0143] It is understandable that in order to make the process of frame drop clearer, Figure 3b The interaction process between the binder driver 208 and the layer synthesis process, and the interaction process between the binder driver 208 and the application process are not shown. The specific interaction process can refer to the interaction process between the binder driver 208 and the client process, and the interaction process between the binder driver 208 and the client process shown in 3a above, which will not be repeated here. Among them, the layer synthesis process can be a client process, and the application process can be a service process.

[0144] See also Figure 3b , the thread 36 of the layer synthesis process may send a notification to release the image buffer (as an example of the first asynchronous task determined as a key asynchronous task) at time t21. However, at this time, the application process has received the second asynchronous task sent by the thread 35 of the layer synthesis process at an earlier time t20, and has determined the binder thread 33 to execute the second asynchronous task. Therefore, at time t21, the application process does not have a binder thread that can release the image buffer.

[0145] However, the binder thread 33 is in a non-running state from t20 to t22, unable to execute the second asynchronous task, for example, waiting to run. If the time interval from t20 to t22 is too long, the image buffer will wait too long to be released, which will in turn cause the application to release the image buffer too long.

[0146] Until the binder thread 33 completes the execution of the second asynchronous task based on the running state from time t22 to time t23, the application process may determine that the image buffer is released by the idle binder thread 34 at time t23, and completes the release of the image buffer at time t24.

[0147] Based on the above content, it can be known that from time t21 to time t23, the image buffer is always in a state of waiting to be released. If the time interval from time t21 to time t23 is too long, exceeding the display time of a frame in the display scene, the next frame will not be drawn, synthesized and displayed based on the released image buffer, resulting in problems such as freezes and frame drops in the display process.

[0148] Based on the aforementioned process scheduling method provided in the present application, when the first asynchronous task is determined to be a critical asynchronous task, the time required for the service process to execute the first asynchronous task can be effectively reduced, thereby avoiding the first asynchronous task from being blocked.

[0149] Below, the process scheduling method provided in the embodiment of the present application will be described in detail with reference to the accompanying drawings.

[0150] Figure 4 A flow chart showing a process scheduling method based on an embodiment of the present application for reducing the time required for a service process to execute a first asynchronous task.

[0151] Here, the electronic device may implement the aforementioned process scheduling method based on the client process 40, the service process 41 and the binder driver 208. The electronic device may be a mobile phone 100. The client process may be a process that initiates the first asynchronous task, such as the aforementioned layer synthesis process. The service process may be a process that the client process requests to execute the first asynchronous task, such as the aforementioned application process. The binder driver 208 may be located in the kernel layer of the electronic device, and is used to send the asynchronous task from the client process to the service process based on the binder driver mechanism. The asynchronous task may include the first asynchronous task, the second asynchronous task, and the third asynchronous task.

[0152] See also Figure 4 , implementing the process scheduling method provided in the embodiment of the present application may include the following steps:

[0153] 400 : The client process 40 sends the first asynchronous task to the binder driver 208 .

[0154] Exemplarily, in order to send the first asynchronous task to the service process 41 across processes, the client process 40 may first send the first asynchronous task to the binder driver 208, so that the binder driver 208 sends the first asynchronous task to the service process 41 based on the binder driver mechanism.

[0155] Here, the client process 40 sends the first asynchronous task to the binder driver 208, which may include sending one or more attribute parameters of the first asynchronous task to the binder driver 208. The aforementioned attribute parameters may include an interface descriptor, an interface number, an asynchronous communication identifier, etc. It is understood that the present application does not make a restrictive description of the attribute parameters sent by the client process 40 to the binder driver 208.

[0156] The interface descriptor may be used to indicate the class name of an interface class, which may be a class that aggregates several service interfaces. The interface number may be used to indicate a service interface in an interface class, which may correspond to a task implementation method. The asynchronous communication identifier may be used to indicate that the task type is an asynchronous task.

[0157] Therefore, the task content of the first asynchronous task can be determined based on the interface descriptor and the interface number of the first asynchronous task.

[0158] For example, interface class A includes service interface B, and service interface B corresponds to the implementation of releasing the image buffer, and service interface B is numbered "1". Therefore, if the interface descriptor of the first asynchronous task indicates interface class A, and the interface number of the first asynchronous task is "1", it can be indicated that the task content of the first asynchronous task is to release the image buffer.

[0159] Furthermore, combined with the asynchronous communication identifier of the first asynchronous task, it can be indicated that the first asynchronous task is an asynchronous task for releasing the image buffer.

[0160] In an example manner, the client process 40 may send a remote procedure call (RPC) to the binder driver 208 based on the transact() function in the binder driver mechanism to send the first asynchronous task to the binder driver 208. Here, the aforementioned interface descriptor may be included in the data parameter of the transact() function, the aforementioned interface number may be the code parameter in the transact() function, and the aforementioned asynchronous communication identifier may be the FLAG_ONEWAY parameter in the transact() function.

[0161] 401: The binder driver 208 determines that the first asynchronous task is a critical asynchronous task.

[0162] Exemplarily, after the binder driver 208 receives the first asynchronous task sent by the client process 40, it can determine that the first asynchronous task is a critical asynchronous task. In an exemplary manner, the binder driver 208 can determine that the first asynchronous task is a critical asynchronous task based on the interface number, the interface descriptor and the asynchronous communication identifier.

[0163] Specifically, the electronic device can determine the asynchronous task of specific task content as a critical asynchronous task in advance according to the aforementioned preset conditions. At this time, if the binder driver 208 determines that the task content of the first asynchronous task is the task content of the critical asynchronous task according to the interface descriptor and interface number of the first asynchronous task, and the first asynchronous task has an asynchronous communication identifier, then the first asynchronous task can be determined as a critical asynchronous task.

[0164] In another example, the binder driver 208 may determine that the first asynchronous task is a critical asynchronous task based on the interface number, the interface descriptor, the asynchronous communication identifier, the client process number, and the service process number.

[0165] Here, the electronic device may pre-store a client process number and a service process number, wherein the client process number corresponds to the client process 40 of the key asynchronous task, and the service process number corresponds to the service process 41 of the key asynchronous task.

[0166] Specifically, the electronic device can determine in advance, based on the aforementioned preset conditions, an asynchronous task with specific task content performed between specific processes as a critical asynchronous task. At this time, if the binder driver 208 determines that the task content of the first asynchronous task is the task content of the critical asynchronous task based on the interface descriptor and interface number of the first asynchronous task, the first asynchronous task has an asynchronous communication identifier, and the client process 40 of the first asynchronous task corresponds to the client process number, and the service process 41 of the first asynchronous task corresponds to the service process number, then the first asynchronous task can be determined as a critical asynchronous task.

[0167] 402: The binder driver 208 determines that the service process 41 does not have a binder thread capable of executing the first asynchronous task.

[0168] Exemplarily, if the service process 41 has the situation described in the aforementioned step 301, the binder driver 208 may determine that the service process 41 does not have a binder thread capable of executing the first asynchronous task. At this time, the binder driver 208 may accelerate the asynchronous task before the service process 41 executes the first asynchronous task based on the following steps 403 to 407. Here, the binder driver 208 determines that the service process 41 does not have a binder thread capable of executing the first asynchronous task. For details, please refer to the aforementioned step 301, which will not be repeated here.

[0169] 403: The binder driver 208 determines whether the service process 41 is executing the second asynchronous task.

[0170] If the judgment result is yes, it means that the service process 41 is executing the second asynchronous task, and then the following step 404 is executed;

[0171] If the judgment result is no, it means that the service process 41 has not executed the second asynchronous task, and then jump to the following step 405.

[0172] On the one hand, if the service process 41 is executing the second asynchronous task, it means that the service process 41 does not have a binder thread capable of executing the first asynchronous task because there is a binder thread executing the second asynchronous task in the binder thread pool of the service process 41. At this time, the service process 41 takes too long to execute the second asynchronous task, or there are too many third asynchronous tasks with a higher execution priority than the first asynchronous task in the asynchronous queue of the service process 41, which may cause the service process 41 to take too long to execute the first asynchronous task.

[0173] Therefore, the binder driver 208 can shorten the time required for the service process 41 to execute the second asynchronous task based on the following step 404, so as to shorten the time required for the service process 41 to execute the first asynchronous task. Furthermore, the number of third asynchronous tasks with a higher execution priority than the first asynchronous task in the asynchronous queue of the service process 41 can be reduced based on the following step 405, so as to further shorten the time required for the service process 41 to execute the first asynchronous task.

[0174] On the other hand, if the service process 41 does not execute the second asynchronous task, it means that the service process 41 does not have a binder thread capable of executing the first asynchronous task because all binder threads in the binder thread pool are in a non-idle state. At this time, the number of third asynchronous tasks with a higher execution priority than the first asynchronous task in the asynchronous queue of the service process 41 is large, which may cause the service process 41 to take too long to execute the first asynchronous task.

[0175] Therefore, the binder driver 208 can reduce the number of third asynchronous tasks with a higher execution priority than the first asynchronous task in the asynchronous queue of the service process 41 based on the following step 405 to shorten the time required for the service process 41 to execute the first asynchronous task.

[0176] 404: The binder driver 208 increases the scheduling priority of the binder thread used to execute the second asynchronous task.

[0177] Exemplarily, if the binder driver 208 determines that the service process 41 is executing the second asynchronous task based on the aforementioned step 403, it can first determine the binder thread that executes the second asynchronous task, and then increase the scheduling priority of the binder thread to avoid the binder thread entering a non-running state due to a low scheduling priority, which causes the service process 41 to take a longer time to execute the second asynchronous task. Increasing the scheduling priority of the binder thread that executes the second asynchronous task can enable the binder thread to execute the second asynchronous task based on the running state, shortening the time required for the service process 41 to execute the second asynchronous task, which is equivalent to shortening the time the first asynchronous task waits to be executed, thereby achieving the purpose of speeding up the service process 41 to execute the first asynchronous task.

[0178] In an example manner, the scheduling priority of the binder thread can be increased by changing the scheduling policy of the binder thread that executes the second asynchronous task. Specifically, the scheduling policy of the binder thread can be adjusted to the RT scheduling policy, and accordingly, the scheduling priority of the binder thread will be adjusted to the RT priority. It can be understood that the RT priority is higher than the non-RT priority, so the binder thread with RT priority will be allocated to CPU resources faster. Then, the second asynchronous task can be executed faster based on the running state. Here, it can be understood that adjusting the scheduling policy of the binder thread to any of the aforementioned RT scheduling policies can adjust the scheduling priority of the binder thread to the RT priority. Here, no restrictive description is made on the specific scheduling policy adjusted.

[0179] 405: The binder driver 208 increases the execution priority of the first asynchronous task.

[0180] Exemplarily, the binder driver 208 may increase the execution priority of the first asynchronous task in the asynchronous queue corresponding to the service process 41 .

[0181] Specifically, the binder driver 208 determines based on the aforementioned step 403 that the service process 41 is executing the second asynchronous task, or that the service process 41 is not executing the second asynchronous task, and can shorten the time required for the service process 41 to execute the first asynchronous task by increasing the execution priority of the first asynchronous task in the asynchronous queue.

[0182] In an example manner, after determining based on the aforementioned step 402 that the service process 41 does not have a binder thread capable of executing the first asynchronous task, the binder driver 208 can add the first asynchronous task to the asynchronous queue corresponding to the service process 41, and determine the execution priority of the first asynchronous task to be the highest execution priority.

[0183] Specifically, the binder driver 208 can add the first asynchronous task to the head of the asynchronous queue corresponding to the service process 41. It can be understood that the asynchronous task at the head of the asynchronous queue has the highest priority. Therefore, this method can determine the execution priority of the first asynchronous task as the highest execution priority in the asynchronous queue.

[0184] Furthermore, the first asynchronous task can be the first asynchronous task in the asynchronous queue to be assigned a binder thread, without waiting for all third asynchronous tasks that were added to the asynchronous queue earlier to be completed. Obviously, in the scenario where there are one or more third asynchronous tasks added earlier in the asynchronous queue, this method can effectively serve the time required for process 41 to execute the first asynchronous task.

[0185] In another example, the binder driver 208 may determine the execution priority of the first asynchronous task as priority a after determining that the service process 41 does not have a binder thread capable of executing the first asynchronous task based on the aforementioned step 402. Priority a is higher than the execution priority of all third asynchronous tasks that are non-critical asynchronous tasks, and lower than the execution priority of all third asynchronous tasks that are critical asynchronous tasks.

[0186] Specifically, the binder driver 208 can add the first asynchronous task to the asynchronous queue before all the third asynchronous tasks that are non-critical asynchronous tasks. It can be understood that this method can make the execution priority of the first asynchronous task higher than all the third asynchronous tasks that are non-critical asynchronous tasks. Correspondingly, the execution priority of the first asynchronous task is lower than that of all the third asynchronous tasks that are critical asynchronous tasks. This is equivalent to that in the asynchronous queue of the service process 41, the execution priority order between all critical asynchronous tasks is still sorted according to the early and late joining time, and the critical asynchronous tasks that are joined earlier have higher execution priority.

[0187] Obviously, this example method ensures that the execution order of key asynchronous tasks remains unchanged while increasing the execution priority of the first asynchronous task. This is equivalent to preventing the service process 41 from taking longer to execute other key asynchronous tasks while increasing the execution priority of the first asynchronous task. This avoids the adverse effects of the longer time required for other key asynchronous tasks on the functional implementation of the application.

[0188] 406: The binder driver 208 determines that the asynchronous task before the first asynchronous task has been completed.

[0189] Here, if the binder driver 208 determines based on the aforementioned step 403 that the service process 41 is executing the second asynchronous task, it is determined that the asynchronous tasks before the first asynchronous task have been completed, including: the second asynchronous task and one or more third asynchronous tasks that may exist in the asynchronous queue have all been completed by the service process 41.

[0190] Here, if the binder driver 208 determines based on the aforementioned step 403 that the service process 41 has not executed the second asynchronous task, it is determined that the asynchronous task before the first asynchronous task has been completed, including: one or more third asynchronous tasks that may exist in the asynchronous queue have been completed by the service process 41.

[0191] 407: The binder driver 208 increases the scheduling priority of the binder thread used to execute the first asynchronous task.

[0192] Exemplarily, if the binder driver 208 determines based on the aforementioned step 406 that the third asynchronous task before the first asynchronous task has been completed, an idle binder thread for executing the first asynchronous task can be determined, and the scheduling priority of the binder thread can be increased before waking up the binder thread to execute the first asynchronous task.

[0193] Here, increasing the scheduling priority of the binder thread can enable the binder thread to enter the running state faster, and further, can execute the first asynchronous task based on the running state faster, thus shortening the time required for the service process 41 to execute the first asynchronous task.

[0194] Here, the manner in which the binder driver 208 increases the scheduling priority of the binder thread can be referred to in the aforementioned step 404, which will not be described in detail here.

[0195] 408 : The binder driver 208 sends the first asynchronous task to the service process 41 .

[0196] Exemplarily, after the binder driver 208 increases the scheduling priority of the binder thread based on the aforementioned step 407 , the first asynchronous task may be sent to the service process 41 , and the binder thread of the service process 41 may be awakened to execute the first asynchronous task.

[0197] 409: The service process 41 executes the first asynchronous task based on the binder thread.

[0198] Exemplarily, after receiving the first asynchronous task, the service process 41 may execute the first asynchronous task based on the awakened binder thread.

[0199] 410: The service process 41 notifies the binder driver 208 that the first asynchronous task has been executed.

[0200] Exemplarily, after the service process 41 completes the first asynchronous task based on the binder thread, the binder driver 208 may be notified that the first asynchronous task has been completed, so that the binder driver 208 executes the following step 411 .

[0201] Moreover, after the binder driver 208 learns that the service process 41 has completed executing the first asynchronous task, it can identify and record whether the next task executed by the binder thread used to execute the first asynchronous task is an asynchronous task. The recording result can assist the binder driver 208 in determining whether the service process 41 has a binder thread capable of executing the next critical asynchronous task when the client process 40 sends the next critical asynchronous task to the binder driver 208.

[0202] For example, if the binder driver 208 identifies that the next task that the binder thread used to execute the first asynchronous task needs to execute is an asynchronous task, the identification result can be recorded. Further, when the client process 40 sends the next critical asynchronous task to the binder driver 208 based on the aforementioned step 400, the binder driver 208 can determine through the aforementioned step 402 based on the identification result that the service process 41 does not have a binder thread that can execute the next critical asynchronous task. Further, the time required for the service process 41 to execute the next critical asynchronous task can be reduced based on the aforementioned steps 403 to 407.

[0203] 411: Binder driver 208 restores priority.

[0204] Exemplarily, the binder driver 208 may restore the binder thread whose scheduling priority is increased to its original scheduling priority.

[0205] In an example manner, if the binder thread has no tasks to perform, the binder driver 208 may restore the binder thread whose scheduling priority is adjusted to the RT priority to the non-RT priority.

[0206] Specifically, if the above-mentioned step 403 is judged to be yes, the binder driver 208 can restore the scheduling priority of the binder thread used to execute the first asynchronous task and / or the second asynchronous task to the original scheduling priority when the binder thread used to execute the first asynchronous task and / or the second asynchronous task has no tasks to perform, so that the binder thread used to execute the first asynchronous task and / or the second asynchronous task can execute subsequent tasks that may be assigned based on the original scheduling priority.

[0207] If the result of the judgment in the aforementioned step 403 is no, the binder driver 208 can restore the scheduling priority of the binder thread used to execute the first asynchronous task to the original scheduling priority when there is no task to be done by the binder thread, so that the binder thread can execute the subsequent tasks that may be assigned based on the original scheduling priority.

[0208] In another example, if the first asynchronous task is executed completely, the binder driver 208 may restore the binder thread whose scheduling priority is adjusted to the RT priority to the non-RT priority.

[0209] Specifically, if the judgment result of the aforementioned step 403 is yes, the binder driver 208 can restore the scheduling priority of the binder thread used to execute the first asynchronous task and / or the second asynchronous task to the original scheduling priority when the first asynchronous task is completed, so that the binder thread used to execute the first asynchronous task and / or the second asynchronous task can execute non-critical asynchronous tasks or synchronous tasks without reducing the execution time based on the original scheduling priority.

[0210] If the result of the judgment in the aforementioned step 403 is no, the binder driver 208 may restore the scheduling priority of the binder thread used to execute the first asynchronous task to the original scheduling priority after the first asynchronous task is executed, so that the binder thread can execute non-critical asynchronous tasks or synchronous tasks without reducing the execution time based on the original scheduling priority.

[0211] In addition, after the service process 41 completes the first asynchronous task based on the binder thread, the binder driver 208 can determine whether there is an unexecuted task in the task queue corresponding to the service process 41. If so, the service process 41 can continue to execute the unexecuted task; if not, the service process 41 can sleep. The task queue can include all tasks to be executed by the service process 41, including asynchronous tasks and synchronous tasks.

[0212] Below, the process scheduling method provided by the embodiment of the present application will be described in detail by taking the scene of the electronic device displaying a screen as an example and combining with specific embodiments. It can be understood that the following embodiments all take the electronic device as a mobile phone 100 as an example to explain the implementation process of the process scheduling method provided by the embodiment of the present application, and the specific example of the electronic device will not be described below.

[0213] In an embodiment of the present application, the scene of the screen displayed by the electronic device may include a scene showing dynamic effects.

[0214] This embodiment will illustrate the specific process of applying the process scheduling method provided in the embodiment of the present application in a scenario of displaying dynamic effects in conjunction with the accompanying drawings.

[0215] Figure 5a Taking the dynamic effect of gradually enlarging the startup window (hereinafter referred to as "transition effect") as an example, a flow chart is shown for reducing the time required for a service process to execute key asynchronous tasks in a scenario where dynamic effects are displayed, based on the process scheduling method provided in an embodiment of the present application.

[0216] See also Figure 5a , the process of accelerating the execution of key asynchronous tasks in a scene that displays dynamic effects can include the following steps:

[0217] 500: The desktop application 200 receives a click operation on an application icon by a user.

[0218] For example, Figure 5b A schematic diagram of an operation in which a user clicks an application icon is shown.

[0219] See also Figure 5b , the user's click operation on the application icon may be the user's click operation on the SMS application icon 530a of the SMS application 201. Specifically, the process of the desktop application 200 (hereinafter referred to as the "desktop process") may receive the user's click operation on the SMS application icon 530a. Specifically, the desktop process may receive the user's click operation based on the onClick() function.

[0220] Here, the mobile phone 100 displays a desktop interface 530. Before the desktop process receives a user's click operation on the SMS application icon 530a, the desktop interface 530 displays multiple application icons including the SMS application icon 530a. After the desktop process receives the user's click operation on the SMS application icon 530a and a period of time (for example, 0.02 seconds) has passed, the desktop interface 530 displays a startup window 531a. After another period of time (for example, 0.1 seconds), the desktop interface 530 displays a startup window 531b. It can be understood that the startup window 531a gradually enlarges to a startup window 531b after a period of time (for example, 0.1 seconds). After the mobile phone 100 displays the transition effect of the startup window 531a gradually enlarging to the startup window 531b, the SMS interface 532 can be displayed.

[0221] Here, the present application does not provide any restrictive description on the specific display contents of the startup window 531a and the startup window 531b, the time interval required to enlarge the startup window 531a to the startup window 531b, and the time interval required to change from the startup window 531b to the SMS interface 532.

[0222] 501: The desktop application 200 prepares startup parameters.

[0223] Exemplarily, after the desktop process receives a click operation on the application icon by the user, it may start preparing the startup parameters of the startup window, which may include display position parameters, size parameters, etc. of the startup window.

[0224] 502: The desktop application 200 requests the window management service 203a to switch the user interface.

[0225] For example, the desktop process may request the process of the window management service 203 a (hereinafter referred to as “window management process”) to switch the user interface based on the received click operation.

[0226] Specifically, the desktop process requests the window management process to switch the user interface, which may include the desktop process requesting the window management process to display the startup window. Here, the startup window can be used as an activity, so the desktop process can request the window management process to display the startup window based on the startActivityAsUser() function.

[0227] 503: The window management service 203a starts a transition.

[0228] Exemplarily, after the window management process receives the request for switching the user interface sent by the desktop process, a transition may be started. Here, starting a transition may correspond to creating a task for displaying a transition effect.

[0229] 504: The window management service 203a adds a startup window.

[0230] Exemplarily, the window management process may add a startup window to manage the startup window for displaying dynamic effects.

[0231] 505: The window management service 203a requests the binder driver 208 to add a startup window.

[0232] Exemplarily, the window management process requests the process of the system interface 203b (hereinafter referred to as the system interface process) to add a startup window, and may first send a request to add a startup window to the binder driver 208. Here, the request to add a startup window may be implemented based on the addStartingWindow() function.

[0233] Specifically, the window management process can be based on the aforementioned Figure 4 Step 400 in the flow chart sends a request to add a startup window to the binder driver 208. At this time, adding a startup window can be used as an example of the aforementioned first asynchronous task, the window management process can be used as an example of the aforementioned client process, and the system interface process can be used as an example of the aforementioned service process.

[0234] 506: The binder driver 208 determines that adding a startup window is a critical asynchronous task.

[0235] Exemplarily, the binder driver 208 may determine that adding a startup window is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0236] Here, adding a startup window may be an asynchronous task between processes that occurs frequently during the display of dynamic effects. Furthermore, if the task of adding a startup window is not responded to in a timely manner, the startup window may not be displayed in a timely manner. For example, in an application scenario, the startup window may not be displayed immediately after the user clicks the application icon, resulting in the time interval between the click operation and the display of the startup window being perceived by the user. In turn, the display of the transition special effects will not be smooth, and the user's visual experience will be poor. Therefore, the mobile phone 100 can determine the addition of the startup window as a key asynchronous task.

[0237] 507: The binder driver 208 reduces the time required to add the startup window.

[0238] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that the system interface process does not have a binder thread capable of adding a startup window, the binder driver 208 can reduce the time required for the system interface process to add a startup window based on the aforementioned steps 403 to 407, so that the system interface process can add a startup window faster.

[0239] 508: The binder driver 208 requests the system interface 203b to add a startup window.

[0240] Exemplarily, the binder driver 208 requests the system interface process to add a startup window, which may include: the binder driver 208 based on the aforementioned Figure 4 Step 408 in the illustrated flow sends a request to add a launch window to the system interface process.

[0241] Here, the binder driver 208 may send a request for adding a startup window to the system interface process based on the onTransact() function.

[0242] 509: The system interface 203b adds a startup window.

[0243] Exemplarily, after receiving the request to add a startup window, the system interface process may add a startup window based on the aforementioned step 409 .

[0244] It can be understood that based on the aforementioned steps 507 to 509, the system interface process can add the startup window in time, avoiding the problem of the dynamic effect not being displayed in time due to the slow speed of adding the startup window. Furthermore, the adverse effect of the unsmooth display of the transition special effect on the user's visual experience can be avoided.

[0245] It can be understood that after the system interface process completes adding the startup window, it can restore the priority of the binder thread based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0246] 510: The window management service 203a registers with the binder driver 208 to use the desktop application 200 to perform transition effects.

[0247] For example, the window management process can first send a task of registering the desktop application 200 program as a transition effect to the binder driver 208 to register the desktop application 200 program as a transition effect in order to register the desktop application 200 program as a transition effect with the system interface process. Here, registering the desktop application 200 as a transition effect can be implemented based on the requestStartTransition() function.

[0248] Specifically, the window management process can be based on the aforementioned Figure 4 Step 400 in the flow chart sends a task of registering a transition effect (hereinafter referred to as "registering a transition effect") by the desktop application 200 to the binder driver 208. At this time, registering a transition effect can be used as an example of the aforementioned first asynchronous task, the window management process can be used as an example of the aforementioned client process, and the system interface process can be used as an example of the aforementioned service process.

[0249] 511: The binder driver 208 determines that registering the transition effect is a key asynchronous task.

[0250] Exemplarily, the binder driver 208 may determine that registering the transition effect is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0251] Here, registering transition effects may be an asynchronous task between processes that occurs frequently during the display of dynamic effects. Furthermore, if the task of registering transition effects is not responded to in a timely manner, the dynamic effects may not be displayed in a timely manner. For example, in an application scenario, the transition effects may not be displayed immediately after the user clicks the application icon, causing the time interval between the click operation and the transition effects to be perceived by the user. Furthermore, the display of the transition effects will not be smooth, and the user's visual experience will be poor. Therefore, the mobile phone 100 can determine the registration of transition effects as a key asynchronous task.

[0252] 512: The binder driver 208 reduces the time required to register transition effects.

[0253] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that the system interface process does not have a binder thread capable of registering transition effects, the binder driver 208 can reduce the time required to register transition effects based on the aforementioned steps 403 to 407, so that the system interface process can register transition effects faster.

[0254] 513: The binder driver 208 registers with the system interface process to use the desktop application 200 to perform transition effects.

[0255] Exemplarily, the binder driver 208 registers with the system interface process that the desktop application 200 performs transition effects, which may include: the binder driver 208 sends the task of registering the transition effects to the system interface process based on the aforementioned step 408 .

[0256] Here, the binder driver 208 can send the task of registering the transition effect to the system interface process based on the onTransact() function.

[0257] It can be understood that based on the aforementioned steps 512 to 513, the system interface process can register the transition effect in time, avoiding the problem that the dynamic effect cannot be displayed in time due to the slow speed of registering the transition effect. Furthermore, the adverse effect of the unsmooth display of the transition effect on the user's visual experience can be avoided.

[0258] It can be understood that after completing the registration of the transition effect, the system interface process can restore the priority of the binder thread based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0259] 514: The window management service 203a notifies the binder driver 208 to display the transition effect.

[0260] Exemplarily, the window management process can first send a notification of displaying the transition effect to the binder driver 208 to notify the desktop process to display the transition effect. Here, the notification of displaying the transition effect can be implemented based on the onTransitionReady() function.

[0261] Specifically, the window management process can be based on the aforementioned Figure 4Step 400 in the illustrated flow sends a notification of display transition effects to the binder driver 208. At this time, the display transition effects can be used as an example of the aforementioned first asynchronous task, the window management process can be used as an example of the aforementioned client process, and the desktop process can be used as an example of the aforementioned service process.

[0262] 515: The binder driver 208 determines that displaying the transition effect is a key asynchronous task.

[0263] Exemplarily, the binder driver 208 may determine that displaying the transition effect is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0264] Here, displaying transition effects may be an asynchronous task between processes that occurs frequently during the display of dynamic effects. Furthermore, if the task of displaying transition effects is not responded to in a timely manner, the dynamic effects may not be displayed in a timely manner. For example, in an application scenario, the transition effects may not be displayed immediately after the user clicks the application icon, causing the time interval between the click operation and the transition effects to be perceived by the user. Furthermore, the display of the transition effects will not be smooth, and the user's visual experience will be poor. Therefore, the mobile phone 100 can determine the display of the transition effects as a key asynchronous task.

[0265] 516: The binder driver 208 reduces the time required to display transition effects.

[0266] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that there is no binder thread capable of displaying transition effects in the desktop process, the binder driver 208 can reduce the time required to display the transition effects based on the aforementioned steps 403 to 407, so that the desktop process can display the transition effects faster.

[0267] 517: The binder driver 208 notifies the desktop process to display the transition effect.

[0268] Exemplarily, the binder driver 208 notifies the desktop process to display the transition effect, which may include the binder driver 208 sending a notification of displaying the transition effect to the desktop process based on the aforementioned step 408 .

[0269] Here, the binder driver 208 may send a notification of displaying the transition effect to the desktop process based on the onTransact() function.

[0270] It can be understood that based on the aforementioned steps 516 to 517, the desktop process can display the transition effects in time, avoiding the problem of the dynamic effects not being displayed in time due to the slow speed of displaying the transition effects. Furthermore, the adverse effect of the unsmooth display of the transition effects on the user's visual experience can be avoided.

[0271] It can be understood that after the desktop process completes the display transition effect, it can restore the priority of the binder thread based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0272] 518: Desktop application 200 drawing frames.

[0273] Exemplarily, after receiving the notification of displaying the transition effect, the desktop process may draw a frame. Here, drawing a frame may include drawing the display content of the startup window based on the startup window. Figure 5b Taking the above content as an example, drawing a frame may include filling the startup window 531a with a preset color and filling the startup window 532b with a preset color. Here, the embodiment of the present application does not restrict the specific display content of the startup window, and the startup window may display a preset pattern, preset color, etc.

[0274] Here, a frame drawn by the desktop process may include a transition image frame of a transition special effect, which is equivalent to a startup window and its display content.

[0275] 519: The desktop application 200 submits the transaction to the layer composition engine 206a.

[0276] Exemplarily, after the desktop process completes the frame drawing, it can submit a transaction to the layer synthesis process. Here, the display parameters of a frame transition image drawn by the desktop process can be collected in the transaction corresponding to the frame transition image, and then, the desktop process submits the transaction corresponding to the frame transition image to the layer synthesis process, so that the layer synthesis process can determine the display mode of the frame transition image. The aforementioned display parameters may include the display position, display size, dynamic effects of the transition image, etc. The aforementioned dynamic effects may include translation, fade-out, rotation, etc. This application does not make a restrictive description of the content of the display parameters. Here, submitting a transaction can be implemented based on the apply() function.

[0277] 520: The layer composition engine 206a reaches a refresh cycle.

[0278] Exemplarily, when the layer synthesis process determines that the refresh cycle has been reached, a frame of transition image of the transition special effect can be synthesized based on the following step 521. Here, the layer synthesis process can determine that the refresh cycle has been reached based on the onVsync() function.

[0279] 521: The layer synthesis engine 206a synthesizes the frame.

[0280] Exemplarily, the layer synthesis process may synthesize a frame of transition image of a transition special effect based on a frame of transition image drawn by the desktop process.

[0281] 522: The layer synthesis engine 206a sends the display to the display driver 207 for display.

[0282] Here, "sending for display" may mean notification for display. For example, after synthesizing a transition image frame of a transition special effect, the layer synthesis process may send the transition image frame to the display driver 207 to notify the display driver 207 to display the transition image frame.

[0283] 523: The display driver 207 displays the frame.

[0284] Exemplarily, after receiving a frame of transition image sent by the layer synthesis process, the display driver 207 may display the frame of transition image.

[0285] 524: The layer composition engine 206a notifies the binder driver 208 to release the image buffer.

[0286] Exemplarily, when the displayed transition effect needs to be refreshed, which is equivalent to when the next frame of transition image needs to be displayed, the layer synthesis process can notify the desktop process to release the image buffer so as to synthesize the next frame of transition image based on the released image buffer.

[0287] Here, the layer composition process sends a notification of releasing the image buffer to the desktop process, and can first send a notification of releasing the image buffer to the binder driver 208. Here, the notification of releasing the image buffer can be implemented based on the releaseBufferCallback() function.

[0288] Specifically, the layer synthesis process can be based on the aforementioned Figure 4 Step 400 in the illustrated flow sends a notification of releasing the image buffer to the binder driver 208. At this time, releasing the image buffer can be used as an example of the aforementioned first asynchronous task, the layer synthesis process can be used as an example of the aforementioned client process, and the desktop process can be used as an example of the aforementioned service process.

[0289] 525: The binder driver 208 determines that releasing the image buffer is a critical asynchronous task.

[0290] Exemplarily, the binder driver 208 may determine that releasing the image buffer is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0291] Here, releasing the image buffer may be an asynchronous task between processes that occurs frequently during the display of dynamic effects. Furthermore, if the time for which the desktop process takes to execute an asynchronous task with a higher priority than releasing the image buffer is too long, the image buffer will not be released. Furthermore, the layer synthesis process may not be able to synthesize the next frame of transition images based on the released image buffer, causing problems such as freezes and dropped frames in the display of dynamic effects. For the specific reasons why untimely release of the image buffer will cause freezes and dropped frames in the display of dynamic effects, please refer to the aforementioned Figure 1b The specific description is not repeated here.

[0292] Furthermore, the mobile phone 100 may determine releasing the image buffer as a key asynchronous task in displaying a dynamic effect scene.

[0293] 526: The binder driver 208 reduces the time required to release the image buffer.

[0294] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that there is no binder thread in the desktop process that can release the image buffer, the binder driver 208 can reduce the time required to release the image buffer based on the aforementioned steps 403 to 407, so that the desktop process can release the image buffer faster.

[0295] 527: The binder driver 208 notifies the desktop application 200 to release the image buffer.

[0296] Exemplarily, the binder driver 208 notifies the desktop process to release the image buffer, which may include: the binder driver 208 notifies the desktop process to release the image buffer based on the above Figure 4 Step 408 in the illustrated flow sends a notification of releasing the image buffer to the desktop process.

[0297] Here, the binder driver 208 may send a notification of releasing the image buffer to the desktop process based on the onTransact() function.

[0298] 528: The desktop application 200 releases the image buffer.

[0299] Exemplarily, after receiving the notification of releasing the image buffer, the desktop process may release the image buffer based on the aforementioned step 409 .

[0300] It can be understood that based on the aforementioned steps 526 to 528, the desktop process can be accelerated to release the image buffer, and then, when the next transition image of the transition special effect needs to be displayed, the layer synthesis process can timely synthesize the next transition image according to the released image buffer. Therefore, it can avoid the problems of freeze, frame drop, etc. caused by the image buffer not being released when the next transition image needs to be displayed.

[0301] It can be understood that based on the aforementioned steps 500 to 528, during the process of displaying dynamic effects, the mobile phone 100 can smoothly display the process of the startup window 531a gradually enlarging into the startup window 531b, thereby enhancing the user's visual experience during the process of starting the application and displaying the transition special effects.

[0302] It can be understood that after the desktop process completes the release of the image buffer, it can restore the priority of the binder thread based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0303] In addition, it can be understood that in the display process of a transition special effect, the above steps 518 to 528 may be executed multiple times. The specific number of executions may be determined by the number of frames of a transition special effect.

[0304] Based on the aforementioned Figure 5a The description of the process, based on the process scheduling method provided in the embodiment of the present application, can avoid problems such as freeze and frame drop in scenes displaying dynamic effects.

[0305] In the embodiment of the present application, the scene of the display screen of the electronic device may be a scene of a sliding list.

[0306] This embodiment will illustrate the specific process of applying the process scheduling method provided in the embodiment of the present application in the scenario of the sliding list in conjunction with the accompanying drawings.

[0307] Figure 6a A flow chart showing a method for reducing the time required for a service process to execute key asynchronous tasks in a sliding list scenario based on a process scheduling method provided in an embodiment of the present application.

[0308] See also Figure 6a , the process of accelerating the execution of key asynchronous tasks in the sliding list scenario can include the following steps:

[0309] 600: The view framework 203d receives a sliding operation from the user.

[0310] Exemplarily, the process of the view framework 203d (hereinafter referred to as the view framework process) can receive a user's sliding operation on a list based on the onUpEvent() function. Here, the list can include a list displayed in a user interface such as a system application, a third-party application, a mini-program, a web page, etc., which can display more content based on a sliding operation. This application does not make a restrictive description of the user interface for displaying the list and the specific content of the list.

[0311] For example, Figure 6b A schematic diagram of an operation of a user sliding a list is shown.

[0312] See also Figure 6b The aforementioned list may be a list of short messages displayed on the short message interface of the short message application 201 .

[0313] Specifically, the mobile phone 100 displays the SMS interface 620, and the user's sliding operation on the list may be an upward sliding operation of the user on the SMS list displayed on the SMS interface 620. The aforementioned SMS list may include one or more SMS messages from the same sender received by the mobile phone 100. For example, it may include Figure 6b Receive text messages with the time of "17:30", "19:30", "21:30" and "23:30".

[0314] Before the view framework process receives the user's upward sliding operation on the SMS interface 620, the SMS interface 620 displays a list image 620a. The list image 620a includes three SMS messages received at "17:30", "19:30", and "21:30". After the view framework process receives the user's upward sliding operation on the SMS interface 620, and the upward sliding operation lasts for a period of time (for example, 0.3 seconds), the SMS interface 620 displays a list image 620b. The list image 620b includes two SMS messages received at "21:30" and "23:30".

[0315] Here, the present application does not make any restrictive description on the specific contents of the list image 620a and the list image 620b, and the time interval required for the list image 620a to change to the list image 620b.

[0316] It can be understood that in the process of the list image displayed on the SMS interface 620 changing from the list image 620a to the list image 620b, the upward sliding operation received by the view frame process is always in a continuous state. The upward sliding operation being in a continuous state may correspond to the state in which the mobile phone 100 detects that the user's finger has not left the display screen, or corresponds to the state in which the mobile phone 100 detects that the user's finger has left the display screen for less than a preset time threshold (for example, 0.5 seconds), and / or corresponds to the state in which the mobile phone 100 detects that the speed of the user sliding the display screen is greater than a preset speed threshold (for example, 5 cm / second).

[0317] It can be understood that the subject implementing the aforementioned upward sliding operation is the user's finger is only an example. In other examples, the subject implementing the aforementioned upward sliding operation can also include human body parts such as the user's palm, a stylus, a touch screen glove and any other conductive media, the aforementioned human body parts or conductive media suspended above the touch screen, etc.

[0318] 601: The view framework 203d calculates the position of the view on the screen.

[0319] For example, the view framework process can calculate the position of the view in the screen according to the sliding speed. Specifically, the view framework process can calculate which part of the short message list should be displayed in the short message interface 620 according to the speed at which the user slides the screen upward. For example, the view framework process can calculate the part corresponding to the list image 620b in the short message list that should be displayed.

[0320] 602: The view frame 203d draws the frame.

[0321] Exemplarily, the view framework process may draw frames according to the calculation result of the aforementioned step 601. This is equivalent to determining and drawing a frame of list image to be displayed according to the calculation result of the aforementioned step 601.

[0322] 603: The view framework 203d submits the transaction to the layer composition engine 206a.

[0323] Exemplarily, after the view framework process finishes drawing a frame list image, it can submit a transaction including display parameters of the frame list image to the layer synthesis process.

[0324] Here, the display parameters of a frame list image drawn by the view framework process can be collected in the transaction corresponding to the frame list image. Then, the view framework process submits the transaction corresponding to the frame to the layer synthesis process, so that the layer synthesis process can determine the display mode of the frame list image. The specific content of the display parameters can be found in the specific description of the aforementioned step 519, which will not be repeated here.

[0325] 604: The layer composition engine 206a reaches a refresh cycle.

[0326] Exemplarily, the layer synthesis process may determine that the refresh cycle has arrived when a refresh cycle signal (eg, a vsync signal) is received based on an onVsync() function.

[0327] 605: The layer synthesis engine 206a synthesizes the frame.

[0328] Here, the synthesized frame may be a frame of a list image to be displayed. For example, the specific content of the synthesized frame in the layer synthesis process can refer to the specific description in the aforementioned step 521, which will not be repeated here.

[0329] 606: The layer synthesis engine 206a sends the display to the display driver 207 for display.

[0330] Exemplarily, the specific content of the layer synthesis process sending the display driver 207 for display can be found in the specific description of the aforementioned step 522, which will not be repeated here.

[0331] 607: The display driver 207 displays the frame.

[0332] Here, the frame displayed by the display driver 207 may be the aforementioned list image. For example, the specific content of the frame displayed by the display driver 207 may refer to the specific description in the aforementioned step 523, which will not be described in detail here.

[0333] 608: The layer composition engine 206a notifies the binder driver 208 to release the image buffer.

[0334] Exemplarily, when the displayed list needs to be refreshed, the layer synthesis process may notify the view framework process to release the image buffer so as to synthesize the next frame of list images based on the released image buffer.

[0335] At this time, the layer synthesis process sends a notification of releasing the image buffer to the view framework process, and can first send a notification of releasing the image buffer to the binder driver 208. Here, the notification of releasing the image buffer can be implemented based on the releaseBufferCallback() function.

[0336] Specifically, the layer synthesis process can be based on the aforementioned Figure 4 Step 400 in the illustrated flow sends a notification of releasing the image buffer to the binder driver 208. At this time, releasing the image buffer can be used as an example of the aforementioned first asynchronous task, the layer synthesis process can be used as an example of the aforementioned client process, and the view framework process can be used as an example of the aforementioned service process.

[0337] 609: The binder driver 208 determines that releasing the image buffer is a critical asynchronous task.

[0338] Exemplarily, the binder driver 208 may determine that releasing the image buffer is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0339] Here, releasing the image buffer may be an asynchronous task between processes that occurs frequently in the sliding list scenario. In addition, if the view framework process takes too long to execute the asynchronous task with a higher priority than releasing the image buffer, the image buffer will not be released. As a result, the layer synthesis process may not be able to synthesize the next frame based on the released image buffer, causing problems such as freezes and frame drops during the sliding list process.

[0340] Therefore, the mobile phone 100 may determine releasing the image buffer as a key asynchronous task in the sliding list scenario.

[0341] 610: The binder driver 208 reduces the time required to release the image buffer.

[0342] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that there is no binder thread in the view framework process that can release the image buffer, the binder driver 208 can reduce the time required to release the image buffer based on the aforementioned steps 403 to 407, so that the view framework process can release the image buffer faster.

[0343] 611: The binder driver 208 notifies the view framework 203d to release the image buffer.

[0344] Exemplarily, the binder driver 208 notifies the view framework process to release the image buffer, which may include the binder driver 208 based on the aforementioned Figure 4 Step 408 in the illustrated flow sends a notification of releasing the image buffer to the view framework process.

[0345] Here, the binder driver 208 may send a notification of releasing the image buffer to the view framework process based on the onTransact() function.

[0346] 612: The view framework 203d releases the image buffer.

[0347] Exemplarily, after receiving the notification of releasing the image buffer, the view framework process may release the image buffer based on the aforementioned step 409 .

[0348] Here, based on the aforementioned steps 610 to 612, the view frame process can be accelerated to release the image buffer. Further, when the next frame of the list image in the process of the user sliding the list needs to be displayed, the layer synthesis process can timely synthesize the next frame of the list image according to the released image buffer. Therefore, it can avoid the problems of freeze, frame drop, etc. caused by the image buffer not being released when the next frame of the list image needs to be displayed.

[0349] It can be understood that after the view framework process completes the release of the image buffer, it can restore the priority of the binder thread based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0350] It can be understood that based on the above steps 600 to 611, the above Figure 6b In the sliding process shown, the mobile phone 100 can smoothly display the process of the SMS list sliding upward, improving the user's visual experience during the sliding SMS list process. For example, the SMS interface 620 can smoothly display the sliding process from the list image 620a to the list image 620b.

[0351] In addition, it can be understood that during a user's sliding list display process, the layer synthesis process can receive multiple refresh cycle signals (for example, vsync signals). Equivalently, the aforementioned steps 601 to 611 can be executed multiple times. The specific number of executions can be determined according to factors such as the user's sliding speed, sliding time, and refresh cycle.

[0352] In an embodiment of the present application, the scene of the electronic device display screen may include a scene of playing a video.

[0353] This embodiment will illustrate the specific process of applying the process scheduling method provided in the embodiment of the present application in the scenario of playing a video in conjunction with the accompanying drawings.

[0354] Figure 7a A flow chart showing a method for reducing the time required for a service process to execute key asynchronous tasks in a video playback scenario based on a process scheduling method provided in an embodiment of the present application.

[0355] See also Figure 7a , the process of accelerating the execution of key asynchronous tasks in the video playback scenario can include the following steps:

[0356] 700: The video player 202 receives a video play operation from the user.

[0357] Here, the process of the video player 202 (hereinafter referred to as "video playback process") can receive the user's video playback operation. The video player 202 can be a system application, a third-party application, a small program, etc. with a video playback function. This application does not make a restrictive description on the specific content of the video player 202.

[0358] Figure 7b A schematic diagram of a video playback operation is shown.

[0359] See also Figure 7b , the mobile phone 100 displays a video interface 720 , and the user's video playing operation may include the user clicking an operation on a play button 720 a in the video interface 720 .

[0360] Before the video playing process receives the user's click operation on the play button 720a, the video interface 720 displays the video image 720b. After the video playing process receives the user's click operation on the play button 720a and a period of time (e.g., 5 seconds) has passed, the video interface 720 displays the video image 720c. Here, this application does not make a restrictive description of the specific content of the video image 720b and the video image 720c, and the time interval required for playing from the video image 720b to the video image 720c.

[0361] Here, the video playback process can determine whether the video should be played according to the state value of the play button 720a after being clicked. For example, before the user clicks the play button 720a, the state value of the play button 720a is "0", and after the user clicks the play button 720a, the state value of the play button 720a changes to "1", and the video playback process can determine that the video should be played. Here, different state values ​​of the play button 720a will correspond to different display forms. Correspondingly, after the user clicks the play button 720a, the display form of the play button 720a will change. For details, see Figure 7b Here, this application does not make any restrictive description on the display form and changes of the play button 720a.

[0362] 701: The video player 202 notifies the media codec 203c to decode.

[0363] Exemplarily, after the video playback process determines that a video playback operation should be performed, the process of the media codec 203 c (hereinafter referred to as “media codec process”) may be notified to perform a decoding operation on the video stream.

[0364] 702: The media codec 203c decodes a frame of image.

[0365] Here, the decoded frame of image may include a video image for display, such as the aforementioned video image 720b and video image 720c, etc. Exemplarily, the media encoding and decoding process may decode the video stream frame by frame to decode each frame of the video image.

[0366] 703: The media codec 203c fills the image buffer.

[0367] Exemplarily, after decoding a frame of video image, the media encoding and decoding process may fill the frame of video image into the image buffer.

[0368] 704: The media codec 203c submits the transaction to the layer composition engine 206a.

[0369] Exemplarily, after the media encoding and decoding process finishes filling the image buffer, it can hand over the transaction to the layer composition process.

[0370] Here, the display parameters of a frame of video image filled into the image buffer by the media codec process can be collected in the transaction corresponding to the frame. Then, the media codec process submits the transaction corresponding to the frame to the layer synthesis process, so that the layer synthesis process can determine the display mode of the frame. The specific content of the display parameters can refer to the specific description in the aforementioned step 519, which will not be repeated here.

[0371] 705: The layer composition engine 206a reaches a refresh cycle.

[0372] Exemplarily, the layer synthesis process may determine that the refresh cycle has arrived when a refresh cycle signal (eg, a vsync signal) is received based on an onVsync() function.

[0373] 706: The layer synthesis engine 206a synthesizes the frame.

[0374] Here, the synthesized frame may be the aforementioned video image. For example, the specific content of the synthesized frame in the layer synthesis process may refer to the specific description in the aforementioned step 521, which will not be described in detail here.

[0375] 707: The layer synthesis engine 206a sends the display to the display driver 207 for display.

[0376] Exemplarily, the specific content of the layer synthesis process sending the display driver 207 for display can be found in the specific description of the aforementioned step 522, which will not be repeated here.

[0377] 708: The display driver 207 displays the frame.

[0378] Here, the frame displayed by the display driver 207 may be the aforementioned video image. For example, the specific content of the frame displayed by the display driver 207 may refer to the specific description in the aforementioned step 523, which will not be described in detail here.

[0379] 709: The layer composition engine 206a notifies the binder driver 208 to release the image buffer.

[0380] Exemplarily, when the next frame of video image is needed, the layer synthesis process may notify the video playback process to release the image buffer so as to synthesize the next frame of video image based on the released image buffer.

[0381] At this time, the layer synthesis process sends a notification of releasing the image buffer to the video playback process, and can first send a notification of releasing the image buffer to the binder driver 208. Here, the notification of releasing the image buffer can be implemented based on the releaseBufferCallback() function.

[0382] Specifically, the layer synthesis process can be based on the aforementioned Figure 4 Step 400 in the illustrated flow sends a notification of releasing the image buffer to the binder driver 208. At this time, releasing the image buffer can be used as an example of the aforementioned first asynchronous task, the layer synthesis process can be used as an example of the aforementioned client process, and the video playback process can be used as an example of the aforementioned service process.

[0383] 710: The binder driver 208 determines that releasing the image buffer is a critical asynchronous task.

[0384] Exemplarily, the binder driver 208 may determine that releasing the image buffer is a key asynchronous task based on the aforementioned step 401 . The specific process may refer to the detailed description of step 401 , which will not be described in detail here.

[0385] Here, releasing the image buffer may be an asynchronous task between processes that occurs frequently in the video playback scene. In addition, if the video playback process takes too long to execute the asynchronous task with a higher priority than releasing the image buffer, the image buffer will not be released. As a result, the layer synthesis process may not be able to synthesize the next frame of video based on the released image buffer, resulting in problems such as freezes and frame drops during video playback.

[0386] Therefore, the mobile phone 100 may determine releasing the image buffer as a key asynchronous task in the video playback scenario.

[0387] 711: The binder driver 208 reduces the time required to release the image buffer.

[0388] Exemplarily, if the binder driver 208 determines based on the aforementioned step 402 that there is no binder thread in the video playback process that can release the image buffer, the binder driver 208 can reduce the time required to release the image buffer based on the aforementioned steps 403 to 407, so that the video playback process can release the image buffer faster.

[0389] 712: The binder driver 208 notifies the video player 202 to release the image buffer.

[0390] For example, the binder driver 208 notifies the video playback process to release the image buffer, which may be based on the aforementioned Figure 4 Step 408 in the illustrated flow sends a notification of releasing the image buffer to the video playback process.

[0391] Here, the binder driver 208 may send a notification of releasing the image buffer to the video playback process based on the onTransact() function.

[0392] 713: The video player 202 releases the image buffer.

[0393] Exemplarily, after receiving the notification of releasing the image buffer, the video playback process may release the image buffer based on the aforementioned step 409 .

[0394] Here, based on the aforementioned steps 710 to 712, the video playback process can be accelerated to release the image buffer. Further, when the next frame of video image needs to be displayed, the layer synthesis process can timely synthesize the next frame according to the released image buffer. Therefore, when the next frame of video image needs to be displayed, problems such as freeze and frame drop caused by the image buffer not being released can be avoided.

[0395] It can be understood that based on the above steps 700 to 713, the above Figure 7b During the video playback process shown, the mobile phone 100 can play the video smoothly, improving the user's visual experience during the video viewing process. For example, the video interface 800 can smoothly display the video playback process from video image 720b to video image 720c.

[0396] It can be understood that after the video playback process completes the release of the image buffer, the priority of the binder thread can be restored based on the aforementioned steps 410 to 411. The specific content can be found in the detailed description of the aforementioned steps 410 to 411, which will not be repeated here.

[0397] In addition, it can be understood that during a video playback process, the layer synthesis process can receive multiple refresh cycle signals (for example, vsync signals). Equivalently, the aforementioned steps 701 to 713 can be executed multiple times. The specific number of executions can be determined according to factors such as the refresh cycle.

[0398] Figure 8 The electronic device according to the embodiment is shown in FIG.

[0399] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0400] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

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

[0402] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

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

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

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

[0406] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 can be one or more devices integrating at least one communication processing module 206b. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0407] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The above wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The above GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).

[0408] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

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

[0410] Video codecs are used to compress or decompress digital videos. Electronic devices can support one or more video codecs. In this way, electronic devices can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

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

[0412] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device can also calculate the touch position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0413] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device, which is different from the position of the display screen 194.

[0414] The embodiments of the present application also provide a computer program product for implementing the process scheduling methods provided in the above embodiments.

[0415] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program module or module code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.

[0416] A computer program module or module code may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0417] Module code can be implemented with high-level modular language or object-oriented programming language to communicate with the processing system. When necessary, module code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0418] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to a floppy disk, an optical disk, an optical disk, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic card or an optical card, a flash memory, or a tangible machine-readable memory for transmitting information (e.g., a carrier wave, an infrared signal, a digital signal, etc.) using the Internet in an electrical, optical, acoustic, or other form of propagation signal. Accordingly, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).

[0419] References to "one embodiment" or "an embodiment" in the specification mean that the specific features, structures, or characteristics described in conjunction with the embodiment are included in at least one exemplary implementation or technology disclosed according to the embodiment of the present application. The appearance of the phrase "in one embodiment" in various places in the specification does not necessarily all refer to the same embodiment.

[0420] The disclosure of the embodiments of the present application also relates to an operating device for executing the text. The device can be constructed specifically for the required purpose or it can include a general-purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program can be stored in a computer-readable medium, such as, but not limited to, any type of disk, including a floppy disk, an optical disk, a CD-ROM, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an EPROM, an EEPROM, a magnetic or optical card, an application-specific integrated circuit (ASIC), or any type of medium suitable for storing electronic instructions, and each can be coupled to a computer system bus. In addition, the computer mentioned in the specification may include a single processor or may be an architecture involving multiple processors for increased computing power.

[0421] In addition, the language used in this specification has been primarily selected for readability and instructional purposes and may not be selected to describe or limit the disclosed subject matter. Therefore, the present application embodiment disclosure is intended to illustrate rather than limit the scope of the concepts discussed herein.

Claims

1. A process scheduling method, applied to electronic equipment, characterized in that: include: It is detected that a first asynchronous task sent by the first process to the second process meets an adjustment condition; By adjusting the priority of at least one asynchronous task executed by the second process, the execution time of the second process executing the first asynchronous task is reduced, wherein: The at least one asynchronous task includes one or more unexecuted third asynchronous tasks received by the second process before the first asynchronous task; The third asynchronous tasks are stored in a first queue corresponding to the second process, and each of the third asynchronous tasks has a corresponding fifth priority in the first queue. The reducing the execution time of the second process to execute the first asynchronous task includes: reducing the fifth priority level corresponding to at least one third asynchronous task among the one or more third asynchronous tasks to a sixth priority level; The step of reducing the fifth priority level corresponding to at least one of the one or more third asynchronous tasks to the sixth priority level includes: Corresponding to the at least one third asynchronous task not satisfying the adjustment condition, the first asynchronous task is added before the at least one third asynchronous task to reduce the priority corresponding to the at least one third asynchronous task.

2. The process scheduling method according to claim 1, characterized in that: The at least one asynchronous task also includes: at least one of the first asynchronous task and the second asynchronous task currently executed by the second process.

3. The process scheduling method according to claim 2, characterized in that: The reducing the execution time of the second process to execute the first asynchronous task includes: Corresponding to the at least one asynchronous task including the first asynchronous task, determining a first thread in the second process for executing the first asynchronous task; The first priority level corresponding to the first thread is increased to a second priority level.

4. The process scheduling method according to claim 3, characterized in that: The step of increasing the first priority level corresponding to the first thread to a second priority level includes: The scheduling policy corresponding to the first thread is adjusted to a real-time scheduling policy, wherein the real-time scheduling policy corresponds to the second priority.

5. The process scheduling method according to claim 3, characterized in that: After the first asynchronous task is executed, the method further includes: The second priority level corresponding to the first thread is restored to the first priority level.

6. The process scheduling method according to claim 2 or 3, characterized in that: The reducing the execution time of the second process to execute the first asynchronous task includes: Corresponding to the at least one asynchronous task including the second asynchronous task, determining a second thread in the second process for executing the second asynchronous task; The third priority level corresponding to the second thread is increased to a fourth priority level.

7. The process scheduling method according to claim 6, characterized in that: The step of increasing the third priority level corresponding to the second thread to a fourth priority level includes: The scheduling policy corresponding to the second thread is adjusted to a real-time scheduling policy, wherein the real-time scheduling policy corresponds to the fourth priority.

8. The process scheduling method according to claim 6, characterized in that: After the second asynchronous task is executed, the method further includes: The fourth priority level corresponding to the second thread is restored to the third priority level.

9. The process scheduling method according to claim 1, characterized in that: The step of reducing the fifth priority level corresponding to at least one third asynchronous task among the one or more third asynchronous tasks to a sixth priority level includes: The first asynchronous task is added to the head of the first queue to reduce the priority corresponding to each of the third asynchronous tasks.

10. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device executes the process scheduling method described in any one of claims 1 to 9.

11. A computer readable medium, characterized in that The readable medium stores instructions, which, when executed on a computer, enable the computer to execute the process scheduling method according to any one of claims 1 to 9.

12. A computer program product, characterized in that It comprises a computer program / instruction, which implements the process scheduling method according to any one of claims 1 to 9 when executed by a processor.

Citation Information

Patent Citations

  • Resource scheduling method and related equipment

    CN116048771A