顺序调度策略
描述: 将一组任务顺序分配给一组虚拟机
实现代码:
private void bindCloudletToVmsRoundRobin(){
int vmNumber = vmList.size();
int index = 0;
for (Cloudlet cloudlet : cloudletList) {
cloudlet.setVm(vmList.get(index));
index = (index + 1) % vmNumber;
}
}
贪心调度策略
描述: 定义一个矩阵time[i][j]
,表示任务i
在虚拟机j
所需的执行时间,显然time[i][j] = MI[i] / MIPS[j]
。在初始化矩阵time
前,首先将任务按MI
的大小降序排序,将虚拟机按MIPS
的大小升序排列。注意,重新排序后矩阵time
的行号和任务ID
不再一一对应,列号和虚拟机ID
的对应关系也相应改变。初始化后,矩阵time
的每一行、每一列的元素值都是降序排列的,然后对time
做贪心。选用的贪心策略是:从矩阵中行号为0的任务开始,每次都尝试分配给最后一列对应的虚拟机,如果该选择相对于其他选择是最优的,就完成分配,否则将任务分配给运行任务最少的虚拟机,实现一种简单的负载均衡。这种方式反映了越复杂的任务需要更快的虚拟机来处理,以解决复杂任务造成的瓶颈,降低所有任务的总执行时间。
实现代码:
private void bindCloudletToVmsTimeAwared(){
int vmNum = vmList.size();
int cloudletNum = cloudletList.size();
double[][] time = new double[cloudletNum][vmNum];
vmList.sort(Comparator.comparing(Vm::getTotalMipsCapacity));
cloudletList.sort(Comparator.comparing(Cloudlet::getTotalLength).reversed());
for (int i = 0; i < cloudletNum; i++) {
for (int j = 0; j < vmNum; j++) {
time[i][j] = cloudletList.get(i).getTotalLength() / vmList.get(j).getTotalMipsCapacity();
}
}
double[] vmLoad = new double[vmNum];
int[] vmTask = new int[vmNum];
double minLoad = 0;
int index = 0;
vmLoad[vmNum-1] = time[0][vmNum-1];
vmTask[vmNum-1] = 1;
cloudletList.get(0).setVm(vmList.get(vmNum-1));
for (int i = 0; i < cloudletNum; i++) {
minLoad = vmLoad[vmNum-1] + time[i][vmNum-1];
index = vmNum - 1;
for (int j = vmNum -2; j >= 0; j--) {
if (vmLoad[j] == 0) {
if (minLoad >= time[i][j]){
index = j;
}
break;
}
if (minLoad > vmLoad[j] + time[i][j]){
minLoad = vmLoad[j] + time[i][j];
index = j;
} else if (minLoad == vmLoad[j] + time[i][j] && vmTask[j] < vmTask[index]){
index = j;
}
}
vmLoad[index] += time[i][index];
vmTask[index]++;
cloudletList.get(i).setVm(vmList.get(index));
}
}
仿真实验结果
顺序策略
INFO
================== Starting CloudSim Plus 6.3.7 ==================
INFO 0.00: DatacenterSimple1 is starting...
INFO DatacenterBrokerSimple2 is starting...
INFO Entities started.
INFO 0.00: DatacenterBrokerSimple2: List of 1 datacenters(s) received.
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 0 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 1 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 2 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 3 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 4 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 5 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 6 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 7 in DatacenterSimple1
INFO 0.00: VmAllocationPolicySimple: Vm 0 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 1 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 2 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 3 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 4 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 5 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 6 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 7 has been allocated to Host 0/DC 1
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 0 to Vm 0 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 1 to Vm 1 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 2 to Vm 2 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 3 to Vm 3 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 4 to Vm 4 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 5 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 6 to Vm 6 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 7 to Vm 7 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 8 to Vm 0 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 9 to Vm 1 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 10 to Vm 2 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 11 to Vm 3 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 12 to Vm 4 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 13 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 14 to Vm 6 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 15 to Vm 7 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 16 to Vm 0 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 17 to Vm 1 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 18 to Vm 2 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 19 to Vm 3 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: All waiting Cloudlets submitted to some VM.
INFO 0.61: DatacenterBrokerSimple2: Cloudlet 6 finished in Vm 6 and returned to broker.
INFO 0.96: DatacenterBrokerSimple2: Cloudlet 7 finished in Vm 7 and returned to broker.
INFO 1.75: DatacenterBrokerSimple2: Cloudlet 1 finished in Vm 1 and returned to broker.
INFO 2.89: DatacenterBrokerSimple2: Cloudlet 14 finished in Vm 6 and returned to broker.
INFO 3.18: DatacenterBrokerSimple2: Cloudlet 0 finished in Vm 0 and returned to broker.
INFO 3.60: DatacenterBrokerSimple2: Cloudlet 15 finished in Vm 7 and returned to broker.
INFO 4.37: DatacenterBrokerSimple2: Cloudlet 5 finished in Vm 5 and returned to broker.
INFO 4.92: DatacenterBrokerSimple2: Cloudlet 2 finished in Vm 2 and returned to broker.
INFO 6.12: DatacenterBrokerSimple2: Cloudlet 9 finished in Vm 1 and returned to broker.
INFO 6.34: DatacenterBrokerSimple2: Cloudlet 8 finished in Vm 0 and returned to broker.
INFO 6.78: DatacenterBrokerSimple2: Cloudlet 3 finished in Vm 3 and returned to broker.
INFO 7.33: DatacenterBrokerSimple2: Cloudlet 13 finished in Vm 5 and returned to broker.
INFO 9.44: DatacenterBrokerSimple2: Cloudlet 16 finished in Vm 0 and returned to broker.
INFO 10.78: DatacenterBrokerSimple2: Cloudlet 11 finished in Vm 3 and returned to broker.
INFO 12.78: DatacenterBrokerSimple2: Cloudlet 4 finished in Vm 4 and returned to broker.
INFO 13.31: DatacenterBrokerSimple2: Cloudlet 17 finished in Vm 1 and returned to broker.
INFO 14.98: DatacenterBrokerSimple2: Cloudlet 10 finished in Vm 2 and returned to broker.
INFO 19.20: DatacenterBrokerSimple2: Cloudlet 19 finished in Vm 3 and returned to broker.
INFO 19.95: DatacenterBrokerSimple2: Cloudlet 18 finished in Vm 2 and returned to broker.
INFO 30.11: DatacenterBrokerSimple2: Cloudlet 12 finished in Vm 4 and returned to broker.
INFO 30.12: Processing last events before simulation shutdown.
INFO 30.12: DatacenterBrokerSimple2 is shutting down...
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 7 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 6 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 5 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 4 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 3 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 2 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 1 destruction.
INFO 30.12: DatacenterBrokerSimple2: Requesting Vm 0 destruction.
INFO 30.12: DatacenterSimple: Vm 7 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 6 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 5 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 4 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 3 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 2 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 1 destroyed on Host 0/DC 1.
INFO 30.12: DatacenterSimple: Vm 0 destroyed on Host 0/DC 1.
INFO Simulation: No more future events
INFO CloudInformationService0: Notify all CloudSim Plus entities to shutdown.
INFO
================== Simulation finished at time 30.12 ==================
DEBUG DeferredQueue >> max size: 19 added to middle: 0 added to tail: 200
SIMULATION RESULTS
Cloudlet|Status |DC|Host|Host PEs |VM|VM PEs |VM PEs |CloudletLen|CloudletPEs|StartTime|FinishTime|ExecTime
ID| |ID| ID|CPU cores|ID|CPU cores| MIPS| MI| CPU cores| Seconds| Seconds| Seconds
---------------------------------------------------------------------------------------------------------------
6|SUCCESS| 1| 0| 8| 6| 1| 8238.0| 5007| 1| 0.00| 0.61| 0.61
7|SUCCESS| 1| 0| 8| 7| 1| 8942.0| 8531| 1| 0.00| 0.96| 0.96
1|SUCCESS| 1| 0| 8| 1| 1| 2985.0| 5187| 1| 0.00| 1.75| 1.75
14|SUCCESS| 1| 0| 8| 6| 1| 8238.0| 18623| 1| 0.62| 2.89| 2.27
0|SUCCESS| 1| 0| 8| 0| 1| 6739.0| 21330| 1| 0.00| 3.18| 3.18
15|SUCCESS| 1| 0| 8| 7| 1| 8942.0| 23437| 1| 0.96| 3.60| 2.63
5|SUCCESS| 1| 0| 8| 5| 1| 8236.0| 35912| 1| 0.00| 4.37| 4.37
2|SUCCESS| 1| 0| 8| 2| 1| 3513.0| 17247| 1| 0.00| 4.92| 4.92
9|SUCCESS| 1| 0| 8| 1| 1| 2985.0| 13010| 1| 1.75| 6.12| 4.37
8|SUCCESS| 1| 0| 8| 0| 1| 6739.0| 21281| 1| 3.18| 6.34| 3.17
3|SUCCESS| 1| 0| 8| 3| 1| 4704.0| 31823| 1| 0.00| 6.78| 6.78
13|SUCCESS| 1| 0| 8| 5| 1| 8236.0| 24262| 1| 4.37| 7.33| 2.96
16|SUCCESS| 1| 0| 8| 0| 1| 6739.0| 20712| 1| 6.35| 9.44| 3.08
11|SUCCESS| 1| 0| 8| 3| 1| 4704.0| 18801| 1| 6.78| 10.78| 4.01
4|SUCCESS| 1| 0| 8| 4| 1| 1638.0| 20894| 1| 0.00| 12.78| 12.78
17|SUCCESS| 1| 0| 8| 1| 1| 2985.0| 21426| 1| 6.13| 13.31| 7.19
10|SUCCESS| 1| 0| 8| 2| 1| 3513.0| 35315| 1| 4.92| 14.98| 10.06
19|SUCCESS| 1| 0| 8| 3| 1| 4704.0| 39488| 1| 10.79| 19.20| 8.40
18|SUCCESS| 1| 0| 8| 2| 1| 3513.0| 17378| 1| 14.99| 19.95| 4.96
12|SUCCESS| 1| 0| 8| 4| 1| 1638.0| 28379| 1| 12.78| 30.11| 17.33
---------------------------------------------------------------------------------------------------------------
贪心策略
INFO
================== Starting CloudSim Plus 6.3.7 ==================
INFO 0.00: DatacenterSimple1 is starting...
INFO DatacenterBrokerSimple2 is starting...
INFO Entities started.
INFO 0.00: DatacenterBrokerSimple2: List of 1 datacenters(s) received.
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 0 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 1 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 2 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 3 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 4 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 5 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 6 in DatacenterSimple1
INFO 0.00: DatacenterBrokerSimple2: Trying to create Vm 7 in DatacenterSimple1
INFO 0.00: VmAllocationPolicySimple: Vm 0 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 1 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 2 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 3 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 4 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 5 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 6 has been allocated to Host 0/DC 1
INFO 0.00: VmAllocationPolicySimple: Vm 7 has been allocated to Host 0/DC 1
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 0 to Vm 6 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 1 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 2 to Vm 4 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 3 to Vm 7 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 4 to Vm 6 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 5 to Vm 3 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 6 to Vm 2 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 7 to Vm 1 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 8 to Vm 0 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 9 to Vm 4 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 10 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 11 to Vm 7 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 12 to Vm 6 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 13 to Vm 2 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 14 to Vm 3 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 15 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 16 to Vm 4 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 17 to Vm 1 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 18 to Vm 5 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: Sending Cloudlet 19 to Vm 0 in Host 0/DC 1.
INFO 0.00: DatacenterBrokerSimple2: All waiting Cloudlets submitted to some VM.
INFO 5.65: DatacenterBrokerSimple2: Cloudlet 3 finished in Vm 7 and returned to broker.
INFO 6.19: DatacenterBrokerSimple2: Cloudlet 0 finished in Vm 6 and returned to broker.
INFO 7.83: DatacenterBrokerSimple2: Cloudlet 2 finished in Vm 4 and returned to broker.
INFO 7.95: DatacenterBrokerSimple2: Cloudlet 1 finished in Vm 5 and returned to broker.
INFO 8.45: DatacenterBrokerSimple2: Cloudlet 11 finished in Vm 7 and returned to broker.
INFO 10.21: DatacenterBrokerSimple2: Cloudlet 6 finished in Vm 2 and returned to broker.
INFO 10.40: DatacenterBrokerSimple2: Cloudlet 5 finished in Vm 3 and returned to broker.
INFO 11.77: DatacenterBrokerSimple2: Cloudlet 7 finished in Vm 1 and returned to broker.
INFO 11.86: DatacenterBrokerSimple2: Cloudlet 10 finished in Vm 5 and returned to broker.
INFO 11.86: DatacenterBrokerSimple2: Cloudlet 4 finished in Vm 6 and returned to broker.
INFO 11.90: DatacenterBrokerSimple2: Cloudlet 9 finished in Vm 4 and returned to broker.
INFO 12.40: DatacenterBrokerSimple2: Cloudlet 8 finished in Vm 0 and returned to broker.
INFO 13.34: DatacenterBrokerSimple2: Cloudlet 14 finished in Vm 3 and returned to broker.
INFO 13.51: DatacenterBrokerSimple2: Cloudlet 15 finished in Vm 5 and returned to broker.
INFO 13.57: DatacenterBrokerSimple2: Cloudlet 16 finished in Vm 4 and returned to broker.
INFO 13.90: DatacenterBrokerSimple2: Cloudlet 12 finished in Vm 6 and returned to broker.
INFO 14.20: DatacenterBrokerSimple2: Cloudlet 13 finished in Vm 2 and returned to broker.
INFO 14.48: DatacenterBrokerSimple2: Cloudlet 17 finished in Vm 1 and returned to broker.
INFO 14.56: DatacenterBrokerSimple2: Cloudlet 19 finished in Vm 0 and returned to broker.
INFO 14.79: DatacenterBrokerSimple2: Cloudlet 18 finished in Vm 5 and returned to broker.
INFO 14.80: Processing last events before simulation shutdown.
INFO 14.80: DatacenterBrokerSimple2 is shutting down...
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 7 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 6 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 5 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 4 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 3 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 2 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 1 destruction.
INFO 14.80: DatacenterBrokerSimple2: Requesting Vm 0 destruction.
INFO 14.80: DatacenterSimple: Vm 7 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 6 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 5 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 4 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 3 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 2 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 1 destroyed on Host 0/DC 1.
INFO 14.80: DatacenterSimple: Vm 0 destroyed on Host 0/DC 1.
INFO Simulation: No more future events
INFO CloudInformationService0: Notify all CloudSim Plus entities to shutdown.
INFO
================== Simulation finished at time 14.80 ==================
DEBUG DeferredQueue >> max size: 19 added to middle: 0 added to tail: 222
SIMULATION RESULTS
Cloudlet|Status |DC|Host|Host PEs |VM|VM PEs |VM PEs |CloudletLen|CloudletPEs|StartTime|FinishTime|ExecTime
ID| |ID| ID|CPU cores|ID|CPU cores| MIPS| MI| CPU cores| Seconds| Seconds| Seconds
---------------------------------------------------------------------------------------------------------------
3|SUCCESS| 1| 0| 8| 7| 1| 8129.0| 45902| 1| 0.00| 5.65| 5.65
0|SUCCESS| 1| 0| 8| 6| 1| 8051.0| 49760| 1| 0.00| 6.19| 6.19
2|SUCCESS| 1| 0| 8| 4| 1| 5899.0| 46114| 1| 0.00| 7.83| 7.83
1|SUCCESS| 1| 0| 8| 5| 1| 6029.0| 47863| 1| 0.00| 7.95| 7.95
11|SUCCESS| 1| 0| 8| 7| 1| 8129.0| 22652| 1| 5.66| 8.45| 2.80
6|SUCCESS| 1| 0| 8| 2| 1| 3770.0| 38452| 1| 0.00| 10.21| 10.21
5|SUCCESS| 1| 0| 8| 3| 1| 3794.0| 39416| 1| 0.00| 10.40| 10.40
7|SUCCESS| 1| 0| 8| 1| 1| 3244.0| 38160| 1| 0.00| 11.77| 11.77
10|SUCCESS| 1| 0| 8| 5| 1| 6029.0| 23515| 1| 7.95| 11.86| 3.91
4|SUCCESS| 1| 0| 8| 6| 1| 8051.0| 45564| 1| 6.19| 11.86| 5.67
9|SUCCESS| 1| 0| 8| 4| 1| 5899.0| 23958| 1| 7.83| 11.90| 4.07
8|SUCCESS| 1| 0| 8| 0| 1| 2873.0| 35583| 1| 0.00| 12.40| 12.40
14|SUCCESS| 1| 0| 8| 3| 1| 3794.0| 11134| 1| 10.40| 13.34| 2.94
15|SUCCESS| 1| 0| 8| 5| 1| 6029.0| 9909| 1| 11.86| 13.51| 1.65
16|SUCCESS| 1| 0| 8| 4| 1| 5899.0| 9796| 1| 11.90| 13.57| 1.67
12|SUCCESS| 1| 0| 8| 6| 1| 8051.0| 16374| 1| 11.86| 13.90| 2.04
13|SUCCESS| 1| 0| 8| 2| 1| 3770.0| 14989| 1| 10.21| 14.20| 3.99
17|SUCCESS| 1| 0| 8| 1| 1| 3244.0| 8727| 1| 11.77| 14.48| 2.71
19|SUCCESS| 1| 0| 8| 0| 1| 2873.0| 6194| 1| 12.40| 14.56| 2.17
18|SUCCESS| 1| 0| 8| 5| 1| 6029.0| 7622| 1| 13.51| 14.79| 1.27
---------------------------------------------------------------------------------------------------------------
任务的总执行时间
描述: 两种调度方式均重复执行十次实验,取平均值。
结果:
算法\实验ID | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|---|
Round Robin | 23.51 | 33.81 | 67.29 | 48.85 | 55.33 | 38.12 | 29.29 | 21.41 | 51.74 | 59.13 |
Greedy | 15.73 | 19.39 | 20.22 | 11.72 | 21.65 | 23.34 | 17.15 | 16.60 | 14.42 | 14.15 |
分析:
顺序调度策略的平均执行时间:
A
v
e
r
a
g
e
R
R
=
42.45
\text Average_{RR}=\text {42.45}
AverageRR=42.45
贪心调度策略的平均执行时间:
A
v
e
r
a
g
e
G
r
e
e
d
y
=
17.44
\text Average_{Greedy}=\text {17.44}
AverageGreedy=17.44
总结: 贪心策略比顺序策略节省了59%的总执行时间。
参考
《分布式计算、云计算与大数据》林伟伟