Research Article
Dynamic Resource Allocation for Load Balancing in Fog Environment
Algorithm 3
Static resource allocation for fog service subset.
Input: The fog service subset | Output: The relevant resource allocation records | (1) Get the node type nt in the service subset | (2) Sort in decreasing order of required resource amount | (3) for each fog service in do | (4) for to do | (5) if has the same type with then | (6) Get the spare space byAlgorithm 2 | (7) if has enough space to host the service then | (8) Add the computing node to | (9) end if | (10) end if | (11) end for | (12) Sort in increasing order of spare space | (13) Put the service in the first computing node in | (14) end for | (15) flag = 1, | (16) Identify the occupied computing nodes from to | (17) Sort in the decreasing order of spare space | (18) while flag == 1 do | (19) if the resource usage of is less than then | (20) Select the tasks to migrate to the computing node | (21) | (22) else flag = 0 | (23) end if | (24) end while | (25) Update the relevant occupation records | (26) Generate an allocation records |
|