CN115964180A - Task scheduling method and device and electronic equipment - Google Patents

Task scheduling method and device and electronic equipment Download PDF

Info

Publication number
CN115964180A
CN115964180A CN202310067875.2A CN202310067875A CN115964180A CN 115964180 A CN115964180 A CN 115964180A CN 202310067875 A CN202310067875 A CN 202310067875A CN 115964180 A CN115964180 A CN 115964180A
Authority
CN
China
Prior art keywords
task
parameter information
target identification
identification information
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310067875.2A
Other languages
Chinese (zh)
Inventor
柯锦玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202310067875.2A priority Critical patent/CN115964180A/en
Publication of CN115964180A publication Critical patent/CN115964180A/en
Priority to PCT/CN2024/074173 priority patent/WO2024160136A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a task scheduling method, a task scheduling device and electronic equipment, which are applied to the technical field of communication, and the method comprises the following steps: acquiring parameter information of a first task under the condition that the first task acquires a key lock; and running the first task under the condition that the parameter information meets a preset condition, wherein the condition that the parameter information meets the preset condition comprises the following steps: the parameter information includes target identification information.

Description

Task scheduling method and device and electronic equipment
Technical Field
The present application belongs to the field of communications technologies, and in particular, to a task scheduling method, an apparatus and an electronic device.
Background
With the continuous development of science and technology, electronic equipment has more and more functions and more applications resident in the background of the electronic equipment. In general, when there are many programs running at the same time, the system can schedule resources according to the scheduling priority in the resource scheduling policy. For example, when a user swipes a WeChat friend circle in the foreground using a cell phone, many applications in the background of the cell phone are running in the background, such as QQ receiving messages in the background, flashing a flash to download movies in the background, and so on. The resource scheduling policy of the current system can preferentially guarantee the operation of foreground application, that is, the foreground application can preferentially obtain resources, for example, the WeChat of the foreground is preferentially operated on the CPU big core and the scheduling priority of the CPU big core is improved, and the background application limits the obtaining of resources, for example, the QQ or the thunder of the background is limited on the CPU small core and the scheduling priority of the CPU small core is reduced.
However, the problem of priority reversal is greatly aggravated by adopting the resource scheduling strategy, that is, a task with a high priority cannot run because of being blocked by a task with a low priority, and a task with a high priority can run only after a task with a low priority is run to release a system lock, thereby causing the problem of system deadlock.
Disclosure of Invention
The embodiment of the application aims to provide a task scheduling method, a task scheduling device and electronic equipment, which can solve the problem of system congestion caused by priority inversion in the related art.
In a first aspect, an embodiment of the present application provides a task scheduling method, where the method includes:
acquiring parameter information of a first task under the condition that the first task acquires a key lock;
and running the first task under the condition that the parameter information meets a preset condition, wherein the condition that the parameter information meets the preset condition comprises the following steps: the parameter information includes target identification information.
In a second aspect, an embodiment of the present application provides a task scheduling apparatus, where the apparatus includes:
the acquiring module is used for acquiring the parameter information of the first task under the condition that the first task acquires the key lock;
the control module is used for running the first task under the condition that the parameter information meets preset conditions, wherein the condition that the parameter information meets the preset conditions comprises the following steps: the parameter information includes target identification information.
In a third aspect, embodiments of the present application provide an electronic device, which includes a processor and a memory, where the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor, implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product, stored on a storage medium, for execution by at least one processor to implement the method according to the first aspect.
In the embodiment of the application, by setting the key lock, only one task acquisition Guan Jiansuo can be ensured to exist at the same time, so that a plurality of tasks can be operated in a time sequence manner by acquiring the time of the key lock when the plurality of tasks are operated simultaneously, and the problem of system congestion is avoided. The method comprises the steps of acquiring parameter information of a first task under the condition that the first task acquires a key lock, and operating the first task under the condition that the parameter information meets preset conditions, so that the first task with target identification information can be preferentially operated, the waiting time of the first task for operation is shortened, and the problem of system jam caused by priority reversal in the related technology is avoided.
Drawings
Fig. 1 is a flowchart of a task scheduling method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of an example of the present application;
FIG. 3 is a schematic flow chart of another example of the present application;
FIG. 4 is a schematic flow chart of yet another example of the present application;
FIG. 5 is a diagram illustrating a task scheduler according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 7 is a schematic hardware structure diagram of an electronic device according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below in detail with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/", and generally means that the former and latter related objects are in an "or" relationship.
The task scheduling method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
As shown in fig. 1, a task scheduling method provided in an embodiment of the present application includes the following steps 101 to 102, which are described in detail below.
Step 101, acquiring parameter information of a first task when the first task acquires a key lock.
And 102, running the first task under the condition that the parameter information meets a preset condition.
In this embodiment, in a system of an electronic device, there are often situations where multiple tasks are executed at the same time. For example, in the process of playing a game using a mobile phone, a game application is run in the foreground, and at the same time, applications such as "setting" application, "music" application, "file management" may also be run in the background. However, due to the limitation of some hardware resources of the electronic device, for example, only one UFS memory for storing data is in the mobile phone, so that when multiple tasks call system resources, only one task can be called at the same time. Wherein, the key lock can be set at the entrance of the calling data to ensure that only one task reads the system resource at the same time. That is, there is only one task acquiring the critical lock at a time.
After the key lock is set at the entrance of the calling data, under the condition that a plurality of tasks need to acquire system resources, because only one task acquires the key lock at the same time, the plurality of tasks sequentially acquire the key lock according to the time sequence. And after any task in the plurality of tasks acquires the key lock, the task is marked to enter a waiting operation or a critical operation region, and the system resource corresponding to the task is occupied. Generally, a task that is earlier in time to acquire the key lock may be executed in preference to a task that is later in time to acquire the key lock, and thus, the plurality of tasks may be executed in chronological order to acquire the key lock.
If a task needs to be preferentially run, when the task acquires a key lock, the task can be marked by target identification information, and the target identification information is used as one item of parameter information of the task. The target identification information may be used to indicate that the task corresponding to the target identification information is a special task. For example, the target identification information may be a special character by which a special task that needs to be preferentially run is marked. It will be understood by those skilled in the art that the target identification information is not particularly limited thereto.
And acquiring the parameter information of the first task under the condition that the first task acquires the key lock. And under the condition that the parameter information comprises the target identification information, determining that the first task is a special task meeting a preset condition. And under the condition that the parameter information does not comprise the target identification information, determining that the first task does not meet a preset condition. Wherein the first task is any one of the plurality of tasks.
And under the condition that the first task is determined to be a special task meeting the preset condition, the first task is operated on the CPU, and other tasks with high priority are forbidden to operate.
For example, task 1 and task 2 acquire the key lock according to time sequence, and if neither task 1 nor task 2 is marked with the identification information, then task 1 and task 2 are run according to the time sequence of acquiring the key lock. If the task 2 is a special task marked by a special character, the task 2 runs before the task 1 under the condition that the task 2 acquires the key lock with the identification information.
According to the embodiment of the application, the key lock is set, so that only one task acquisition Guan Jiansuo exists at the same time, the multiple tasks can be operated in a time sequence by acquiring the key lock when the multiple tasks are operated simultaneously, and the problem of system congestion is avoided. The method comprises the steps that parameter information of a first task is obtained under the condition that the first task obtains a key lock, the first task is operated under the condition that the parameter information meets preset conditions, the first task with target identification information can be preferentially operated, and therefore the waiting time of the first task for operation is shortened, and the problem that a system is blocked due to priority reversal in the related technology is avoided.
In an embodiment, in order to avoid the problem that other tasks cannot normally run due to long-time running of a special task and further reduce user experience, the embodiment of the present application further provides a method for controlling task scheduling based on the identification duration of the target identification information. That is, in a case that the parameter information includes target identification information, the parameter information satisfying a preset condition further includes: the identification duration of the target identification information is less than or equal to a preset duration.
In this embodiment, when a plurality of tasks acquire a key lock, the identification duration of a specific task marked with target identification information may be recorded while marking the specific task with the target identification information. And, associating the identification duration with the corresponding target identification information.
When a first task acquires a key lock, acquiring parameter information of the first task, and determining whether the parameter information of the first task comprises target identification information. And under the condition that the parameter information of the first task comprises target identification information, determining whether the identification time length of the target identification information is less than or equal to preset time length. And under the condition that the identification time length of the target identification information is less than or equal to the preset time length, determining that the parameter information meets the preset condition, further forbidding other tasks with high priority to run, and running the first task.
According to the embodiment of the application, when the parameter information includes the target identification information, the parameter information satisfying the preset condition further includes: the identification time length of the target identification information is less than or equal to the preset time length, so that the influence on the operation of other tasks due to the long-time operation of a special task can be avoided, the operation speed of the system is further influenced, and the user experience is reduced.
In one embodiment, after the obtaining of the parameter information of the first task, the method further includes:
step 201, running a second task with priority higher than that of the first task when the parameter information does not meet the preset condition; wherein the parameter information not meeting the preset condition comprises one of the following items: the parameter information does not include the target identification information, the parameter information includes the target identification information, but the identification duration of the target identification information is greater than the preset duration;
and 202, after the second task exits from running, running the first task.
In this embodiment, when the parameter information of the first task does not include the target identification information, or when the parameter information includes the target identification information but the identification duration of the target identification information is greater than the preset duration, it is determined that the parameter information of the first task does not satisfy a preset condition.
And running the second task under the condition that the parameter information of the first task does not meet the preset condition and the second task with the priority higher than that of the first task exists. And, while running the second task, the first task is in a wait-to-run state. And after the second task exits from running, running the first task.
For example, task 2 acquires the key lock earlier than task 1, i.e., task 2 has a higher priority than task 1. And the parameter information of the task 1 does not include the target identification information, or the parameter information of the task 1 includes the target identification information but the identification duration of the target identification information is longer than the preset duration. In this case, the parameter information of the task 1 does not satisfy the setting condition, the task 2 is run first according to the priority order, and the task 1 is run after the task 2 is run and quits the running.
According to the embodiment of the application, the second task is operated under the condition that the parameter information of the first task does not meet the set condition and the second task with the priority higher than that of the first task exists, and the first task is operated after the second task quits operation, so that the problem that a system is blocked due to multi-task operation conflict can be solved.
In an embodiment, in order to increase the operating speed of the system and reduce the power consumption of the system, a condition for triggering acquisition of parameter information of the first task is further set in the embodiment of the present application. That is to say, in the case that the first task acquires the key lock, acquiring the parameter information of the first task includes:
301, when the first task acquires Guan Jiansuo and the first task occupies a system resource, acquiring parameter information of the first task;
step 302, when the first task acquires Guan Jiansuo and a third task occupies the system resource, waiting for the first task to be awakened, and acquiring parameter information of the first task when the first task is awakened; wherein the first task is awakened if the third task releases the system resources.
In this embodiment, two conditions for triggering acquisition of parameter information of the first task are set:
the first condition is as follows: and acquiring parameter information of the first task when the first task acquires Guan Jiansuo and occupies system resources.
When a first task acquires Guan Jiansuo and the first task does not occupy system resources, it is described that the first task may be blocked, and at this time, detection is not performed on whether parameter information of the first task meets a preset condition.
When a first task acquires Guan Jiansuo and occupies system resources, it needs to be determined whether the first task is a special task meeting preset conditions, and then the priority order of the first task and other tasks needing to be run is determined. Namely, the parameter information of the first task is acquired to detect whether the parameter information of the first task meets a preset condition.
And a second condition: when the first task acquires Guan Jiansuo and a third task occupies the system resource, waiting for the first task to be awakened, and acquiring parameter information of the first task when the first task is awakened; wherein the first task is woken up on a condition that the third task releases the system resources.
The second condition is for the case where the first task acquired Guan Jiansuo and the third task occupied system resources, in which case the operation of the first task may be blocked. For example, the first task is a lock nested configuration, and before the first task is executed, not only the key lock needs to be acquired as an external lock, but also an internal lock for locking the system resource it is engaged with. After the first task acquires the key lock, the internal lock is occupied by the third task and cannot be acquired. In this case, the operation of the first task is blocked.
In the case where the execution of a first task is blocked, other tasks are executed first in order of priority, the first task being in a sleep state waiting to be woken up. Wherein the other tasks include the third task. And after the third task is finished and quits running, releasing the internal lock. At this time, the first task is awakened, and the first task can acquire the internal lock to occupy the system resource. And acquiring the parameter information of the first task under the condition that the first task occupies the system resource so as to detect whether the parameter information of the first task meets the preset condition.
According to the embodiment of the application, the condition for triggering the acquisition of the parameter information of the first task is further set, so that the running speed of a system can be increased, and the power consumption of the system can be reduced. And when the first task is blocked, other tasks are operated firstly, the first task is awakened under the condition that the third task releases the system resources, the parameter information of the first task is obtained, the problem that other tasks with low priority cannot be operated due to the blockage of the task with high priority can be avoided, and the system operation speed is improved.
In one embodiment, after the running the first task, the method further comprises:
clearing the parameter information of the first task after the first task releases the key lock.
In this embodiment, after the first task is run, the first task releases Guan Jiansuo, and clears the parameter information of the first task. When the parameter information includes target identification information, the clearing of the parameter information of the first task is to clear the target identification information in the parameter information of the first task. And under the condition that the parameter information comprises target identification information and identification duration of the target identification information, the parameter information of the first task is cleared by the target identification information and the identification duration of the target identification information in the parameter information of the first task.
According to the embodiment of the application, after the first task releases the key lock, the parameter information of the first task is cleared, so that the target identification information can be prevented from influencing the normal operation of other tasks after the task with the target identification information is operated.
In one embodiment, after the obtaining of the parameter information of the first task, the method further includes:
step 401, when a set event occurs and the parameter information of the first task includes the target identification information, acquiring an identification duration of the target identification information.
In this embodiment, the setting event may be a periodically occurring event. For example, the set event may be a Tick interrupt event, which is understood to be a periodic clock interrupt, typically 4 milliseconds each in a cellular system. The Tick interruption can realize that the time information of task operation in the system is periodically updated, and then whether the currently operated task needs to be scheduled or not is determined based on the time information of the task operation.
In the running process of the system, the overtime judgment of the identification duration can be carried out on the special task comprising the target identification information in the system under the condition that a set event occurs.
Step 402, removing the target identification information in the parameter information of the first task when the identification duration of the target identification information is greater than the preset duration.
In this embodiment, when the identification duration of the target identification information is longer than the preset duration, that is, the time for running the first task is too long, the running of the first task is abnormal, and a dead cycle may be involved. In this case, the target identification information in the parameter information of the first task is cleared, and the first task is reordered according to the time when it acquires the key lock, so as to avoid running all the time.
According to the embodiment of the application, under the condition that a set event occurs and the parameter information of the first task comprises the target identification information, the identification duration of the target identification information is obtained; and under the condition that the identification time length of the target identification information is longer than the preset time length, the target identification information in the parameter information of the first task is removed, so that the problem that other tasks cannot run due to abnormal task running can be avoided, and the running speed of the system is improved.
< example 1>
Fig. 2 is a schematic diagram of a task scheduling method according to an example of the present invention, which is used for executing a special task that cannot be preempted in the case where the special task exists in the tasks.
As shown in fig. 2, in this example, the specific steps of the task scheduling method may include:
step 21, before the first task acquires the system resource, acquiring the key lock. When the key lock is acquired, marking target identification information for the first task, recording the marking duration of the first task marked with the target identification information, and taking the target identification information and the marking duration of the target identification information as one item of parameter information of the first task.
And 22, acquiring the parameter information of the first task when the first task acquires Guan Jiansuo and the first task occupies system resources.
In this embodiment, the first task acquires the key lock, and marks that the first task enters a critical area in a waiting operation or an operation state, and the first task occupies the CPU. If there is a second task with high priority to be run, and the first task preempts the CPU, step 23 is executed to determine the running sequence of the first task and the second task.
Step 23, judging whether the parameter information of the first task includes the target identification information, and whether the identification duration of the target identification information of the first task exceeds the preset duration t?
And 24, if the parameter information of the first task is detected to comprise the target identification information, and the identification time length of the target identification information is less than or equal to the preset time length t, the CPU is prohibited to be switched to the second task, and the CPU runs the first task.
And 25, if the parameter information of the first task is detected not to include the target identification information, or the parameter information of the first task includes the target identification information but the identification time length exceeds the preset time length t, operating the second task with high priority first.
When the second task is finished running, the CPU will switch back to running the first task, step 26.
Step 27, the first task releases Guan Jiansuo.
In this embodiment, the first task releasing the critical lock marks that the first task exits the critical section.
And step 28, clearing the target identification information in the parameter information of the first task.
In this embodiment, in step 24, if it is detected that the parameter information of the first task includes the target identification information, and the identification duration of the target identification information is less than or equal to the preset duration t, the CPU is prohibited from switching to the second task, and the CPU runs the first task, so that the critical section time of the first task can be shortened. In step 25 and step 26, if it is detected that the parameter information of the first task does not include the target identification information, or the parameter information of the first task includes the target identification information but the identification duration exceeds the preset duration t, the second task with high priority is executed first, and when the second task is executed, the CPU will switch back to execute the first task, so as to avoid the problem of system jamming caused by priority inversion.
< example 2>
Fig. 3 is a diagram of a task scheduling method according to another example of the present invention, which is directed to a case where a first task is blocked, an active yield of a CPU is performed, and then a fast switch is performed back to run on the CPU.
As shown in fig. 3, in this example, the specific steps of the task scheduling method may include:
step 31, before the first task acquires the system resource, acquiring the key lock. When the key lock is acquired, marking target identification information for the first task, recording the marking duration of the first task marked with the target identification information, and taking the target identification information and the marking duration of the target identification information as one item of parameter information of the first task.
And 32, waiting for the first task to be awakened when the first task acquires Guan Jiansuo and the third task occupies the system resources.
In this embodiment, the first task acquires the key lock, and marks that the first task enters the critical section. At this time, the third task occupies the system resource that the first task needs to commission, and the first task is blocked, and at this time, the first task is in a state waiting to be awakened. The CPU will run other tasks, wherein the other tasks include a third task.
Step 33, acquiring the parameter information of the first task under the condition that the first task is awakened; wherein the first task is awakened if the third task releases the system resources.
In this embodiment, the first task is awakened when the third task exits from running and releases the system resource. And acquiring the parameter information of the first task under the condition that the first task is awakened so as to judge whether the parameter information of the first task meets a preset condition.
Step 34, judging whether the parameter information of the first task includes the target identification information, and whether the identification duration of the target identification information of the first task exceeds the preset duration t?
And 35, if the parameter information of the first task comprises the target identification information and is not overtime, immediately switching the CPU back to the operation of the first task.
And step 36, if the parameter information of the first task does not include the target identification information, or the parameter information of the first task includes the target identification information but the identification duration is overtime, judging whether to switch to other tasks to operate or not according to whether other tasks with high priority need to operate or not.
And step 37, after other tasks with high priority quit running, switching the CPU back to the first task to run.
Step 38, the first task releases the critical lock, marking the first task as exiting the critical section.
And step 39, clearing the target identification information of the first task.
In this embodiment, when the first task is blocked, the CPU is yielded actively, and the current CPU will run the third task. And when the third task exits from running, the first task is awakened. And under the condition that the first task is awakened, judging whether the parameter information of the first task meets a preset condition. If the parameter information of the first task comprises the target identification information and the timeout does not exist, the current CPU is immediately switched back to run the first task, so that the problem that other tasks cannot be run due to the blockage of the task with high priority is avoided, and the running speed of the system can be increased.
< example 3>
Fig. 4 is a schematic diagram of a task scheduling method according to another example of the present invention, which is directed to periodic timeout detection of a system to determine whether a task has an abnormal operation condition.
As shown in fig. 4, in this example, the specific steps of the task scheduling method may include:
step 41. Tick interrupt occurs.
Step 42, when tick is interrupted, checking whether the first task is a special task including target identification information, and whether the identification duration of the target identification information exceeds a preset duration t?
And 43, if the first task is a special task comprising target identification information and the identification time length of the first task exceeds the preset time length t, clearing the target identification information of the first task, namely allowing the CPU to run other tasks.
And 44, if the first task is not the special task or the first task is the special task comprising the target identification information but the identification time length of the first task exceeds the preset time length t, exiting the Tick timeout judgment.
In this embodiment, tick interrupt may be used to perform timeout detection on a task with target identification information in the system, and if it is detected that the identification duration of the target identification information exceeds the preset duration, it indicates that the task occupies the CPU for a long time, and abnormal operation may occur, which falls into a dead cycle. The task is queued again and then the priority is lower, so that the task can be queued again and the system can run other tasks. Therefore, the problem that other tasks cannot run due to abnormal running of the tasks can be avoided, and the running speed of the system is improved.
According to the task scheduling method provided by the embodiment of the application, the execution main body can be a task scheduling device. In the embodiment of the present application, a method for a task scheduling device to perform task scheduling is taken as an example to describe the task scheduling device provided in the embodiment of the present application.
As shown in fig. 5, a task scheduling apparatus 500 provided for an embodiment of the present application, the apparatus 500 includes:
an obtaining module 501, configured to obtain parameter information of a first task when the first task obtains a key lock;
a control module 502, configured to run the first task when the parameter information meets a preset condition, where the parameter information meets the preset condition includes: the parameter information includes target identification information.
According to the embodiment of the application, the key lock is set, so that only one task acquisition Guan Jiansuo exists at the same time, the multiple tasks can be operated in a time sequence by acquiring the key lock when the multiple tasks are operated simultaneously, and the problem of system congestion is avoided. The method comprises the steps of acquiring parameter information of a first task under the condition that the first task acquires a key lock, and operating the first task under the condition that the parameter information meets preset conditions, so that the first task with target identification information can be preferentially operated, the waiting time of the first task for operation is shortened, and the problem of system jam caused by priority reversal in the related technology is avoided.
In one embodiment, in a case that the parameter information includes target identification information, the parameter information satisfying a preset condition further includes: the identification duration of the target identification information is less than or equal to a preset duration.
According to the embodiment of the application, when the parameter information includes the target identification information, the parameter information satisfying the preset condition further includes: the identification time length of the target identification information is less than or equal to the preset time length, so that the influence on the operation of other tasks due to the long-time operation of a special task can be avoided, the operation speed of the system is further influenced, and the user experience is reduced.
In one embodiment, the control module 502 is further configured to run a second task having a higher priority than the first task if the parameter information does not satisfy the preset condition and the second task has a higher priority than the first task; wherein the parameter information not meeting the preset condition comprises one of the following items: the parameter information does not include the target identification information, the parameter information includes the target identification information, but the identification duration of the target identification information is longer than the preset duration;
and after the second task exits from running, running the first task.
According to the embodiment of the application, the second task is operated under the condition that the parameter information of the first task does not meet the set condition and the second task with the priority higher than that of the first task exists, and the first task is operated after the second task quits operation, so that the problem that a system is blocked due to multi-task operation conflict can be solved.
In one embodiment, the apparatus further comprises: the cleaning module 503 is used for cleaning the workpiece,
the clearing module 503 is configured to clear the parameter information of the first task after the first task releases the key lock.
According to the embodiment of the application, after the first task releases the key lock, the parameter information of the first task is cleared, so that the target identification information can be prevented from influencing the normal operation of other tasks after the task with the target identification information is operated.
In an embodiment, the obtaining module 501 is specifically configured to obtain parameter information of the first task when the first task obtains Guan Jiansuo and the first task occupies a system resource;
or, the obtaining module 501 is specifically configured to wait for the first task to be woken up when the first task obtains Guan Jiansuo and a third task occupies the system resource, and obtain parameter information of the first task when the first task is woken up; wherein the first task is awakened if the third task releases the system resources.
According to the embodiment of the application, the condition for triggering the acquisition of the parameter information of the first task is set, so that the running speed of a system can be increased, and the power consumption of the system can be reduced. And when the first task is blocked, other tasks are firstly operated, the first task is awakened under the condition that the third task releases the system resources, the parameter information of the first task is obtained, the problem that other tasks with low priority cannot be operated due to the blockage of the task with high priority can be avoided, and the operation speed of the system is improved.
In an embodiment, the obtaining module 501 is configured to obtain an identifier duration of the target identifier information when a set event occurs and the parameter information of the first task includes the target identifier information;
the clearing module 503 is configured to clear the target identification information in the parameter information of the first task when the identification duration of the target identification information is greater than the preset duration.
According to the embodiment of the application, under the condition that a set event occurs and the parameter information of the first task comprises the target identification information, the identification duration of the target identification information is obtained; and under the condition that the identification time length of the target identification information is longer than the preset time length, the target identification information in the parameter information of the first task is removed, so that the problem that other tasks cannot run due to abnormal task running can be avoided, and the running speed of the system is improved.
The task scheduling apparatus in the embodiment of the present application may be an electronic device, and may also be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be a device other than a terminal. The electronic Device may be, for example, a Mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic Device, a Mobile Internet Device (MID), an Augmented Reality (AR)/Virtual Reality (VR) Device, a robot, a wearable Device, an ultra-Mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and may also be a server, a Network Attached Storage (Network Attached Storage, NAS), a personal computer (NAS), a Television (TV), a teller machine, a self-service machine, and the like, and the embodiments of the present application are not limited in particular.
The task scheduling device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The task scheduling device provided in the embodiment of the present application can implement each process implemented by the method embodiments of fig. 1 to fig. 4, and is not described here again to avoid repetition.
Optionally, as shown in fig. 6, an electronic device 600 is further provided in an embodiment of the present application, and includes a processor 601 and a memory 602, where a program or an instruction that can be executed on the processor 601 is stored in the memory 602, and when the program or the instruction is executed by the processor 601, the steps of the task scheduling method embodiment are implemented, and the same technical effects can be achieved, and are not described again here to avoid repetition.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.
Those skilled in the art will appreciate that the electronic device 1000 may further comprise a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 1010 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 7 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 1010 is configured to, when a first task acquires a key lock, acquire parameter information of the first task; and running the first task under the condition that the parameter information meets a preset condition, wherein the condition that the parameter information meets the preset condition comprises the following steps: the parameter information includes target identification information.
According to the embodiment of the application, the key lock is set, so that only one task acquisition Guan Jiansuo exists at the same time, the multiple tasks can be operated in a time sequence by acquiring the key lock when the multiple tasks are operated simultaneously, and the problem of system congestion is avoided. The method comprises the steps of acquiring parameter information of a first task under the condition that the first task acquires a key lock, and operating the first task under the condition that the parameter information meets preset conditions, so that the first task with target identification information can be preferentially operated, the waiting time of the first task for operation is shortened, and the problem of system jam caused by priority reversal in the related technology is avoided.
Optionally, when the parameter information includes target identification information, the parameter information meeting a preset condition further includes: the identification duration of the target identification information is less than or equal to a preset duration.
According to the embodiment of the application, when the parameter information includes the target identification information, the parameter information satisfying the preset condition further includes: the identification time length of the target identification information is less than or equal to the preset time length, so that the influence on the operation of other tasks due to the long-time operation of a special task can be avoided, the operation speed of the system is further influenced, and the user experience is reduced.
Optionally, the processor 1010 is further configured to run a second task having a priority higher than that of the first task when the parameter information does not satisfy the preset condition and the second task has a priority higher than that of the first task; wherein the parameter information not meeting the preset condition comprises one of the following items: the parameter information does not include the target identification information, the parameter information includes the target identification information, but the identification duration of the target identification information is longer than the preset duration; and after the second task exits from running, running the first task.
According to the embodiment of the application, the second task is operated under the condition that the parameter information of the first task does not meet the set condition and the second task with the priority higher than that of the first task exists, and the first task is operated after the second task quits operation, so that the problem that a system is blocked due to multi-task operation conflict can be solved.
Optionally, the processor 1010 is configured to clear the parameter information of the first task after the first task releases the key lock.
According to the embodiment of the application, after the first task releases the key lock, the parameter information of the first task is cleared, so that the target identification information can be prevented from influencing the normal operation of other tasks after the task with the target identification information is operated.
Optionally, the processor 1010 is configured to obtain parameter information of the first task when the first task obtains Guan Jiansuo and the first task occupies a system resource; or when the first task acquires Guan Jiansuo and a third task occupies the system resource, waiting for the first task to be awakened, and acquiring parameter information of the first task when the first task is awakened; wherein the first task is woken up on a condition that the third task releases the system resources.
According to the embodiment of the application, the condition for triggering the acquisition of the parameter information of the first task is set, so that the running speed of a system can be increased, and the power consumption of the system can be reduced. And when the first task is blocked, other tasks are firstly operated, the first task is awakened under the condition that the third task releases the system resources, the parameter information of the first task is obtained, the problem that other tasks with low priority cannot be operated due to the blockage of the task with high priority can be avoided, and the operation speed of the system is improved.
Optionally, the processor 1010 is configured to, when a set event occurs and the parameter information of the first task includes the target identification information, obtain an identification duration of the target identification information; and clearing the target identification information in the parameter information of the first task under the condition that the identification duration of the target identification information is greater than the preset duration.
According to the embodiment of the application, under the condition that a set event occurs and the parameter information of the first task comprises the target identification information, the identification duration of the target identification information is obtained; and under the condition that the identification time length of the target identification information is longer than the preset time length, the target identification information in the parameter information of the first task is removed, so that the problem that other tasks cannot run due to abnormal task running can be avoided, and the running speed of the system is improved.
It should be understood that in the embodiment of the present application, the input Unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042, and the Graphics Processing Unit 10041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts, a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.
The memory 1009 may be used to store software programs as well as various data. The memory 1009 may mainly include a first storage area storing a program or an instruction and a second storage area storing data, wherein the first storage area may store an operating system, an application program or an instruction (such as a sound playing function, an image playing function, and the like) required for at least one function, and the like. Further, the memory 1009 may include volatile memory or nonvolatile memory, or the memory 1009 may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. The volatile Memory may be a Random Access Memory (RAM), a Static Random Access Memory (Static RAM, SRAM), a Dynamic Random Access Memory (Dynamic RAM, DRAM), a Synchronous Dynamic Random Access Memory (Synchronous DRAM, SDRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (Double Data Rate SDRAM, ddr SDRAM), an Enhanced Synchronous SDRAM (ESDRAM), a Synchronous Link DRAM (SLDRAM), and a Direct Memory bus RAM (DRRAM). The memory 1009 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
Processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor, which primarily handles operations related to the operating system, user interface, applications, etc., and a modem processor, which primarily handles wireless communication signals, such as a baseband processor. It will be appreciated that the modem processor described above may not be integrated into processor 1010.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the task scheduling method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read only memory ROM, a random access memory RAM, a magnetic or optical disk, and the like.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the task scheduling method embodiment, and can achieve the same technical effect, and the details are not repeated here to avoid repetition.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
Embodiments of the present application provide a computer program product, where the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the processes in the foregoing task scheduling method embodiments, and can achieve the same technical effects, and in order to avoid repetition, details are not described here again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the description of the foregoing embodiments, those skilled in the art may clearly understand that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (13)

1. A method for task scheduling, the method comprising:
acquiring parameter information of a first task under the condition that the first task acquires a key lock;
and running the first task under the condition that the parameter information meets a preset condition, wherein the condition that the parameter information meets the preset condition comprises the following steps: the parameter information includes target identification information.
2. The method of claim 1, wherein in a case that the parameter information includes target identification information, the parameter information satisfying a preset condition further comprises: the identification duration of the target identification information is less than or equal to a preset duration.
3. The method of claim 2, wherein after obtaining the parameter information of the first task, the method further comprises:
running a second task with priority higher than that of the first task when the parameter information does not meet the preset condition and the second task exists; wherein the parameter information not meeting the preset condition comprises one of the following items: the parameter information does not include the target identification information, the parameter information includes the target identification information, but the identification duration of the target identification information is longer than the preset duration;
and after the second task exits from running, running the first task.
4. A method according to any of claims 1-3, wherein after said running said first task, said method further comprises:
clearing the parameter information of the first task after the first task releases the key lock.
5. The method according to any one of claims 1 to 3, wherein the obtaining parameter information of the first task in the case that the first task obtains a key lock comprises:
acquiring parameter information of the first task when the first task acquires Guan Jiansuo and the first task occupies system resources;
or when the first task acquires Guan Jiansuo and a third task occupies the system resource, waiting for the first task to be awakened, and acquiring parameter information of the first task when the first task is awakened; wherein the first task is awakened if the third task releases the system resources.
6. The method of claim 1, wherein after obtaining the parameter information of the first task, the method further comprises:
acquiring the identification duration of the target identification information under the condition that a set event occurs and the parameter information of the first task comprises the target identification information;
and clearing the target identification information in the parameter information of the first task under the condition that the identification duration of the target identification information is greater than the preset duration.
7. A task scheduling apparatus, characterized in that the apparatus comprises:
the acquiring module is used for acquiring the parameter information of the first task under the condition that the first task acquires the key lock;
the control module is used for running the first task under the condition that the parameter information meets preset conditions, wherein the condition that the parameter information meets the preset conditions comprises the following steps: the parameter information includes target identification information.
8. The apparatus of claim 7, wherein in a case that the parameter information includes target identification information, the parameter information satisfying a preset condition further comprises: the identification duration of the target identification information is less than or equal to a preset duration.
9. The device of claim 8, wherein the control module is further configured to run a second task having a higher priority than the first task if the parameter information does not satisfy the preset condition and the second task is present; wherein the parameter information not meeting the preset condition comprises one of the following items: the parameter information does not include the target identification information, the parameter information includes the target identification information, but the identification duration of the target identification information is longer than the preset duration;
and after the second task exits from running, running the first task.
10. The apparatus of any one of claims 7 to 9, further comprising: the cleaning module is used for cleaning the back-up module,
the clearing module is configured to clear the parameter information of the first task after the first task releases the key lock.
11. The apparatus according to any one of claims 7 to 9, wherein the obtaining module is specifically configured to, when the first task obtains Guan Jiansuo and the first task occupies a system resource, obtain parameter information of the first task;
or the obtaining module is specifically configured to wait for the first task to be awakened when the first task obtains Guan Jiansuo and a third task occupies the system resource, and obtain parameter information of the first task when the first task is awakened; wherein the first task is awakened if the third task releases the system resources.
12. The apparatus according to claim 7, wherein the obtaining module is configured to obtain an identifier duration of the target identifier information when a set event occurs and the parameter information of the first task includes the target identifier information;
the clearing module is configured to clear the target identification information in the parameter information of the first task when the identification duration of the target identification information is greater than the preset duration.
13. An electronic device, comprising a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the task scheduling method according to any one of claims 1-6.
CN202310067875.2A 2023-01-30 2023-01-30 Task scheduling method and device and electronic equipment Pending CN115964180A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202310067875.2A CN115964180A (en) 2023-01-30 2023-01-30 Task scheduling method and device and electronic equipment
PCT/CN2024/074173 WO2024160136A1 (en) 2023-01-30 2024-01-26 Task scheduling method and apparatus, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310067875.2A CN115964180A (en) 2023-01-30 2023-01-30 Task scheduling method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN115964180A true CN115964180A (en) 2023-04-14

Family

ID=87359964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310067875.2A Pending CN115964180A (en) 2023-01-30 2023-01-30 Task scheduling method and device and electronic equipment

Country Status (2)

Country Link
CN (1) CN115964180A (en)
WO (1) WO2024160136A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024160136A1 (en) * 2023-01-30 2024-08-08 维沃移动通信有限公司 Task scheduling method and apparatus, and electronic device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046034B (en) * 2018-01-15 2021-04-23 北京国双科技有限公司 Task obtaining method and device
CN110275766A (en) * 2019-06-25 2019-09-24 深圳前海微众银行股份有限公司 A kind of task processing method and device
CN114327894A (en) * 2021-12-29 2022-04-12 中国光大银行股份有限公司 Resource allocation method, device, electronic equipment and storage medium
CN115061800A (en) * 2022-06-30 2022-09-16 中国联合网络通信集团有限公司 Edge computing task processing method, edge server and storage medium
CN115964180A (en) * 2023-01-30 2023-04-14 维沃移动通信有限公司 Task scheduling method and device and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024160136A1 (en) * 2023-01-30 2024-08-08 维沃移动通信有限公司 Task scheduling method and apparatus, and electronic device

Also Published As

Publication number Publication date
WO2024160136A1 (en) 2024-08-08

Similar Documents

Publication Publication Date Title
CN105335099A (en) Memory cleaning method and terminal
CN112269508B (en) Display method and device and electronic equipment
WO2024160136A1 (en) Task scheduling method and apparatus, and electronic device
CN112148163B (en) Screen recording method and device and electronic equipment
CN111767012A (en) Screen projection method and device
CN113535364A (en) Task scheduling method and device
CN111597009B (en) Application program display method and device and terminal equipment
WO2024078494A1 (en) Thread management method and apparatus, electronic device, and storage medium
CN103037153A (en) Monitoring method based on camera and electronic device with camera
CN112764611A (en) Application program control method and device and electronic equipment
WO2023130866A1 (en) Method and apparatus for switching operating system, and electronic device and storage medium
CN116302485A (en) CPU scheduling method and device, electronic equipment and readable storage medium
CN113360254A (en) Task scheduling method and system
CN113010004A (en) Abnormal power consumption processing method and device and electronic equipment
CN112286687A (en) Resource processing method and device
CN115033306B (en) Application exit method and device
CN111767153A (en) Resource access method and device and electronic equipment
CN118093146B (en) Multitasking method, device, equipment and storage medium
CN117149391A (en) Thread management method and device and electronic equipment
CN118093109A (en) Thread execution method, thread execution device, electronic equipment and medium
CN116382876A (en) Task management method, device, electronic equipment and medium
CN116991605A (en) Process processing method, device, electronic equipment and readable storage medium
CN116541151A (en) Thread scheduling method, device, electronic equipment and medium
CN116737338A (en) Processing method, processing device, processing equipment and storage medium
CN113805972A (en) Application running method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination