Timing task control method and device and storage medium

By concurrently executing scheduled tasks to be triggered in a preset time wheel, the problems of delayed and inefficient triggering of scheduled tasks in the existing technology are solved, and efficient scheduled task management and second-level triggering in the cloud environment are realized.

CN118535295APending Publication Date: 2024-08-23BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310190573.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-23
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing technology cannot effectively support the triggering of millions of scheduled tasks in seconds, especially in cloud environments, resulting in delayed triggering of scheduled tasks and low execution efficiency.

Method used

The first time unit of the current moment is determined by multiple time units in the preset time wheel. The scheduled tasks to be triggered for this time unit are executed concurrently. The time unit pointer and task operation parameters are used for task management and triggering to avoid single-thread strings. execution to improve task concurrency.

Benefits of technology

It significantly reduces the triggering delay of scheduled tasks, improves task execution efficiency, and can support second-level triggering of millions of tasks in the cloud.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535295A
    Figure CN118535295A
Patent Text Reader

Abstract

The invention relates to a timed task control method and device and a storage medium, a first time unit corresponding to the current moment can be determined from multiple time units of a preset time wheel, and the preset time wheel is used for triggering a received timed task; aiming at a first to-be-triggered timed task corresponding to the first time unit, determining a plurality of target timed tasks from the first to-be-triggered timed task; and controlling the multiple target timed tasks to be executed concurrently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of timing triggering, and in particular to a timing task control method, device and storage medium. Background Art

[0002] Currently, there are many user functions based on timers, such as alarm clocks, countdown stopwatches, etc. These timers are generally implemented on terminal devices (such as mobile phones), and the supported data volume is limited, which is relatively easy to implement. In the smart home scenario, some IoT devices do not have the timing capability themselves, but can be triggered based on the cloud. The cloud often supports a larger amount of data, and generally needs to support the second-level triggering of scheduled tasks at the million-level. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides a timed task control method, device and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a timed task control method, comprising: determining a first time unit corresponding to a current moment from a plurality of time units of a preset time wheel, the preset time wheel being used to trigger a received timed task;

[0005] For the first scheduled task to be triggered corresponding to the first time unit, determining a plurality of target scheduled tasks from the first scheduled task to be triggered;

[0006] Control multiple target scheduled tasks to execute concurrently.

[0007] Optionally, controlling the concurrent execution of a plurality of the target scheduled tasks includes:

[0008] For each target scheduled task among the plurality of target scheduled tasks, obtaining a trigger parameter of the target scheduled task at a current moment;

[0009] When it is determined according to the trigger parameter that the target scheduled task meets a preset trigger condition, the target scheduled task is triggered.

[0010] Optionally, controlling the concurrent execution of the plurality of target scheduled tasks further comprises:

[0011] When it is determined according to the trigger parameter that the target scheduled task does not meet the preset trigger condition, the trigger parameter of the target scheduled task is updated.

[0012] Optionally, the method further comprises:

[0013] Adjusting a parameter value of a task operation parameter corresponding to the first time unit, wherein the task operation parameter is used to control the read and write operations of each of the first to-be-triggered scheduled tasks corresponding to the first time unit;

[0014] The controlling of the concurrent execution of the plurality of target scheduled tasks comprises:

[0015] After adjusting the parameter value of the task operation parameter to the target parameter value, controlling a plurality of the target scheduled tasks to be executed concurrently.

[0016] Optionally, determining the first time unit corresponding to the current moment from a plurality of time units of a preset time wheel includes:

[0017] Obtaining a time unit pointer corresponding to the preset time wheel, wherein the time unit pointer is used to record an identifier of a time unit currently performing task detection;

[0018] The first time unit is determined according to the time unit pointer.

[0019] Optionally, the method further comprises:

[0020] The time unit pointer is updated according to a preset time interval.

[0021] Optionally, the method further comprises:

[0022] In response to obtaining a scheduled task creation request, storing a second to-be-triggered scheduled task corresponding to the scheduled task creation request in a preset disk;

[0023] The third scheduled task to be triggered is loaded from the preset disk into the target memory corresponding to the preset time wheel, wherein the third scheduled task to be triggered is the second scheduled task to be triggered whose triggering time is within the preset time period.

[0024] Optionally, the step of loading the third to-be-triggered scheduled task from the preset disk into a target memory corresponding to the preset time wheel includes:

[0025] For each of the third scheduled tasks to be triggered, determine a second time unit corresponding to the third scheduled task to be triggered from the plurality of time units according to the triggering time of the third scheduled task to be triggered;

[0026] The third scheduled task to be triggered is loaded into any set corresponding to the second time unit.

[0027] According to a second aspect of an embodiment of the present disclosure, there is provided a timed task control device, comprising:

[0028] A first determination module is configured to determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger a received timed task;

[0029] A second determining module is configured to determine a plurality of target scheduled tasks from the first scheduled tasks to be triggered corresponding to the first time unit;

[0030] The control module is configured to control the concurrent execution of multiple target scheduled tasks.

[0031] According to a third aspect of an embodiment of the present disclosure, there is provided a timed task control device, comprising:

[0032] processor;

[0033] a memory for storing processor-executable instructions;

[0034] Wherein, the processor is configured to:

[0035] Determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger the received scheduled task;

[0036] For the first scheduled task to be triggered corresponding to the first time unit, determining a plurality of target scheduled tasks from the first scheduled task to be triggered;

[0037] Control multiple target scheduled tasks to execute concurrently.

[0038] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the timing task control method provided in the first aspect of the present disclosure are implemented.

[0039] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: determining a first time unit corresponding to the current moment from multiple time units of a preset time wheel, wherein the preset time wheel is used to trigger a received timed task; determining multiple target timed tasks from the first timed tasks to be triggered corresponding to the first time unit; controlling the concurrent execution of multiple target timed tasks, thereby avoiding the execution of each first timed task to be triggered in sequence, thereby significantly reducing the occurrence of delays in triggering timed tasks and improving the execution efficiency of tasks.

[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0042] Figure 1 The figure is a flow chart of a timed task control method according to an exemplary embodiment.

[0043] Figure 2 The figure is a schematic diagram showing the structure of a timing wheel according to an exemplary embodiment.

[0044] Figure 3 is based on Figure 1 The illustrated embodiment shows a flow chart of a method for controlling a scheduled task.

[0045] Figure 4 is based on Figure 1 The illustrated embodiment shows a flow chart of a method for controlling a scheduled task.

[0046] Figure 5 is based on Figure 1 The illustrated embodiment shows a flow chart of a method for controlling a scheduled task.

[0047] Figure 6 is based on Figure 1 The illustrated embodiment shows a flow chart of a method for controlling a scheduled task.

[0048] Figure 7 The figure is a block diagram of a timing task control device according to an exemplary embodiment.

[0049] Figure 8 is based on Figure 7 The illustrated embodiment shows a block diagram of a timing task control device.

[0050] Fig. 9 is based on Figure 7 The illustrated embodiment shows a block diagram of a timing task control device.

[0051] Fig.10 is based on Figure 7 The illustrated embodiment shows a block diagram of a timing task control device.

[0052] Fig.11 The invention is a block diagram of a device for timing task control according to an exemplary embodiment. DETAILED DESCRIPTION

[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0054] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.

[0055] The present disclosure is mainly used in scenarios where the scheduled tasks of IoT devices (such as smart pressure rice cookers, smart air purifiers, etc.) are triggered on a scheduled basis through the cloud. The following timing triggering schemes are provided in the related art:

[0056] 1. Scheduled polling solution: that is, traverse the disk database at regular intervals (usually a few seconds) to trigger the scheduled tasks one by one. However, when dealing with a large number of tasks, this solution will greatly increase the triggering delay, and even not complete all tasks in one or several time periods.

[0057] 2. Every time a scheduled task is generated, a timer thread is started inside the timer service and triggered after the time is up. This solution has low latency, but is limited by the number of threads and the number of tasks that can be carried by a single machine is limited.

[0058] Therefore, the above two solutions cannot handle millions of scheduled tasks, and do not support the second-level triggering of millions of scheduled tasks on the cloud.

[0059] The related art also provides a method for realizing timed triggering based on a time wheel algorithm, but in this method, all the timed tasks are stored in the memory. Due to the limited storage capacity of the memory, if the total amount of tasks is large (millions, tens of millions, or even hundreds of millions), they cannot all be stored in the memory. In addition, in the timed triggering scheme based on the time wheel provided in the related art, each timed task is executed by a single thread, and each timed task needs to be executed serially, which will cause the problem of accumulated delays in task execution, especially when there are too many peak tasks (tens of thousands, hundreds of thousands, or millions), it is impossible to achieve second-level triggering.

[0060] In order to solve the above-mentioned problems, the present disclosure provides a timed task control method, device and storage medium. The specific implementation methods of the present disclosure are described in detail below with reference to the accompanying drawings.

[0061] Figure 1The present invention is a flowchart of a timed task control method according to an exemplary embodiment. The method can be applied to a server (or cloud). For example, taking an IoT device (such as a smart pressure rice cooker, a smart air purifier, etc.) in a smart home scenario as an example, a user can control and operate the functions of his IoT device through a smart home APP (Application) installed on a terminal (such as a mobile phone). For example, a user can start a timed task for a smart home device through the smart home APP (such as setting the smart air purifier to start at 8 o'clock in the morning). The server in the present disclosure refers to a server corresponding to the smart home APP. The terminal where the smart home APP is located can communicate with the server through the Internet. In this way, when the terminal obtains the user's timed task creation operation on the smart home APP, it can send a timed task creation request to the server. In response to receiving the timed task creation request, the server stores the timed task corresponding to the timed task creation request so that when the trigger time corresponding to the timed task is obtained, a trigger instruction is sent to the smart home device.

[0062] like Figure 1 As shown, the method comprises the following steps:

[0063] In step S101, a first time unit corresponding to the current moment is determined from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger a received scheduled task.

[0064] Among them, the time wheel is an algorithm for implementing a timer, through which a large number of timed tasks can be managed, triggered and run.

[0065] For example, Figure 2 is a schematic diagram showing the structure of a timing wheel according to an exemplary embodiment. Figure 2 As shown, the time wheel is usually a circular queue (or called a time queue), which includes multiple time units ( Figure 2 In the circular queue shown, one grid corresponds to one time unit), and each time unit (which can be recorded as a slot) corresponds to a period of time (such as 1 millisecond, 1 second, 2 seconds or 1 minute), and usually each time unit corresponds to the same duration. In addition, each time unit can correspond to one or more scheduled tasks, that is, a time unit can be regarded as a task set, and the scheduled tasks in the task set are all scheduled tasks that should be triggered in the time unit.

[0066] In the scenario of triggering a scheduled task based on the time wheel, you also need to set the time unit pointer (such as Figure 2As shown) and a timer, the time unit pointer is used to record the identifier of the time unit of the task detection at the current moment. After the timer is started, it will be reset every preset time. Figure 2 The time unit pointer shown moves one grid in the circular queue. The preset duration is usually equal to the duration of a time unit. For example, if the duration of a time unit is 1 second, the preset duration is also 1 second.

[0067] Therefore, in the present disclosure, the preset time wheel refers to a time wheel with set parameters such as the number of time units, the duration corresponding to each time unit, and the preset duration corresponding to the timer.

[0068] In this step, a time unit pointer corresponding to the preset time wheel may be obtained, wherein the time unit pointer is used to record the identifier of the time unit currently performing task detection; and then the first time unit is determined according to the time unit pointer.

[0069] For example, the time unit pointer can be recorded as Current Index. If Current Index=3, it means that the time unit currently performing task detection is the time unit marked as 3, that is, the first time unit is the time unit marked as 3. The example here is only for illustration and the present disclosure does not limit this.

[0070] In step S102, for the first scheduled task to be triggered corresponding to the first time unit, a plurality of target scheduled tasks are determined from the first scheduled task to be triggered.

[0071] Typically, one time unit on the time wheel may correspond to multiple first timed tasks to be triggered. In a possible implementation, a preset number of the target timed tasks may be determined from the multiple first timed tasks to be triggered corresponding to the first time unit, wherein the preset number is the number of timed tasks that can be executed concurrently and is predetermined based on the performance of the server, and the preset number may be set to 5000, for example.

[0072] In step S103, a plurality of target scheduled tasks are controlled to be executed concurrently.

[0073] For example, assuming that the first time unit corresponds to 10,000 first timed tasks to be triggered, 5,000 timed tasks can be selected from the 10,000 first timed tasks to be triggered, and then the 5,000 timed tasks can be controlled to be executed concurrently at the same time, and then the remaining 5,000 tasks can be controlled to be executed concurrently at the same time. It should be noted that in the time wheel-based timed task triggering scheme provided in the related art, the 10,000 first timed tasks to be triggered corresponding to the first time unit need to be executed one by one in sequence by a single thread, that is, the next timed task can be executed only after one timed task is executed. This method of serial execution of each timed task has a delay problem, especially when the timed task is triggered through the cloud, the number of tasks that need to be triggered at the same time in the cloud is high. If many timed tasks with the same or close triggering time are to be executed one by one, it is bound to cause a more serious trigger delay problem. However, if 5,000 timed tasks are selected to be executed concurrently at the same time, compared with the single-threaded execution one by one, the execution efficiency of the task can be significantly improved. The above example is only an example, and the present disclosure is not limited to this.

[0074] By adopting the above method, for multiple first to-be-triggered timed tasks corresponding to the first time unit on the preset time wheel, multiple target timed tasks are determined from the multiple first to-be-triggered timed tasks; and then the multiple target timed tasks are controlled to be executed concurrently, which can significantly reduce the occurrence of delays in triggering timed tasks and improve the execution efficiency of tasks.

[0075] Figure 3 is based on Figure 1 The embodiment shown is a flowchart of a timed task control method, such as Figure 3 As shown, step S103 includes the following sub-steps:

[0076] In step S1031, for each target scheduled task among the plurality of target scheduled tasks, a trigger parameter of the target scheduled task at the current moment is obtained.

[0077] The trigger parameter refers to a parameter that indicates whether the corresponding target scheduled task has reached the trigger time. Figure 2 When the timing wheel shown triggers a timing task, it is also necessary to determine the number of times the current time unit pointer scans the first time unit, and then further determine whether the trigger time of the target timing task has been reached. Therefore, the trigger parameter can be the number of cycles of the circular queue that have been scanned when the current time unit pointer Current Index points to the first time unit, which can be recorded as Cycle-Num. In other words, Cycle-Num is used to record when the CurrentIndex scans the first time unit to execute the target timing task.

[0078] Assume that the preset time wheel includes 3600 time units, and the duration of each time unit is 1 second, that is, the circular queue corresponding to the preset time wheel includes 3600 grids, and a timer is started at the same time. The time unit pointer Current Index moves one grid every 1 second. Assume that the Current Index points to the first grid at the current moment. When a scheduled task A arrives, for example, the scheduled task A is scheduled to be triggered after 3610 seconds, it is necessary to calculate which time unit the scheduled task A should be placed in. Since the Current Index points to the first grid at the current moment, the Current Index points to the 11th grid after 3610 seconds, and it should go around the circular queue once (3610 / 3600=1). When the Current Index points to the 11th grid, the scheduled task A is executed. Therefore, Cycle-Num=1. After the Current Index moves around the circular queue once, the Cycle-Num is reduced by 1 until Cycle-Num=0 and the Current Index points to the 11th grid, and the scheduled task A can be executed. The above example is only for illustration and the present disclosure does not limit this.

[0079] In step S1032, when it is determined according to the trigger parameters that the target scheduled task meets a preset trigger condition, the target scheduled task is triggered.

[0080] The preset trigger condition may be that the parameter value of the trigger parameter is a preset value (eg, Cycle-Num=0).

[0081] Continuing with the example in step S1031, the Current Index moves to a new time unit every second. When determining whether to execute each scheduled task in the task set corresponding to the new time unit, it is necessary to determine whether the Cycle-Num corresponding to the scheduled task is 0. If it is not 0, it means that it is necessary to move around the time wheel a few times and reduce the Cycle-Num by 1; if it is 0, it means that the current moment is the triggering moment of the scheduled task and the scheduled task needs to be executed immediately.

[0082] In addition, in the process of triggering the target scheduled task, it can be executed by calling the pre-created method corresponding to the target scheduled task (which can be recorded as Task-Funciton method). After executing the target scheduled task, the target scheduled task can be deleted from the task set corresponding to the first time unit.

[0083] like Figure 3 As shown, step S103 also includes the following sub-steps:

[0084] In step S1033, when it is determined according to the trigger parameters that the target scheduled task does not satisfy the preset trigger condition, the trigger parameters of the target scheduled task are updated.

[0085] For example, when it is determined that the trigger parameter Cycle-Num is not equal to 0, it is determined that the target scheduled task does not meet the preset trigger condition. At this time, the Cycle-Num corresponding to the target scheduled task can be reduced by 1. The example here is only for illustration and the present disclosure is not limited to this.

[0086] Figure 4 is based on Figure 1 The embodiment shown is a flowchart of a timed task control method, such as Figure 4 As shown, the method further comprises the following steps:

[0087] In step S104, a parameter value of a task operation parameter corresponding to the first time unit is adjusted, where the task operation parameter is used to control the read and write operations of each of the first to-be-triggered scheduled tasks corresponding to the first time unit.

[0088] In actual application scenarios, there may be problems with concurrent reading and writing of multiple tasks. For example, the user sets the target device to turn on at 8 o'clock, and then the server receives a scheduled task from the user to turn off the target device at 8 o'clock. In this case, the two conflicting scheduled tasks need to operate a piece of data at the same time, which will cause the program to crash. Therefore, in order to avoid program crashes in the process of controlling the concurrent execution of multiple target scheduled tasks, a queuing mechanism can be added to the scheduled tasks by locking them. In other words, a lock can be added to each time unit. In one possible implementation method, the lock can be added by adjusting the parameter value of the task operation parameter corresponding to the first time unit. After the first time unit is locked, all the first to-be-triggered scheduled tasks corresponding to the first time unit cannot perform read and write operations, thereby avoiding program crashes.

[0089] In this way, during the execution of step S103, after the parameter value of the task operation parameter is adjusted to the target parameter value, the plurality of target scheduled tasks are controlled to be executed concurrently.

[0090] In one possible implementation, if the parameter value of the task operation parameter is the target parameter value, it indicates that each first to-be-triggered scheduled task corresponding to the first time unit is in a state where read and write operations are prohibited; if the parameter value of the task operation parameter is a value other than the target parameter value, it indicates that read and write operations can be performed on each first to-be-triggered scheduled task corresponding to the first time unit.

[0091] Figure 5 is based on Figure 1 The embodiment shown is a flowchart of a timed task control method, such as Figure 5 As shown, the method further comprises the following steps:

[0092] In step S105, the time unit pointer is updated according to a preset time interval.

[0093] As described above, when a timed task is triggered based on the preset time wheel, a timer needs to be set. After the timer is started, the time unit pointer can be set at a preset time interval. Figure 2 One grid is moved in the circular queue shown, so the preset time interval here is the preset duration.

[0094] In this step, updating the time unit pointer according to the preset time interval is equivalent to controlling the time unit pointer to jump according to the preset time interval. For example, assuming that the time unit pointer at the current moment points to the first time unit (the unit identifier is x1), one second (i.e., the preset duration) later, the time unit pointer points to the second time unit (the unit identifier is x2), that is, Current Index = x1 is updated to Current Index = x2, which is only an example and is not limited to this in the present disclosure.

[0095] After executing this step, regardless of whether the first to-be-triggered scheduled task corresponding to the first time unit has been fully executed, as long as the time unit pointer is updated, the new first time unit can be determined according to the updated time unit pointer, and then the multiple target scheduled tasks corresponding to the new first time unit can be controlled to be executed concurrently in the manner described in steps S101-S103.

[0096] It should be noted that in the process of triggering a scheduled task based on the time wheel in the related technology, it is necessary to wait until the first scheduled task to be triggered corresponding to the target time unit pointed to by the current time unit pointer is completely executed before the timer is started to update the time unit pointer. However, in the related technology, multiple first scheduled tasks to be triggered corresponding to the target time unit need to be executed one by one in sequence by a single thread, that is, the next scheduled task can only be executed after one scheduled task is executed. This method of serial execution of each scheduled task has a delay problem. If it is necessary to wait for the multiple first scheduled tasks to be triggered corresponding to the target time unit to be executed before triggering the timer to jump the time unit pointer, it will cause serious delayed triggering, and it cannot meet the second-level triggering requirements in the cloud-triggered scenario.

[0097] By adopting the timer asynchronous triggering scheme provided by the present invention, the time unit pointer is updated according to the preset time interval. There is no need to wait for the first time unit to be corresponding to the first time unit to be triggered. The new first time unit can be determined according to the updated time unit pointer, and then the multiple target timed tasks corresponding to the new first time unit are controlled to be executed concurrently in the manner described in steps S101-S103, thereby ensuring that the task triggering delay can be controlled within seconds during peak times.

[0098] Figure 6 is based on Figure 1 The embodiment shown is a flowchart of a timed task control method, such as Figure 6 As shown, the method further comprises the following steps:

[0099] In step S106, in response to obtaining the scheduled task creation request, the second scheduled task to be triggered corresponding to the scheduled task creation request is stored in a preset disk.

[0100] In step S107, the third scheduled task to be triggered is loaded from the preset disk into the target memory corresponding to the preset time wheel, wherein the third scheduled task to be triggered is the second scheduled task to be triggered whose triggering time is within the preset time period.

[0101] For example, the preset time period may be the nearest hour in the future.

[0102] In this step, for each of the third scheduled tasks to be triggered, the second time unit corresponding to the third scheduled task to be triggered can be determined from the multiple time units according to the trigger time of the third scheduled task to be triggered; and the third scheduled task to be triggered can be loaded into any set corresponding to the second time unit.

[0103] As described above, in the scheme of implementing timed triggering based on the algorithm of the time wheel in the related technology, all scheduled tasks are stored in the memory. Due to the limited storage capacity of the memory, if the total amount of tasks is large (millions, tens of millions or even hundreds of millions), they cannot be stored in the memory. In order to solve this technical problem in the future, in the present disclosure, when the server obtains a scheduled task creation request, it can store the second scheduled task to be triggered corresponding to the scheduled task creation request in the preset disk. Compared with the memory, the capacity of the preset disk is generally larger (such as 512G or 1T). For the case where the total amount of tasks is large, tasks can also be stored on the preset disk. Afterwards, the scheduled tasks to be triggered in the future (such as the next 1 hour) can be loaded from the preset disk to the memory of the preset time wheel. This allows the memory to only save the tasks to be triggered in the recent period of time, and save the full amount of data in the disk, so as to support the storage of scheduled tasks with a large amount of data.

[0104] In one possible implementation, a preset task scanning module can be used to perform a scheduled scan on the scheduled tasks stored in the preset disk (e.g., once every 1 minute), and then load the second scheduled task to be triggered whose trigger time is within the preset time period from the preset disk into the memory.

[0105] Figure 7 is a block diagram of a timing task control device according to an exemplary embodiment. Figure 7 As shown, the device comprises:

[0106] A first determination module 701 is configured to determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger a received timed task;

[0107] The second determining module 702 is configured to determine a plurality of target scheduled tasks from the first scheduled tasks to be triggered corresponding to the first time unit;

[0108] The control module 703 is configured to control the concurrent execution of multiple target scheduled tasks.

[0109] Optionally, the control module 703 is configured to obtain the trigger parameters of the target scheduled task at the current moment for each of the multiple target scheduled tasks; and trigger the target scheduled task when it is determined according to the trigger parameters that the target scheduled task meets the preset trigger conditions.

[0110] Optionally, the control module 703 is configured to update the trigger parameter of the target scheduled task when it is determined according to the trigger parameter that the target scheduled task does not meet the preset trigger condition.

[0111] Optionally, Figure 8 is based on Figure 7 The block diagram of a timing task control device shown in the embodiment shown in FIG. Figure 8 As shown, the device also includes:

[0112] A parameter adjustment module 704 is configured to adjust a parameter value of a task operation parameter corresponding to the first time unit, wherein the task operation parameter is used to control the read and write operations of each of the first to-be-triggered scheduled tasks corresponding to the first time unit;

[0113] The control module 703 is configured to control the concurrent execution of multiple target scheduled tasks after adjusting the parameter value of the task operation parameter to the target parameter value.

[0114] Optionally, the first determination module 701 is configured to obtain a time unit pointer corresponding to the preset time wheel, the time unit pointer being used to record an identifier of a time unit currently performing task detection; and determine the first time unit according to the time unit pointer.

[0115] Optionally, Fig. 9 is based on Figure 7 The block diagram of a timing task control device shown in the embodiment shown in FIG. Fig. 9 As shown, the device also includes:

[0116] The pointer updating module 705 is configured to update the time unit pointer according to a preset time interval.

[0117] Optionally, Fig.10 is based on Figure 7 The block diagram of a timing task control device shown in the embodiment shown in FIG. Fig.10 As shown, the device also includes:

[0118] The storage module 706 is configured to, in response to obtaining a scheduled task creation request, store the second scheduled task to be triggered corresponding to the scheduled task creation request in a preset disk;

[0119] The memory loading module 707 is configured to load the third scheduled task to be triggered from the preset disk into the target memory corresponding to the preset time wheel, wherein the third scheduled task to be triggered is the second scheduled task to be triggered whose trigger time is within the preset time period.

[0120] Optionally, the memory loading module 707 is configured to determine, for each of the third scheduled tasks to be triggered, a second time unit corresponding to the third scheduled task to be triggered from the multiple time units according to the trigger time of the third scheduled task to be triggered; and load the third scheduled task to be triggered into any set corresponding to the second time unit.

[0121] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0122] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, and when the program instructions are executed by a processor, the steps of the timed task control method provided by the present disclosure are implemented.

[0123] Fig.11800 is a block diagram of a device for timing task control according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0124] Reference Fig.11 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output interface 812 , a sensor component 814 , and a communication component 816 .

[0125] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned timed task control method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0126] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0127] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0128] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0129] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0130] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0131] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0132] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0133] In an exemplary embodiment, the device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned timing task control method.

[0134] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of the device 800 to complete the above-mentioned timed task control method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0135] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned timed task control method when executed by the programmable device.

[0136] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0137] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A timed task control method, It is characterized in that include: Determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger the received scheduled task; For the first scheduled task to be triggered corresponding to the first time unit, determining a plurality of target scheduled tasks from the first scheduled task to be triggered; Control multiple target scheduled tasks to execute concurrently.

2. The method according to claim 1, It is characterized in that The controlling of the concurrent execution of the plurality of target scheduled tasks comprises: For each target scheduled task among the plurality of target scheduled tasks, obtaining a trigger parameter of the target scheduled task at a current moment; When it is determined according to the trigger parameter that the target scheduled task meets a preset trigger condition, the target scheduled task is triggered.

3. The method according to claim 2, It is characterized in that The controlling of the concurrent execution of the plurality of target scheduled tasks also includes: When it is determined according to the trigger parameter that the target scheduled task does not meet the preset trigger condition, the trigger parameter of the target scheduled task is updated.

4. The method according to claim 1, It is characterized in that The method further comprises: Adjusting a parameter value of a task operation parameter corresponding to the first time unit, wherein the task operation parameter is used to control the read and write operations of each of the first to-be-triggered scheduled tasks corresponding to the first time unit; The controlling of the concurrent execution of the plurality of target scheduled tasks comprises: After adjusting the parameter value of the task operation parameter to the target parameter value, controlling a plurality of the target scheduled tasks to be executed concurrently.

5. The method according to claim 1, It is characterized in that The step of determining the first time unit corresponding to the current moment from a plurality of time units of a preset time wheel comprises: Obtaining a time unit pointer corresponding to the preset time wheel, wherein the time unit pointer is used to record an identifier of a time unit currently performing task detection; The first time unit is determined according to the time unit pointer.

6. The method according to claim 5, It is characterized in that The method further comprises: The time unit pointer is updated according to a preset time interval.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: In response to obtaining a scheduled task creation request, storing a second to-be-triggered scheduled task corresponding to the scheduled task creation request in a preset disk; The third scheduled task to be triggered is loaded from the preset disk into the target memory corresponding to the preset time wheel, wherein the third scheduled task to be triggered is the second scheduled task to be triggered whose triggering time is within the preset time period.

8. The method according to claim 7, It is characterized in that The step of loading the third to-be-triggered scheduled task from the preset disk into the target memory corresponding to the preset time wheel includes: For each of the third scheduled tasks to be triggered, determine a second time unit corresponding to the third scheduled task to be triggered from the plurality of time units according to the triggering time of the third scheduled task to be triggered; The third scheduled task to be triggered is loaded into any set corresponding to the second time unit.

9. A timed task control device, It is characterized in that include: A first determination module is configured to determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger a received timed task; A second determining module is configured to determine a plurality of target scheduled tasks from the first scheduled tasks to be triggered corresponding to the first time unit; The control module is configured to control the concurrent execution of multiple target scheduled tasks.

10. A timed task control device, It is characterized in that include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to: Determine a first time unit corresponding to the current moment from a plurality of time units of a preset time wheel, wherein the preset time wheel is used to trigger the received scheduled task; For the first scheduled task to be triggered corresponding to the first time unit, determining a plurality of target scheduled tasks from the first scheduled task to be triggered; Control multiple target scheduled tasks to execute concurrently.

11. A computer readable storage medium having computer program instructions stored thereon, It is characterized in that When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 8 are implemented.