Research Article

Energy-Aware Scheduling of Workflow Using a Heuristic Method on Green Cloud

Algorithm 2

Resource allocation cost function (RACF).
Input: list of task, resources, and alpha
 Output: assigning the best resources to tasks and estimating the amount of objective function according to alpha
(1)function [f, ] = RACF (list,VM,alpha)
(2)  while I ≤ length(list)||∼isempty(reserved)
(3)  if i ≤ length(list)
(4)  CurrentTask = list(i);
(5)  for j = 1: length(VM)
(6)   if CurrentTask.Ram ≤ VM(j).Ram && CurrentTask. Core ≤ VM(j). Core && VM(j). On = = true
(7)    VM(j).Ram = VM(j).Ram-CurrentTask.Ram;
(8)    VM(j).Core = VM(j).Core-CurrentTask.Core;
(9)    ;
(10)    reserved = [reserved; [ij]];
(11)    ;
(12)    
(13)     ;
(14)    ;
(15)    ;
(16)    ;
(17)    i = i + 1;
(18)    end if;
(19)   end for;
(20)  end if;
(21)  for r = 1:size(reserved, 1 )
(22)   if reserved(r, 3) < time
(23) VM(j).Ram = VM(j).Ram + list(reserved(r, 1)).Ram;
(24) VM(j).Core = VM(j).Core + list(reserved(r, 1)).Core;
(25)    ID = [ID r];
(26)   end if;
(27)  end for;
(28)  Reserved (ID,:) = [];
(29)  time = time + 1;
(30) end while;
(31)f = ;
(32)End