(1) Identify the Pending Execution Time in each of the VMs by collecting the Pending Execution length from executing, waiting & |
paused list. |
(a) Set pendingJobsTotLength = JobsRemainingLengthInExecList + JobsRemainingLengthInWaitList + |
JobsRemainingLengthInPauseList |
(b) is the processing capacity of the VM. |
(c) Set pendingETime = pendingJobsTotLength/ |
(2) Arrange the VMs based on the least pending execution time to the highest pending execution time and group it, in case two |
VMs fall in the same pending length. This Map should contain pending execution time as key and it’s associated VMs as a value. |
(a) Sort the VMMap by the Pending Execution Time of each VM |
(3) Re-arrange the incoming Jobs based on the length & priority of the Jobs. |
(a) Sort the JobSubmittedList based on length & priority. |
(4) Initiate the vmIndex, jobIndex variable & totalJobs |
(a) Set vmIndex = 0 |
(b) Set totalJobs = length of JobSubmittedList |
(c) Set totalVMsCount = size of VMMap |
(d) Set jobIndex = 0 |
(e) Set jobToVMratio = totalJobs/totalVMsCount |
(5) Assign the incoming jobs to the VMs based on the least Pending Execution Time in the VMs & its processing capacity. |
(a) While (true) |
Set job = JobSubmittedList.get(jobIndex) |
Set jobLength = lengthOf(job) |
Set newCompletiontimeMap = EmptyMap |
For startNumber from 0 by 1 to totalVMsCount do |
Set vm = VMMap.getValue(startNumber) |
Set probableNewCompTime = jobLength/ + VMMap.getKey(startNumber) |
newCompletiontimeMap.add(probableNewCompTime, vm) |
|
SortByCompletionTime(newCompletiontimeMap) |
Set selectedVM = newCompletiontimeMap.getValue(0) |
selectedVM.assign(job) |
For startNumber from 0 by 1 to totalVMsCount do |
Set vm = VMMap.getValue(startNumber) |
If (vm equals selectedVM) |
Set currentLength = VMMap.getKey(startNumber) |
Set newCurrentLength = currentLength + newCompletiontimeMap.getKey(0) |
VMMap.removeItem(startNumber) |
VMMap.add(newCurrentLength, vm) |
EndIf |
|
sortByCompletionTime(VMMap) |
Increase the jobIndex by 1 |
If (jobIndex equals totalJobs) |
Break |
(b) End While |
(6) Remove all the assigned Jobs from the JobSubmittedList |