1 | package de.uka.ipd.sdq.scheduler.loaddistribution.balancers; |
2 | // |
3 | import de.uka.ipd.sdq.scheduler.resources.IResourceInstance; |
4 | // |
5 | ///** |
6 | // * For all idle resource instances it ensures that the load is shared so that |
7 | // * the load of two the resource instances does not differ more than 'threshold'. |
8 | // * The threshold is a relative value between 0 and 1. If 0 the load of both |
9 | // * instances must be equal, if 1 the load of both instances is never balanced. |
10 | // * |
11 | // * @author jens.happe |
12 | // * |
13 | // */ |
14 | public class IdleToThresholdBalancer extends AbstractLoadBalancer { |
15 | |
16 | protected IdleToThresholdBalancer(double balancing_interval, |
17 | boolean prio_increasing, boolean queue_ascending) { |
18 | super(balancing_interval, prio_increasing, queue_ascending); |
19 | // TODO Auto-generated constructor stub |
20 | } |
21 | |
22 | public void activelyBalance(IResourceInstance instance) { |
23 | // TODO Auto-generated method stub |
24 | |
25 | } |
26 | |
27 | public void onFork(IResourceInstance current) { |
28 | // TODO Auto-generated method stub |
29 | |
30 | } |
31 | |
32 | public void onSleep(IResourceInstance lastInstance) { |
33 | // TODO Auto-generated method stub |
34 | |
35 | } |
36 | |
37 | public void onTerminate(IResourceInstance lastInstance) { |
38 | // TODO Auto-generated method stub |
39 | |
40 | } |
41 | |
42 | public void onWake(IResourceInstance current) { |
43 | // TODO Auto-generated method stub |
44 | |
45 | } |
46 | // |
47 | // /** |
48 | // * Maximum, relative load difference of two resource instances. |
49 | // */ |
50 | // private double threshold; |
51 | // |
52 | // /** |
53 | // * Creates a new load balancer. |
54 | // * |
55 | // * @param balance_interval |
56 | // * Minimum time that needs to pass between two executions of the |
57 | // * load balancer. |
58 | // * |
59 | // * @param do_global_balance |
60 | // * Indicates whether all instances should be balanced or only the |
61 | // * specified and busiest one. |
62 | // * |
63 | // * @param prio_increasing |
64 | // * Determines the order how movable processes are returned. If |
65 | // * true, the priority of the processes is increasing, otherwise |
66 | // * decreasing. |
67 | // * |
68 | // * @param queue_ascending |
69 | // * Determines the order how movable processes are returned. If |
70 | // * true, the first processes are returned in the same order of |
71 | // * the queue, otherwise they are returned in reverse order. |
72 | // * |
73 | // * @param max_iterations |
74 | // * Gives the maximum number of iterations for a global balancing. |
75 | // * |
76 | // * @param threshold |
77 | // * Maximum, relative load difference of two resource instances. |
78 | // */ |
79 | // public IdleToThresholdBalancer(double balance_interval, |
80 | // boolean global_balance, boolean prio_increasing, |
81 | // boolean queue_ascending, int max_iterations, double threshold) { |
82 | // super(balance_interval, global_balance, prio_increasing, |
83 | // queue_ascending, max_iterations); |
84 | // this.threshold = threshold; |
85 | // } |
86 | // |
87 | // @Override |
88 | // protected boolean isBalanced(IResourceInstance firstInstance, |
89 | // IResourceInstance secondInstance) { |
90 | // |
91 | // if (queue_holder.isIdle(firstInstance) != queue_holder |
92 | // .isIdle(secondInstance)) { |
93 | // double firstLoad = load(firstInstance); |
94 | // double secondLoad = load(secondInstance); |
95 | // double totalLoad = firstLoad + secondLoad; |
96 | // |
97 | // if (totalLoad == 0) |
98 | // return true; |
99 | // |
100 | // firstLoad /= totalLoad; |
101 | // secondLoad /= totalLoad; |
102 | // double distance = Math.abs(firstLoad - secondLoad); |
103 | // return distance <= threshold; |
104 | // } |
105 | // return true; |
106 | // } |
107 | } |