CN110221907A - A kind of real-time task scheduling method based on EDF algorithm and fuzzy set - Google Patents
A kind of real-time task scheduling method based on EDF algorithm and fuzzy set Download PDFInfo
- Publication number
- CN110221907A CN110221907A CN201910438335.4A CN201910438335A CN110221907A CN 110221907 A CN110221907 A CN 110221907A CN 201910438335 A CN201910438335 A CN 201910438335A CN 110221907 A CN110221907 A CN 110221907A
- Authority
- CN
- China
- Prior art keywords
- task
- time
- random
- execution
- scheduling
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 230000000737 periodic effect Effects 0.000 claims abstract description 108
- 230000006870 function Effects 0.000 claims description 18
- 241000287196 Asthenes Species 0.000 claims description 6
- 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
- 125000002015 acyclic group Chemical group 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
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 present invention relates to a kind of real-time task scheduling method based on EDF algorithm and fuzzy set, belongs to system task scheduling field.The present invention constructs priority query to Random Task, it can guarantee that the highest Random Task of importance and periodic duty in priority query in head of the queue cooperatively participate in scheduling process, this method considers the important gender gap between Random Task, it can effectively ensure that the submission rate of important Random Task, the Random Task for keeping priority high preferentially executes, and reduces the probability for causing system that gross mistake occurs because important Random Task misses the off period.
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
Real-time periodic tasks and random tasks exist in the system, the arrival time of the random tasks cannot be predicted, and the execution time and the deadline are unknown. And the arrival time, execution time, and deadline of the periodic task may be determined by its periodicity. Therefore, the mixed scheduling of periodic tasks and random tasks has been studied by a large number of scholars. However, the importance difference between random tasks is not considered, and the important tasks may not be scheduled preferentially. And important random tasks missing deadlines can cause significant problems to 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 a fuzzy set comprises the following steps:
step1, recording the period task set as pi ═ T1,T2,...,Ti,., recording the random task set as Γ ═ a1,A2,...,Aa,., constructing a priority queue; wherein T isiRepresenting the ith periodic task, and recording the jth scheduling of the ith periodic task as Tij,AaRepresenting the a-th random task, and concentrating the task A into the random taskaSetting arrival time to Ga;
Step2, obtaining a scheduling process of the periodic task according to an EDF algorithm, obtaining an inverse scheduling process according to the scheduling process and the super-period, and obtaining a latest execution time set, a predicted ending time set and a maximum approvable time set of the periodic task according to the scheduling process and the inverse scheduling process;
obtaining a forward execution process of the periodic task set according to the EDF algorithm and recording the forward execution process as a scheduling process ξ, and recording each scheduling of each period of each task in a scheduling process ξ of the periodic task set as ξij=(pij,qij) Wherein ξijIndicating a periodic task T in forward executioniScheduling j of pijRepresentation ξijStart execution time of qijRepresentation ξijThe end time of (d);
the reverse execution of the periodic task set is denoted as the reverse scheduling ξ-1Inverse scheduling process ξ for periodic task sets-1Each execution of each cycle of each task is noted asWhereinRepresenting a periodic task T in reverse executioniThe (j) th scheduling of (a),to representAt the latest moment of execution of the program,to representThe predicted end time of (2);the sum of j and k-1 is the periodic task TiThe number of times of co-scheduling in a super-period H, where H is the super-period, i.e. the periodic task setThe least common multiple of all periodic tasks;
recording the latest execution time of the periodic task set asSet of predicted end times asThe maximum approvable time set is denoted as f'; f' represents the time period left by the execution period of the inverse scheduling process in the super period;
step3, when the current task arrives, judging the type of the current task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, Step7 is executed;
step4, if there is periodic task scheduling T at the current momentijUp to its latest execution timeGo to Step 5;
if there is no periodic task scheduling T at the current momentijUp to its latest execution timeIf the random task exists in the priority queue, the Step8 is switched to;
if there is no periodic task scheduling T at the current momentijReaching the latest execution timeIf no random task exists in the priority queue, the periodic task which does not reach the latest execution time is scheduled to wait for the latest execution time to arrive, and the Step3 is carried out;
in the Step4 executing process, if a task arrives at the current time and before the current time, the Step3 needs to be executed synchronously;
step5, if the arrival time of a certain schedule with a periodic task is equal to the latest execution time, executing the schedule TijAnd go to Step 6;
if the arrival time of a certain scheduling of a plurality of periodic tasks is equal to the corresponding latest execution time, one scheduling T is randomly selectedijExecuting, terminating other periodic task scheduling, and turning to Step 6;
step6, if periodic task scheduling TijIs actually finished at time rijEqual to its predicted end timeGo to Step 4;
if periodic task scheduling TijIs actually finished at time rijDoes not reach its predicted end timeThe current execution end time is recorded as the actual end time rijAnd updating the phase difference timeAnd idle time F' + F ", then go to Step 4;
if periodic task scheduling TijAt its predicted end timeIf not, the scheduling task is terminated and the actual end time r is ensuredijEqual to its predicted end timeThen go to Step 4;
wherein, the Step5 is executedThe jth scheduling T of the ith periodic taskijThe actual end time is denoted as rijJ-th scheduling T of i-th periodic taskijPredicted end time ofAnd the actual end time rijThe time between them is recorded as the phase difference timeThe sum of the maximum approvable time and the phase difference time is recorded as idle time, namely F '+ F';
step7, if the random task is one and there is no task in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priority of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the criticality and the fuzzy sets of the execution time of the random tasks, and inserting the priority queues according to the priority; go to Step 8;
step8, if the task is being executed at the current moment, waiting;
if no task is being executed at the current moment and a random task exists in the priority queue, selecting the random task at the head of the queue to execute, and turning to Step 9;
if no task is being executed at the current moment and no random task exists in the priority queue, the Step3 is carried out;
step9, if random task AaIs equal to the latest set of execution timesAt a certain time point in time, the random task a is terminatedaAnd go to Step 4;
if random task AaDoes not reach the latest execution time setAt a certain time, go to Step 8;
if random task AaThe latest execution time set is reached in the execution processAt a certain time point in time, the random task A is terminatedaAnd put into the head of the priority queue, go to Step 4;
in the process of Step9, if the task arrives at the execution end time or before the execution end time, Step3 needs to be executed synchronously.
The Step7 specifically comprises the following steps:
step7.1: computing fuzzy sets of available time for random tasks
Will random task AaHas an arrival time of GaTask scheduling T to the nearest cycleijAt the latest moment of executionIs recorded as a random task AaAvailable time S ofaI.e. byDefine available time in fuzzy languageWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is recorded asThe available time SaIs given by the following formula (1):
wherein "+" indicates the available time SaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is available time SaIs a membership function of (A), represents SaBelong toThe degree of (d);
available time SaFit into a normal distribution, so the membership function is expressed as formula (2):
wherein c (v) is a function for determining the position of the centre of the membership function, i.e.σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.2: computing fuzzy sets of criticality for random tasks
Will random task AaIs marked as CaIs defined by fuzzy language and is notedDenote the discourse domain asThen the random task AaCriticality of (C)aIs given by the following formula (3):
wherein "+" represents criticality CaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the criticality of CaIs a membership function of CaBelong toThe degree of (d);
criticality CaIs expressed by the formula (4):
wherein, is a center point, CzRepresenting a random task AzW represents the total number of the random tasks participating in the Step7 execution; σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.3: computing a fuzzy set of execution times for random tasks
Random task AaExecution time E ofaIs defined by fuzzy language and is notedWherein, v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked asThen the random task AaExecution time E ofaIs given by the following formula (5):
wherein "+" represents execution time EaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the execution time EaIs a membership function of (E)aBelong toThe degree of (d);
recording the execution time EaHas a probability of P (E)a) Then task A is randomizedaE of execution time ofaThe membership degree is as follows:
wherein, is a center point, EzRepresenting a random task AzExecution time of (E), P (E)z) Representing execution time EzThe probability of (d);
step7.4: calculating priority of random tasks
Random task AaIs given by priority PaDetermining a priority PaThe comment set is defined and recorded by m fuzzy languagesWhereinAnd a priority PaBy random task AaThe fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time are determined together; thus random task AaThe priority factor set of (1) is X { "available time", "criticality", "execution time", and the fuzzy relation matrix thereof is expressed as formula (7):
since the fuzzy sets of available time, the fuzzy sets of criticality and the fuzzy sets of execution time have different influence degrees on the priority, they are given different weights and are denoted as weighted fuzzy set R ═ R (R ═ R)1,R2,R3) Wherein R is1+R2+R3=1;
Synthesizing a decision set by A and R, the decision set being represented by equation (8):
wherein,representing fuzzy synthesis max-min, adopting a small-size operation for a fuzzy operator ' V ', and adopting a large-size operation for a V ';
decision set B and priority PaIf the comment sets are in one-to-one correspondence, the subset of the comment sets corresponding to the maximum value in the decision set B is the priority of the random task.
The invention has the beneficial effects that: the invention constructs the priority queue for the random task, can ensure that the random task with the highest importance at the head of the queue in the priority queue and the periodic task jointly participate in the scheduling process, considers the importance difference among the random tasks, can effectively ensure the submission rate of the important random task, ensures the priority of the high-priority random task to be preferentially executed, and reduces the probability of major errors of the system caused by the important random task missing the deadline.
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 a fuzzy set includes the following steps:
step1, recording the period task set as pi ═ T1,T2,...,Ti,., recording the random task set as Γ ═ a1,A2,...,Aa,., constructing a priority queue; wherein T isiRepresenting the ith periodic task, and recording the jth scheduling of the ith periodic task as Tij,AaRepresenting the a-th random task, and concentrating the task A into the random taskaSetting arrival time to Ga;
Step2, obtaining a scheduling process of the periodic task according to an EDF algorithm, obtaining an inverse scheduling process according to the scheduling process and the super-period, and obtaining a latest execution time set, a predicted ending time set and a maximum approvable time set of the periodic task according to the scheduling process and the inverse scheduling process;
obtaining a forward execution process of the periodic task set according to the EDF algorithm and recording the forward execution process as a scheduling process ξ, and recording each scheduling of each period of each task in a scheduling process ξ of the periodic task set as ξij=(pij,qij) Wherein ξijIndicating a periodic task T in forward executioniScheduling j of pijRepresentation ξijStart execution time of qijRepresentation ξijThe end time of (d);
the reverse execution of the periodic task set is denoted as the reverse scheduling ξ-1Inverse scheduling process ξ for periodic task sets-1Each execution of each cycle of each task is noted asWhereinRepresenting a periodic task T in reverse executioniThe (j) th scheduling of (a),to representAt the latest moment of execution of the program,to representThe predicted end time of (2);the sum of j and k-1 is the periodic task TiThe scheduling times are shared in a super-period H, wherein H is the super-period, namely the least common multiple of all periodic tasks in the periodic task set;
recording the latest execution time of the periodic task set asSet of predicted end times asThe maximum approvable time set is denoted as f'; f' represents the removal of inverse tone in the hypercycleThe time period remaining for the process execution cycle;
step3, when the current task arrives, judging the type of the current task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, Step7 is executed;
step4, if there is periodic task scheduling T at the current momentijUp to its latest execution timeGo to Step 5;
if there is no periodic task scheduling T at the current momentijUp to its latest execution timeIf the random task exists in the priority queue, the Step8 is switched to;
if there is no periodic task scheduling T at the current momentijReaching the latest execution timeIf no random task exists in the priority queue, the periodic task which does not reach the latest execution time is scheduled to wait for the latest execution time to arrive, and the Step3 is carried out;
in the Step4 executing process, if a task arrives at the current time and before the current time, the Step3 needs to be executed synchronously;
step5, if the arrival time of a certain schedule with a periodic task is equal to the latest execution time, executing the schedule TijAnd go to Step 6;
if the arrival time of a certain scheduling of a plurality of periodic tasks is equal to the corresponding latest execution time, one scheduling T is randomly selectedijExecuting, terminating other periodic task callsAnd (4) turning to Step 6;
step6, if periodic task scheduling TijIs actually finished at time rijEqual to its predicted end timeGo to Step 4;
if periodic task scheduling TijIs actually finished at time rijDoes not reach its predicted end timeThe current execution end time is recorded as the actual end time rijAnd updating the phase difference timeAnd idle time F' + F ", then go to Step 4;
if periodic task scheduling TijAt its predicted end timeIf not, the scheduling task is terminated and the actual end time r is ensuredijEqual to its predicted end timeThen go to Step 4;
wherein, the jth dispatch T of the ith periodic task executed in the Step5ijThe actual end time is denoted as rijJ-th scheduling T of i-th periodic taskijPredicted end time ofAnd the actual end time rijThe time between them is recorded as the phase difference timeMaximum portabilityThe sum of the time and the difference time is recorded as idle time, namely F ═ F '+ F';
step7, if the random task is one and there is no task in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priority of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the criticality and the fuzzy sets of the execution time of the random tasks, and inserting the priority queues according to the priority; go to Step 8;
step8, if the task is being executed at the current moment, waiting;
if no task is being executed at the current moment and a random task exists in the priority queue, selecting the random task at the head of the queue to execute, and turning to Step 9;
if no task is being executed at the current moment and no random task exists in the priority queue, the Step3 is carried out;
step9, if random task AaIs equal to the latest set of execution timesAt a certain time point in time, the random task a is terminatedaAnd go to Step 4;
if random task AaDoes not reach the latest execution time setAt a certain time, go to Step 8;
if random task AaThe latest execution time set is reached in the execution processAt a certain time point in time, the random task A is terminatedaAnd put into the head of the priority queue, go to Step 4;
in the process of Step9, if the task arrives at the execution end time or 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 AaHas an arrival time of GaTask scheduling T to the nearest cycleijAt the latest moment of executionIs recorded as a random task AaAvailable time S ofaI.e. byDefine available time in fuzzy languageWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is recorded asThe available time SaIs given by the following formula (1):
wherein "+" indicates the available time SaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is available time SaIs a membership function of (A), represents SaBelong toThe degree of (d);
available time SaFit into a normal distribution, so the membership function is expressed as formula (2):
wherein c (v) is a function for determining the position of the centre of the membership function, i.e.σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.2: computing fuzzy sets of criticality for random tasks
Will random task AaIs marked as CaIs defined by fuzzy language and is notedDenote the discourse domain asThen the random task AaCriticality of (C)aIs given by the following formula (3):
wherein "+" represents criticality CaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the criticality of CaIs a membership function of CaBelong toThe degree of (d);
criticality CaIs expressed by the formula (4):
wherein, is a center point, CzRepresenting a random task AzW represents the criticality of the receiptThe total number of random tasks involved in line Step 7; σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.3: computing a fuzzy set of execution times for random tasks
Random task AaExecution time E ofaIs defined by fuzzy language and is notedWherein, v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked asThen the random task AaExecution time E ofaIs given by the following formula (5):
wherein "+" represents execution time EaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the execution time EaIs a membership function of (E)aBelong toThe degree of (d);
recording the execution time EaHas a probability of P (E)a) Then task A is randomizedaE of execution time ofaThe membership degree is as follows:
wherein, is a center point, EzRepresenting a random task AzExecution time of (E), P (E)z) Representing execution time EzThe probability of (d);
step7.4: calculating priority of random tasks
Random task AaIs given by priority PaDetermining a priority PaThe comment set is defined and recorded by m fuzzy languagesWhereinAnd a priority PaBy random task AaThe fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time are determined together; thus random task AaThe priority factor set of (1) is X { "available time", "criticality", "execution time", and the fuzzy relation matrix thereof is expressed as formula (7):
since the fuzzy sets of available time, the fuzzy sets of criticality and the fuzzy sets of execution time have different influence degrees on the priority, they are given different weights and are denoted as weighted fuzzy set R ═ R (R ═ R)1,R2,R3) Wherein R is1+R2+R3=1;
Synthesizing a decision set by A and R, the decision set being represented by equation (8):
wherein,representing fuzzy synthesis max-min, adopting a small-size operation for a fuzzy operator ' V ', and adopting a large-size operation for a V ';
decision set B and priority PaIf the comment sets are in one-to-one correspondence, the subset of the comment sets corresponding to the maximum value in the decision set B is the priority of the random task.
Further, the following example is made for the steps in the present application:
get periodic task T1And T2Periodic task T1The execution time of (2) and the period and relative deadline are both 8; periodic task T2Has an execution time of 3 and a period and relative deadline of 10. Periodic task T1And T2At the same time, the supercycle H is 40.
Assume that at time 0 a task A is random1Arriving, at time 1 random task A2、A3Arriving, at time 8, random task A4Arrives, at time 10 random task A5When the random task set arrives, the arrival time of the random task set isG1=0,G2=1,G3=1,G4=8,G5=10。
Random task AaAvailable time SaThe terms "short", "medium" and "long" are used in the fuzzy language, and correspond toCriticality CaThe terms "low", "medium" and "high" are used interchangeablyExecution time EaThe terms "long", "medium" and "short" are used in the fuzzy language, and correspond toPriority PaThe terms "low", "medium" and "high" are used interchangeablyThe weighted blur set takes R (0.20.60.2).
Part of the scheduling process is as follows, assuming that the time consumed in the decision and step jumps is not counted:
step1, cycle task set pi ═ T1,T2And the random task set is gamma-A1,A2,A3,A4,A5The arrival time of the random task is G1=0,G2=1,G3=1,G4=8,G5=10。
Step2, obtaining periodic task T according to EDF algorithm1And T2Schedule ξ, schedule ξ is specifically ξ11=(p11,q11)=(0,2),ξ12=(p12,q12)=(8,10),ξ13=(p13,q13)=(16,18),ξ14=(p14,q14)=(24,26),ξ15=(p15,q15)=(33,35),ξ21=(p21,q21)=(2,5),ξ22=(p22,q22)=(10,13),ξ23=(p23,q23)=(20,23),ξ24=(p24,q24)=(30,33)。
And a periodic task T1And T2Inverse schedule ξ-1In particular to
Periodic task T1And T2Is set as the latest execution timeSet of predicted end times asThe maximum approvable time set is f' ═ ((0,5), (10,14), (16,17), (20,22), (24,27), (32,35)) (i.e., (5,7), (14,16), (22,24), (30,32), (38,40), (7,10), (17,20), (27,30), (35,38)) is removed during the time interval 0 to 40.
Step3, at time 0, the current arriving task has a periodic task scheduling T11And T21Random task A1For periodic task T11And T21Executing Step 4; random task A1Waiting;
step4, at time 0 (since Step3 is the determination Step, no time is consumed, and therefore, when this Step is executed, it is time to executeThe time is still 0), and the periodic task scheduling T11And T21All do not reach T11And T21At the latest moment of executionAndif no random task exists in the priority queue, the periodic task scheduling T which does not reach the latest execution time is achieved11And T21Waiting for the latest execution time to arrive, and turning to Step 3;
step3, at time 0, T11And T21The latest execution time is not reached, and a random task A exists at the current time1Waiting, then executing Step 7;
step7, at time 0, no task exists in the current priority queue, and the random task A is directly processed1The queue head is arranged, and the Step8 is carried out;
step8, at time 0, no task is currently executing, and the priority queue head task A is selected1Executing, and moving to Step9, executing Step9 to divide into two cases:
step9 is executed for the first case: step9, at time 3, random task A1The execution is finished, and the current arriving task has a random task A at the time 1 before the execution finishing time2,A3Go to Step 3; step3, for random task A2,A3Executing Step 7; step7, random task AaAvailable time SaIs composed ofCriticality CaIs composed ofExecution time EaIs composed ofPriority PaIs composed ofThe weighted blur set takes R (0.20.60.2). A. the2Available time ofCriticality ofExecution timeA3Available time ofCriticality ofExecution timeA2Decision set ofThen A is2Priority P of2Is composed ofA3Decision set ofThen A is3Has a priority P2 ofAt this point there is no task in the priority queue, so task A will be randomized3Arranged at the head of a priority queue, a random task A2After the random task, go to step 8; step8, at time1 hour, there is a random task A1In execution, wait.
Step9 executes the second case: step9, at time 3, random task A1Ending execution, not reaching the latest execution time setGo to step8 at some point; at time 3, no task is currently executing, and priority queue head task A is selected3Executing and transferring to step 9;
after both cases are performed, the following is then performed:
step9, at time 4, random task A3Ending execution, not reaching the latest execution time setAt a certain time, go to Step 8;
step8, at time 4, no task is currently executing, and the priority queue head task A is selected2Executing and transferring to step 9;
step9, at time 5, random task A2The latest execution time set is reached in the execution processAt time 5, random task A is terminated2And combine random task A2Putting the queue head, and turning to step 4;
step4, at time 5, the periodic task T11Up to its latest execution timeGo to step 5;
step5, at time 5, there is a one-cycle task T11Up to its latest execution timePerforming a periodic task T11And go to step 6;
step6, at time 7, the periodic task T11Is equal to its predicted end timeAnd go to step 4;
step4, at time 7, there is a periodic task T21Up to its latest execution timeGo to step 5;
step5, at time 7, there is a one-cycle task T21Up to its latest execution timePerforming a periodic task T21And go to step 6;
step6, at time 9, the periodic task T21The execution is finished, and the predicted end time is not reachedRecording the actual end time, i.e. r219, by a time ofThe idle time F' + F ″ (0,5), (9,14), (16,17), (20,22), (24,27), (32,35)), and goes to Step 4; the execution Step4 is divided into two cases:
the first case of Step4 is executed: at time 8, random task A4When the current state reaches, the step3 is switched to; step3, at time 8, the current task is a random task A2、A4Go to step 7; step7, at time 8, the priority queue has task A2Priority P of2Is composed ofRandom task A4Available time ofCriticality ofExecution timeRandom task A4Decision set ofThen the random task A4Has a priority P2 ofSo will random task A4Put at random task A2Then go to step 8; step8, at time 8, there is currently a task T21Executing, random task A2Waiting;
the second case of Step4 is executed: step4, at time 9, the acyclic task reaches its latest execution time and there is a random task A in the priority queue2Go to step 8; step8, at time 9, no task is currently executing, and task A is randomized at the head of the selected priority queue2Executing and transferring to step 9;
after the two cases are executed, the following procedure is executed, and the following procedure is divided into two cases:
the first case of step9 is performed: at time 10, random task A2Execution is finished, and at the execution end time 10, the random task A5When the current state reaches, the step3 is switched to; step3, at time 10, there is currently only random task A5Step7 is executed; step7, at time 10, no task is in the priority queue, and the random task A is directly sent5The queue head is arranged, and the step8 is switched to; step8, at time 10, a task is currently executed, and a random task A5Waiting;
the second case of Step9 is executed: step9, at time 10, random task A2Ending execution, not reaching the latest execution time setAt a certain time, go to step 8; step8, at time 10, no task is currently executing, and task A is randomized by selecting the head of the priority queue4Executing and transferring to step 9; step9, at time 11, random task A4Ending execution, not reaching the latest execution time setAt a certain time, go to step 8; step8, at time 11, no task is currently executing, and random task A at the head of the selected priority queue5Executing and transferring to step 9;
after both cases are performed, the following is then performed:
step9, at time 12, random task A5Ending execution, not reaching the latest execution time setGo to step8 at some point;
step8, if no task is currently executed and no task exists in the priority queue, the process goes to Step 3;
(subsequent execution Processes are as above)
The working principle of the invention is as follows: firstly, obtaining a scheduling process and a reverse scheduling process of a periodic task according to an EDF algorithm, thereby obtaining the maximum appropriateness time; simultaneously recording the time difference between the actual execution ending time and the predicted execution ending time of the periodic task as phase difference time; then, processing the available time, the criticality and the execution time of the random task by using a fuzzy set, and calculating the priority of the random task; and finally, selecting a high-priority random task to execute by using the maximum stealing time and the phase difference time. The method can improve the submission rate of important random tasks, can enable the random tasks with high priority to be executed preferentially, and reduces the probability of major errors of the system caused by the fact that the tasks miss the deadline.
While the present invention has been described in detail with reference to the embodiments shown in the drawings, the present invention is not limited to the 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 a fuzzy set is characterized in that: the method comprises the following steps:
step1, recording the period task set as pi ═ T1,T2,...,Ti,., recording the random task set as Γ ═ a1,A2,...,Aa,., constructing a priority queue; wherein T isiRepresenting the ith periodic task, and recording the jth scheduling of the ith periodic task as Tij,AaRepresenting the a-th random task, for the random task setMiddle task AaSetting arrival time to Ga;
Step2, obtaining a scheduling process of the periodic task according to an EDF algorithm, obtaining an inverse scheduling process according to the scheduling process and the super-period, and obtaining a latest execution time set, a predicted ending time set and a maximum approvable time set of the periodic task according to the scheduling process and the inverse scheduling process;
obtaining a forward execution process of the periodic task set according to the EDF algorithm and recording the forward execution process as a scheduling process ξ, and recording each scheduling of each period of each task in a scheduling process ξ of the periodic task set as ξij=(pij,qij) Wherein ξijIndicating a periodic task T in forward executioniScheduling j of pijRepresentation ξijStart execution time of qijRepresentation ξijThe end time of (d);
the reverse execution of the periodic task set is denoted as the reverse scheduling ξ-1Inverse scheduling process ξ for periodic task sets-1Each execution of each cycle of each task is noted asWhereinRepresenting a periodic task T in reverse executioniThe (j) th scheduling of (a),to representAt the latest moment of execution of the program,to representThe predicted end time of (2);the sum of j and k-1 is the periodic task TiThe scheduling times are shared in a super-period H, wherein H is the super-period, namely the least common multiple of all periodic tasks in the periodic task set;
recording the latest execution time of the periodic task set asSet of predicted end times asThe maximum approvable time set is denoted as f'; f' represents the time period left by the execution period of the inverse scheduling process in the super period;
step3, when the current task arrives, judging the type of the current task: if the multiple tasks which arrive at the same time comprise both periodic tasks and random tasks, executing Step4 on all the periodic tasks, and waiting for all the random tasks; if only random tasks exist, Step7 is executed;
step4, if there is periodic task scheduling T at the current momentijUp to its latest execution timeGo to Step 5;
if there is no periodic task scheduling T at the current momentijUp to its latest execution timeIf the random task exists in the priority queue, the Step8 is switched to;
if there is no periodic task scheduling T at the current momentijReaching the latest execution timeIf no random task exists in the priority queue, the random task does not arriveThe periodic task scheduling to the latest execution time waits for the latest execution time to arrive, and then the Step3 is carried out;
in the Step4 executing process, if a task arrives at the current time and before the current time, the Step3 needs to be executed synchronously;
step5, if the arrival time of a certain schedule with a periodic task is equal to the latest execution time, executing the schedule TijAnd go to Step 6;
if the arrival time of a certain scheduling of a plurality of periodic tasks is equal to the corresponding latest execution time, one scheduling T is randomly selectedijExecuting, terminating other periodic task scheduling, and turning to Step 6;
step6, if periodic task scheduling TijIs actually finished at time rijEqual to its predicted end timeGo to Step 4;
if periodic task scheduling TijIs actually finished at time rijDoes not reach its predicted end timeThe current execution end time is recorded as the actual end time rijAnd updating the phase difference timeAnd idle time F' + F ", then go to Step 4;
if periodic task scheduling TijAt its predicted end timeIf not, the scheduling task is terminated and the actual end time r is ensuredijEqual to its predicted end timeThen go to Step 4;
wherein, the jth dispatch T of the ith periodic task executed in the Step5ijThe actual end time is denoted as rijJ-th scheduling T of i-th periodic taskijPredicted end time ofAnd the actual end time rijThe time between them is recorded as the phase difference timeThe sum of the maximum approvable time and the phase difference time is recorded as idle time, namely F '+ F';
step7, if the random task is one and there is no task in the current priority queue, directly arranging the random task into the head of the priority queue; otherwise, calculating the priority of all the random tasks according to the fuzzy sets of the available time, the fuzzy sets of the criticality and the fuzzy sets of the execution time of the random tasks, and inserting the priority queues according to the priority; go to Step 8;
step8, if the task is being executed at the current moment, waiting;
if no task is being executed at the current moment and a random task exists in the priority queue, selecting the random task at the head of the queue to execute, and turning to Step 9;
if no task is being executed at the current moment and no random task exists in the priority queue, the Step3 is carried out;
step9, if random task AaIs equal to the latest set of execution timesAt a certain time point in time, the random task a is terminatedaAnd go to Step 4;
if random task AaDoes not reach the latest execution time setAt a certain time, go to Step 8;
if random task AaThe latest execution time set is reached in the execution processAt a certain time point in time, the random task A is terminatedaAnd put into the head of the priority queue, go to Step 4;
in the process of Step9, if the task arrives at the execution end time or before the execution end time, Step3 needs to be executed synchronously.
2. The EDF algorithm and fuzzy set based real-time task scheduling method according to claim 1, wherein: the Step7 specifically comprises the following steps:
step7.1: computing fuzzy sets of available time for random tasks
Will random task AaHas an arrival time of GaTask scheduling T to the nearest cycleijAt the latest moment of executionIs recorded as a random task AaAvailable time S ofaI.e. byDefine available time in fuzzy languageWherein v is more than or equal to 1 and less than or equal to m, and the discourse domain is recorded asThe available time SaIs given by the following formula (1):
wherein "+" indicates the available time SaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is available time SaIs a membership function of (A), represents SaBelong toThe degree of (d);
available time SaFit into a normal distribution, so the membership function is expressed as formula (2):
wherein c (v) is a function for determining the position of the centre of the membership function, i.e.σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.2: computing fuzzy sets of criticality for random tasks
Will random task AaIs marked as CaIs defined by fuzzy language and is notedDenote the discourse domain asThen the random task AaCriticality of (C)aIs given by the following formula (3):
wherein "+" represents criticality CaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the criticality of CaIs a membership function of CaBelong toThe degree of (d);
criticality CaIs expressed by the formula (4):
wherein, is a center point, CzRepresenting a random task AzW represents the total number of the random tasks participating in the Step7 execution; σ is a constant that determines the width of the curve, determined by both supercycles H and m, i.e.
Step7.3: computing a fuzzy set of execution times for random tasks
Random task AaExecution time E ofaIs defined by fuzzy language and is notedWherein, v is more than or equal to 1 and less than or equal to m, and the discourse domain is marked asThen the random task AaExecution time E ofaIs given by the following formula (5):
wherein "+" represents execution time EaIn the universe of discourseThe whole of (1);to representAndthe corresponding relationship of (a);is the execution time EaIs a membership function of (E)aBelong toThe degree of (d);
recording the execution time EaHas a probability of P (E)a) Then task A is randomizedaE of execution time ofaThe membership degree is as follows:
wherein, is a center point, EzRepresenting a random task AzExecution time of (E), P (E)z) Representing execution time EzThe probability of (d);
step7.4: calculating priority of random tasks
Random task AaIs given by priority PaDetermining a priority PaThe comment set is defined and recorded by m fuzzy languagesWhereinAnd a priority PaBy random task AaThe fuzzy set of the available time, the fuzzy set of the criticality and the fuzzy set of the execution time are determined together; thus random task AaThe priority factor set of (1) is X { "available time", "criticality", "execution time", and the fuzzy relation matrix thereof is expressed as formula (7):
since the fuzzy sets of available time, the fuzzy sets of criticality and the fuzzy sets of execution time have different influence degrees on the priority, they are given different weights and are denoted as weighted fuzzy set R ═ R (R ═ R)1,R2,R3) Wherein R is1+R2+R3=1;
Synthesizing a decision set by A and R, the decision set being represented by equation (8):
wherein,representing fuzzy synthesis max-min, adopting a small-size operation for a fuzzy operator ' V ', and adopting a large-size operation for a V ';
decision set B and priority PaIf the comment sets are in one-to-one correspondence, the subset of the comment sets corresponding to the maximum value in the decision set B is 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 true CN110221907A (en) | 2019-09-10 |
CN110221907B 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) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110609712A (en) * | 2019-09-25 | 2019-12-24 | 上海依图信息技术有限公司 | Network request discretization processing method |
CN114546617A (en) * | 2022-02-23 | 2022-05-27 | 南京航空航天大学 | Task scheduling method with low service cost in vehicle-mounted cloud environment |
CN114936076A (en) * | 2022-04-26 | 2022-08-23 | 中国人民解放军国防科技大学 | Real-time scheduling method and device for mixed task set and computer equipment |
CN115269203A (en) * | 2022-09-26 | 2022-11-01 | 环球数科集团有限公司 | 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 |
---|
JING ZHANG: "Component-oriented Modeling and Design of Hierarchical Hybrid Control System", 《2007 IEEE INTERNATIONAL CONFERENCE ON CONTROL AND AUTOMATION》 * |
张晶等: "一种高回报的最小空闲时间优先实时调度改进算法", 《计算机工程》 * |
金宏等: "模糊动态抢占调度算法", 《计算机学报》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110609712A (en) * | 2019-09-25 | 2019-12-24 | 上海依图信息技术有限公司 | Network request discretization processing method |
CN114546617A (en) * | 2022-02-23 | 2022-05-27 | 南京航空航天大学 | Task scheduling method with low service cost in vehicle-mounted cloud environment |
CN114546617B (en) * | 2022-02-23 | 2024-06-11 | 南京航空航天大学 | Task scheduling method with low service cost in vehicle-mounted cloud environment |
CN114936076A (en) * | 2022-04-26 | 2022-08-23 | 中国人民解放军国防科技大学 | Real-time scheduling method and device for mixed task set and computer equipment |
CN115269203A (en) * | 2022-09-26 | 2022-11-01 | 环球数科集团有限公司 | Distributed parallel computing programming system based on MapReduce model |
CN115269203B (en) * | 2022-09-26 | 2022-12-27 | 环球数科集团有限公司 | Distributed parallel computing programming system based on MapReduce model |
Also Published As
Publication number | Publication date |
---|---|
CN110221907B (en) | 2023-06-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110221907A (en) | A kind of real-time task scheduling method based on EDF algorithm and fuzzy set | |
Li et al. | Efficient multi-objective optimization algorithm for hybrid flow shop scheduling problems with setup energy consumptions | |
US20070044102A1 (en) | A Method and System for Performing Fair-Share Preemption | |
CN104765640B (en) | A kind of intelligent Service dispatching method | |
CN106155781B (en) | A kind of real-time task scheduling method in multiple agent platform | |
CN109871270B (en) | Scheduling scheme generation method and device | |
CN105974891B (en) | A kind of mold production process self-adaptation control method based on dynamic billboard | |
CN110187956B (en) | Layered real-time task scheduling method and system for multi-agent platform | |
CN106874112B (en) | Workflow backfilling method combined with load balancing | |
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 | |
CN116540659B (en) | Large complex product workshop scheduling method, system, equipment and medium | |
CN110780985A (en) | Parallel task scheduling method and device with limited time | |
CN111158875B (en) | Multi-module-based multi-task processing method, device and system | |
CN110245809B (en) | Intelligent optimization method and system for multi-robot multitask cooperative work | |
Zhang et al. | A discrete job-shop scheduling algorithm based on improved genetic algorithm | |
CN108958919A (en) | More DAG task schedule expense fairness assessment models of limited constraint in a kind of cloud computing | |
CN117290066A (en) | Scheduling method and system based on computing power network computing system architecture | |
CN104077182B (en) | Strategy for scheduling tasks of same priority | |
US8281313B1 (en) | Scheduling computer processing jobs that have stages and precedence constraints among the stages | |
Wei et al. | Composite rules selection using reinforcement learning for dynamic job-shop scheduling | |
CN113657742B (en) | Workshop scheduling method and device, electronic equipment and storage medium | |
CN109298917B (en) | Self-adaptive scheduling method suitable for real-time system mixed task | |
CN116862206A (en) | Method and system for adaptively optimizing distributed manufacturing execution of production plan | |
Xu et al. | Resource Management Scheduling-Based on Proximal Policy Optimization |
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 |