Task running method and device, equipment and storage medium

By dynamically adjusting the priority of non-real-time tasks in the real-time system, the problem of long-term blocking of non-real-time tasks is solved, the overall performance of the system is improved, and the reasonable allocation of resources is achieved.

CN119576489APending Publication Date: 2025-03-07CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411596939.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In existing real-time systems, non-real-time tasks may block for a long time, affecting the overall system performance, especially when non-real-time tasks and real-time tasks compete for sharing resources.

Method used

By dynamically adjusting the priority of non-real-time tasks, when non-real-time tasks give up shared resources to real-time tasks, they increase their priority so that they are higher than other non-real-time tasks, thereby prioritizing the acquisition of resources in resource redistribution.

Benefits of technology

It effectively reduces the blocking time of non-real-time tasks, improves the overall performance of the system, and ensures the rationality and efficiency of resource allocation of real-time tasks and non-real-time tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576489A_ABST
    Figure CN119576489A_ABST
Patent Text Reader

Abstract

The invention provides a task running method and device, equipment and a storage medium, and relates to the technical field of computer systems. The method comprises the following steps: starting a non-real-time task; the real-time tasks occupy shared resources; under the condition that the real-time tasks require the shared resources, allocating the shared resources occupied by the non-real-time tasks to the real-time tasks; and adjusting the priority of the non-real-time task to enable the priority of the non-real-time task to be higher than the priorities of other non-real-time tasks. The task running method can reasonably schedule execution of non-real-time tasks under the condition of ensuring the certainty of the real-time tasks, so that the overall performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer systems, and in particular to a task execution method, device, equipment and storage medium. Background Art

[0002] With the development and popularization of computer technology, people's requirements for computer system response speed and processing efficiency are increasing. Traditional batch processing systems and time-sharing systems can no longer meet the time-sensitive requirements in certain specific application scenarios. Therefore, real-time systems have emerged and become the key to solving time constraint problems. An important feature of real-time systems is that they need to ensure that real-time tasks must be executed within a predictable time range.

[0003] In existing real-time systems, when real-time tasks and non-real-time tasks need to access the same shared resources, the non-real-time tasks may preempt the shared resources in advance. At this time, the system allows the non-real-time tasks to give up the shared resources as much as possible in order to ensure the determinism of the real-time tasks. However, such a mechanism can easily cause the non-real-time tasks to be blocked for a long time, thus affecting the overall performance of the system. Summary of the invention

[0004] The present application provides a task running method, apparatus, device and storage medium, which can avoid long-term blocking of non-real-time tasks and ensure the overall performance of the system.

[0005] In a first aspect, the present application provides a task running method, the method comprising: starting a non-real-time task; the non-real-time task occupies shared resources; when there is a real-time task requiring shared resources, allocating the shared resources occupied by the non-real-time task to the real-time task; adjusting the priority of the non-real-time task so that the priority of the non-real-time task is higher than that of other non-real-time tasks.

[0006] The embodiment of the present application provides a task running method, when the non-real-time task occupying shared resources is running, if the non-real-time task gives up the shared resources to the real-time task, the priority of the non-real-time task is increased so that the priority of the non-real-time task is higher than the priority of other non-real-time tasks. This method can realize the redistribution of resources by dynamically adjusting the priority. When the non-real-time task gives up the shared resources to the real-time task, the priority of the non-real-time task is increased to ensure that the non-real-time task can obtain the resources first among the same tasks, reduce the blocking time of the non-real-time task, and improve the overall performance of the system.

[0007] In a possible implementation manner, the method further includes: after the non-real-time task occupies the shared resource, adjusting the priority of the non-real-time task so that the priority of the non-real-time task is lower than the priorities of other non-real-time tasks.

[0008] Another possible implementation manner is to lower the priority of the real-time task when the real-time task occupies shared resources.

[0009] Another possible implementation is to allocate the running resources according to the priority of each task when there are multiple tasks requiring the same type of resources, wherein the tasks include real-time tasks and non-real-time tasks.

[0010] In another possible implementation, the operating resources include shared resources and / or computing resources, and the computing resources include central processing unit (CPU) resources and / or graphics processing unit (GPU) resources.

[0011] In another possible implementation, the initial priorities of different non-real-time tasks are the same.

[0012] In another possible implementation, the adjusted priority of the non-real-time task does not exceed the priority of the real-time task. The reduced priority of the real-time task is not lower than the priority of the non-real-time task.

[0013] In a second aspect, the present application provides a task execution device, which includes: a startup module, an allocation module and an adjustment module.

[0014] The startup module is used to start real-time tasks or non-real-time tasks;

[0015] The allocation module is used to allocate the shared resources occupied by the non-real-time tasks to the real-time tasks;

[0016] In a possible implementation, the allocation module is further used to allocate resources according to the priority of each task when there are multiple tasks requiring the same type of resources. Tasks include real-time tasks and non-real-time tasks.

[0017] The adjustment module is used to adjust the priorities of the real-time task and the non-real-time task. In a possible implementation, the adjustment module is also used to adjust the priority of the non-real-time task after the non-real-time task occupies the shared resource, so that the priority of the non-real-time task is lower than the priority of other non-real-time tasks.

[0018] In another possible implementation, the adjustment module is further configured to reduce the priority of the real-time task when the real-time task occupies shared resources.

[0019] In another possible implementation, the adjustment module is further configured to ensure that the priority of the non-real-time task after adjustment does not exceed the priority of the real-time task, and that the priority of the real-time task after adjustment is not lower than the priority of the non-real-time task.

[0020] In another possible implementation, the operating resources include shared resources and / or computing resources, and the computing resources include central processing unit (CPU) resources and / or graphics processing unit (GPU) resources.

[0021] In another possible implementation, the initial priorities of different non-real-time tasks are the same.

[0022] In another possible implementation, the adjusted priority of the non-real-time task does not exceed the priority of the real-time task. The reduced priority of the real-time task is not lower than the priority of the non-real-time task.

[0023] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory; the memory stores instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method of the first aspect above.

[0024] In a fourth aspect, the present application provides a computer-readable storage medium, which includes: computer software instructions; when the computer software instructions are executed in an electronic device, the electronic device implements the method of the first aspect above.

[0025] In a fifth aspect, the present application provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the steps of the related method described in the first aspect above to implement the method of the first aspect above.

[0026] The beneficial effects of the second to fifth aspects mentioned above refer to the corresponding description of the first aspect and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A flowchart of a task execution method provided in an embodiment of the present application;

[0028] Figure 2 A flowchart of another task execution method provided in an embodiment of the present application;

[0029] Figure 3 A flowchart of another task execution method provided in an embodiment of the present application;

[0030] Figure 4 A flowchart of a task execution method provided in an embodiment of the present application;

[0031] Figure 5 A schematic diagram of the composition of a task running device provided in an embodiment of the present application;

[0032] Figure 6 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0034] It should be noted that, in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0035] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. are not limiting the quantity and execution order.

[0036] The technical terms involved in the embodiments of the present application are explained below.

[0037] 1. Real-time task: refers to a task (process or thread) that must be completed under strict time constraints, that is, the task execution must be within the specified deadline. For example: input / output (I / O) device interrupt processing, clock interrupt processing, etc.

[0038] 2. Non-real-time tasks: refers to tasks (processes or threads) that do not require immediate or instant response during execution, such as file transfer, data backup, and log processing.

[0039] 3. Shared resources: refers to resources in a computing device that can be used by multiple concurrently executed tasks in memory. And only one task is allowed to access them at a time. These resources can be hardware resources (such as printers, storage devices, etc.) or software resources (such as files, databases, etc.).

[0040] 4. Blocked state: refers to a process or thread that is temporarily unable to continue running due to some reason (or event), so it abandons execution and waits for the factors affecting its operation to be eliminated. It should be mentioned that the reason for the blocked state mentioned in this application is that the task loses the computing resources required for execution.

[0041] Real-time systems are a special type of computer system that is designed and implemented to respond to external events or data inputs within a specific time. Such systems are widely used in aerospace, medical, and industrial control, and have extremely high requirements for time sensitivity and reliability.

[0042] The most important feature of a real-time system is the real-time task in the system, which must be executed within a predictable time range. When a real-time task is awakened or actively executed, it must be able to immediately preempt the resources of other low-priority tasks for execution.

[0043] In existing real-time systems, to ensure data consistency, when multiple tasks access the same shared resource at the same time, a shared lock needs to be configured for the shared resource to ensure that only one task accesses the data at a time. In addition, tasks are executed according to priority, allowing tasks with higher priority to preempt shared resources. However, this resource allocation method will cause a short priority inversion phenomenon during the use of shared locks. That is, non-real-time tasks may preempt shared resources in advance, thereby extending the waiting time of real-time tasks. To ensure the execution of real-time tasks, the system usually allows non-real-time tasks that are currently occupying shared resources to give up resources as much as possible. Although such a mechanism ensures the determinism of real-time tasks, it may also bring another problem: non-real-time tasks that give up resources enter a blocked state and need to wait for the resources to become available again and their priority to be high enough to reacquire the resources before they can continue to execute. If there are multiple non-real-time tasks in the system competing for the same resource, it is easy for non-real-time tasks that are about to end their operation (such as the non-real-time tasks that release shared resources mentioned above) to be blocked for a long time due to priority inversion, thereby affecting the overall performance of the system.

[0044] Based on this, an embodiment of the present application provides a task running method, which, when running a non-real-time task occupying shared resources, if the non-real-time task gives up the shared resources to the real-time task, then the priority of the non-real-time task is increased so that the priority of the non-real-time task is higher than the priority of other non-real-time tasks. This method can achieve resource redistribution by dynamically adjusting the priority. When the non-real-time task gives up the shared resources to the real-time task, by increasing the priority of the non-real-time task, it is ensured that the non-real-time task can obtain resources first among similar tasks, thereby reducing the blocking time of the non-real-time task and improving the overall performance of the system.

[0045] The task running method provided in the present application can be applied to a computing device configured with a real-time system. The computing device can be a server cluster composed of multiple servers, or a single server, or a computer, or a processor or processing chip in a server or computer. The embodiments of the present application do not limit the specific device form of the computing device.

[0046] Figure 1 The following is a flow chart of a task execution method provided in an embodiment of the present application. Figure 1 As shown, the task running method provided in the present application can be implemented by the above computing device, and specifically includes the following steps:

[0047] In order to facilitate understanding of the steps of the present application, it is necessary to explain the task priority structure in the present application: real-time task priority +1~N> real-time task priority> real-time task priority-1~N> non-real-time task+1~N> non-real-time task> non-real-time task-1~N, N is a positive integer. This structure allows the task priority to be reduced or increased under the premise that the real-time task priority is greater than the non-real-time task priority.

[0048] S101, start a non-real-time task.

[0049] Among them, non-real-time tasks occupy shared resources.

[0050] The computing device receives a non-real-time task execution request and starts the non-real-time task. The non-real-time task has a read and write requirement for shared resources and will occupy the shared resources during the running process.

[0051] In some embodiments, the computing device may initiate a non-real-time task upon receiving a user instruction.

[0052] In other embodiments, the computing device may automatically start the non-real-time task, such as the computing device is pre-configured to start at a certain time, or the non-real-time task is called to start when other tasks are running.

[0053] S102: When there is a real-time task requiring shared resources, the shared resources occupied by the non-real-time task are allocated to the real-time task.

[0054] The computing device receives the real-time task execution request and starts the real-time task. In the case where the real-time task also requires the occupied shared resources, since the priority of the real-time task is greater than the priority of the non-real-time task, the computing device allocates the shared resources occupied by the non-real-time task to the real-time task.

[0055] It should be noted that the specific resource allocation process can be referred to in the relevant technology, and the embodiments of the present application do not impose any specific limitations on this.

[0056] In some embodiments, when there are multiple tasks requiring the same type of resources, the operating resources are allocated according to the priority of each task; the tasks include real-time tasks and non-real-time tasks.

[0057] In some embodiments, the operating resources include shared resources and / or computing resources; the computing resources include central processing unit (CPU) resources and / or graphics processing unit (GPU) resources.

[0058] It should be understood that the priority of a real-time task is higher than that of a non-real-time task, so when a non-real-time task releases shared resources, it also releases computing resources (such as CPU resources), and thus enters a blocked state.

[0059] It is understandable that the core feature of a real-time system is the real-time task. Setting a higher priority for the real-time task in the computing device can immediately obtain the resources required for execution when the real-time task is started, thereby ensuring the determinism of the real-time task.

[0060] S103: Adjust the priority of the non-real-time task so that the priority of the non-real-time task is higher than the priorities of other non-real-time tasks.

[0061] After the non-real-time task gives up the shared resources, the computing device increases the priority of the non-real-time task.

[0062] As mentioned above, after a non-real-time task abandons a resource, it needs to wait for the resource to become available again and needs to have a high enough priority before it can obtain access to the resource. If there are other non-real-time tasks competing for the same resource during this process, the non-real-time task will be blocked for a long time. In this application, the priority of the non-real-time task that abandons the resource is increased so that it can obtain the resource first among the same tasks, which can reduce the blocking time of the non-real-time task and ensure that the non-real-time task can also be executed within a reasonable time range.

[0063] Exemplarily, the computing device maintains a task list (process list), which records the identifier and priority value of each task. When the computing device needs to adjust the priority of a non-real-time task, it finds the corresponding non-real-time task according to the identifier and adds n to the priority value of the task to improve the priority of the non-real-time task. For example, n is a positive integer, and the value of n can be calculated based on factors such as the importance of the task giving up resources and the deadline of the non-real-time task.

[0064] In some embodiments, the adjusted priority of the non-real-time task does not exceed the priority of the real-time task; the reduced priority of the real-time task is not lower than the priority of the non-real-time task.

[0065] It can be understood that making the priority of the adjusted (lowered or increased) real-time task not lower than the priority of the adjusted non-real-time task can ensure that the real-time task can obtain the resources occupied by the non-real-time task according to its high priority when needed.

[0066] In some embodiments, Figure 2 As shown, after S101, the task running method provided in the embodiment of the present application further includes:

[0067] S104: After the non-real-time task occupies the shared resource, adjust the priority of the non-real-time task so that the priority of the non-real-time task is lower than the priorities of other non-real-time tasks.

[0068] After the computing device allocates the shared resources to the non-real-time task, the non-real-time task starts to read the shared resource data, and its dependence on CPU resources is reduced, that is, the non-real-time task has less demand for CPU resources at this time. Therefore, the computing device lowers its task priority, so that other non-real-time tasks that need CPU resources can obtain part of the CPU resources without waiting for a long time.

[0069] In some embodiments, the initial priorities of different non-real-time tasks are the same. Through the adjustment of S103 or S104, the priority of a non-real-time task can be temporarily higher than that of other non-real-time tasks, so as to facilitate the priority allocation of running resources.

[0070] Exemplarily, there is a non-real-time task 1 in the computing device that occupies shared resources and CPU resources. When non-real-time task 1 starts to access shared resources, it enters a state of reading and writing data. The state of reading and writing data requires less CPU resources, and the computing device can lower its priority so that the excess CPU resources can be allocated to other tasks. Afterwards, the computing device receives a user instruction to start non-real-time task 2, which requires CPU resources. Since the priority of non-real-time task 1 after the reduction is lower than the priority of non-real-time task 2, the computing device allocates the unnecessary CPU resources of non-real-time task 1 to non-real-time task 2. Under this strategy, non-real-time task 2 does not have to wait for the completion of non-real-time task 1 and can also use part of the CPU resources to start execution, thereby ensuring the overall performance of the system.

[0071] In some embodiments, Figure 3 As shown, after S102, the task running method provided in the embodiment of the present application further includes:

[0072] S105: When the real-time task occupies shared resources, lower the priority of the real-time task.

[0073] After the computing device allocates the shared resources to the real-time task, the real-time task starts to read the shared resource data, and its dependence on CPU resources is reduced, that is, the real-time task has less demand for CPU resources at this time. Therefore, the computing device lowers its task priority, so that other high-priority real-time tasks can obtain part of the CPU resources without waiting for a long time.

[0074] For example, in S104 and S105, the priority of the non-real-time task and the real-time task is lowered according to the access to the shared resource, or in S103, the priority of the non-real-time task that has abandoned the shared resource is increased. The computing device will dynamically adjust the priority according to the resource access situation of the task, and reallocate resources to the task according to the adjusted priority.

[0075] The following is an example of the task running method provided in the embodiment of the present application, combined with specific scenarios and drawings in the specification.

[0076] like Figure 4 As shown, there are three tasks, namely non-real-time task 1, non-real-time task 2, and real-time task 1.

[0077] At time T1, the CPU is in an idle state. The computing device receives user instruction 1 and starts non-real-time task 1. Non-real-time task 1 needs to access shared resources and CPU resources. At this time, only non-real-time task 1 is executed in the CPU, so the computing device allocates shared resources and CPU resources to non-real-time task 1. Because non-real-time task 1 occupies shared resources, the system lowers the task priority of non-real-time task 1.

[0078] At time T2, the computing device receives user instruction 2 and starts non-real-time task 2. Non-real-time task 2 needs to access CPU resources. The computing device allocates non-essential CPU resources of non-real-time task 1 to non-real-time task 2 after determining the priority.

[0079] Specifically, the non-essential CPU resources refer to CPU resources that are less required by the non-real-time task 1 except for the CPU resources required for running the task.

[0080] At time T3, the computing device receives user instruction 3 and starts real-time task 1. Real-time task 1 needs to access shared resources and CPU resources. After determining the priority, the computing device allocates the CPU resources occupied by non-real-time task 2 to real-time task 1, and non-real-time task 2 enters a blocked state.

[0081] At time T4, because real-time task 1 needs to access shared resources, the computing device determines the priority and allocates the shared resources and CPU resources occupied by non-real-time task 1 to real-time task 2, and increases the task priority of non-real-time task 1, and non-real-time task 1 enters a blocked state. At the same time, the computing device reduces the task priority of real-time task 1.

[0082] Specifically, when the computing device increases the priority of a non-real-time task that abandons shared resources and CPU resources, the absolute value of the increase is greater than the absolute value of the decrease in task priority due to the non-real-time task occupying shared resources.

[0083] Specifically, by increasing the task priority of the non-real-time task 1 that makes resource concessions, the priority of the non-real-time task 1 is made higher than that of the non-real-time task 2, so that the non-real-time task 1 can be executed in time after the real-time task 1 is executed.

[0084] Preferably, because the task priority of real-time task 1 is lowered, if the computing device receives user instruction 4 to start real-time task 2 whose priority is higher than that of real-time task 1, the computing device can allocate non-essential CPU resources of real-time task 1 to real-time task 2.

[0085] At T5, real-time task 1 is finished, and shared resources and CPU resources are released. At this time, non-real-time task 1 and non-real-time task 2 are compared in priority. Non-real-time task 1 has a higher priority and starts to execute the task, while non-real-time task 2 is still blocked.

[0086] At time T6, non-real-time task 1 ends execution and non-real-time task 2 starts execution until non-real-time task 2 ends and CPU resources are released.

[0087] The embodiment of the present application provides a task running method, when the non-real-time task occupying shared resources is running, if the non-real-time task gives up the shared resources to the real-time task, the priority of the non-real-time task is increased so that the priority of the non-real-time task is higher than the priority of other non-real-time tasks. This method can realize the redistribution of resources by dynamically adjusting the priority. When the non-real-time task gives up the shared resources to the real-time task, the priority of the non-real-time task is increased to ensure that the non-real-time task can obtain the resources first among the same tasks, reduce the blocking time of the non-real-time task, and improve the overall performance of the system.

[0088] In addition, the embodiment of the present application avoids the problem of priority inversion through a reward mechanism (i.e., occupying shared resources reduces the priority, and releasing shared resources increases the priority), ensuring that each task can be executed in a timely manner. Moreover, by adjusting the priority, the allocation of operating resources can be optimized, so that the system can process tasks more efficiently.

[0089] In an exemplary embodiment, the present application further provides a task execution device, which may include one or more functional modules for implementing the task execution method of the above method embodiment.

[0090] For example, Figure 5 A schematic diagram of the composition of a task running device provided in this application. Figure 3 As shown, the task execution device includes: a starting module 501 , an allocation module 502 and an adjustment module 503 .

[0091] The start module 501 is used to start a real-time task or a non-real-time task;

[0092] The allocation module 502 is used to allocate the shared resources occupied by the non-real-time tasks to the real-time tasks;

[0093] In a possible implementation, the allocation module is further used to allocate resources according to the priority of each task when there are multiple tasks requiring the same type of resources. Tasks include real-time tasks and non-real-time tasks.

[0094] The adjustment module 503 is used to adjust the priorities of real-time tasks and non-real-time tasks.

[0095] In a possible implementation, the adjustment module 503 is further configured to adjust the priority of the non-real-time task after the non-real-time task occupies the shared resource, so that the priority of the non-real-time task is lower than the priorities of other non-real-time tasks.

[0096] In another possible implementation, the adjustment module 503 is further configured to reduce the priority of the real-time task when the real-time task occupies shared resources.

[0097] In another possible implementation, the adjustment module 503 is further configured to ensure that the priority of the non-real-time task after adjustment does not exceed the priority of the real-time task. The priority of the real-time task after adjustment is not lower than the priority of the non-real-time task.

[0098] In another possible implementation, the operating resources include shared resources and / or computing resources, and the computing resources include central processing unit (CPU) resources and / or graphics processing unit (GPU) resources.

[0099] In another possible implementation, the initial priorities of different non-real-time tasks are the same.

[0100] In another possible implementation, the adjusted priority of the non-real-time task does not exceed the priority of the real-time task. The reduced priority of the real-time task is not lower than the priority of the non-real-time task.

[0101] In an exemplary embodiment, the present application also provides an electronic device, which may be the task execution device described in the above method embodiment. Figure 6 This is a schematic diagram of the structure of the task running device provided in the embodiment of the present application. Figure 6 As shown, the electronic device may include: a processor 601 and a memory 602; the memory 602 stores instructions executable by the processor 601; when the processor 601 is configured to execute the instructions, the server implements the method described in the aforementioned method embodiment.

[0102] In an exemplary embodiment, the present application also provides a computer-readable storage medium on which computer program instructions are stored; when the computer program instructions are executed by a computer, the computer implements the method described in the aforementioned embodiment. The computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, a non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.

[0103] In an exemplary embodiment, the embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute the above-mentioned related method steps to implement the task execution method in the above-mentioned embodiment.

[0104] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A task running method, characterized in that: The method comprises: Starting a non-real-time task; the non-real-time task occupies shared resources; In the case where there is a real-time task requiring the shared resource, allocating the shared resource occupied by the non-real-time task to the real-time task; The priority of the non-real-time task is adjusted so that the priority of the non-real-time task is higher than the priorities of other non-real-time tasks.

2. The method according to claim 1, characterized in that The method further comprises: After the non-real-time task occupies the shared resource, the priority of the non-real-time task is adjusted so that the priority of the non-real-time task is lower than the priorities of other non-real-time tasks.

3. The method according to claim 1, characterized in that The method further comprises: In the case where the real-time task occupies the shared resource, the priority of the real-time task is reduced.

4. The method according to any one of claims 1 to 3, characterized in that: When there are multiple tasks requiring the same type of resources, the operating resources are allocated according to the priority of each task; the tasks include real-time tasks and non-real-time tasks.

5. The method according to claim 4, characterized in that The operating resources include shared resources and / or computing resources; the computing resources include central processing unit (CPU) resources and / or graphics processing unit (GPU) resources.

6. The method according to any one of claims 1 to 3, characterized in that: The initial priorities of different non-real-time tasks are the same.

7. The method according to any one of claims 1 to 3, characterized in that: The adjusted priority of the non-real-time task does not exceed the priority of the real-time task; The reduced priority of the real-time task is not lower than the priority of the non-real-time task.

8. A task running device, characterized in that: The device comprises: a starting module, a distribution module and an adjustment module; The startup module is used to start a non-real-time task; the non-real-time task occupies shared resources; The allocation module is used for allocating the shared resources occupied by the non-real-time task to the real-time task when there is a real-time task requiring the shared resources; The adjustment module is used to adjust the priority of the non-real-time task so that the priority of the non-real-time task is higher than the priorities of other non-real-time tasks.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; The memory stores instructions executable by the processor; When the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes: computer software instructions; When the computer software instructions are executed in an electronic device, the electronic device implements the method according to any one of claims 1 to 7.