Research Article

An Architecture of IoT Service Delegation and Resource Allocation Based on Collaboration between Fog and Cloud Computing

Algorithm 1

Finding IoT services delegation/management in fog/cloud based on three conditions (service size, completion time, and VMs capacity) for cases 1 and 2.
Input: // service size (small or large), // service completion time (now or later), VMc // VM capacity
   (occupied = not enough or not occupied = enough)
Output: service delegation/management location // fog or cloud
(1) If (Service Size = small) && (Service completion time = now) && (VMs capacity = enough)
(2) THEN
(3) Divide requested services to small chunk
(4) Calculate the required no. of VMs
(5) Assign these chunks to the assigned VMs for processing
(6) else if (Service Size = small) && (Service completion time = now) && (VMs capacity = not enough)
(7) THEN
(8) Divide requested services to small chunks
(9) Calculate the required no. of VMs
(10) Obtain list of available VMs capacity in other fog/cloud environment from Services Monitor Server in cloud.
(11) Reserved the VMs and assign the chunks to them.
(12) else if (Service Size = small) && (Service completion time = later) && (VMs capacity = enough) && (Services in Queue = no)
(13) THEN
(14) Process the requested service at current location (fog environment)
(15) Divide requested services to small chunks
(16) Calculate the required no. of VMs
(17) Assign these chunks to the assigned VMs for processing
(18) else if (Service Size = small) && (Service completion time = later) && (VMs capacity = enough) && (Services in Queue = yes)
(19) delegate the requested services to be processed in cloud
(20) Divide requested services to small chunks
(21) Calculate the required no. of VMs
(22) Assign these chunks to the assigned VMs for processing
(23) end if
(24)  end if
(25)   end if
(26) After completion the processing of all chunks,
(27) return the chunks to broker for combining them and send the result to users IoT devices.