@Override public void run() { int size = getCloudletList().size(); for (int i = 0; i < size; i++) { Cloudlet cloudlet = (Cloudlet) getCloudletList().get(i); int vmSize = getVmList().size(); CondorVM closestVm = null; // (CondorVM)getVmList().get(0); double minTime = Double.MAX_VALUE; for (int j = 0; j < vmSize; j++) { CondorVM vm = (CondorVM) getVmList().get(j); if (vm.getState() == WorkflowSimTags.VM_STATUS_IDLE) { Job job = (Job) cloudlet; double time = dataTransferTime(job.getFileList(), cloudlet, vm.getId()); if (time < minTime) { minTime = time; closestVm = vm; } } } if (closestVm != null) { closestVm.setState(WorkflowSimTags.VM_STATUS_BUSY); cloudlet.setVmId(closestVm.getId()); getScheduledList().add(cloudlet); } } }
@Override public void run() { // Round Robin for (Iterator it = getCloudletList().iterator(); it.hasNext(); ) { Cloudlet cloudlet = (Cloudlet) it.next(); boolean stillHasVm = false; for (Iterator itc = getVmList().iterator(); itc.hasNext(); ) { CondorVM vm = (CondorVM) itc.next(); if (vm.getState() == WorkflowSimTags.VM_STATUS_IDLE) { stillHasVm = true; vm.setState(WorkflowSimTags.VM_STATUS_BUSY); cloudlet.setVmId(vm.getId()); this.scheduledList.add(cloudlet); break; } } // no vm available if (!stillHasVm) { break; } } }