Scheduling methods, storage media, electronic devices and program products

By dynamically adjusting the trigger interval of the beat event, the problem of increased power consumption and interface lag caused by fixed time intervals is solved, and the energy consumption control and interface smoothness of electronic devices are optimized in a coordinated manner.

CN122309077APending Publication Date: 2026-06-30ASR MICROELECTRONICS CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ASR MICROELECTRONICS CO LTD
Filing Date
2026-04-02
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In the prior art, electronic devices continuously trigger beat events (TE) at fixed time intervals, which increases power consumption and makes it impossible to dynamically adjust the trigger frequency according to the active state of the animation or input events, affecting the smoothness of the interface and the user interaction experience.

Method used

By detecting the system status of electronic devices, the trigger interval of the tick event is dynamically adjusted, including setting it to the minimum value when there are pending messages in high-priority events or active JavaScript applications, and extending the trigger interval to reduce meaningless triggers when there are no high-priority events, thus realizing the dynamic and intelligent scheduling of TE.

Benefits of technology

It reduces the energy consumption of electronic devices, improves interface smoothness and user interaction experience, and ensures the coordinated optimization of system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309077A_ABST
    Figure CN122309077A_ABST
Patent Text Reader

Abstract

This application provides a scheduling method applied to an electronic device. The method includes: detecting a tick event triggered by the electronic device; setting the trigger interval of the tick event to a first threshold when a first event occurs; setting the trigger interval of the tick event to a second threshold when the message queue count is greater than 0; and setting the trigger interval of the tick event to the minimum of the first and second recent task expiration times in the first and second managers when the electronic device does not experience the first event or the message queue count is equal to 0. In this way, the electronic device can obtain the expiration time of a first recent task from a first manager and the expiration time of a second recent task from a second manager, and set the trigger interval of the tick event to the minimum of the first and second recent task expiration times. This avoids the limitations of a fixed trigger interval, achieves adaptive control of the tick event triggering frequency, reduces meaningless triggering of tick events, and lowers the energy consumption of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of embedded systems technology, specifically to a scheduling method, storage medium, electronic device, and program product. Background Technology

[0002] Tick ​​events (TEs) are a fundamental mechanism in electronic devices for implementing timing synchronization, task scheduling, and timed control. Typically, electronic devices trigger TEs continuously at fixed time intervals. However, in some scenarios, such as when the electronic device has no high-priority events, no pending JavaScript messages, animations, or when the expiration time of microcontroller unit (MCU) tasks is far off, triggering TEs continuously at fixed time intervals increases the power consumption of the electronic device. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a scheduling method, a storage medium, an electronic device, and a program product.

[0004] In a first aspect, the present invention provides a scheduling method applied to an electronic device. The method includes: detecting that the electronic device triggers a tick event; obtaining a first event flag; determining whether the electronic device has experienced a first event based on the first event flag; if the electronic device has experienced a first event, setting the trigger interval of the tick event to a first threshold; obtaining a message queue count of a first application; if the message queue count is greater than 0, setting the trigger interval of the tick event to a second threshold; if the electronic device has not experienced a first event or the message queue count is equal to 0, obtaining the expiration time of a first most recent task in a first manager and the expiration time of a second most recent task in a second manager of the electronic device, and setting the trigger interval of the tick event to the minimum value of the expiration time of the first most recent task and the expiration time of the second most recent task.

[0005] In one possible implementation of the first aspect above, detecting that an electronic device triggers a beat event includes: acquiring the system state of the electronic device, the system state including at least one of the following: input device state, animation activity state, asynchronous task queue state, microcontroller unit task state, and message queue state of the first application; and triggering a beat event when at least one system state satisfies a first condition.

[0006] In one possible implementation of the first aspect described above, triggering a beat event when at least one system state satisfies the first condition includes: determining whether an input event has occurred based on the input device state, and triggering a beat event if an input event has occurred; and / or, acquiring at least one active animation from the animation list, obtaining the expiration time of the next frame of the animation based on the runtime of the previous frame of the animation and the frame interval parameter, and triggering a beat event based on the expiration time of the next frame of the animation; and / or, triggering a beat event if the second manager contains the first task; and / or, triggering a beat event if the third manager contains the second task; and / or, acquiring the message queue count of the first application, and triggering a beat event if the message queue count is greater than 0; and / or, triggering a beat event if the interface of the electronic device contains a control or area to be rendered.

[0007] In one possible implementation of the first aspect above, triggering a beat event upon the occurrence of an input event includes: reducing the frequency of triggering the beat event after the input event has ended.

[0008] In one possible implementation of the first aspect above, the execution time of the previous frame of the animation and the frame interval parameter are used to obtain the expiration time of the next frame of the animation, including: different frame interval parameters for different animations.

[0009] In one possible implementation of the first aspect above, a beat event is triggered based on the expiration time of the next frame of the animation, including: when the current time of the electronic device reaches the expiration time of the next frame of the animation, or when the time interval of the current frame of the animation is greater than the frame interval parameter, executing the Run() operation and recalculating the expiration time of the next frame of the animation.

[0010] In one possible implementation of the first aspect above, the method further includes: setting a default task cycle, wherein the time interval between two consecutive triggering of a beat event is not less than the default task cycle.

[0011] In one possible implementation of the first aspect above, the method further includes: triggering a beat event when an electronic device adds an animation task, and setting the expiration time of the next frame of the animation to 0.

[0012] In one possible implementation of the first aspect above, the method further includes: the electronic device acquiring a second event and / or a first event in a blocking manner, the second event being associated with a flag of the first event; and triggering a beat event based on the second event and / or the first event.

[0013] In a second aspect, embodiments of the present invention provide a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement any of the scheduling methods provided by the first aspect and various possible implementations of the first aspect.

[0014] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising: a memory for storing instructions executed by one or more processors of the electronic device; and a processor, one of the processors of the electronic device, for executing the instructions stored in the memory to implement any scheduling method provided by the first aspect and various possible implementations of the first aspect.

[0015] Fourthly, embodiments of the present invention provide a program product including instructions that, when executed by an electronic device, enable the electronic device to implement any scheduling method provided by the first aspect and various possible implementations of the first aspect.

[0016] Compared with the prior art, the embodiments of this application have the following advantages: The TE scheduling method of this invention achieves adaptive adjustment of the TE triggering frequency by acquiring the real-time system status. Specifically, when a high-priority event or active JavaScript application with pending messages is detected, the TE triggering interval is set to the minimum value to trigger TEs at a high frequency, thereby ensuring timely response to user input events, animation frame updates, etc., and guaranteeing system performance and interface smoothness. When the electronic device has no high-priority events, no pending JavaScript messages, and the due time of animations or MCU tasks is far away, the TE triggering interval is extended to reduce meaningless TE triggering and lower the energy consumption of the electronic device. The TE scheduling method of this invention avoids the limitations of fixed triggering intervals, realizing dynamic and intelligent TE scheduling, and achieving synergistic optimization of system performance, interface smoothness, and energy consumption control of electronic devices. Attached Figure Description

[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0018] Figure 1 This is a flowchart of a scheduling method according to an embodiment of this application; Figure 2 This is a flowchart of another scheduling method according to an embodiment of this application; Figure 3This is a structural diagram of an electronic device 10 according to an embodiment of this application. Detailed Implementation

[0019] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It should be noted that the following description covers various aspects of embodiments within the scope of the appended claims. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this application, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.

[0021] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0022] Additionally, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that practice can be carried out without these specific details.

[0023] As mentioned earlier, in embedded systems, timing response (TE) is the fundamental mechanism for implementing functions such as timing synchronization, task scheduling, and timing control. Specifically, the system clock source generates a reference clock signal, which is then divided and input to a counter. The counter then increments pulse by pulse based on the clock pulses in the reference clock signal. When the counter's count reaches a preset threshold, the hardware circuit automatically generates a TE signal to trigger the TE. The counter then automatically resets to zero and restarts counting. Thus, the electronic device can trigger the TE continuously and cyclically at fixed time intervals.

[0024] It is understandable that the reference clock signal is a continuous clock waveform, and the clock pulse is a single transition in the reference clock signal.

[0025] For example, an electronic device running a lightweight operating system (LiteOS, as an example of an embedded system) triggers a TE signal at fixed time intervals to drive the orderly execution of tasks such as interface refresh or animation update. Specifically, the electronic device calls DispatchTEMessage() through the UI main task (UiMain) to generate a TE signal at fixed time intervals. JsAppHost or the user interface (UI) receives the TE signal. Then, the electronic device calls TaskHandler() and iterates through the managers in the TaskList (such as AnimatorManager, RenderManager, InputDeviceManager, AsyncTaskManager, MCUTaskManager, etc.) to perform tasks such as animation calculation, interface rendering, and user operation response, ultimately executing tasks such as interface refresh or animation update.

[0026] However, when the electronic device's interface displays complex animations, or when the user interacts with the electronic device frequently, the electronic device triggers TE at fixed time intervals, revealing its inadequacy, as detailed below: First, if the electronic device still triggers TE at a high frequency when the interface of the electronic device is static or without animation, this causes the processor (central processing unit, CPU) of the electronic device to run frequently, increasing the power consumption of the electronic device and reducing battery life.

[0027] Secondly, when the TE trigger frequency is low and the first frame of the animation is displayed instantly, subsequent frames of the animation need to wait for the next TE to be triggered before they can be refreshed, which causes obvious stuttering or delay in the animation.

[0028] Third, by triggering TE at fixed time intervals, electronic devices cannot dynamically adjust the interface refresh rate based on user actions. When a user taps the touchscreen, presses a button, or rotates a knob, if the electronic device cannot promptly adjust to a higher frequency for TE triggering, the interface response will lag, affecting the user's interactive experience.

[0029] Fourth, the existing mechanism for triggering TE in electronic devices cannot dynamically switch the frequency of triggering TE based on the active state of the animation or the input events of the electronic device, and cannot reduce the power consumption of the electronic device while ensuring the smoothness of the animation.

[0030] Therefore, there is an urgent need for a dynamically scheduled TE mechanism that can dynamically adjust the frequency of TE triggering based on the input device status, animation activity status, or system operating mode (such as static, low power consumption, etc.) to improve the smoothness of interface animation, reduce the power consumption of electronic devices, and enhance the user's interactive experience.

[0031] Based on this, embodiments of this application provide a scheduling method applied to an electronic device. The scheduling method includes: when a tick event is detected on the electronic device, the electronic device can acquire a first event flag (e.g., a UI event flag), determine whether a first event (e.g., a high-priority event) has occurred based on the first event flag, and if the first event has occurred, set the trigger interval of the tick event to a first threshold. The electronic device can also acquire a message queue count of a first application (e.g., a JavaScript application), and if the message queue count is greater than 0, set the trigger interval of the tick event to a second threshold; if the first event has not occurred or the message queue count is equal to 0, the electronic device can acquire the first recent task expiration time of a first manager (e.g., AnimatorManager) and the second recent task expiration time of a second manager (e.g., MCUTaskManager), and set the trigger interval of the tick event to the minimum of the first and second recent task expiration times.

[0032] In some embodiments, the electronic device can acquire the system state of the electronic device, which includes at least one of the following: input device state, animation activity state, asynchronous task queue state, microcontroller unit task state, and message queue state of the first application; and trigger a tick event when at least one system state satisfies a first condition.

[0033] For example, triggering a beat event when at least one system state satisfies a first condition includes: determining whether an input event has occurred based on the input device state, and triggering a beat event if an input event has occurred; and / or, obtaining at least one active animation from the animation list, obtaining the expiration time of the next frame of the animation based on the runtime of the previous frame of the animation and the frame interval parameter, and triggering a beat event based on the expiration time of the next frame of the animation; and / or, triggering a beat event if the second manager contains a first task; and / or, triggering a beat event if the third manager contains a second task; and / or, obtaining the message queue count of the first application, and triggering a beat event if the message queue count is greater than 0; and / or, triggering a beat event if the interface of the electronic device contains a control or area to be rendered.

[0034] Figure 1 According to some embodiments of this application, a flowchart of a scheduling method is shown. It can be understood that... Figure 1 The processes shown are all executed by electronic devices. For simplicity, the following description... Figure 1 The execution entity will not be described again in the process shown. For example... Figure 1 As shown, including but not limited to the following processes: S101, detects the system status of electronic equipment.

[0035] In some embodiments, the electronic device can trigger TE at preset fixed time intervals (e.g., 16ms, 32ms). Within each tick cycle, the electronic device can detect the input device status, animation activity status, asynchronous task queue status, MCU task status, and message queue status of the first application (e.g., a JavaScript application).

[0036] It can be understood that the input device status refers to the real-time operating status of the input device (such as touch screen, physical button, gyroscope, heart rate sensor, etc.), including whether an input event is generated (such as touch press, button trigger, device shaking), the type of input event, the coordinates of the input event, the duration of the input event, and whether the input device is in an abnormal state (such as touch failure, button jamming), etc.

[0037] It is understandable that the animation activity status refers to whether the animation is in an active state (e.g., the animation is playing), a paused state, whether the current playback progress, remaining duration, and frame rate meet the standards, and whether there are animation tasks to be started or terminated.

[0038] As can be understood, asynchronous tasks refer to tasks such as network data requests, local file reading and writing, data parsing, and low-priority computation tasks. The status of the asynchronous task queue includes whether the queue is empty, the number of tasks to be executed, the task priority order, and whether the task is in a waiting (or executing, or failed) state.

[0039] As can be understood, an MCU task refers to a task running on an MCU, such as hardware driver scheduling, sensor data sampling, low-power execution, and peripheral status detection. MCU task status includes the preset execution time, the MCU task expiration time, the current remaining time, whether the expected execution time has arrived, and whether it has timed out. The MCU task expiration time refers to the preset deadline for execution of a timed task within the MCU.

[0040] It is understandable that the messages that JavaScript applications interact with the underlying system (or other modules of electronic devices) include UI update instructions, user operation callbacks, data transmission notifications, etc. The status of the JavaScript application message queue includes whether there are unprocessed messages in the queue, message queue count, message priority, whether the message has timed out, whether the queue is blocked, etc.

[0041] In some embodiments, the electronic device can determine whether a high-priority event (as an example of a first event) exists based on the system state.

[0042] For example, touch operations, animation refreshes, or soon-to-expire MCU tasks are events with high real-time requirements, directly affecting user interaction response speed, interface smoothness, and hardware timing reliability. If electronic devices do not process these events in a timely manner, they may experience operation delays, screen stuttering, or hardware malfunctions, impacting the user experience. Therefore, electronic devices can set touch operations, animation refreshes, and soon-to-expire MCU tasks as high-priority events.

[0043] For example, since electronic devices can delay the processing of events such as asynchronous tasks and JavaScript application messages without significantly affecting the user's real-time experience or system stability, they can set these events as low-priority events.

[0044] It is understandable that electronic devices can set the priority of events according to the actual situation, and there are no restrictions here.

[0045] S102, trigger TE based on input event.

[0046] It's understandable that electronic devices can detect input events through interrupt signals. Furthermore, electronic devices can continuously trigger TE (Touch Transmission) at high frequency and fixed time intervals to poll and detect the complete user operation process corresponding to the input event (e.g., touch operation includes pressing → swiping → releasing). However, if the electronic device continues to continuously trigger TE at high frequency and fixed time intervals even after the user operation ends, it will significantly increase the power consumption of the electronic device (e.g., low-power embedded devices like smartwatches). Moreover, high-frequency polling consumes CPU resources, leading to a decrease in the overall operating efficiency of the electronic device and further increasing its power consumption.

[0047] Based on this, in some embodiments, after the electronic device detects an input event via an interrupt signal, it can continue executing the UiMain task until the input event is completely finished. For example, when a user presses a touchscreen with their finger, the input device triggers a touch operation via an interrupt signal. However, throughout the entire process of the user's finger holding the press and sliding until it finally leaves the screen, the electronic device cannot determine when the touch operation ends through a single interrupt signal. Therefore, the electronic device can continuously execute the UiMain task and trigger the TE at a fixed high frequency, polling the touch operation status within each TE cycle until the electronic device detects that the finger has left the screen and the touch operation has ended. After the input event ends, the electronic device can promptly reduce the frequency of the TE trigger, stopping the high-frequency TE trigger, to achieve high-precision response while dynamically adjusting the TE trigger frequency, thereby reducing the power consumption of the electronic device.

[0048] It's understandable that the electronic device continuously executes the UiMain task to determine whether the input event has ended. Specifically, if the input event hasn't ended, the electronic device can trigger the TE at a fixed high frequency to ensure timely response and accurate recognition of the input event. If the input event has ended, the electronic device can reduce the frequency of triggering the TE to dynamically adjust the triggering frequency while maintaining high-precision response, thereby reducing the power consumption of the electronic device.

[0049] S103, trigger TE based on the animation activity status.

[0050] Typically, electronic devices continuously trigger TE (Time Transmission) at a fixed high frequency (e.g., 16ms) to refresh animations. If the current animation is paused or there is a long interval between two adjacent frames of the current animation, but the electronic device continues to trigger TE at a fixed high frequency, the animation refresh is ineffective, and the power consumption of the electronic device is high.

[0051] In this application, the electronic device can set a frame interval parameter (represented by frameInterval) for the animation in the AnimatorManager. The electronic device can define the refresh period of the animation through the frame interval parameter. Different animations can be set with different refresh periods according to their own characteristics. For example, the electronic device can set the frame interval parameter of complex interface transition animations to a high-frequency period (e.g., 16ms), while the electronic device can set the frame interval parameter of low-frequency animations such as dial pointers and blinking to a long period (e.g., 500ms or 1000ms). It is understood that the electronic device can set the frame interval parameter according to the actual situation, and there are no restrictions here.

[0052] It is understandable that, based on the above method, electronic devices can adaptively adjust the refresh cycle of different animations in order to reduce the power consumption of electronic devices while ensuring the animation refresh performance.

[0053] Understandably, during the scheduling of animation tasks, the electronic device can first obtain an animation list, which contains all currently active animations. The electronic device can then iterate through the animation list. Furthermore, for each active animation in the list, the electronic device can calculate the expiration time of the next frame. For example, the electronic device can calculate the expiration time of the next frame using the following formula: nextDue = lastRunTime + frameInterval Where nextDue represents the expiration time of the next frame of the animation, lastRunTime represents the running time of the previous frame of the animation, and frameInterval represents the frame interval parameter.

[0054] Understandably, based on the animation's next frame expiration time, the electronic device can determine whether to immediately refresh the animation. If the current time has not yet reached the animation's next frame expiration time, the electronic device can skip the current execution (i.e., not refresh the animation) and update the global nearest task expiration time (represented by nextTillTime). If the current time reaches the animation's next frame expiration time or the time interval between the current frames is greater than the aforementioned frame interval parameter, the electronic device can immediately execute the Run() operation to refresh the animation and recalculate the animation's next frame expiration time to ensure that the animation can be refreshed on time.

[0055] It is understandable that electronic devices can record the next frame expiration time of all animations by updating the global most recent task expiration time, and trigger TE based on the earliest next frame expiration time of all animations.

[0056] In some embodiments, to avoid high-frequency triggering of TE (Time-Off) events, the electronic device can set a protection mechanism based on nextTillTime. For example, the electronic device can set a default task period (DEFAULT_TASK_PERIOD, e.g., 16ms), and the time interval between two consecutive TE triggers is not less than the default task period. In this way, the electronic device can extend the time interval between TE triggers when animation tasks are sparse or stopped, thereby reducing the power consumption of the electronic device.

[0057] In some embodiments, if the animation does not have a frameInterval set, the electronic device can set the period_ value in the AnimatorManager (e.g., 16ms) to trigger the TE at the end of the next frame of the animation. In this way, the electronic device can control the refresh of animations without a frameInterval set, while also ensuring that the electronic device can control the animation refresh by customizing the frame interval parameter, thus being compatible with animations with different parameter settings.

[0058] In some embodiments, when an electronic device adds a new animation task, if the electronic device triggers a Time Execution (TE) based on nextTillTime, the first frame of the new animation task may be dropped or delayed. For example, if the electronic device triggers the TE after 16ms based on nextTillTime, the new animation task will start refreshing 16ms later, resulting in a dropped first frame.

[0059] Based on this, electronic devices can trigger the TE immediately when adding an animation task by calling AnimatorManager::Add(), and set nextTillTime to zero to ensure that the newly added animation task can start refreshing immediately.

[0060] In some embodiments, when the electronic device starts executing a new animation task or the electronic device confirms that it has responded to a new animation task, the electronic device may clear the flag variable that triggered the TE (e.g., set wakeup_flag to false).

[0061] It is understandable that if the electronic device does not clear the flag variable that triggers the TE, the TE will be triggered immediately when the electronic device starts executing a new animation task or when the electronic device confirms that it has responded to the new animation task. Furthermore, if the transition animation or the rendering-related data in the virtual display buffer (VDB) is not yet ready, the electronic device cannot render the first frame of the animation task immediately. The electronic device will start rendering the animation after the time indicated by the frame interval parameter (e.g., 16ms), which will result in animation delay or the first frame being dropped.

[0062] It is understandable that by clearing the flag variable that triggers TE, the electronic device can load the transition animation, add a new animation task, or the animation that needs to be rendered to the VDB after triggering TE, and then render the animation, thereby avoiding the phenomenon of animation delay or first frame loss.

[0063] Understandably, based on the methods described above, electronic devices can dynamically trigger TEs (Time Triggers) based on frame interval parameters. During animation refresh or rendering, when the electronic device is under high load or in rapidly changing scenarios, it can maintain smooth interface refresh. Conversely, when the animation is static or running at low frequency, the electronic device can automatically extend the TE trigger interval to reduce power consumption.

[0064] S104, TE is triggered when the first task exists in the second manager.

[0065] It is understandable that in existing solutions, regardless of whether the MCU task in MCUTaskManager (as an example of the first task) is about to expire, the electronic device will repeatedly trigger TE at fixed time intervals. This results in a large number of invalid TE triggers in the electronic device, which in turn leads to excessive power consumption of the electronic device.

[0066] In this application, when the electronic device has an immediately executable MCU task, the electronic device can trigger a Time Limit Expiration (TE). After triggering the TE, the electronic device can schedule the UiMain main task to execute the MCU task. The electronic device can also trigger a TE if the expiration time of at least one MCU timed task is earlier than the expiration time currently recorded by the electronic device (represented by mcuTaskTime). After triggering the TE, the electronic device can schedule the UiMain main task to execute the MCU task. This avoids the power waste caused by repeatedly triggering the TE, and also coordinates the operation of the electronic device's underlying hardware tasks and interface refresh tasks.

[0067] It is understandable that electronic devices obtain the expiration time mcuTaskTime of MCU tasks through MCUTaskManager.

[0068] S105, TE is triggered when the third manager contains the second task.

[0069] In some embodiments, when an electronic device detects that an AsyncTaskManager (as an example of a third manager) has added an asynchronous task (as an example of a second task), the electronic device can immediately trigger a TE (Execution Timeout) to enable the electronic device to execute the newly added asynchronous task in a timely manner. Based on this, whether it is the asynchronous processing logic at the system's underlying level or the delayed task at the JavaScript application layer, the electronic device can execute the newly added asynchronous task in a timely manner, thereby completing the task as expected, thus improving the timeliness of task scheduling and the responsiveness of the electronic device.

[0070] S106, obtain the message queue count of the first application, and trigger TE if the message queue count is greater than 0.

[0071] In some embodiments, the electronic device can obtain the message queue count (represented by msgCnt) of the currently active JavaScript application (as an example of a first application). These JavaScript application messages include, but are not limited to, interactive messages such as onActive messages and page transition messages. If msgCnt is greater than 0, the JavaScript application has unprocessed JavaScript application messages, and the electronic device can trigger a TE (Transaction Execution). If msgCnt is equal to 0, the JavaScript application has no unprocessed JavaScript application messages, and the electronic device stops triggering the TE.

[0072] The above method ensures that the electronic device can process JavaScript application messages in a timely manner, while reducing invalid TE triggers. This guarantees the real-time processing of JavaScript application messages, improves the system scheduling efficiency of the electronic device, and reduces its power consumption. In some embodiments, the above method can also ensure that JavaScript application message processing and JavaScript application interface refresh remain synchronized.

[0073] S107, TE is triggered when the interface of the electronic device contains a control or area to be rendered.

[0074] In some embodiments, the electronic device can use `UI_View::Invalidate` to determine whether the interface contains controls or areas to be rendered, and `DispatchAsyncWork` to determine whether there are asynchronous tasks. If the interface contains controls or areas to be rendered, or if there are asynchronous tasks, the electronic device can immediately trigger a TE (Execution Timeout) to ensure timely rendering of the controls or areas to be rendered, or timely execution of the asynchronous tasks.

[0075] It is understandable that the above method can ensure that the electronic device only triggers TE when the interface contains controls or areas to be rendered, or when there are asynchronous tasks, rather than triggering TE at fixed time intervals. This can improve the efficiency of interface rendering and the smoothness of the interface, while also reducing the power consumption of the electronic device.

[0076] S108, the dynamic scheduling method after TE is triggered.

[0077] In some embodiments, the electronic device may initiate a triggering process after triggering the TE in each Tick cycle, and a dynamic scheduling method after triggering the TE.

[0078] Specifically, in some embodiments, the electronic device can non-blockingly check UI event flags (as an example of a first event flag, such as EVENT_UI_WAKEUP). Based on the UI event flags, the electronic device can generate high-priority events (as an example of a first event) before or during the calculation of the next trigger time of the calculated TE. In the event that the electronic device generates a first event, the trigger interval of the TE is set to a first threshold (e.g., minimum time interval, 5ms, etc.), and the TE is triggered according to the first threshold to respond to user actions or refresh animations, thus preventing the electronic device from missing the first event.

[0079] In some embodiments, if no first event is detected, the electronic device may check the message queue count (represented by msgCnt) of the currently active JavaScript application. If msgCnt is greater than 0, the electronic device may set the trigger interval of TE to a second threshold (e.g., minimum time interval, 5ms, etc.) to ensure that the electronic device can process JavaScript messages in a timely manner and avoid delays in JavaScript message processing.

[0080] In some embodiments, if the electronic device does not experience the first event or the message queue count is equal to 0, the electronic device may obtain the first recent task expiration time from the first manager (e.g., AnimatorManager) and the second recent task expiration time from the second manager (e.g., MCUTaskManager), and set the trigger interval of TE to the minimum of the first and second recent task expiration times to ensure that the electronic device can execute animations or MCU tasks in a timely manner.

[0081] In some embodiments, the electronic device may set the TE trigger interval to a third threshold (e.g., minimum time interval, 5ms, etc.) to avoid frequent TE triggering due to a small TE trigger interval.

[0082] In some embodiments, the electronic device may also convert the third threshold into a tick count and use the converted third threshold as the timeout for the next TE event, thereby unifying the TE trigger interval with the system kernel's time scheduling system and improving the stability and compatibility of the TE scheduling mechanism.

[0083] In some embodiments, the electronic device can block-wait for a second event to trigger a TE (Event Execution Timer) via LOS_EventRead or trigger a TE based on a timeout. Specifically, the second event can be an input event, a new animation, an asynchronous task, a new MCU task, etc. It can be understood that the second event is related to the first event flag, and the electronic device can detect whether a second event has occurred by checking the UI event flag.

[0084] It is understandable that timeout-based triggering (TE) refers to the system automatically triggering TE after a pre-calculated timeout period when no second event (such as an input event, a new animation, an asynchronous task, or a new MCU task) is detected while the electronic device is waiting for the event that triggers TE. This ensures that animations and MCU tasks can be executed in a timely manner near their expiration time. This timeout period is typically the minimum of the expiration time of the first most recent task in the first manager (such as AnimatorManager) and the expiration time of the second most recent task in the second manager (such as MCUTaskManager), and is ensured to be no less than the minimum time interval (such as 5ms) to avoid increased power consumption due to frequent wake-ups.

[0085] It is understood that this invention achieves unified scheduling of input events, animation frame refreshes, asynchronous tasks, and MCU tasks, enabling all types of tasks to be executed through the TE scheduling process, thus avoiding resource conflicts and response delays caused by the decentralized scheduling of multiple tasks.

[0086] In summary, the dynamic TE scheduling method of this invention achieves adaptive adjustment of the TE triggering frequency by acquiring the real-time system status. Specifically, when high-priority events or pending messages in active JavaScript applications are detected, the TE triggering interval is set to the minimum value to trigger TEs at a high frequency, thereby ensuring timely response to user input events, animation frame updates, etc., and guaranteeing system performance and interface smoothness. When there are no high-priority events or pending JavaScript messages on the electronic device, and the expiration time of animations or MCU tasks is far away, the TE triggering interval is extended to reduce meaningless TE triggering and lower the energy consumption of the electronic device. The dynamic TE scheduling method of this invention avoids the limitations of fixed triggering intervals, realizes dynamic and intelligent TE scheduling, and achieves synergistic optimization of system performance, interface smoothness, and energy consumption control of electronic devices.

[0087] Figure 2 According to some embodiments of this application, a flowchart of another scheduling method is shown. It can be understood that... Figure 2 The processes shown are all executed by electronic devices. For simplicity, the following description... Figure 2 The execution entity will not be described again in the process shown. For example... Figure 2 As shown, including but not limited to the following processes: S201, A beat event triggered by an electronic device has been detected.

[0088] S202, obtain the first event flag, determine whether the electronic device has experienced a first event based on the first event flag, and if the electronic device has experienced a first event, set the trigger interval of the beat event to the first threshold.

[0089] S203, obtain the message queue count of the first application, and if the message queue count is greater than 0, set the trigger interval of the tick event to the second threshold.

[0090] S204, if the electronic device does not experience the first event or the message queue count is equal to 0, obtain the first recent task expiration time in the first manager and the second recent task expiration time in the second manager of the electronic device, and set the trigger interval of the beat event to the minimum value of the first recent task expiration time and the second recent task expiration time.

[0091] In some embodiments, this application also provides a computer-readable medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the scheduling method described in the above embodiments.

[0092] In some embodiments, this application also provides an electronic device, which includes: a memory for storing instructions executed by one or more processors of the electronic device; and a processor, one of the processors of the electronic device, for executing the instructions stored in the memory to perform the scheduling method in the above embodiments.

[0093] In some embodiments, this application also provides a program product comprising: instructions that, when executed on an electronic device, cause the electronic device to perform the scheduling method described in the above embodiments.

[0094] To facilitate better implementation of the above-described solutions in the embodiments of this application, related equipment for implementing the above-described solutions is also provided below.

[0095] For example, Figure 3 A schematic diagram of the structure of an electronic device 10 is shown according to some embodiments of this application. It is understood that the electronic device 10 can be used as an example of the aforementioned electronic device.

[0096] In some embodiments, electronic device 10 may include one or more processors 1004, system control logic 1008 connected to at least one of the processors 1004, system memory 1012 connected to system control logic 1008, nonvolatile memory (NVM) 1016 connected to system control logic 1008, and network interface 1020 connected to system control logic 1008.

[0097] In some embodiments, processor 1004 may include one or more single-core or multi-core processors. In some embodiments, processor 1004 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In embodiments where electronic device 10 employs an evolved node B (eNB) or radio access network (RAN) controller, processor 1004 may be configured to perform various corresponding embodiments.

[0098] In some embodiments, system control logic 1008 may include any suitable interface controller to provide any suitable interface to at least one of the processors 1004 and / or any suitable device or component communicating with system control logic 1008.

[0099] In some embodiments, system control logic 1008 may include one or more memory controllers to provide an interface to system memory 1012. System memory 1012 may be used to load and store data and / or instructions. In some embodiments, memory 1012 of system 1000 may include any suitable volatile memory, such as suitable dynamic random access memory (DRAM).

[0100] The NVM 1016 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the NVM 1016 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of a hard disk drive (HDD), a compact disc (CD) drive, and a digital versatile disc (DVD) drive.

[0101] NVM 1016 may include a portion of the storage resources on the device on which electronic device 10 is installed, or it may be accessible by the device, but is not necessarily part of the device. For example, NVM 1016 may be accessed over a network via network interface 1020.

[0102] Specifically, system memory 1012 and NVM 1016 may respectively include: a temporary copy and a permanent copy of instruction 1024. Instruction 1024 may include: when executed by at least one of processors 1004, causing electronic device 10 to perform, as Figure 1 The instructions for the method shown. In some embodiments, instructions 1024, hardware, firmware and / or their software components may additionally / alternatively be located in system control logic 1008, network interface 1020 and / or processor 1004.

[0103] Network interface 1020 may include a transceiver for providing a radio interface to electronic device 10, thereby enabling communication with any other suitable device (such as a front-end module, antenna, etc.) via one or more networks. In some embodiments, network interface 1020 may be integrated into other components of electronic device 10. For example, network interface 1020 may be integrated into at least one of processor 1004, system memory 1012, NVM 1016, and firmware device (not shown) with instructions, which, when at least one of processor 1004 executes the instructions, enable electronic device 10 to implement, as Figure 1 The method shown.

[0104] The network interface 1020 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 1020 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.

[0105] In one embodiment, at least one of the processors 1004 may be encapsulated with logic from one or more controllers for system control logic 1008 to form a system encapsulation session initialization protocol (SIP).

[0106] In one embodiment, at least one of the processors 1004 may be integrated on the same die with the logic of one or more controllers for system control logic 1008 to form a system on chip (SOC).

[0107] In one embodiment, electronic device 10 may further include: input / output (I / O) device 1032.

[0108] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0109] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

[0110] Those skilled in the art will understand that the above embodiments are specific embodiments for implementing the present invention, and in practical applications, various changes in form and detail may be made without departing from the spirit and scope of the present invention.

Claims

1. A scheduling method applied to electronic devices, characterized in that, include: The electronic device was detected to have triggered a beat event; Obtain a first event flag; determine whether the electronic device has experienced a first event based on the first event flag; if the electronic device has experienced the first event, set the trigger interval of the beat event to a first threshold. Obtain the message queue count of the first application; if the message queue count is greater than 0, set the trigger interval of the beat event to the second threshold. If the electronic device does not experience the first event or the message queue count is equal to 0, obtain the first recent task expiration time in the first manager and the second recent task expiration time in the second manager of the electronic device, and set the trigger interval of the beat event to the minimum value of the first recent task expiration time and the second recent task expiration time.

2. The method according to claim 1, characterized in that, The detection of the electronic device triggering a beat event includes: The system status of the electronic device is obtained, and the system status includes at least one of the following: input device status, animation activity status, asynchronous task queue status, microcontroller unit task status, and message queue status of the first application. The beat event is triggered when at least one of the system states satisfies the first condition.

3. The method according to claim 2, characterized in that, The step event is triggered when at least one of the system states satisfies the first condition, including: Based on the input device status, determine whether an input event has occurred; if the input event has occurred, trigger the beat event; and / or, Retrieve at least one active animation from the animation list; determine the expiration time of the next frame of the animation based on the runtime of the previous frame and the frame interval parameter; and trigger the beat event based on the expiration time of the next frame; and / or, If the second manager contains the first task, the beat event is triggered; and / or, The beat event is triggered when a second task exists in the third manager; and / or, Obtain the message queue count of the first application, and trigger the tick event if the message queue count is greater than 0; and / or, The beat event is triggered when the interface of the electronic device contains controls or areas to be rendered.

4. The method according to claim 3, characterized in that, The step event being triggered upon the generation of the input event includes: After the input event ends, reduce the frequency of triggering the beat event.

5. The method according to claim 3, characterized in that, The step of obtaining the expiration time of the next frame of the animation based on the running time of the previous frame and the frame interval parameter includes: The frame interval parameters are different for different animations.

6. The method according to claim 3, characterized in that, The step of triggering the beat event based on the expiration time of the next frame of the animation includes: If the current time of the electronic device reaches the expiration time of the next frame of the animation, or if the time interval between the current frames of the animation is greater than the frame interval parameter, the Run() operation is executed, and the expiration time of the next frame of the animation is recalculated.

7. The method according to claim 3, characterized in that, The method further includes: A default task cycle is set, wherein the time interval between two consecutive triggering beat events is not less than the default task cycle.

8. The method according to claim 3, characterized in that, The method further includes: When a new animation task is added to the electronic device, the beat event is triggered, and the expiration time of the next frame of the animation is set to 0.

9. The method according to claim 1, characterized in that, The method further includes: The electronic device acquires a second event and / or the first event in a blocking manner, wherein the second event is associated with the first event flag; The beat event is triggered based on the second event and / or the first event.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 9.

11. An electronic device, characterized in that, include: Memory is used to store instructions executed by one or more processors of an electronic device; And a processor, one of the processors of the electronic device, for executing instructions stored in the memory to implement the method of any one of claims 1 to 9.

12. A program product, characterized in that, The program product includes instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 9.