Multi-sequence mode task execution method, device, system and storage medium
By adopting a multi-sequence mode task execution method in the Internet of Things system, monitoring the task status and allocating tasks to the corresponding cache interval, the problem of low scheduling efficiency of multi-core processing tasks is solved, and more efficient data processing and priority task processing are achieved.
Patent Information
- Application Number
- CN202111424318.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-31
- Filing Date
- 2021-11-26
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The scheduling of multi-core processing task scheduling in the Internet of Things is low in scheduling and complex in handling different types of tasks.
Using a multi-sequence mode task execution method, by monitoring the task status in a multi-core IoT system, cache the latest tasks to the corresponding cache interval according to task priority, and allocate tasks between execution cores to reduce invalid scheduling and improve data processing. efficiency.
It improves the data processing efficiency of multi-core processing task scheduling in the Internet of Things system, simplifies the scheduling process of different types of tasks, and ensures the processing requirements of priority tasks.
Smart Images

Figure CN114035929B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of network technology, and in particular to a method, device, system and storage medium for executing tasks in multiple sequence modes. Background Art
[0002] The Internet of Things is seen as a major development and transformation opportunity in the information field, and is expected to bring about revolutionary changes. In a more general view, this revolutionary change will have an all-round impact on various fields such as industry, agriculture, property, urban management, safety and fire protection. However, from a technical point of view, the Internet of Things not only changes the subject of data transmission, but also has obvious differences from traditional communications. For example, the characteristic of large-scale Internet of Things is that a large number of users send very small packets sporadically, which is different from traditional cellular communications.
[0003] In order to meet the task scheduling requirements in the Internet of Things, high-performance embedded nodes are usually designed for large-scale Internet of Things to process the data collected in the Internet of Things in parallel, and even use multi-core processing to achieve task scheduling.
[0004] The inventors discovered during the process of scheduling tasks through multi-core processing in a large-scale Internet of Things that a task may be scheduled multiple times between multiple execution cores, resulting in a large amount of useless scheduling, low scheduling efficiency, and complex processing of different types of tasks. Summary of the invention
[0005] The present invention provides a multi-sequence mode task execution method, device, system and storage medium to solve the technical problems of low scheduling efficiency and complex processing of different types of tasks in the prior art Internet of Things multi-core processing task scheduling.
[0006] In a first aspect, an embodiment of the present invention provides a task execution method in a multi-sequence mode, which is used in a multi-core Internet of Things system, including:
[0007] Monitoring the task status in the multi-core Internet of Things system, wherein each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, wherein the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is further provided with a priority cache interval;
[0008] When a new task input is detected, the new task is cached in a first cache interval or a priority cache interval according to the task priority, so as to be allocated to an execution core corresponding to the first cache interval or enter a priority allocation state, and the first cache interval is a cache interval with the longest remaining cache queue in the common cache interval;
[0009] The execution core obtains a new task from the priority cache interval or the corresponding common cache interval in a preset first manner after the current task is processed. If the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, the execution core obtains a new task from the corresponding common cache interval in a preset second manner after the current task is processed. The first manner is to obtain a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails. The second manner is to directly obtain a new task from the corresponding common cache interval.
[0010] Furthermore, the method further comprises:
[0011] If the second method is used to continuously obtain new tasks from the common cache interval for a second set number of times, the first method is switched to obtain new tasks.
[0012] Furthermore, the method further comprises:
[0013] When it is detected that there is an idle cache interval in the ordinary cache interval, at least one task cache is migrated from the second cache interval to the idle cache interval to be allocated to the execution core corresponding to the idle cache interval. The idle cache interval is a cache interval where tasks are cleared, and the second cache interval is the ordinary cache interval with the most remaining tasks.
[0014] Further, when it is detected that there is an idle cache interval in the common cache interval, migrating at least one task cache from the second cache interval to the idle cache interval includes:
[0015] When it is detected that there is an idle cache interval in the ordinary cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the idle cache interval one by one until the number of tasks in the idle cache interval reaches a preset threshold value, or the number of tasks in all ordinary cache intervals is no higher than the preset threshold value.
[0016] Furthermore, when there are multiple second cache intervals, a task cache is randomly migrated from one of the second cache intervals to the idle cache interval.
[0017] Furthermore, when there are multiple first cache intervals, the latest task is randomly cached in one of the first cache intervals.
[0018] Furthermore, the lengths of the cache queues corresponding to each of the execution cores are the same.
[0019] In a second aspect, an embodiment of the present invention further provides a task execution device in a multi-sequence mode, which is used in a multi-core Internet of Things system, comprising:
[0020] A status monitoring unit, used to monitor the task status in the multi-core Internet of Things system, each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval;
[0021] A task cache unit, configured to cache the latest task into a first cache interval or a priority cache interval according to the task priority when a latest task input is detected, so as to allocate the latest task to an execution core corresponding to the first cache interval or enter a priority allocation state, wherein the first cache interval is a cache interval with the longest remaining cache queue in the common cache interval;
[0022] A task acquisition unit is used for the execution core to acquire a new task from the priority cache interval or the corresponding common cache interval in a preset first manner after the current task is processed. If the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, the execution core acquires a new task from the corresponding common cache interval in a preset second manner after the current task is processed. The first manner is to acquire a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly acquire a new task from the corresponding common cache interval.
[0023] Furthermore, the device further comprises:
[0024] The mode switching unit is used to switch to the first mode to obtain new tasks if the second mode is used to continuously obtain new tasks from the common cache interval for a second set number of times.
[0025] Furthermore, the device further comprises:
[0026] The task migration unit is used to migrate at least one task cache from the second cache interval to the free cache interval when it is detected that there is a free cache interval in the common cache interval, so as to be allocated to the execution core corresponding to the free cache interval. The free cache interval is the cache interval where the task is cleared, and the second cache interval is the common cache interval with the most remaining tasks.
[0027] Further, when it is detected that there is an idle cache interval in the common cache interval, migrating at least one task cache from the second cache interval to the idle cache interval includes:
[0028] When it is detected that there is an idle cache interval in the ordinary cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the idle cache interval one by one until the number of tasks in the idle cache interval reaches a preset threshold value, or the number of tasks in all ordinary cache intervals is no higher than the preset threshold value.
[0029] Furthermore, when there are multiple second cache intervals, a task cache is randomly migrated from one of the second cache intervals to the idle cache interval.
[0030] Furthermore, when there are multiple first cache intervals, the latest task is randomly cached in one of the first cache intervals.
[0031] Furthermore, the lengths of the cache queues corresponding to each of the execution cores are the same.
[0032] In a third aspect, an embodiment of the present invention further provides an Internet of Things system, including:
[0033] one or more processors;
[0034] A memory for storing one or more programs;
[0035] When the one or more programs are executed by the one or more processors, the Internet of Things system implements the multi-sequence mode task execution method as described in any one of the first aspects.
[0036] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-sequence mode task execution method as described in the first aspect.
[0037] The above-mentioned multi-sequence mode task execution method, device, Internet of Things system and storage medium monitor the task status in the multi-core Internet of Things system, each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval; when the latest task input is detected, the latest task is cached in the first cache interval or the priority cache interval according to the task priority, so as to be allocated to the execution core corresponding to the first cache interval or enter a priority allocation state, the first cache interval is the longest cache interval in the current remaining cache queue in the common cache interval; after the current task is processed, the execution core obtains a new task from the priority cache interval or the corresponding common cache interval in a preset first manner, if the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, then after the current task is processed, a new task is obtained from the corresponding common cache interval in a preset second manner, the first manner is to obtain a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly obtain a new task from the corresponding common cache interval. This solution allocates a corresponding cache interval to each execution core, and allocates it to the corresponding cache interval when the latest task is received according to the number of tasks in the cache interval, thereby reducing the switching process of task allocation and improving the data processing efficiency of multi-core processing task scheduling in the Internet of Things system. In addition, each execution processes the priority task, which simplifies the scheduling process of different types of tasks and ensures the priority processing requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flowchart of a multi-sequence mode task execution method provided in Embodiment 1 of the present invention;
[0039] Figure 2 A schematic diagram of the structure of a task execution device with multiple sequence modes provided in the second embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the structure of an Internet of Things system provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0042] It should be noted that due to space limitations, this application description does not list all optional implementation methods. After reading this application description, those skilled in the art should be able to understand that as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0043] Each embodiment is described in detail below.
[0044] Embodiment 1
[0045] Figure 1 A flowchart of a multi-sequence mode task execution method provided in Embodiment 1 of the present invention. The multi-sequence mode task execution method provided in the embodiment can be executed by various operating devices for multi-sequence mode task execution, and the operating device can be implemented by software and / or hardware, and the operating device can be composed of two or more physical entities, or can be composed of one physical entity.
[0046] Specifically, refer to Figure 1 The task execution method of the multi-sequence mode specifically includes:
[0047] Step S101: monitor the task status in the multi-core Internet of Things system, each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval.
[0048] In the architecture of the Internet of Things system, the aggregation node is a key component of the architecture. In the specific implementation process, the multi-core Internet of Things system is designed based on the embedded multi-core processor. Multiple execution cores in the embedded multi-core processor can perform calculations simultaneously, thereby bringing higher processing efficiency for data collection in the multi-core Internet of Things system under limited resource configuration.
[0049] For embedded multi-core processors, each processing core cannot process all the tasks assigned to it at the same time, that is, the tasks assigned to an IoT node may need to queue up, and the tasks in the queue state are temporarily cached in the first-in-first-out cache queue. According to the prior art, these tasks may be continuously scheduled and switched to different execution cores for execution according to the actual processing progress of the execution core during the queuing process, which is equivalent to an invalid scheduling process in the task scheduling process.
[0050] In this solution, in order to improve the scheduling efficiency, the first-in-first-out cache queue is segmented, each segment corresponds to an execution core, and the tasks specifically assigned to a certain execution core are first cached in the corresponding cache interval. Through this corresponding allocation of execution cores and cache intervals, the association between the task and the execution core that processes the task is fixed in a relatively static manner to minimize invalid task allocation scheduling. When the first-in-first-out cache queue is specifically segmented, the cache interval assigned to each execution core can be set to be the same, that is, the length of the cache queue corresponding to each execution core is the same, thereby ensuring that the upper limit of tasks assigned to each execution core is the same, and the amount of tasks assigned to each execution core is relatively balanced.
[0051] In the actual processing process, in order to meet the priority processing requirements for priority tasks, all priority tasks are cached in the corresponding priority cache interval, and all execution cores can obtain priority tasks from the priority cache interval for processing.
[0052] Step S102: When a new task input is detected, the new task is cached in a first cache interval or a priority cache interval according to the task priority, so as to be allocated to an execution core corresponding to the first cache interval or enter a priority allocation state. The first cache interval is the cache interval with the longest remaining cache queue in the ordinary cache interval.
[0053] For IoT nodes, when receiving the latest task input, the latest task needs to be assigned to an execution core in the embedded multi-core processor of the IoT node. With the existing processing method, when the current execution cores all have tasks to be executed, the first-in-first-out cache queue is managed as a whole. The allocation process of a task to a specific execution core may be adjusted continuously due to changes in the task processing progress, resulting in the task processing status of all execution cores to be continuously monitored when the task is cached in the first-in-first-out cache queue, and then the task allocation is continuously adaptively adjusted. In this scheme, ordinary latest tasks are directly assigned to the execution core with the least current processing tasks, and the tasks assigned to each execution core are relatively fixed. The basic processing principle is to process tasks with the initially assigned execution core, reducing the allocation changes during the task waiting process. Priority latest tasks are directly cached in the priority cache interval, and are processed by all execution cores by default.
[0054] In order to minimize the waiting time of each task in the queue, the latest task detected will first determine the current task status of each execution core. The current task status is confirmed from the cache interval corresponding to the execution core. Generally speaking, the cache interval has the least number of currently cached tasks, so the occupied cache queue is shorter and the remaining cache queue is longer. The cache interval with the longest remaining cache queue is identified as the first cache interval, and the latest task is allocated to the first cache interval. After the latest task is cached in the first cache interval, the corresponding relationship between the cache interval and the execution core is used to determine the execution core to which the latest task is assigned, and the task can wait in the cache interval for processing by the corresponding execution core.
[0055] In the actual processing process, there may be multiple cache intervals with the same remaining tasks, that is, there may be multiple cache intervals that are first cache intervals. When there are multiple first cache intervals, the latest task is randomly cached in one of the first cache intervals.
[0056] Step S103: After the current task is processed, the execution core obtains a new task from the priority cache interval or the corresponding common cache interval in a preset first manner. If the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, then after the current task is processed, the execution core obtains a new task from the corresponding common cache interval in a preset second manner. The first manner is to obtain a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails. The second manner is to directly obtain a new task from the corresponding common cache interval.
[0057] In the specific task processing process, in order to ensure the processing of priority tasks, when the execution core obtains a new task after the current task is executed, considering the priority processing of priority tasks, each execution core first tries to obtain a new task from the priority cache interval for processing, and obtains a new task from the corresponding common cache interval for processing when the acquisition fails, thereby ensuring the orderly processing of common tasks and realizing the priority processing of priority tasks. However, in an Internet of Things system, priority tasks are generally a small number of tasks, so there is a considerable probability that the priority cache interval is emptied. In response to the situation where the priority cache interval is emptied, the execution core that fails to obtain tasks from the priority cache interval for a certain number of times (i.e., the first set number of times) can be suspended from obtaining tasks from the priority cache interval, and only obtains new tasks from the corresponding common cache interval, thereby reducing invalid access to the priority cache interval and improving data processing efficiency. Because there are multiple execution cores, and the processing rhythm of each execution core is different, when a new priority task is added to the priority cache interval, the Internet of Things system can still basically ensure the orderly processing of priority tasks.
[0058] To ensure the normal execution of the priority task, the task acquisition method can also be switched in step S104:
[0059] Step S104: if the second method is used to continuously obtain new tasks from the common cache interval for a second set number of times, switching to the first method to obtain new tasks.
[0060] During the actual processing, even if there is no priority task that needs to be processed at present, a priority task may be generated at any time. To avoid missing the processing of the priority task, the execution core cannot use the second method to obtain new tasks from the corresponding ordinary cache interval for a long time. Instead, it needs to confirm whether there is a priority task that needs to be processed after a certain number of ordinary tasks have been processed continuously (i.e., the second set number of times), that is, switch to the first method and prioritize obtaining new tasks from the priority cache interval.
[0061] To adapt to the differences in the progress of general task processing that may be caused by differences in the specific task processing process, the present solution further includes step S105 to achieve fine-tuning of task allocation.
[0062] Step S105: When it is detected that there is an idle cache interval in the ordinary cache interval, at least one task cache is migrated from the second cache interval to the idle cache interval to be allocated to the execution core corresponding to the idle cache interval. The idle cache interval is a cache interval where tasks are cleared, and the second cache interval is the ordinary cache interval with the most remaining tasks.
[0063] When each execution core processes tasks, the task processing speed may not be exactly the same due to the complexity of the task, data transmission speed, bandwidth allocation, etc., which ultimately leads to different task queuing conditions in the cache interval. For example, some execution cores may have processed all tasks, that is, the tasks in the corresponding cache interval have been cleared; while the cache intervals corresponding to other execution cores still have multiple tasks queued. At this time, one or more tasks can be migrated from the queued cache interval to the idle cache interval, thereby improving the overall task processing speed and avoiding the situation where the execution core is idle.
[0064] When performing task migration, multiple tasks are not migrated from other cache intervals to the free cache interval at one time, but are migrated one by one to determine the status of the number of tasks in all common cache intervals. In general, when it is detected that there is a free cache interval in the common cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the free cache interval one by one until the number of tasks in the free cache interval reaches the preset threshold value, or the number of tasks in all common cache intervals is not higher than the preset threshold value. In the process of migrating tasks one by one, it is determined whether the previously confirmed free cache interval reaches the preset threshold value. If the preset threshold value is reached, it means that the free cache interval already has a certain number of tasks to be processed, and no tasks are migrated to the free cache interval, waiting for the latest task to be assigned to the cache interval. At the same time, in order to avoid too few tasks in other cache intervals, when the outward migration reaches a certain extent so that the number of tasks in other cache intervals is small, that is, when the number of remaining tasks in other cache intervals is not higher than the preset threshold value, the migration is stopped.
[0065] In the specific processing process, it is possible that there are the most remaining tasks in multiple cache intervals, that is, there are multiple second cache intervals. At this time, instead of directly migrating a task from each second cache interval to the free cache interval, a task cache is randomly migrated from one of the second cache intervals to the free cache interval, and the method of successive migration confirmation is still adopted. After each migration of a task, the remaining tasks in the free cache interval and the tasks in other cache intervals are judged until the set number of tasks is reached and the migration is stopped. The task migrated to the free cache interval can be the latest cached task or the earliest cached task.
[0066] In addition to the above-mentioned preset threshold value, the judgment basis for stopping migration of other cache intervals can also be based on comparison with tasks in the free cache interval. If the remaining tasks in other cache intervals are no more than one task in the free cache interval, task migration will not be performed.
[0067] It should be noted that the first cache interval and the second cache interval mentioned in this embodiment are not fixed one or more cache intervals. They are only distinguished and defined according to the state of the cache interval at a certain moment. They are special identifiers for the convenience of describing the embodiment. Their functions are no different from other cache intervals. After the current latest task is cached to a first cache interval, the first cache interval may no longer be the first cache interval when the next latest task is cached. Moreover, the idle cache interval is defined as an idle cache interval during the entire migration process, rather than being defined as an idle cache interval only when there are no tasks in it. From the perspective of the task queuing state, the state definition of the idle cache interval ends only after the task migration of a certain cache interval is completed.
[0068] At the same time, in the present scheme, it should be understood that step S101-step S105 exist as a whole scheme, and are not strictly executed in the order described in the previous text. When the multi-core Internet of Things system processes tasks, the allocation of the latest task and the migration of tasks can be executed according to the actual monitoring results. When the latest task is monitored, the latest task is cached; when an idle cache interval is monitored, the task is migrated to the idle cache interval. If the latest task is continuously monitored, step S102 and step S103 are continuously executed to cache and process the task. If an idle cache interval is continuously monitored, step S105 is continuously executed to fine-tune the task allocation.
[0069] In the above, the task status in the multi-core Internet of Things system is monitored, and each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, and the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval; when the latest task input is detected, the latest task is cached in the first cache interval or the priority cache interval according to the task priority, so as to be allocated to the execution core corresponding to the first cache interval or enter a priority allocation state, and the first cache interval is the longest cache interval in the current remaining cache queue in the common cache interval; after the current task is processed, the execution core obtains a new task from the priority cache interval or the corresponding common cache interval in a preset first manner, and if the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, after the current task is processed, the new task is obtained from the corresponding common cache interval in a preset second manner, and the first manner is to obtain a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly obtain a new task from the corresponding common cache interval. This solution allocates a corresponding cache interval to each execution core, and allocates it to the corresponding cache interval when the latest task is received according to the number of tasks in the cache interval, thereby reducing the switching process of task allocation and improving the data processing efficiency of multi-core processing task scheduling in the Internet of Things system. In addition, each execution processes the priority task, which simplifies the scheduling process of different types of tasks and ensures the priority processing requirements.
[0070] Embodiment 2
[0071] Figure 2 This is a schematic diagram of the structure of a multi-sequence mode task execution device provided by the second embodiment of the present invention. Figure 2 The multi-sequence mode task execution device includes: a state monitoring unit 210, a task cache unit 220 and a task acquisition unit 230.
[0072] Among them, the state monitoring unit 210 is used to monitor the task state in the multi-core Internet of Things system, each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, the common cache interval is a section of the first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval; the task cache unit 220 is used to cache the latest task to the first cache interval or the priority cache interval according to the task priority when the latest task input is detected, so as to be allocated to the execution core corresponding to the first cache interval or enter the priority allocation state, the first cache interval is the cache interval with the longest current remaining cache queue in the common cache interval; the task acquisition unit 230 is used for the execution core to acquire a new task from the priority cache interval or the corresponding common cache interval in a preset first manner after the current task is processed. If the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, the new task is acquired from the corresponding common cache interval in a preset second manner after the current task is processed. The first manner is to acquire a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly acquire a new task from the corresponding common cache interval.
[0073] Based on the above embodiment, the device further includes:
[0074] The mode switching unit is used to switch to the first mode to obtain new tasks if the second mode is used to continuously obtain new tasks from the common cache interval for a second set number of times.
[0075] Based on the above embodiment, the device further includes:
[0076] The task migration unit is used to migrate at least one task cache from the second cache interval to the free cache interval when it is detected that there is a free cache interval in the common cache interval, so as to be allocated to the execution core corresponding to the free cache interval. The free cache interval is the cache interval where the task is cleared, and the second cache interval is the common cache interval with the most remaining tasks.
[0077] Based on the above embodiment, when it is detected that there is an idle cache interval in the common cache interval, migrating at least one task cache from the second cache interval to the idle cache interval includes:
[0078] When it is detected that there is an idle cache interval in the ordinary cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the idle cache interval one by one until the number of tasks in the idle cache interval reaches a preset threshold value, or the number of tasks in all ordinary cache intervals is no higher than the preset threshold value.
[0079] On the basis of the above embodiment, when there are multiple second cache intervals, a task cache is randomly migrated from one of the second cache intervals to the free cache interval.
[0080] On the basis of the above embodiment, when there are multiple first cache intervals, the latest task is randomly cached in one of the first cache intervals.
[0081] Based on the above embodiment, the lengths of the cache queues corresponding to each of the execution cores are the same.
[0082] The multi-sequence mode task execution apparatus provided in the embodiment of the present invention is included in the multi-sequence mode task execution device, and can be used to execute any multi-sequence mode task execution method provided in the above-mentioned embodiment 1, and has corresponding functions and beneficial effects.
[0083] Embodiment 3
[0084] Figure 3 This is a schematic diagram of the structure of an Internet of Things node device provided in the third embodiment of the present invention. The Internet of Things node device is used to form an Internet of Things system, thereby comprehensively implementing the task scheduling in this solution. Figure 3 As shown, the IoT node device includes a processor 310, a memory 320, an input device 330, an output device 340, and a communication device 350; the number of processors 310 in the IoT node device can be one or more. Figure 3 A processor 310 is taken as an example; the processor 310, the memory 320, the input device 330, the output device 340 and the communication device 350 in the IoT node device can be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0085] The memory 320, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the multi-sequence mode task execution method in the embodiment of the present invention (for example, the state monitoring unit 210, the task cache unit 220 and the task acquisition unit 230 in the multi-sequence mode task execution device). The processor 310 executes various functional applications and data processing of the IoT node device by running the software programs, instructions and modules stored in the memory 320, that is, realizes the above-mentioned multi-sequence mode task execution method.
[0086] The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the IoT node device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 320 may further include a memory remotely arranged relative to the processor 310, and these remote memories may be connected to the IoT node device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0087] The input device 330 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the IoT node device. The output device 340 may include a display device such as a display screen.
[0088] The above-mentioned Internet of Things node device includes a multi-sequence mode task execution device, which can be used to execute any multi-sequence mode task execution method and has corresponding functions and beneficial effects.
[0089] Embodiment 4
[0090] An embodiment of the present invention also provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to perform relevant operations in the multi-sequence mode task execution method provided in any embodiment of the present application, and have corresponding functions and beneficial effects.
[0091] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.
[0092] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0093] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0094] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0095] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0096] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A multi-sequence mode task execution method for multi-core Internet of Things systems, It is characterized in that include: Monitoring the task status in the multi-core Internet of Things system, wherein each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, wherein the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is further provided with a priority cache interval; When a new task input is detected, the new task is cached in a first cache interval or a priority cache interval according to the task priority, so as to be allocated to an execution core corresponding to the first cache interval or enter a priority allocation state, and the first cache interval is a cache interval with the longest remaining cache queue in the common cache interval; The execution core obtains a new task from the priority cache interval or the corresponding common cache interval in a preset first manner after the current task is processed. If the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, the execution core obtains a new task from the corresponding common cache interval in a preset second manner after the current task is processed. The first manner is to obtain a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly obtain a new task from the corresponding common cache interval. If the second method is used to continuously obtain new tasks from the common cache interval for a second set number of times, switching to the first method to obtain new tasks; When it is detected that there is an idle cache interval in the common cache interval, the second cache interval is confirmed one by one, and at least one task cache is migrated from the second cache interval to the idle cache interval one by one, the idle cache interval is the cache interval where the task is cleared, and the second cache interval is the common cache interval with the most remaining tasks; When it is detected that there is an idle cache interval in the common cache interval, migrating at least one task cache from the second cache interval to the idle cache interval includes: When it is detected that there is an idle cache interval in the common cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the idle cache interval one by one. In the process of migrating tasks one by one, it is judged whether the idle cache interval reaches a preset threshold value, and the state of the number of tasks in the common cache interval is judged. If the number of tasks in the idle cache interval reaches the preset threshold value, the task is no longer migrated to the idle cache interval, or the number of tasks in all common cache intervals is not higher than the preset threshold value, the task migration is stopped; Among them, when there are multiple second cache intervals, a task cache is randomly migrated from one of the second cache intervals to the free cache interval, and after each migration of a task cache to the free cache interval, it is determined whether the free cache interval reaches a preset threshold value, and the task quantity status in the ordinary cache interval is determined. If the task quantity in the free cache interval reaches the preset threshold value, the task will no longer be migrated to the free cache interval, or the task quantity in all ordinary cache intervals is not higher than the preset threshold value, then the task migration is stopped.
2. The method according to claim 1, It is characterized in that When there are multiple first cache intervals, the latest task is randomly cached in one of the first cache intervals.
3. The method according to claim 1, It is characterized in that The length of the cache queue corresponding to each execution core is the same.
4. A multi-sequence mode task execution device for a multi-core Internet of Things system, It is characterized in that include: A status monitoring unit, used to monitor the task status in the multi-core Internet of Things system, each execution core of the multi-core Internet of Things system is respectively allocated a common cache interval, the common cache interval is a section of a first-in-first-out cache queue in the multi-core Internet of Things system, and the first-in-first-out cache queue is also provided with a priority cache interval; A task cache unit, configured to cache the latest task into a first cache interval or a priority cache interval according to the task priority when a latest task input is detected, so as to allocate the latest task to an execution core corresponding to the first cache interval or enter a priority allocation state, wherein the first cache interval is a cache interval with the longest remaining cache queue in the common cache interval; a task acquisition unit, configured for the execution core to acquire a new task from the priority cache interval or the corresponding common cache interval in a preset first manner after the current task is processed, and if the acquisition of a new task from the priority cache interval fails for a first set number of consecutive times, then acquire a new task from the corresponding common cache interval in a preset second manner after the current task is processed, wherein the first manner is to acquire a new task from the corresponding common cache interval when the acquisition of a new task from the priority cache interval fails, and the second manner is to directly acquire a new task from the corresponding common cache interval; a mode switching unit, configured to switch to the first mode to obtain new tasks if the second mode is used to continuously obtain new tasks from the common cache interval for a second set number of times; A task migration unit is used to successively confirm the second cache intervals when it is detected that there is an idle cache interval in the common cache interval, and migrate at least one task cache from the second cache interval to the idle cache interval one by one, wherein the idle cache interval is a cache interval where tasks are cleared, and the second cache interval is the common cache interval with the most remaining tasks; When it is detected that there is an idle cache interval in the common cache interval, migrating at least one task cache from the second cache interval to the idle cache interval includes: When it is detected that there is an idle cache interval in the common cache interval, the second cache interval is confirmed one by one, and the task cache is migrated from the second cache interval to the idle cache interval one by one. In the process of migrating tasks one by one, it is judged whether the idle cache interval reaches a preset threshold value, and the state of the number of tasks in the common cache interval is judged. If the number of tasks in the idle cache interval reaches the preset threshold value, the task is no longer migrated to the idle cache interval, or the number of tasks in all common cache intervals is not higher than the preset threshold value, the task migration is stopped; Among them, when there are multiple second cache intervals, a task cache is randomly migrated from one of the second cache intervals to the free cache interval, and after each migration of a task cache to the free cache interval, it is determined whether the free cache interval reaches a preset threshold value, and the task quantity status in the ordinary cache interval is determined. If the task quantity in the free cache interval reaches the preset threshold value, the task will no longer be migrated to the free cache interval, or the task quantity in all ordinary cache intervals is not higher than the preset threshold value, then the task migration is stopped.
5. An Internet of Things system, It is characterized in that include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the Internet of Things system implements the multi-sequence mode task execution method as described in any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the multi-sequence mode task execution method as described in any one of claims 1-3 is implemented.
Citation Information
Patent Citations
Task scheduling method and related non-transitory computer readable medium for dispatching task in multi-core processor system based at least partly on distribution of tasks sharing same data and / or accessing same memory address (ES)
CN104995603A
Storage management device, storage system control device, storage medium storing storage management program, and storage system
US20090150629A1
