Research Article

Blockchain-Enhanced Fair Task Scheduling for Cloud-Fog-Edge Coordination Environments: Model and Algorithm

Algorithm 2

. Matching mobile task ti with the suitable resource r.
(i)Input: R, ti, load_safe_range
(ii)Output: the matching of ti to an appropriate r
(1)for each rj in R do
(2)   observe the workload of rj;
(3)   if (workloadrj ≤ load_safe_range) then
(4)    rj - > Rcandidate
(5)   end if
(6)done
(7)for each rk in Rcandidatedo
(8)   Calculate service justice SJti_rk of ti in rj according to formula (4);
(9)   If ( SJti_rk < min_sj) then
(10)    min_sk = SJti_rk;
(11)    rchosen = rk;
(12)   end if
(13)done
(14)if rchosen! = NULL then
(15)    schedule ti to rchosen;
(16)    update the workload of rchosen;
(17)end if