Advanced Mathematics and Numerical Modeling of IoT

(lily) #1
(1)BooleanSflag=false//a flag representing occurrence of a task execution
(2)while(search user’s job)do
(3) if(require job execution by the user)then
(4) take the cost and total execution time by the user;
(5) Sflag =true;
(6) end if
(7) if(Sflag)then
(8) invoke initialworkflow ( );//thread function
(9) while(task execution does not finish)do
(10) if(meet the recalculation point by instance)then
(11) invoke recalculationworkflow ( );//thread function
(12) end if
(13) end while
(14) end if
(15)end while

Algorithm 1: Workflow scheduling algorithm.

(1)ThreadFunctioninitialworkflow ( )begin
(2) forallinstance퐼푖∈Insdo
(3) retrieve an instance information to meet the user’s requirement in an
instance퐼푖;
(4) analyze an available execution time and cost in an instance퐼푖;
(5) store the analyzed available instance to a queueinstance;
(6) end forall
(7) calculate on priority list for the priority job allocation;
(8) forallinstance퐼푖∈queueinstancedo
(9) allocate tasks to the instance퐼푖;
(10) end forall
(11)end ThreadFunction
(12)ThreadFunctionrecalculation workflow ( )begin
(13) forallinstance퐼푖∈Insdo
(14) retrieve the information푇rate퐼푖 to an instance퐼푖;
(15) calculate the modified task size;
(16) end forall
(17)end ThreadFunction

Algorithm 2: Workflow recalculation function.

We use the instance rate푇rate퐼푖 for determining the criteria

to divide groups.푇퐼rate푖 represents the unit taken for the
processing of a task size in the instance퐼푖. Consider


푇rate퐼푖 =

푇execution퐼푖 +푇퐼failure푖

푇execution퐼푖

, (2)

where푇execution퐼푖 and푇퐼failure푖 represent the task execution time
and the task failure time, respectively.
Andwedefinetheavgtoclassifygroups.Theavgisthe
average of available instances such as푇avgrateand푇avgwhich


represent the average of the푇rate퐼푖 and푇퐼푖,respectively.The
set of instances is classified into two groups, positive and
negative, based on푇avgrate.Thepositivegroup퐺푃is the set of


instances with푇rate퐼푖 greater than푇rateavg. Consider


퐺푃={퐼푖푇rate퐼푖 ≥푇rateavg,1≤푖≤푁}. (3)

We calculate the task size to transfer from instance퐼푖
(푇푟퐼푖)in퐺푃as follows:

푇푟퐼푖=

[(푇퐼퐼−푇execution퐼푖 )×퐼퐼rate푖 −(푇avg−푇executionavg )×퐼avgrate]

퐼rate퐼푖

,

1≤푖≤푁.

(4)

In group퐺푃, the task size of each instance퐼푖is given as
푇퐼耠푖∈퐺푃. We are able to get푇퐼耠푖∈퐺푃by considering푇푟퐼푖after the
transfer operation:

푇퐼耠푖∈퐺푃=푇퐼푖∈퐺푃−푇푟퐼푖, 1≤푖≤푁. (5)

The negative group퐺푁is the set of instances퐼푖with푇퐼rate푖
less than푇

avg
rate. Consider

퐺푁={퐼푖푇푟푎푡푒퐼푖 <푇ratebase,1≤푖≤푁}. (6)
Free download pdf