CN110221907B - Real-time task scheduling method based on EDF algorithm and fuzzy set - Google Patents
Real-time task scheduling method based on EDF algorithm and fuzzy set Download PDFInfo
- Publication number
- CN110221907B CN110221907B CN201910438335.4A CN201910438335A CN110221907B CN 110221907 B CN110221907 B CN 110221907B CN 201910438335 A CN201910438335 A CN 201910438335A CN 110221907 B CN110221907 B CN 110221907B
- Authority
- CN
- China
- Prior art keywords
- task
- time
- random
- execution
- periodic
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 82
- 230000000737 periodic effect Effects 0.000 claims abstract description 105
- 230000006870 function Effects 0.000 claims description 21
- 230000015572 biosynthetic process Effects 0.000 claims description 3
- 239000011159 matrix material Substances 0.000 claims description 3
- 238000003786 synthesis reaction Methods 0.000 claims description 3
- 230000002194 synthesizing effect Effects 0.000 claims description 3
- 241000287196 Asthenes Species 0.000 description 2
- 241000135164 Timea Species 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
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)
Abstract
The invention relates to a real-time task scheduling method based on an EDF algorithm and a fuzzy set, and belongs to the field of system task scheduling. The method can ensure that the random tasks with highest importance at the head of the queue in the priority queue and the periodic tasks participate in the scheduling process together, and can effectively ensure the submission rate of the important random tasks by considering the importance difference between the random tasks, so that the random tasks with high priority are preferentially executed, and the probability of serious errors of a system caused by missing the deadline of the important random tasks is reduced.
Description
Technical Field
The invention relates to a real-time task scheduling method based on an EDF algorithm and a fuzzy set, and belongs to the field of system task scheduling.
Background
There are real-time periodic tasks and random tasks in the system, the random task arrival time is unpredictable, and the execution time and deadline are unknown. And the arrival time, execution time and deadline of the periodic task may be determined by its periodicity. Thus, mixed scheduling of periodic and random tasks has been studied by a great deal of scholars. But none take into account the importance differences between the random tasks, which may result in priority scheduling of important tasks. While important random tasks miss deadlines, can cause significant problems for the system.
Disclosure of Invention
The invention provides a real-time task scheduling method based on an EDF algorithm and a fuzzy set, which is used for adding random tasks into a priority queue and participating in task scheduling together with periodic tasks.
The technical scheme of the invention is as follows: a real-time task scheduling method based on an EDF algorithm and fuzzy sets comprises the following steps:
step1, recording the periodic task set as pi= { T 1 ,T 2 ,...,T i ,..}, remembering the random task set as Γ= { a 1 ,A 2 ,...,A a ,..}, building a priority queue; wherein T is i The j-th schedule representing the i-th periodic task is denoted as T ij ,A a Represents the a-th random task, and gathers task A for the random task a Setting the arrival time to G a ;
Step2, a scheduling process of the periodic task is obtained according to an EDF algorithm, an inverse scheduling process is obtained according to the scheduling process and the overcycle, and a latest execution time set, a predicted ending time set and a maximum movable time set of the periodic task are obtained according to the scheduling process and the inverse scheduling process;
the forward executing process of the periodic task set is obtained according to the EDF algorithm and is marked as a scheduling process xi, and each scheduling of each period of each task in the scheduling process xi of the periodic task set is marked as xi ij =(p ij ,q ij ) The method comprises the steps of carrying out a first treatment on the surface of the Wherein xi ij Representing periodic task T in forward execution i P ij Representing xi ij Start execution time, q ij Representing xi ij End time of (2);
the reverse execution process of the periodic task set is recorded as a reverse scheduling process xi -1 Reverse scheduling process ζ of periodic task set -1 Each execution of each cycle of each task in (a) is noted asWherein->Representing a reverse execution time period task T i Is (are) j-th scheduling of->Representation->Is the latest execution moment of->Representation->Is a predicted end time of (2);the sum of j and k-1 is the periodic task T i The times of co-scheduling in an overcycle H, H is the overcycle, namely the least common multiple of all periodic tasks in a periodic task set;
the latest execution time set of the periodic task set is recorded asThe set of expected ending moments is +.>The maximum movable time set is marked as f'; f' represents a time period remaining by removing the execution period of the inverse scheduling process in the super period;
step3, when the current task arrives, judging the type of the currently arrived task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing a Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, executing Step7;
step4, if periodic task scheduling T exists at the current moment ij Reaching its latest execution timeGo to Step5;
if the periodic task schedule T does not exist at the current moment ij Reaching its maximumLate execution timeAnd if random tasks exist in the priority queue, the process goes to Step8;
if the periodic task schedule T does not exist at the current moment ij Reaching the latest execution timeAnd if no random task exists in the priority queue, the periodic task schedule which does not reach the latest execution time waits for the latest execution time to reach, and the process goes to Step3;
in the executing process of Step4, if the task arrives at the current moment and before the current moment, the Step3 needs to be synchronously executed;
step5, if the arrival time of a schedule of a task with one cycle is equal to the latest execution time, executing the schedule T ij And go to Step6;
if the arrival time of a certain schedule with a plurality of periodic tasks is equal to the corresponding latest execution time, randomly selecting one schedule T ij Executing, terminating other periodic task scheduling, and turning to Step6;
step6, if periodic task scheduling T ij Is the actual end time r of (2) ij Equal to its estimated end timeTurning to Step4;
if periodic task schedule T ij Is the actual end time r of (2) ij Not reaching its expected end timeRecording the current execution ending time as the actual ending time r ij And update the phase difference time +.>And an idle time f=f' +f ", then go to Step4;
if periodic task schedule T ij At its expected end timeIf not, terminating the scheduling task and making the actual end time r ij Equal to its expected end time->Then go to Step4;
wherein, the jth scheduling T of the ith periodic task executed in Step5 ij The actual end time is denoted as r ij Jth schedule T of ith periodic task ij Is (are) the expected end time of (a)And the actual end time r ij The time between them is recorded as phase difference time +.>The sum of the maximum movable time and the phase difference time is denoted as the idle time, i.e. f=f' +f ";
step7, if the random task is one and no task exists in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priorities of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the key degree and the fuzzy sets of the execution time of the random tasks, and inserting priority queues according to the priorities; go to Step8;
step8, waiting if a task is being executed at the current moment;
if no task is executing at the current moment and random tasks exist in the priority queue, selecting the random task at the head of the queue to execute, and switching to Step9;
if no task is executing at the current moment and no random task exists in the priority queue, the process goes to Step3;
step9, if random task A a The execution end time equals the latest execution time setAt some point in the process, terminating the random task A a And go to Step4;
if it is random task A a Execution end time of not reaching latest execution time setAt a certain time, go to Step8;
if it is random task A a The latest execution time set is reached in the execution processAt some point in time, the random task A is aborted a Placing the first priority queue, and turning to Step4;
in the execution process of Step9, if the task arrives at and before the execution end time, step3 needs to be executed synchronously.
Step7 specifically comprises the following steps:
step7.1: computing fuzzy sets of available time for random tasks
Will random task A a Is G a Scheduling T to the latest one cycle task ij Latest execution time of (a)The time of (a) is recorded as random task A a Is available for time S a I.e. +.>Definition of available time in ambiguous language is recorded +.>Wherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is recorded asThen the available time S a Is of the fuzzy set of (a)(1):
Wherein "+" denotes the availability time S a In the field of discussionThe whole body is arranged on the upper part;Representation->And (3) withCorresponding relation of (3);Is the availability time S a Is a membership function of S a Belonging to->The extent of (3);
time of availability S a The normal distribution is met, so the membership function is expressed as formula (2):
wherein c (v) is a function of determining the central position of the membership function, i.eSigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.2: fuzzy set for calculating criticality of random task
Will random task A a The criticality of (C) a Definition in ambiguous language is noted asDesignating the discourse as +.>Then random task a a Criticality C of (2) a The fuzzy set of (2) is the formula (3):
wherein "+" represents criticality C a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is criticality C a Is a membership function of (C) a Belonging to->The extent of (3);
criticality C a The membership function of (2) is expressed as formula (4):
wherein,, as the center point, C z Representing random task A z W represents the total number of random tasks participated in when Step7 is executed this time; sigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.3: computing fuzzy sets of execution times for random tasks
Random task A a Execution time E of (2) a Definition in ambiguous language is noted asWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked as +.>Then random task a a Execution time E of (2) a The fuzzy set of (2) is the formula (5):
wherein "+" denotes execution time E a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is execution time E a Is a membership function of (E) a Belonging to->The extent of (3);
record execution time E a Is P (E) a ) Random task A a E of execution time of (2) a The membership of (2) is:
wherein,, as the center point E z Representing random task A z Execution time of P (E) z ) Representing execution time E z Probability of (2);
step7.4: computing priority of random tasks
Random task A a Importance of (1) is determined by priority P a Determining the priority P a The comment set is defined and recorded as m fuzzy languagesWherein->And priority P a By random task A a Is determined together with the fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time; thus random task A a The priority factor set of (c) is x= { "availability time", "criticality", "execution time" }, which isThe fuzzy relation matrix is expressed as formula (7):
because the influence of the fuzzy set of available time, the fuzzy set of key degree and the fuzzy set of execution time on the priority is different, the fuzzy sets are given different weights, and the fuzzy set is recorded as a weighted fuzzy set R= (R) 1 ,R 2 ,R 3 ) Wherein R is 1 +R 2 +R 3 =1;
By synthesizing a decision set from a and R, the decision set is represented by formula (8):
wherein,,the fuzzy synthesis max-min is represented, the fuzzy operator 'Λ' adopts small-taking operation, and the 'V' adopts large-taking operation;
priority P in decision set B a The maximum value in the decision set B corresponds to the subset of the comment set as the priority of the random task.
The beneficial effects of the invention are as follows: the method can ensure that the random tasks with highest importance at the head of the queue in the priority queue and the periodic tasks participate in the scheduling process together, and can effectively ensure the submission rate of the important random tasks by considering the importance difference between the random tasks, so that the random tasks with high priority are preferentially executed, and the probability of serious errors of a system caused by missing the deadline of the important random tasks is reduced.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
Example 1: as shown in fig. 1, a real-time task scheduling method based on an EDF algorithm and fuzzy sets comprises the following steps:
step1, recording the periodic task set as pi= { T 1 ,T 2 ,...,T i ,..}, remembering the random task set as Γ= { a 1 ,A 2 ,...,A a ,..}, building a priority queue; wherein T is i The j-th schedule representing the i-th periodic task is denoted as T ij ,A a Represents the a-th random task, and gathers task A for the random task a Setting the arrival time to G a ;
Step2, a scheduling process of the periodic task is obtained according to an EDF algorithm, an inverse scheduling process is obtained according to the scheduling process and the overcycle, and a latest execution time set, a predicted ending time set and a maximum movable time set of the periodic task are obtained according to the scheduling process and the inverse scheduling process;
the forward executing process of the periodic task set is obtained according to the EDF algorithm and is marked as a scheduling process xi, and each scheduling of each period of each task in the scheduling process xi of the periodic task set is marked as xi ij =(p ij ,q ij ) The method comprises the steps of carrying out a first treatment on the surface of the Wherein xi ij Representing periodic task T in forward execution i P ij Representing xi ij Start execution time, q ij Representing xi ij End time of (2);
the reverse execution process of the periodic task set is recorded as a reverse scheduling process xi -1 Reverse scheduling process ζ of periodic task set -1 Each execution of each cycle of each task in (a) is noted asWherein->Representing a reverse execution time period task T i Is (are) j-th scheduling of->Representation->Is the most significant of (3)Late execution time, ->Representation->Is a predicted end time of (2);The sum of j and k-1 is the periodic task T i The times of co-scheduling in an overcycle H, H is the overcycle, namely the least common multiple of all periodic tasks in a periodic task set;
the latest execution time set of the periodic task set is recorded asThe set of expected ending moments is +.>The maximum movable time set is marked as f'; f' represents a time period remaining by removing the execution period of the inverse scheduling process in the super period;
step3, when the current task arrives, judging the type of the currently arrived task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing a Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, executing Step7;
step4, if periodic task scheduling T exists at the current moment ij Reaching its latest execution timeGo to Step5;
if the periodic task schedule T does not exist at the current moment ij Reaching its latest execution timeAnd if random tasks exist in the priority queue, the process goes to Step8;
if the current time isAbsence of periodic task schedule T ij Reaching the latest execution timeAnd if no random task exists in the priority queue, the periodic task schedule which does not reach the latest execution time waits for the latest execution time to reach, and the process goes to Step3;
in the executing process of Step4, if the task arrives at the current moment and before the current moment, the Step3 needs to be synchronously executed;
step5, if the arrival time of a schedule of a task with one cycle is equal to the latest execution time, executing the schedule T ij And go to Step6;
if the arrival time of a certain schedule with a plurality of periodic tasks is equal to the corresponding latest execution time, randomly selecting one schedule T ij Executing, terminating other periodic task scheduling, and turning to Step6;
step6, if periodic task scheduling T ij Is the actual end time r of (2) ij Equal to its estimated end timeTurning to Step4;
if periodic task schedule T ij Is the actual end time r of (2) ij Not reaching its expected end timeRecording the current execution ending time as the actual ending time r ij And update the phase difference time +.>And an idle time f=f' +f ", then go to Step4;
if periodic task schedule T ij At its expected end timeIf not, terminating the scheduling task and making it actually bindTime of beam r ij Equal to its expected end time->Then go to Step4;
wherein, the jth scheduling T of the ith periodic task executed in Step5 ij The actual end time is denoted as r ij Jth schedule T of ith periodic task ij Is (are) the expected end time of (a)And the actual end time r ij The time between them is recorded as phase difference time +.>The sum of the maximum movable time and the phase difference time is denoted as the idle time, i.e. f=f' +f ";
step7, if the random task is one and no task exists in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priorities of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the key degree and the fuzzy sets of the execution time of the random tasks, and inserting priority queues according to the priorities; go to Step8;
step8, waiting if a task is being executed at the current moment;
if no task is executing at the current moment and random tasks exist in the priority queue, selecting the random task at the head of the queue to execute, and switching to Step9;
if no task is executing at the current moment and no random task exists in the priority queue, the process goes to Step3;
step9, if random task A a The execution end time equals the latest execution time setAt some point in the process, terminating the random task A a And go to Step4;
if it is random task A a The execution end time is not reachedBy the latest execution time setAt a certain time, go to Step8;
if it is random task A a The latest execution time set is reached in the execution processAt some point in time, the random task A is aborted a Placing the first priority queue, and turning to Step4;
in the execution process of Step9, if the task arrives at and before the execution end time, step3 needs to be executed synchronously.
Further, step7 may be set, specifically:
step7.1: computing fuzzy sets of available time for random tasks
Will random task A a Is G a Scheduling T to the latest one cycle task ij Latest execution time of (a)The time of (a) is recorded as random task A a Is available for time S a I.e. +.>Definition of available time in ambiguous language is recorded +.>Wherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is recorded asThen the available time S a The fuzzy set of (2) is the formula (1):
wherein "+" denotes the availability time S a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is the availability time S a Is a membership function of S a Belonging to->The extent of (3);
time of availability S a The normal distribution is met, so the membership function is expressed as formula (2):
wherein c (v) is a function of determining the central position of the membership function, i.eSigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.2: fuzzy set for calculating criticality of random task
Will random task A a The criticality of (C) a Definition in ambiguous language is noted asDesignating the discourse as +.>Then random task a a Criticality C of (2) a The fuzzy set of (2) is the formula (3):
wherein "+" represents criticality C a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is criticality C a Is a membership function of (C) a Belonging to->The extent of (3);
criticality C a The membership function of (2) is expressed as formula (4):
wherein,, as the center point, C z Representing random task A z W represents the total number of random tasks participated in when Step7 is executed this time; sigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.3: computing fuzzy sets of execution times for random tasks
Random task A a Execution time E of (2) a Definition in ambiguous language is noted asWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked as +.>Then random task a a Execution time E of (2) a The fuzzy set of (2) is the formula (5):
wherein "+" denotes execution time E a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is the execution timeE a Is a membership function of (E) a Belonging to->The extent of (3);
record execution time E a Is P (E) a ) Random task A a E of execution time of (2) a The membership of (2) is:
wherein,, as the center point E z Representing random task A z Execution time of P (E) z ) Representing execution time E z Probability of (2);
step7.4: computing priority of random tasks
Random task A a Importance of (1) is determined by priority P a Determining the priority P a The comment set is defined and recorded as m fuzzy languagesWherein->And priority P a By random task A a Is determined together with the fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time; thus random task A a The priority factor set of (c) is x= { "availability time", "criticality", "execution time" }, and its fuzzy relation matrix is expressed as formula (7):
because the influence of the fuzzy set of available time, the fuzzy set of key degree and the fuzzy set of execution time on the priority is different, the fuzzy sets are given different weights, and the fuzzy set is recorded as a weighted fuzzy set R= (R) 1 ,R 2 ,R 3 ) Wherein R is 1 +R 2 +R 3 =1;
By synthesizing a decision set from a and R, the decision set is represented by formula (8):
wherein,,the fuzzy synthesis max-min is represented, the fuzzy operator 'Λ' adopts small-taking operation, and the 'V' adopts large-taking operation;
priority P in decision set B a The maximum value in the decision set B corresponds to the subset of the comment set as the priority of the random task.
Further, the following example is made for the steps in the present application:
cycle taking task T 1 And T 2 Periodic task T 1 The execution time of (2), the period and the relative deadline are both 8; periodic task T 2 The execution time of (2) is 3, and the period and the relative deadline are 10. Periodic task T 1 And T 2 And simultaneously arrives, the overcycle H is 40.
Suppose that at time 0 random task a 1 Arrival at time 1 random task A 2 、A 3 Arrival at time 8 random task A 4 Arrival, random task A at time 10 5 Arrival, the arrival time of the random task set is G 1 =0,G 2 =1,G 3 =1,G 4 =8,G 5 =10。
Random task A a Time of availability S a Description in ambiguous language "short", "medium", "long" corresponding toCriticality C a The terms "low", "medium", "high" and "low" are used in a fuzzy language, corresponding to->Execution time E a The description of "long", "medium", "short" in ambiguous language corresponds to +.>Priority P a The terms "low", "medium", "high" and "low" are used in a fuzzy language, corresponding to->The weighted fuzzy set takes r= (0.2.0.6.0.2).
The partial scheduling process is as follows, assuming that the time spent in the judgment and step jump is not counted:
step1, the periodic task set is pi= { T 1 ,T 2 The random task set is Γ= { a } 1 ,A 2 ,A 3 ,A 4 ,A 5 Arrival time of random task G 1 =0,G 2 =1,G 3 =1,G 4 =8,G 5 =10。
Step2, obtaining a periodic task T according to an EDF algorithm 1 And T 2 The schedule xi is specifically: zeta type toy 11 =(p 11 ,q 11 )=(0,2),ξ 12 =(p 12 ,q 12 )=(8,10),ξ 13 =(p 13 ,q 13 )=(16,18),ξ 14 =(p 14 ,q 14 )=(24,26),ξ 15 =(p 15 ,q 15 )=(33,35),ξ 21 =(p 21 ,q 21 )=(2,5),ξ 22 =(p 22 ,q 22 )=(10,13),ξ 23 =(p 23 ,q 23 )=(20,23),ξ 24 =(p 24 ,q 24 )=(30,33)。
Periodic task T 1 And T 2 The latest execution time set of (1) is recorded asThe set of expected end times isThe maximum usable time set is f' = ((0, 5), (10, 14), (16, 17), (20, 22), (24, 27), (32, 35)) (i.e., in the time of 0-40, (5, 7), (14, 16), (22, 24), (30, 32), (38, 40), (7, 10), (17, 20), (27, 30), (35, 38)) is removed.
Step3, at time 0, the task currently arriving has a periodic task schedule T 11 And T 21 Random task A 1 For periodic task T 11 And T 21 Step4 is executed; random task A 1 Waiting;
step4, at time 0 (since Step3 is a judgment Step, no time is consumed, and thus the system time is still 0 when this Step is executed), and the periodic task schedule T 11 And T 21 None reach T 11 And T 21 Latest execution time of (a)And->And no random task exists in the priority queue, the periodic task schedule T of the latest execution time is not reached 11 And T 21 Waiting for the latest execution time to arrive, and turning to Step3;
step3, at time 0, T 11 And T 21 The latest execution time is not reached, and the current time has random task A 1 Waiting, executing Step7;
step7, at time 0, no task is in the current priority queue, and the random task A is directly processed 1 Enqueue, go to Step8;
step8, at time 0, no task is currently executing, and selecting the first task A of the priority queue 1 Execution and transition to Step9, execution Step9 is divided into two cases:
step9 first case is performed: step9, at time 3, random task A 1 Ending the execution, wherein before the execution ending time, at the time 1, the currently arrived task has a random task A 2 ,A 3 Turning to Step3; step3, for random task A 2 ,A 3 Step7 is executed; step7, random task A a Time of availability S a Is thatCriticality C a Is thatExecution time E a Is->Priority P a Is thatThe weighted fuzzy set takes r= (0.2.0.6.0.2). A is that 2 Is->Critical->Execution time->A 3 Is->Critical->Execution timeA 2 Decision set->Then A 2 Priority P of (2) 2 Is->A 3 Decision set->Then A 3 Priority P2 of (2) isNo task is in the priority queue at this time, so task a will be random 3 Enqueue first priority queue, random task A 2 After the random task, go to step8; step8, at time 1, there is a random task A 1 Executing and waiting.
Step9 second case is performed: step9, at time 3, random task A 1 Execution ends, and the latest execution time set is not reachedTurning to step8; at time 3, no task is currently executing, and priority queue head task A is selected 3 Executing and turning to step9;
after the two cases are performed, the following is performed:
step9, at time 4, followingMission A 3 Execution ends, and the latest execution time set is not reachedAt a certain time, go to Step8;
step8, at time 4, no task is currently executing, and the first task A of the priority queue is selected 2 Executing and turning to step9;
step9, random task A at time 5 2 The latest execution time set is reached in the execution processAt time 5, the random task a is suspended 2 And to take the random task A 2 Placing the first queue into the queue, and turning to step4;
step5, at time 5, there is a periodic task T 11 Reaching its latest execution timeExecuting periodic task T 11 And go to step6;
step5, at time 7, there is a periodic task T 21 Reaching its latest execution timeExecuting periodic task T 21 And go to step6;
step6, at time 9, periodic task T 21 Execution ends without reaching its expected end timeRecording the actual end time, i.e. r 21 =9, phase difference time +.>Idle time f=f' +f "= ((0, 5), (9, 14), (16, 17), (20, 22), (24, 27), (32, 35)), and go to Step4; the execution Step4 is divided into two cases:
the first case of Step4 is performed: at time 8, random task A 4 Reaching, turning to step3; step3, at time 8, the current task has a random task A 2 、A 4 Turning to step7; step7, at time 8, the priority queue has task A 2 Its priority P 2 Is thatRandom task A 4 Is->Critical->Execution time->Random task A 4 Decision set->Then random task a 4 Priority P2 of +.>So will random task A 4 Put on random task A 2 Then, turning to step8; step8, at time 8, there is currently a task T 21 Executing, random task A 2 Waiting;
the second case of Step4 is performed: step4, at time 9, the non-periodic task reaches its latest execution time, and there is a random task A in the priority queue 2 Turning to step8; step8, at time 9, no task is currently executing, and the first random task A of the priority queue is selected 2 Executing and turning to step9;
after the two cases are executed, the following procedure is then executed, and the following procedure is divided into two cases:
the first case of step9 is performed: at time 10, random task A 2 Execution ends, and at this execution end time 10, task a is randomized 5 Reaching, turning to step3; step3, at time 10, there is currently only random task A 5 Step7 is executed; step7, at time 10, no task is in the priority queue, and the random task A is directly processed 5 Enqueue head, go to step8; step8, at time 10, a task is currently executing, random task A 5 Waiting;
the second case of Step9 is performed: step9, at time 10, random task A 2 Execution ends, and the latest execution time set is not reachedAt a certain time, go to step8; step8, at time 10, no task is currently executing, select priority queue head random task A 4 Executing and turning to step9; step9, at time 11, random task A 4 Execution ends, and the latest execution time set is not reachedAt a certain time, go to step8; step8, at time 11, no task is currently executing, select priority queue head random task A 5 Executing and turning to step9;
after the two cases are performed, the following is performed:
step9, random task A at time 12 5 Execution ends, and the latest execution time set is not reachedTurning to step8;
step8, currently no task is executed, and no task exists in the priority queue, and then Step3 is performed;
(follow-up execution procedure is the same as above)
The working principle of the invention is as follows: firstly, a scheduling process and an inverse scheduling process of a periodic task are obtained according to an EDF algorithm, so that the maximum usable time is obtained; meanwhile, the time difference between the actual execution ending time and the estimated execution ending time of the periodic task is recorded as phase difference time; then, the available time, the criticality and the execution time of the random task are processed by the fuzzy set, and the priority of the random task is calculated; and finally, selecting the high-priority random task to execute by using the maximum available time and the phase difference time. The method can improve the submission rate of important random tasks, can ensure that the random tasks with high priority are executed preferentially, and reduces the probability of serious errors of a system caused by missing the deadline of the tasks.
While the present invention has been described in detail with reference to the drawings, the present invention is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present invention within the knowledge of those skilled in the art.
Claims (2)
1. A real-time task scheduling method based on an EDF algorithm and fuzzy sets is characterized in that: the method comprises the following steps:
step1, recording the periodic task set as pi= { T 1 ,T 2 ,...,T i ,..}, remembering the random task set as Γ= { a 1 ,A 2 ,...,A a ,..}, building a priority queue; wherein T is i The j-th schedule representing the i-th periodic task is denoted as T ij ,A a Represents the a-th random task, for random arbitraryTask A for task concentration a Setting the arrival time to G a ;
Step2, a scheduling process of the periodic task is obtained according to an EDF algorithm, an inverse scheduling process is obtained according to the scheduling process and the overcycle, and a latest execution time set, a predicted ending time set and a maximum movable time set of the periodic task are obtained according to the scheduling process and the inverse scheduling process;
the forward executing process of the periodic task set is obtained according to the EDF algorithm and is marked as a scheduling process xi, and each scheduling of each period of each task in the scheduling process xi of the periodic task set is marked as xi ij =(p ij ,q ij ) The method comprises the steps of carrying out a first treatment on the surface of the Wherein xi ij Representing periodic task T in forward execution i P ij Representing xi ij Start execution time, q ij Representing xi ij End time of (2);
the reverse execution process of the periodic task set is recorded as a reverse scheduling process xi -1 Reverse scheduling process ζ of periodic task set -1 Each execution of each cycle of each task in (a) is noted asWherein->Representing a reverse execution time period task T i Is (are) j-th scheduling of->Representation->Is the latest execution moment of->Representation->Is a predicted end time of (2);The sum of j and k-1 is the periodic task T i The times of co-scheduling in an overcycle H, H is the overcycle, namely the least common multiple of all periodic tasks in a periodic task set;
the latest execution time set of the periodic task set is recorded asThe set of expected end times is noted asThe maximum movable time set is marked as f'; f' represents a time period remaining by removing the execution period of the inverse scheduling process in the super period;
step3, when the current task arrives, judging the type of the currently arrived task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing a Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, executing Step7;
step4, if periodic task scheduling T exists at the current moment ij Reaching its latest execution timeGo to Step5;
if the periodic task schedule T does not exist at the current moment ij Reaching its latest execution timeAnd if random tasks exist in the priority queue, the process goes to Step8;
if the periodic task schedule T does not exist at the current moment ij Reaching the latest execution timeAnd no random task exists in the priority queue, the latest execution time is not reachedThe scheduled task waits for the latest execution time to arrive, and the process goes to Step3;
in the executing process of Step4, if the task arrives at the current moment and before the current moment, the Step3 needs to be synchronously executed;
step5, if the arrival time of a schedule of a task with one cycle is equal to the latest execution time, executing the schedule T ij And go to Step6;
if the arrival time of a certain schedule with a plurality of periodic tasks is equal to the corresponding latest execution time, randomly selecting one schedule T ij Executing, terminating other periodic task scheduling, and turning to Step6;
step6, if periodic task scheduling T ij Is the actual end time r of (2) ij Equal to its estimated end timeTurning to Step4;
if periodic task schedule T ij Is the actual end time r of (2) ij Not reaching its expected end timeRecording the current execution ending time as the actual ending time r ij And update the phase difference time +.>And an idle time f=f' +f ", then go to Step4;
if periodic task schedule T ij At its expected end timeIf not, the scheduling task is terminated and the actual end time r is made ij Equal to its expected end time->Then go to Step4;
wherein, the jth scheduling T of the ith periodic task executed in Step5 ij The actual end time is denoted as r ij Jth schedule T of ith periodic task ij Is (are) the expected end time of (a)And the actual end time r ij The time between them is recorded as the phase difference timeThe sum of the maximum movable time and the phase difference time is denoted as the idle time, i.e. f=f' +f ";
step7, if the random task is one and no task exists in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priorities of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the key degree and the fuzzy sets of the execution time of the random tasks, and inserting priority queues according to the priorities; go to Step8;
step8, waiting if a task is being executed at the current moment;
if no task is executing at the current moment and random tasks exist in the priority queue, selecting the random task at the head of the queue to execute, and switching to Step9;
if no task is executing at the current moment and no random task exists in the priority queue, the process goes to Step3;
step9, if random task A a The execution end time equals the latest execution time setAt some point in the process, terminating the random task A a And go to Step4;
if it is random task A a Execution end time of not reaching latest execution time setAt a certain time, go to Step8;
if it is random task A a The latest execution time set is reached in the execution processAt some point in time, the random task A is aborted a Placing the first priority queue, and turning to Step4;
in the execution process of Step9, if the task arrives at and before the execution end time, step3 needs to be executed synchronously.
2. The EDF algorithm and fuzzy set based real-time task scheduling method of claim 1, wherein: step7 specifically comprises the following steps:
step7.1: computing fuzzy sets of available time for random tasks
Will random task A a Is G a Scheduling T to the latest one cycle task ij Latest execution time of (a)The time of (a) is recorded as random task A a Is available for time S a I.e. +.>Definition of available time in ambiguous language is recorded +.>Wherein v is more than or equal to 1 and less than or equal to m, and the argument is +.>Then the available time S a The fuzzy set of (2) is the formula (1):
wherein "+" denotes the availability time S a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is the availability time S a Is a membership function of S a Belonging to->The extent of (3);
time of availability S a The normal distribution is met, so the membership function is expressed as formula (2):
wherein c (v) is a function of determining the central position of the membership function, i.eSigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.2: fuzzy set for calculating criticality of random task
Will random task A a The criticality of (C) a Definition in ambiguous language is noted asDesignating the discourse as +.>Then random task a a Criticality C of (2) a The fuzzy set of (2) is the formula (3):
wherein "+" represents criticality C a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is criticality C a Is a membership function of (C) a Belonging to->The extent of (3);
criticality C a The membership function of (2) is expressed as formula (4):
wherein,, as the center point, C z Representing random task A z W represents the total number of random tasks participated in when Step7 is executed this time; sigma is a constant determining the width of the curve, determined by the superseriod H and m together, i.e. +.>
Step7.3: computing fuzzy sets of execution times for random tasks
Random task A a Execution time E of (2) a Definition in ambiguous language is noted asWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked as +.>Then random task a a Execution time E of (2) a The fuzzy set of (2) is the formula (5):
wherein "+" denotes execution time E a In the field of discussionThe whole body is arranged on the upper part;Representation->And->Corresponding relation of (3);Is execution time E a Is a membership function of (E) a Belonging to->The extent of (3);
record execution time E a Is P (E) a ) Random task A a E of execution time of (2) a The membership of (2) is:
wherein,, as the center point E z Representing random task A z Execution time of P (E) z ) Representing execution time E z Probability of (2);
step7.4: computing priority of random tasks
Random task A a Importance of (1) is determined by priority P a Determining the priority P a The comment set is defined and recorded as m fuzzy languagesWherein->And priority P a From randomTask A a Is determined together with the fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time; thus random task A a The priority factor set of (c) is x= { "availability time", "criticality", "execution time" }, and its fuzzy relation matrix is expressed as formula (7):
because the influence of the fuzzy set of available time, the fuzzy set of key degree and the fuzzy set of execution time on the priority is different, the fuzzy sets are given different weights, and the fuzzy set is recorded as a weighted fuzzy set R= (R) 1 ,R 2 ,R 3 ) Wherein R is 1 +R 2 +R 3 =1;
By synthesizing a decision set from a and R, the decision set is represented by formula (8):
wherein,,the fuzzy synthesis max-min is represented, the fuzzy operator 'Λ' adopts small-taking operation, and the 'V' adopts large-taking operation;
priority P in decision set B a The maximum value in the decision set B corresponds to the subset of the comment set as the priority of the random task.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910438335.4A CN110221907B (en) | 2019-05-24 | 2019-05-24 | Real-time task scheduling method based on EDF algorithm and fuzzy set |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910438335.4A CN110221907B (en) | 2019-05-24 | 2019-05-24 | Real-time task scheduling method based on EDF algorithm and fuzzy set |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110221907A CN110221907A (en) | 2019-09-10 |
CN110221907B true CN110221907B (en) | 2023-06-27 |
Family
ID=67818268
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910438335.4A Active CN110221907B (en) | 2019-05-24 | 2019-05-24 | Real-time task scheduling method based on EDF algorithm and fuzzy set |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110221907B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110609712A (en) * | 2019-09-25 | 2019-12-24 | 上海依图信息技术有限公司 | Network request discretization processing method |
CN114546617B (en) * | 2022-02-23 | 2024-06-11 | 南京航空航天大学 | Task scheduling method with low service cost in vehicle-mounted cloud environment |
CN114936076B (en) * | 2022-04-26 | 2023-02-28 | 中国人民解放军国防科技大学 | Real-time scheduling method and device for mixed task set and computer equipment |
CN115269203B (en) * | 2022-09-26 | 2022-12-27 | 环球数科集团有限公司 | Distributed parallel computing programming system based on MapReduce model |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009087317A2 (en) * | 2007-10-24 | 2009-07-16 | Centre National De La Recherche Scientifique | Method for managing preemptions in a real-time operating system |
CN101807065A (en) * | 2010-03-26 | 2010-08-18 | 华南理工大学 | Real-time task scheduling method of soft numerical control system |
CN101923489A (en) * | 2010-08-06 | 2010-12-22 | 西华师范大学 | Embedded real-time task scheduling method based on fuzzy importance and idle time |
CN105629873A (en) * | 2014-11-07 | 2016-06-01 | 中国科学院沈阳计算技术研究所有限公司 | Hybrid task scheduling method suitable for numerical control system |
-
2019
- 2019-05-24 CN CN201910438335.4A patent/CN110221907B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009087317A2 (en) * | 2007-10-24 | 2009-07-16 | Centre National De La Recherche Scientifique | Method for managing preemptions in a real-time operating system |
CN101807065A (en) * | 2010-03-26 | 2010-08-18 | 华南理工大学 | Real-time task scheduling method of soft numerical control system |
CN101923489A (en) * | 2010-08-06 | 2010-12-22 | 西华师范大学 | Embedded real-time task scheduling method based on fuzzy importance and idle time |
CN105629873A (en) * | 2014-11-07 | 2016-06-01 | 中国科学院沈阳计算技术研究所有限公司 | Hybrid task scheduling method suitable for numerical control system |
Non-Patent Citations (3)
Title |
---|
Component-oriented Modeling and Design of Hierarchical Hybrid Control System;Jing Zhang;《2007 IEEE International Conference on Control and Automation》;20071105;全文 * |
一种高回报的最小空闲时间优先实时调度改进算法;张晶等;《计算机工程》;20170315;全文 * |
模糊动态抢占调度算法;金宏等;《计算机学报》;20040612(第06期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110221907A (en) | 2019-09-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110221907B (en) | Real-time task scheduling method based on EDF algorithm and fuzzy set | |
Li et al. | A hybrid fruit fly optimization algorithm for the realistic hybrid flowshop rescheduling problem in steelmaking systems | |
CN110598941A (en) | Bionic strategy-based dual-target scheduling method for particle swarm optimization manufacturing system | |
CN104765640B (en) | A kind of intelligent Service dispatching method | |
CN110187956B (en) | Layered real-time task scheduling method and system for multi-agent platform | |
CN116542445A (en) | Intelligent scheduling method and system for equipment manufacturing workshop based on deep reinforcement learning | |
CN106155781B (en) | A kind of real-time task scheduling method in multiple agent platform | |
CN111061565B (en) | Two-section pipeline task scheduling method and system in Spark environment | |
CN113406939A (en) | Unrelated parallel machine dynamic hybrid flow shop scheduling method based on deep Q network | |
CN114579270A (en) | Task scheduling method and system based on resource demand prediction | |
Zhang et al. | A discrete job-shop scheduling algorithm based on improved genetic algorithm | |
CN113095618B (en) | IT operation and maintenance service personnel scheduling method | |
Li et al. | ACO-based multi-objective scheduling of parallel batch processing machines with advanced process control constraints | |
Mhiri et al. | Finite capacity planning algorithm for semiconductor industry considering lots priority | |
Carroll et al. | Incentive compatible online scheduling of malleable parallel jobs with individual deadlines | |
CN109298917B (en) | Self-adaptive scheduling method suitable for real-time system mixed task | |
Wei et al. | Composite rules selection using reinforcement learning for dynamic job-shop scheduling | |
CN102023895A (en) | Singlechip programming method with priority task switching | |
Salmani et al. | A fuzzy-based multi-criteria scheduler for uniform multiprocessor real-time systems | |
CN113657742B (en) | Workshop scheduling method and device, electronic equipment and storage medium | |
Li et al. | Mrsch: Multi-resource scheduling for hpc | |
CN104077182A (en) | Strategy for scheduling tasks of same priority | |
CN115756789A (en) | GPU scheduling optimization method for deep learning inference service system | |
CN113010319A (en) | Dynamic workflow scheduling optimization method based on hybrid heuristic rule and genetic algorithm | |
CN116820707A (en) | Dynamic scheduling method for two-stage tasks of neuron computer |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |