Algorithm 2. Management of fog nodes.
| Step 1 |
| Each fog node sends the (for node k) to nodedt |
| nodedt assigns each to the ordered Lnode list. |
| foreach reqi do |
| reqi is sent to nodedt |
| (Pri) = Priority(, ) |
| if Pri = H then |
| else if Pri = M then |
| else if Pri = L then |
| Step 2 |
| /* Task distribution to fog nodes according to and */ |
| foreach reqi in QH, QM, QL do |
| for Lnode(k) do |
| if then |
| break |
| if reqi is not assigned to any fog node then |
| reversedList /* from high to low (processing capacity) */ |
| for reversedList do |
| if then |
| break |
| else |
| if reqi is not assigned to any fog node group then |
| if (reqi in QH) or (reqi in QM) then |
| reject(reqi) |
| else if reqi in QL then |