330 likes | 350 Views
Explore a new scheduling algorithm for non-preemptive independent tasks on multi-processor platforms, optimizing task execution order to meet deadlines efficiently. Discover the challenges and solutions in real-time scheduling for embedded systems.
E N D
A new scheduling algorithm for non-preemptive independent tasks on a multi-processor platform Presented by: Suresh Vadlakonda Ramanjaneya Gupta Pasumarthi Graduate Project
Introduction • Scheduling (uniprocessor, multiprocessor, distributed system): Given a set of (computer) tasks scheduling is to determine when to execute which task, thus determining the execution order of these tasks. In real-time scheduling, the goal is to meet the deadline of every task by ensuring each task can complete execution by its specified deadline. Graduate Project
Introduction (cont..) • A non-preemptive task is the one that once started cannot be stopped by any other process or task. • Tasks’ scheduling has always been a central problem in the embedded real-time systems community. • As in general the scheduling problem is NP-hard, researchers have been looking for efficient heuristics to solve the scheduling problem in polynomial time. Graduate Project
Any optimal algorithms..? • There are three optimal algorithms for scheduling non-independent tasks on a multi-processor platform. • EDF (Earliest Dead Line First) : EDF means that the task with the earliest deadline has the highest priority. • LLF (Least Laxity First) LLF means that the task with the earliest laxity (that is, the difference between the deadline and computation time, start time) has the highest priority. • ? Graduate Project
Terminology • We consider that a task T is denoted by T(s, c, d). • s is called start time • c is called computation time • d is called as deadline • [s, e) denotes a time interval that is left-closed and right-open. • We say that task T executes in the time interval [s, e)(p) if T is ready to execute on processor p at time s and finishes its execution before time e, allowing the next task to start its execution on processor p at time e. • A task set denoted as T given by {T1, ..., Tn}, where each task Ti is represented by (si, ci, di). Graduate Project
Scheduling based on EDF • Let T = {T1, …, T12 } be a single-instance and non préemptive-task set given by: T1 = (0, 1, 1), T2 = (0, 1, 2), T3 = (0, 2, 3), T4 = (0, 2, 3), T5 = (0, 2, 4), T6 = (0, 2, 4), T7 = (0, 4, 5), T8 = (0, 1, 5), T9 = (0, 1, 5), T10 = (0, 1, 5), T11 = (0, 2, 5), T12 = (0, 1, 5). • Number of processors = 4 and the dead lines are to be in sorted order • Result the EDF is failed to provide a feasible schedule for T(task set) on four processor-platform. This is because tasks T1,T2,T3,T4 will be chosen and executed by 4 processors. • Then T5,T6 will be scheduled for processors p1,p2. so task T7wil miss its deadline. Graduate Project
Scheduling based on EDF(cont …) Graduate Project
Not EDF but LLF schedulable.. • For LLF Schedule task set sorted based on the least laxities • Li= (di – ci - si) • New task set based on the laxities is T1 = (0, 1, 1), T2 = (0, 1, 2), T3 = (0, 2, 3), T4 = (0, 2, 3), T7 = (0, 4, 5), T5 = (0, 2, 4), T6 = (0, 2, 4), T11 = (0, 2, 5), T8 = (0, 1, 5), T9 = (0, 1, 5), T10 = (0, 1, 5), T12 = (0, 1, 5). Graduate Project
Not EDF but LLF schedulable.. Graduate Project
Scheduling based on LLF • Let T = {T1, …, T6 } be a single-instance and non-preemptive task set given by:T1 = (0, 2, 2), T2 = (0, 2, 2), T3 = (0, 3, 6), T4 = (0, 3, 6), T5 = (0, 1, 5), and T6 = (0, 1, 5). • Number of processors = 2 and the tasks are sorted in least laxities • The laxities are l1 = 0, l2 = 0, l3 = 3, l4 = 3, l5 = 4, and l6 = 4. • LLF method fails to provide a feasible schedule for T on a two-processor platform Graduate Project
Scheduling based on LLF(cont..) But EDF Schedulable: Task set is T {T1, T2, T5, T6, T3, T4} based on deadlines Graduate Project
Both EDF and LLF failed • Let T = {T1, …, T7 } be a single-instance and non-preemptive task set given by: T1 = (0, 2, 2), T2 = (0, 7, 7), T3 = (0, 8, 9), T4 = (0, 3, 6), T5 = (0, 1, 5), T6 = (0, 5, 12), and T7 = (0, 3, 11). • Both EDF and LLF methods fail to provide a feasible schedule for T on a three-processor platform. • EDF Task set is : (Sorted based on deadlines):T1 = (0, 2, 2), T5 = (0, 1, 5), T4 = (0, 3, 6), T2 = (0, 7, 7), T3 = (0, 8, 9), T7 = (0, 3, 11), T6 = (0, 5, 12). • LLF Task set is: (Sorted based on laxities) T : {T1, T2, T3, T4, T5, T6, T7} Graduate Project
Both EDF and LLF failed (cont..) EDF Scheduling: LLF Scheduling: Graduate Project
Both are failed so what to do ? Algorithm A By Dr. Stefan Andrei(SYNASC’10) Graduate Project
An ordering relation for the task sets • This ordering relation is based on task laxities, i.e., l = d − c - s, where T = (s, c, d) is a given task. • Given two tasks T1 = (S1, c1, d1) and T2 = (S2, c2, d2), we say that T1 < T2 if d1−c1 –S1 < d2−c2 –S2 or (d1 − c1 –S1 = d2 − c2 – S2 and d1 < d2). • We say that T1 = T2 if c1 = c2 and d1 = d2. • We say that T1 ≤ T2 if T1 < T2 or T1 = T2. • Example: Given T1 = (0, 1, 3), T2 = (0, 2, 5), and T3 = (0, 2, 4), we have T1 ≤ T2, T1 ≤ T3, and T3 ≤ T2. Graduate Project
The task order restriction • Given two tasks T1 = (s1, c1, d1) and T2 = (s2, c2, d2) such that T1 < T2, we say that T1 ̸→x T2if d2 < x + c1 + c2 ≤ d1, s1<= x and s2 <= x. • Given a task set T = {T1, ..., Tn}, we denote by TOR(T) = {Ti ̸→xTj | 1 ≤ i < j ≤ n, x ≥ 0 }. • So, the relation T1 ̸→x T2holds if T2cannot be executed after T1within time x. • In fact, task T1may be executed after task T2under the above conditions. • The ordering relation ̸→ is useful for the cases when the LLF method cannot provide a schedule and the EDF method can be applied instead. Graduate Project
Notations for Algorithm A • We consider a chain of tasks C as [T1, ..., Tk ], a list of tasks from the given task set T. • We denote the computation of the chain c(C) as c(T1)+ ... +c(Tk) and last(C) as Tk. • We denote by C −last(C) the chain C obtained after removing its last task. • We denote by C + T the chainobtained by concatenating C and task T. Graduate Project
Algorithm A • The input: A set of single-instance non-preemptive and independent tasks T = {T1, ..., Tn}, where each task Ti = (si, ci, di), for all i ∈ {1, ..., n }, such that d1 ≤ ... ≤ dn. • The output: A schedule for the task set T on am- processor platform, if T is feasible.Otherwise, display that T is infeasible. Graduate Project
Model of algorithm A • Sort lexicographically tasks T1, ..., Tnunder di − ci – siasa primary key and dias a second key. The obtained list is TS = [Tπ(1), ..., T π(n)], where π is the corresponding permutation such that T π(i) ≤ T π(i+1), for all i ∈ {1, ..., n − 1}. • TOR(TS) = ∅; • for (i = 1; i < n; i++) • if (d(T(i)) − c(T(i) – s(T(i))) >= 0) • for (j = i + 1; j ≤ n; j++) • if (∃ x ≥ 0 such that d(T(j)) < x+c(T(i))+ c(T(j)) ≤ d(T(i))) • TOR(TS)=TOR(TS) ∪ {T(i) ̸→x T(j)}; • Choose T(1), ..., T(m) as the set of initial tasks forthe first p chains • Remove T(1), ..., T(m) from the list TS; • feasible = true; Graduate Project
The method of Algorithm A (cont) • while (TS is a non-empty set && feasible){ • Let T be the first task from TS; • Choose a chain C such that c(T) + c(C) ≤ d(T); • if (such a chain exists) { • Remove T from TS; • Add T to chain C; } else { • Choose a chain C such that last(C) ̸→x T is in TOR(TS ), where x >= c(C − last(C)); • if (such a chain C exists){ Graduate Project
The method of Algorithm A (cont) • Add T to chain C, but switch T and last(C); • Remove T from TS; } else { • Print ‘A was unable to find a schedule’; • feasible = false; } } • if (feasible) { • Print ‘T is feasible and its schedule’ }}} Graduate Project
Proof Let us consider the task set : (From previous only) • T1 = (0, 2, 2), T2 = (0, 7, 7), T3 = (0, 8, 9), T4 = (0, 3, 6), T5 = (0, 1, 5), T6 = (0, 5, 12), and T7 = (0, 3, 11). • The laxities li = di −ci - sifor all i ∈ {1, ..., 7 } are, in order:l1 = 0, l2 = 0, l3 = 1, l4 = 3, l5 = 4, l6 = 7, l7 = 8. • TOR(T) = {T3 ̸→0 T5, T4 ̸→2 T5, T6 ̸→4 T7 }. • The schedule provided by Algorithm A is given by the following chains: C1 = [T1, T5, T4, T6], C2 = [T2, T7], and C3 = [T3]. Graduate Project
Proof (cont..) Because the priority inversion between T4 and T5 was possible because TOR(T) = {T3 ̸→0 T5, T4 ̸→2 T5, T6 ̸→4 T7 }. Processor p1 reaches time unit of 2 before task T4 was scheduled to be executed. Since T4 ̸→2 T5 belongs to TOR(T3) and the current time was 2, According to the algorithm A(line 19) we can switch T4 and T5 and get the schedule. Graduate Project
Complexity of Algorithm Differences between LLF, EDF, and A • The LLF strategy solves the ties randomly, whereas Algorithm A has a more refined and precise way to solve the non-deterministic schedule, namely the task having the earliest deadline is chosen. • Even if the task priorities are initially decided by the task laxities, our technique considers changing a task priority based on the ordering relation ̸→ defined over the task set. • So previous example represents a task set that is neither EDF nor LLF schedulable, but it can be scheduled by our algorithm. Graduate Project
Source code Graduate Project
Output Graduate Project
Results • Implemented three scheduling algorithms in JAVA on a Windows system having processor of 3.3MH and memory is 6gb RAM. • Table shows avg execution time of EDF, LLF and A in msec and to maintain the accuracy, the experiments are executed1000 times to take the average. Graduate Project
Conclusion • When EDF and LLF cannot provide a schedule, the overall execution time of Algorithm A increased by 60% compared to EDF and LLF. • If a task is LLF Schedulable, Algorithm A will take about the same time as LLF. • If a task is EDF-Schedulable but not LLF-schedulable, then Algorithm A takes 60% more execution time than EDF on average Graduate Project
References • [1] Ş. Andrei, A. Cheng, G. Grigoras, and V. Radulescu. An Efficient Scheduling Algorithm for the Multiprocessor Platform. In Proceedings of 12th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC’10), pages 245–252, IEEE Computer Society, Timisoara, Romania, 2010. • [2] Ş. Andrei, A. Cheng, and V. Radulescu. An Improved Upper-bound Algorithm for Non-preemptive Task Scheduling. In Proceedings of 12th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC’15), pages 245–252, IEEE Computer Society, Timisoara, Romania, 2015. Graduate Project