Task execution method and device, storage medium and electronic equipment
By pre-creating a task array and adding the target task to the task queue of the target array element, the problem of monitoring delay is solved and timely execution of tasks and efficient monitoring are achieved.
Patent Information
- Application Number
- CN202410725064.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-23
AI Technical Summary
Existing task execution methods are prone to monitoring delays when the number of monitoring tasks is large and cannot meet timeliness requirements, resulting in delayed response to component problems.
By creating a task array in advance, determining the target array element based on the start time of the target task and the initial array element pointed by the pointer, the target task is added to the task queue of the target array element to execute the task in time when the start time is reached.
It solves the problem of monitoring delay and untimely component monitoring caused by many tasks, realizes the timely start and execution of tasks, and improves the timeliness of monitoring.
Smart Images

Figure CN118535307A
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of digital medicine, financial technology and computer technology, and in particular to a task execution method, device, storage medium and electronic equipment. Background Art
[0002] With the continuous development of Internet technology, various applications and online platform systems have emerged, such as online consultation platforms and remote consultation systems in the field of digital medicine, and insurance systems, banking systems, transaction systems, order systems, etc. in the financial field. With the popularization of these applications and systems, monitoring of component tasks in these system platforms has become extremely important.
[0003] However, in the existing task execution method, when the number of monitoring tasks is large, monitoring delays are prone to occur, which cannot meet the timeliness requirements of the monitoring tasks, resulting in the inability to respond quickly and quickly to component problems.
[0004] Therefore, there is an urgent need for a task execution method to solve the problem of monitoring delay in task monitoring in the prior art, which makes it impossible to monitor the task on time. Summary of the invention
[0005] In view of this, the present invention provides a task execution method, device, storage medium and electronic device, the main purpose of which is to solve the current problem of monitoring delay and inability to monitor tasks on time.
[0006] To solve the above problems, the present application provides a task execution method, comprising:
[0007] Pre-create a number of task arrays; each of the task arrays comprises a number of array elements;
[0008] Based on the cycle period of the same task array and the number of array elements in the same task array, configuring each of the task arrays with a pointer that points to each array element in sequence at a predetermined time interval;
[0009] Obtain the target execution time of the target task in real time;
[0010] Determining a target array element corresponding to a target task based on the target execution time and the current array element pointed to by each of the pointers;
[0011] The target task is added to the task queue corresponding to the target array element, so that when the pointer points to the target array element, the target task in the task queue corresponding to the target array element is executed.
[0012] Optionally, configuring, based on the cycle period of the same task array and the number of array elements in the same task array, for each task array a pointer to sequentially point to each array element at a predetermined time interval comprises:
[0013] Determine the predetermined time interval corresponding to each task array based on the cycle period of the same task array and the number of array elements in the same task array;
[0014] A pointer is configured for each of the task arrays, and the predetermined time interval corresponding to the task array is used as the sleep time of the pointer.
[0015] Optionally, determining the target array element corresponding to the target task based on the target execution time and the current array element pointed to by each pointer specifically includes:
[0016] Determining a first time interval based on the target execution time and a current time;
[0017] Based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array, a target task array is determined, and a target array element corresponding to the target task is determined from the target task array.
[0018] Optionally, determining the target task array and determining the target array element corresponding to the target task from the target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array specifically includes:
[0019] Determine a target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array;
[0020] Based on the current array element pointed to by the pointer in the target task array, the predetermined time interval corresponding to the target task array, and the second time interval, a target array element corresponding to the target task is determined from the target task array.
[0021] Optionally, when the pointer points to the target array element, running the target task in the task queue corresponding to the target array element specifically includes:
[0022] When the pointer points to the target array element, a target thread corresponding to each target task in the task queue corresponding to the target array element is obtained;
[0023] Each of the target threads is started to respectively run a corresponding target task based on each of the target threads.
[0024] Optionally, after respectively running the corresponding target tasks based on each of the target threads, the task execution method further includes:
[0025] The target thread for running each target task is stored in a predetermined thread pool, so that when the corresponding target task is executed next time, the target thread corresponding to the target task is called from the thread pool to directly run the target task based on the target thread.
[0026] Optionally, after running the target task in the task queue corresponding to the target array element, the method further includes:
[0027] Delete the target task from the task queue corresponding to the target array element.
[0028] To solve the above problems, the present application provides a task monitoring device, comprising:
[0029] A creation module, used to pre-create a number of task arrays; each of the task arrays comprises a number of array elements;
[0030] A configuration module, configured to configure, for each task array, a pointer to each array element in sequence at a predetermined time interval based on a cycle period of the same task array and the number of array elements in the same task array;
[0031] An acquisition module is used to obtain the target execution time of the target task in real time;
[0032] A determination module, configured to determine a target array element corresponding to a target task based on the target execution time and a current array element pointed to by each of the pointers;
[0033] The monitoring module is used to add the target task to the task queue corresponding to the target array element, so as to run the target task in the task queue corresponding to the target array element when the pointer points to the target array element.
[0034] To solve the above problems, the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned task execution methods are implemented.
[0035] To solve the above problems, the present application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above-mentioned task execution methods when executing the computer program on the memory.
[0036] The task execution method, device, storage medium and electronic device in the present application pre-create a task array, and based on the start time of the target task and the initial array element pointed to by the current pointer, determine the target array element for storing the target task, and then add it to the task queue corresponding to the target array element. In this way, when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, solving the problem of monitoring delay caused by too many tasks and the inability to monitor components on time.
[0037] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0039] Figure 1 A flowchart of a task execution method according to an embodiment of the present application;
[0040] Figure 2 This is a flowchart of a task execution method according to another embodiment of the present application;
[0041] Figure 3 This is a structural block diagram of a task execution device according to another embodiment of the present application;
[0042] Figure 4 This is a structural block diagram of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION
[0043] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0044] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0045] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0046] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0047] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.
[0048] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0049] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0050] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0051] The embodiment of the present application provides a task execution method, which can be applied to the process of monitoring component classes in medical systems, online medical consultation platforms, and platform systems in the financial field, that is, by executing monitoring tasks / target tasks to monitor the corresponding components in the tasks. The method in this embodiment can be specifically applied to electronic devices such as terminals and servers. Taking the application of this method to a server as an example, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms, such as smart medical systems, digital medical platforms, etc. Figure 1 As shown, the task execution method in this embodiment includes the following steps:
[0052] Step S101, pre-create a number of task arrays; each of the task arrays comprises a number of array elements;
[0053] In this step, the task array refers to an array used to store monitoring tasks. The array contains several array elements. Each monitoring task can be stored in the storage space corresponding to the same array element, or each monitoring task can be stored separately in the storage space of the corresponding array element. The storage can be performed specifically according to the execution time of the monitoring task.
[0054] Step S102, based on the cycle period of the same task array and the number of array elements in the same task array, configuring for each task array a pointer that points to each array element in sequence at a predetermined time interval;
[0055] In this step, a cycle period can be set in advance for each task array. The cycle period refers to the time taken for a pointer to point to an array element and then point to the array element again for a certain task array. For example, if there are three task arrays in total, the cycle period can be configured as 80ms for the first task array, 640ms for the second task array, and 5120ms for the third task array.
[0056] After determining the cycle period of each task array, the predetermined time interval corresponding to each task array can be determined based on the cycle period of each task array and the number of array elements in each task array. The time interval is then used as the sleep time of the pointer to configure each task array to periodically point to the array elements.
[0057] Step S103, obtaining the target execution time of the target task in real time;
[0058] In this step, the target execution time refers to the execution time of the target task, such as 0:0:00 on January 1, 2023, or 0:0:00 on December 12, 2025. The target task can be a monitoring task of a component. Specifically, it can be a component of a medical system or an online consultation platform, or a component in a platform system in the financial field.
[0059] Step S104, determining a target array element corresponding to a target task based on the target execution time and the current array element pointed to by each of the pointers;
[0060] In the specific implementation process of this step, the first time interval can be determined by the target execution time and the current time, and then the storage space corresponding to which array element the target task is stored in is determined based on the first time interval.
[0061] Step S105 , adding the target task to the task queue corresponding to the target array element, so that when the pointer points to the target array element, the target task in the task queue corresponding to the target array element is executed.
[0062] In the specific implementation process of this step, a task queue can be created for each array element in advance, and then after the target array element corresponding to the target task is determined, the target task can be stored in the task queue corresponding to the target array element, and when a subsequent pointer points to the target array element, each target task in the task queue corresponding to the target array element can be run simultaneously and in parallel. In this way, the monitoring task / target task can be started and executed in a timely manner, avoiding the problem of delayed start of the monitoring task due to too many monitoring tasks.
[0063] The task execution method in this embodiment creates a task array in advance, and determines the target array element for storing the target task based on the execution time of the target task and the current array element pointed to by the current pointer, and then adds it to the task queue corresponding to the target array element. Therefore, when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, which solves the problem of untimely task execution due to too many tasks, which in turn causes monitoring delays and inability to monitor components on time.
[0064] Based on the above embodiments, another embodiment of the present application provides a task execution method, such as Figure 2 As shown, the task execution method in this embodiment includes the following steps:
[0065] Step S201, pre-create a number of task arrays; each of the task arrays comprises a number of array elements;
[0066] In this step, the task array refers to an array used to store monitoring tasks. The array contains several array elements. Each monitoring task can be stored in the storage space corresponding to the same array element, or each monitoring task can be stored separately in the storage space of the corresponding array element. The storage can be performed specifically according to the execution time of the monitoring task.
[0067] Step S202, determining the predetermined time interval corresponding to each task array based on the cycle period of the same task array and the number of array elements in the same task array;
[0068] In this step, a cycle period may be set in advance for each task array. The cycle period refers to the time taken for a pointer to point to a certain array element and then to point to the array element again for a certain task array.
[0069] Specifically, a pointer to each array element can be configured for the task array in a manner based on the clock operation relationship at predetermined time intervals. For example, a total of 3 task arrays are created, each task array contains 10 array elements, and the cycle period of the first task array can be set to 100 milliseconds. Then the cycle period of the second task array can be: the cycle period of the first task array * the number of array elements in the second task array, which is 1000ms. Similarly, the cycle period of the third task array can be: the cycle period of the second task array * the number of array elements in the third task array, which is 10000ms.
[0070] In this step, after determining the cycle period of each task array, it can be further determined that the predetermined time interval corresponding to the first task array is 10ms; the predetermined time interval corresponding to the second task array is 100ms; and the predetermined time interval corresponding to the third task array is 1000ms.
[0071] Step S203, configuring a pointer for each of the task arrays, and using the predetermined time interval corresponding to the task array as the sleep time of the pointer;
[0072] In this step, after obtaining the predetermined time intervals corresponding to each task array, a pointer can be directly configured for each task array based on each time interval. In this step, the pointer can be a thread, that is, after configuring the pointer / thread for each task array, the thread will first point to the first array element in the task array, and then call the sleep method of the thread. The thread sleeps / hibernates for a predetermined time interval, such as 10ms. When the thread wakes up / restarts after sleeping for 10ms, it immediately points to the next array element adjacent to the first array element, and then calls the sleep method of the thread to sleep for 10ms, and so on, cyclically pointing to each array element in the task array.
[0073] Step S204, obtaining the target execution time of the target task in real time;
[0074] In this step, the target execution time refers to the execution time of the target task, such as 0:0:0 on January 1, 2023, or 0:0:0 on December 12, 2025, etc. The target task may be a monitoring task of a component class.
[0075] Step S205, determining a first time interval based on the target execution time and the current time;
[0076] In the specific implementation process of this step, for example, the current time is 0:0:00 on January 1, 2023, and the target execution time is 0:0:10 on January 1, 2023, so the first time interval can be determined to be 10 seconds. For another example, the current time is 0:0:00 on January 1, 2023, and the target execution time is 0:0:30 on January 1, 2023, so the first time interval can be determined to be 30ms.
[0077] Step S206, determining a target task array and determining a target array element corresponding to the target task from the target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array;
[0078] In the specific implementation process of this step, when determining the target array element, the specific process is as follows:
[0079] Based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array, the target task array is determined; based on the current array element pointed to by the pointer in the target task array, the predetermined time interval corresponding to the target task array, and the second time interval, the target array element corresponding to the target task is determined from the target task array. That is, when the first time interval is 30 milliseconds, the cycle periods of each task array are 100 milliseconds, 1000 milliseconds, and 10000 milliseconds respectively. Thus, the task array corresponding to 100 milliseconds can be determined as the target task array. For another example, when the first time interval is 300 milliseconds, the cycle periods of each task array are 100 milliseconds, 1000 milliseconds, and 10000 milliseconds respectively. Thus, the task array corresponding to 1000 milliseconds can be determined as the target task array. That is, the first time interval needs to be less than the cycle period of the target task array and greater than or equal to the predetermined time interval corresponding to the target task array.
[0080] Then determine that the current array element pointed to by the pointer of the target task array is the first array element, and the time interval between the pointer pointing to two adjacent task arrays in the target task array is 10 milliseconds, thereby determining that the fourth array element in the target task array is the target array element corresponding to the target task.
[0081] Step S207, adding the target task to the task queue corresponding to the target array element, so as to obtain the target thread corresponding to each target task in the task queue corresponding to the target array element when the pointer points to the target array element;
[0082] During the specific implementation of this step, when the pointer points to the target array element, the predetermined thread pool can be searched first to determine whether the target thread corresponding to the target task is found. If the target thread corresponding to the target task is found, the target thread corresponding to the target task can be directly obtained; conversely, if the target thread corresponding to the target task is not found in the predetermined thread pool, the target thread corresponding to the target task can be created to obtain the target thread.
[0083] In this embodiment, after the pointer points to the target array element, or after the target thread corresponding to each target task in the task queue corresponding to the target array element is obtained, the target task can also be deleted from the task queue corresponding to the target array element, so as to prevent the target task in the target array element from being monitored again when the pointer points to the target array element in the next cycle.
[0084] Step S208: start each of the target threads to respectively run corresponding target tasks based on each of the target threads.
[0085] In this step, by starting the target thread, the corresponding target task can be run, thereby realizing component class monitoring in a timely manner.
[0086] During the specific implementation of this embodiment, after the corresponding target tasks are respectively run based on each of the target threads, the target threads used to run each target task can also be stored in a predetermined thread pool, so that when the corresponding target task is executed next time, the target thread corresponding to the target task can be called from the thread pool to run the target task directly based on the target thread, thereby avoiding repeated creation of threads and extra overhead caused by destroying threads.
[0087] The task execution method in this embodiment creates a task array in advance, and determines the target array element for storing the target task based on the start time of the target task and the initial array element pointed to by the current pointer, and then adds it to the task queue corresponding to the target array element, so that when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, solving the problem of monitoring delay caused by too many tasks and failure to monitor components on time. Millisecond-level processing of monitoring tasks is achieved, thereby achieving efficient monitoring of components.
[0088] Another embodiment of the present application provides a task execution device, such as Figure 3 As shown, including:
[0089] The creation module 11 is used to pre-create a number of task arrays; each of the task arrays comprises a number of array elements;
[0090] A configuration module 12, configured to configure, for each task array, a pointer pointing to each array element in sequence at a predetermined time interval based on a cycle period of the same task array and the number of array elements in the same task array;
[0091] An acquisition module 13 is used to acquire the target execution time of the target task in real time;
[0092] A determination module 14, configured to determine a target array element corresponding to a target task based on the target execution time and the current array element pointed to by each of the pointers;
[0093] The monitoring module 15 is used to add the target task to the task queue corresponding to the target array element, so as to run the target task in the task queue corresponding to the target array element when the pointer points to the target array element.
[0094] In the specific implementation process of this embodiment, the configuration module is used to: determine the predetermined time interval corresponding to each task array based on the cycle period of the same task array and the number of array elements in the same task array; configure a pointer for each task array, and use the predetermined time interval corresponding to the task array as the sleep time of the pointer.
[0095] In the specific implementation process of this embodiment, the determination module is specifically used to: determine a first time interval based on the target execution time and the current time; determine the target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array, and determine the target array element corresponding to the target task from the target task array.
[0096] During the specific implementation of this embodiment, the determination module is specifically used to: determine the target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array; determine the target array element corresponding to the target task from the target task array based on the current array element pointed to by the pointer in the target task array, the predetermined time interval corresponding to the target task array, and the second time interval.
[0097] During the specific implementation of this embodiment, the monitoring module is specifically used to: when the pointer points to the target array element, obtain the target thread corresponding to each target task in the task queue corresponding to the target array element; start each target thread to run the corresponding target task based on each target thread.
[0098] During the specific implementation of this embodiment, the task monitoring device also includes a storage module, which is used to: store the target thread used to run each target task in a predetermined thread pool, so that when the corresponding target task is executed next time, the target thread corresponding to the target task is called from the thread pool to run the target task directly based on the target thread.
[0099] In the specific implementation process of this embodiment, the task monitoring device also includes a deletion module, and the deletion module is used to delete the target task from the task queue corresponding to the target array element after running the target task in the task queue corresponding to the target array element.
[0100] The task monitoring device in this embodiment creates a task array in advance, and determines the target array element for storing the target task based on the start time of the target task and the initial array element pointed to by the current pointer, and then adds it to the task queue corresponding to the target array element. In this way, when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, solving the problem of monitoring delay caused by too many tasks and the inability to monitor components on time.
[0101] Another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the following method steps are implemented:
[0102] Step 1: Pre-create a number of task arrays; each of the task arrays includes a number of array elements;
[0103] Step 2: Based on the cycle period of the same task array and the number of array elements in the same task array, each task array is configured with a pointer that points to each array element in sequence at a predetermined time interval;
[0104] Step 3: Obtain the target execution time of the target task in real time;
[0105] Step 4: Determine a target array element corresponding to the target task based on the target execution time and the current array element pointed to by each of the pointers;
[0106] Step 5: Add the target task to the task queue corresponding to the target array element, so that when the pointer points to the target array element, the target task in the task queue corresponding to the target array element is executed.
[0107] The specific implementation process of the above method steps can refer to the embodiments of any of the above task execution methods, and this embodiment will not be repeated here.
[0108] The storage medium in the present application pre-creates a task array, and based on the start time of the target task and the initial array element pointed to by the current pointer, determines the target array element for storing the target task, and then adds it to the task queue corresponding to the target array element. As a result, when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, solving the problem of monitoring delays caused by too many tasks and the inability to monitor components on time.
[0109] Another embodiment of the present application provides an electronic device, such as Figure 4 As shown, at least a memory 1 and a processor 2 are included, the memory 1 stores a computer program, and the processor 2 implements the following method steps when executing the computer program on the memory 1:
[0110] Step 1: Pre-create a number of task arrays; each of the task arrays includes a number of array elements;
[0111] Step 2: Based on the cycle period of the same task array and the number of array elements in the same task array, each task array is configured with a pointer that points to each array element in sequence at a predetermined time interval;
[0112] Step 3: Obtain the target execution time of the target task in real time;
[0113] Step 4: determining a target array element corresponding to the target task based on the target execution time and the current array element pointed to by each of the pointers;
[0114] Step 5: Add the target task to the task queue corresponding to the target array element, so that when the pointer points to the target array element, the target task in the task queue corresponding to the target array element is executed.
[0115] The specific implementation process of the above method steps can refer to the embodiments of any of the above task execution methods, and this embodiment will not be repeated here.
[0116] The electronic device in the present application pre-creates a task array, and based on the start time of the target task and the initial array element pointed to by the current pointer, determines the target array element for storing the target task, and then adds it to the task queue corresponding to the target array element. As a result, when the start time is reached, the pointer will point to the target array element, so that each task in the task queue under the target array element can be executed in time, solving the problem of monitoring delay caused by too many tasks and the inability to monitor components on time.
[0117] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. A task execution method, characterized in that: include: Pre-create a number of task arrays; each of the task arrays comprises a number of array elements; Based on the cycle period of the same task array and the number of array elements in the same task array, configuring each of the task arrays with a pointer that points to each array element in sequence at a predetermined time interval; Obtain the target execution time of the target task in real time; Determining a target array element corresponding to a target task based on the target execution time and the current array element pointed to by each of the pointers; The target task is added to the task queue corresponding to the target array element, so that when the pointer points to the target array element, the target task in the task queue corresponding to the target array element is executed.
2. The method according to claim 1, characterized in that The configuration of each task array based on the cycle period of the same task array and the number of array elements in the same task array, for each task array to sequentially point to each array element at a predetermined time interval, includes: Determine the predetermined time interval corresponding to each task array based on the cycle period of the same task array and the number of array elements in the same task array; A pointer is configured for each of the task arrays, and the predetermined time interval corresponding to the task array is used as the sleep time of the pointer.
3. The method according to claim 1, characterized in that The determining, based on the target execution time and the current array element pointed to by each of the pointers, a target array element corresponding to the target task specifically includes: Determining a first time interval based on the target execution time and a current time; Based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array, a target task array is determined, and a target array element corresponding to the target task is determined from the target task array.
4. The method according to claim 3, characterized in that The step of determining a target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array and determining a target array element corresponding to the target task from the target task array includes: Determine a target task array based on the first time interval, the cycle period of each task array, and the predetermined time interval corresponding to each task array; Based on the current array element pointed to by the pointer in the target task array, the predetermined time interval corresponding to the target task array, and the second time interval, a target array element corresponding to the target task is determined from the target task array.
5. The method according to claim 1, characterized in that When the pointer points to the target array element, running the target task in the task queue corresponding to the target array element includes: When the pointer points to the target array element, a target thread corresponding to each target task in the task queue corresponding to the target array element is obtained; Each of the target threads is started to respectively run a corresponding target task based on each of the target threads.
6. The method according to claim 5, characterized in that After respectively running the corresponding target tasks based on each of the target threads, the method further includes: The target thread for running each target task is stored in a predetermined thread pool, so that when the corresponding target task is executed next time, the target thread corresponding to the target task is called from the thread pool to directly run the target task based on the target thread.
7. The method according to claim 1, characterized in that After running the target task in the task queue corresponding to the target array element, the method further includes: Delete the target task from the task queue corresponding to the target array element.
8. A task monitoring device, characterized in that: include: A creation module, used to pre-create a number of task arrays; each of the task arrays comprises a number of array elements; A configuration module, configured to configure, for each task array, a pointer to each array element in sequence at a predetermined time interval based on a cycle period of the same task array and the number of array elements in the same task array; An acquisition module is used to obtain the target execution time of the target task in real time; A determination module, configured to determine a target array element corresponding to a target task based on the target execution time and a current array element pointed to by each of the pointers; The monitoring module is used to add the target task to the task queue corresponding to the target array element, so as to run the target task in the task queue corresponding to the target array element when the pointer points to the target array element.
9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the task execution method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: The system at least comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the task execution method according to any one of claims 1 to 7 when executing the computer program on the memory.
