Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.

Similar presentations


Presentation on theme: "1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling."— Presentation transcript:

1 1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling

2 2 Time Frame Given a set of tasks, let H denote the smallest hyper period of all tasks. –T1=(1,4), T2=(1.8,5), T3=(1,20), T4=(2,20) –H=20 Divide time into frames and frame size f should divide H. –f could be 2,4,5,10,20 Choose small frame size since this will make the scheduling solution more useful

3 Network flow formulation Denote all the tasks as J 1,J 2,…,J n Vertices –N job vertices –H/f time frame vertices –Source –Sink Edges –Source to job vertex with capacity set to execution time e i –Job vertex to time frame vertex with capacity f if the job can run in the time frame –Time frame to sink with capacity f 3

4 Flow network 4

5 Computing scheduling If the obtained maximum flow is equal to the sum of execution time of all tasks, then the task set is schedulable. 5

6 6 Flow network Given a directed graph G A source node s A sink node t Goal: To send as much information from s to t

7 7 Flows An s-t flow is a function f which satisfies: (capacity constraint) (conservation of flows ( at intermediate vertices )

8 8 Value of the flow st 10 9 8 4 6 2 3 9 9 9 7 0 G: 6 Value = 19 Maximum flow problem: maximize this value

9 9 Cuts An s-t cut is a set of edges whose removal disconnect s and t The capacity of a cut is defined as the sum of the capacity of the edges in the cut Minimum s-t cut problem: minimize this capacity of a s-t cut

10 10 Flows ≤ cuts Let C be a cut and S be the connected component of G-C containing s.

11 11 Main result Value of max s-t flow ≤ capacity of min s-t cut (Ford Fulkerson 1956) Max flow = Min cut A polynomial time algorithm

12 12 Greedy method? Find an s-t path where every edge has f(e) < c(e) Add this path to the flow Repeat until no such path can be found. Does it work?

13 13 A counterexample 2010 2010 30 The greedy algorithm produces a flow of value 20 while the maximum flow has value of 30.

14 14 Residual graph Key idea allow flows to push back c(e) = 10 f(e) = 2 c(e) = 8 c(e) = 2 Advantage of this representation is not to distinguish send forward or push back Can send 8 units forward or push 2 units back.

15 15 Ford-Fulkerson Algorithm 1.Start from an empty flow f 2.While there is an s-t path P in residual graph update f along the original graph 3.Return f

16 16 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 0 0 0 0 0 0 0 0 G: Flow value = 0 0 flow capacity

17 17 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 0 0 0 0 0 0 0 0 G: s 2 3 4 5t 10 9 4 6 2 G f : 10 8 8 8 8 X X X 0 Flow value = 0 capacity residual capacity flow

18 18 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 8 0 0 0 0 8 8 0 0 G: s 2 3 4 5t 10 4 6 G f : 8 8 8 9 2 2 2 10 2 X X X 2 X Flow value = 8

19 19 0 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 0 0 0 2 8 2 G: s 2 3 4 5t 4 2 G f : 10 8 2 7 6 X 6 6 6 X X 8 X Flow value = 10

20 20 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 0 6 6 8 8 2 G: s 2 3 4 5t 1 6 G f : 10 8 8 6 6 6 4 4 4 2 X 8 2 8 X X 0 X Flow value = 16

21 21 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 2 8 8 8 8 0 G: s 2 3 4 5t 6 2 G f : 10 8 6 8 8 2 2 1 2 8 2 X 9 7 9 X X 9 X X 3 Flow value = 18

22 22 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 3 9 9 9 7 0 G: s 2 3 4 5t 1 9 1 1 6 2 G f : 10 7 6 9 9 3 1 Flow value = 19

23 23 Ford-Fulkerson Algorithm s 2 3 4 5t 10 9 8 4 6 2 3 9 9 9 7 0 G: s 2 3 4 5t 1 9 1 1 6 2 G f : 10 7 6 9 9 3 1 Flow value = 19 Cut capacity = 19

24 24 Max-flow min-cut theorem Consider the set S of all vertices reachable from s s is in S, but t is not in S No incoming flow coming in S (otherwise push back) Achieve full capacity from S to T Min cut!

25 25 Integrality theorem If every edge has integer capacity, then there is a flow of integer value.

26 26 Complexity Assume edge capacity between 1 to C At most mC iterations Finding an s-t path can be done in O(m) time Total running time O(m 2 C)

27 27 Speedup with capacity scaling Capacity scaling to find paths with large capacity –Find 2 p-1  C  2 p –For i from p-1 to 0 Compute the graph with edge capacity at least 2 i Find maximum flow there At iteration i, there are at most m edges, the capacity of the min cut is at most m2 i+1 and each augmenting path has flow value at least 2 i, so there are at most 2m augmentations. Runtime is bounded in O(m 2 logC).

28 Speedup with BFS In each iteration, compute the breadth first search in the residual graph and choose the path with fewest edges. Let level i (v) denote the distance from s to v in the residual graph. Level i (v) cannot decrease during iterations. Prove by induction. –Suppose that in the i+1 iteration, edge u->v is picked in the residual graph for pushing flow. If u->v is an edge in the residual graph in last iteration, level i (u)+1=level i (v)<=level i+1 (u)+1=level i+1 (v) by induction –Otherwise, v->u is in the augmenting path of iteration i, which means that it is along the shortest path, so level i (v)=level i (u)-1<level i (u)+1<=level i+1 (u)+1=level i+1 (v) Each edge cannot appear and disappear many times. Given a consecutive disappearance in G i and appearance in G j of an edge u->v in two residual graphs. u->v is on the augmenting path of G i and v->u is on the augmenting path of G j, so level i (u)+1=level i (v) and level j (v)+1=level j (u). Note that level j (v)>=level i (v). We have level j (u)>=level i (u)+2. 28

29 Speedup with BFS (2) Distance from s to u increases by at least 2 for disappearance and appearance. The level is at most n, so the number of disappearance is bounded by n/2. Each edge can disappear at most n/2 times, totally m edges which means that the total disappearance is nm/2 At least one edge disappears, so at most nm/2 iterations Total runtime O(nm 2 ) 29


Download ppt "1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling."

Similar presentations


Ads by Google