*3.6. The RR Algorithm*

RR is used as the demand scheduling algorithm for cloud environment. It is adapted in this work on the basis of specific time schedules (i.e., time quantum) [30]. The scheduler develops the details of the VMs in an assignment table. In addition, it tries to allocate the jobs equally for the VMs on the DCs; however, it does not confirm completion of their time schedules. Firstly, VM is initiated with the ID of the current VM variable and the requested job is mapped with that VM variable. In some cases, if the IDs of first and last VM resemble then it redefines the current VM ID. It is pre-emptive in nature and if any task has not been completed in the defined time horizon, it reinitiates that task in the next cycle.

```
Algorithm 1: RR.
```

```
Inputs: Set of the incoming requests, Set of the VMs;
Output: Processing_Time, Request_Time, Response_Time, Cost;
Initialization: maxCount = maxVal, VM_ID = −1;
for VM=1; VM ≤ length(VM_list); VM++ do
   find (tasks_assigned to VM)
   if VM_ID == −1 then
      curr_Count = 1;
      else
         curr_Count=VM.getCurrentAssign();
      end
   end
   endJobCount
   find (curr_VM_State)
   state = VM.getState()
   if curr_Count ≤ maxCount && state.equals(AVAILABLE) then
      maxCount=curr_Count
      VM_ID = Curr_VM_ID
   end
   return VM_ID
   Calculate Response_Time
   Calculate Request_Time
   Calculate Processing_Time
   Calculate Costtot
end
```