Internati o nal  Journal of Ele c trical   and Computer  Engineering  (IJE CE)  V o l.  6, N o . 4 ,  A ugu st  2016 , pp . 18 66 ~ 1 879  I S SN : 208 8-8 7 0 8 D O I :  10.115 91 /ij ece.v6 i 4.1 014         1 866     Jo urn a l  h o me pa ge : h ttp ://iaesjo u r na l.com/ o n lin e/ind e x.ph p / IJECE  Cloud Computing CPU Allocation  and Scheduling Algorithms  Using CloudSim Simulator       Gibet T a ni Hi cham , El Amr a ni  Ch aker    Laborator y  of  In formatics S y s t ems and Telecom m unicati ons ( L I S T), Dep a rtement of Computer   Engineering   Faculty   of Scien ces an d  Technologies, A bdelmalek Essaad i Univ ersity  Route  Ziaten , B . P. 416 Tangier,  Morocco       Article Info    A B STRAC T Article histo r y:  Received Feb 11, 2016  Rev i sed  Ap 19 , 20 16  Accepte May 3, 2016      Cloud Computing is an  emerging co mputin g model, wher eas Cloud   providers and u s ers are lookin g  forward to profit and enh a n ce their IT  exploitation .  In   this paper ,  we  desc ribe and d i scuss the Cloud   Computing   basic  com pute r e sources schedu l i ng and  al loc a tio n algor ithm s , in  addition  t o   the working m echanis m .  This  paper al so presen ts a number of  experiments   conducted based on CloudSim  simulation too l kit in  order  to  assess and  evalu a te  the  p e rform ance  of  th ese scheduling algor ithms on Cloud   Computing like infrastructure. Furtherm ore, we introduced and explain e d the  CloudSim simulator d e sign, ar chitect ure and  pr oposed two n e w scheduling  algorithms to enhance th e existent one s and highlight the weakn e sses and/or  effec tiven es s   of thes e algori t hm s .   Keyword:  C l ou d c o m put i n g   C l ou d c o m put i n g  si m u l a t i on  First com e  first  ser v ed   Ro und  rob i Sche dul i n g al g o ri t h m s   Copyright ©  201 6 Institut e  o f   Ad vanced  Engin eer ing and S c i e nce.  All rights re se rve d Co rresp ond i ng  Autho r Gi bet  Ta ni   Hi cham ,   Lab o rat o ry   of  I n f o rm at i c s Sy st em s and Tel e c o m m uni cat i ons (L IST ) De pa rt m e nt  of C o m put e r  E ngi neer i ng,   Faculty of Scie nces a n d Tec h nol ogies Abde lm alek Essaadi  Unive r sity,  Route Ziate n B.P.  416 Tangi e r, M o rocc o.  Em a il: g i b e t.tan i .h ich a m @ g m ail.co m       1.   INTRODUCTION  No wa day s , C l ou d C o m put i n g i s   o n of t h e  ne west   para di gm s i n  t h e I n f o rm at i on Tec h nol ogy   (I T)  wo rl d .  Thi s   n e w m odel  of  com put i ng c onsi s t s   o n  o f f e ri n g  IT  res o urces  (Se r ve rs , St o r age ,  Ne t w o r k ,   Ap pl i cat i ons )  as se r v i ces,  o n   dem a nd  and  o v e r  a  n e t w o r k  [ 1 ] .  C l ou d C o m put i n g  IT  m odel  foc u ses  p r im arily o n  th e flex i b ility  an d  t h e celerity o f  IT  reso urces allo catio n ,  wh ich  lib erat e th e end  u s ers fro m   co n c ern s  ab ou t  th I T  inf r a stru ctur e an d lo catio n ,  and  all  o f   th is pr esen ted  i n  a  p a y- as- you- go  m a n n e r.  In  o r de r t o  i n su re t h at  C l ou d C o m put i n of feri ngs  a n d  cha r act eri s t i c s are at  t h e hei g ht   of   expect at i o ns i n  t h i s  ne w m odel  of c o m put i n g ,  pe rf orm a nce and al l o cat i on  p o l i c i e s eval uat i on i s  nec e ssary   bef o re  a n y   rea l   wo rl d depl oy m e nt . W h i l e  u s i ng real   i n f r as t r uct u res f o r t e st i ng a nd as ses s m e nt  i s  expen s i v e   and t i m e-cons um i ng, t hus i t  i s  not  al way s  pr om i s i ng t o  per f o rm  experi m e nt al , repeat abl e  an d scal abl e   i nvest i g at i o ns   on  real   w o rl d  c l ass C l ou d e n v i ro nm ent s A sol u t i on t o  t h i s  pr o b l e m   i s  t h e use o f  si m u l a t i on t ool s  i n  pu rp ose  of  eval uat i n g an d t e st i ng t h e   cl ou d-c o m put i ng m odel  i n  a  cont rol l e d a n d scal abl e  en vi ro nm ent ,  t h eref o r e ge nerat i n g s p eci fi c res u l t s  base d   on s p ecific m e asurem ents. In the sa m e  context, Clou d S im is an  in n o v a tiv e and  co m p reh e nsiv e sim u l a tio fram e wor k  t h a t  sup p o r t s  m odel i ng, si m u l a t i on a n d ex pe ri m e nt at i on o f   C l ou d com put i ng i n f r ast r uct u res a n d   ap p lication  serv ices [2 ].          Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       C l ou d C o m put i n g  C P U  Al l o c a t i on  an Sc hed u l i n g  Al g o ri t h ms  Usi n g C l o u dSi m . ...  ( G i b et  Ta ni   Hi ch am)   1 867 2.   CLOU D CO MP UTIN SI MUL A TIO N   A C l ou d C o m put i ng of fer  rang es fr om  pro p o si n g  a  speci fi c IT i n fra st ruct ure  t o  depl oy i n g   com p l i cat ed appl i cat i o ns an d so ft ware s o l u t i o n s . B y  st udy i ng t h e  C l o ud C o m put i n servi ce del i v e r y   m odel  ori g i n at es t h e   chal l e ng e o f  m a nagi ng  h u n d r eds  of  t h ous an ds  of  use r s a n d a ppl i cat i o ns  req u est s .  The r efo r e, a   Clo u d  Co m p u t in g   p r ov id er sho u l d  co n s i d er in tellig en t infrastru cture  d e p l oy m e n t  in  o r d e r to  estab lish  a  Clo u d   Co m p u tin g   o ffer,  wh ich  i n sures transp aren cy, scalab ility, secu rity and   fore m o st celerity (Qo S ) [3 ].    C l ou d C o m put i ng assessm ent  and e v al ua t i on i s   m a ndat o ry  fo r b o t h  C l oud p r o v i d ers t h at  are   planning a specific service delivery  and   Clo u d  u s ers who  are in tend ing  to  sh ift th eir IT infrast ru ct u r e,  pl at fo rm  or s o ft ware  i n t o  t h e  C l ou (I nt er n e t  i n  case  o f   p ubl i c  cl ou o r  I n t r a n et  i n   ca se o f   pri v at e c l ou d) Desp ite t h fact th at u s i n g real in frastru c tu re fo r testin g and  ev alu a ting  cloud   d e p l oy m e n t  can   g i ve th i nvest i g at ors a  real  w o rl d a p p r oach t o  m a ke cri t i cal  dec i si on a b o u t  m ovi ng  f o r w ar d  wi t h  t h i s  m odel  o f   com puting, in  m o st cases it can  be  very e xpensive:     In frast ruct ures ,  platf o rm s and   soft ware  hi gh   costs     Necessity to  test on  scalab le e nvi ro nm ent s  ( m ore i n frast ruc t ure)     M a nagem e nt  and  m a i n t e nanc e ex pen s es    In  ad d ition  to th is critical f acto r we can ad d  th e tim e  co n s u m p tio n  in  o r d e r t o  test a sp ecific  scenari o   In frast ruct ures   Installations  an d c o n f ig urati o n s     Repeatable a n d va riable tests     D e bug g i n g  and tr oub lesho o ting  A m o re v i ab le altern ativ e is th e u s e of si m u la tio n  to o l s. Th ese too l o p e n   u p  th po ssib ility o f   ev alu a ting  th h ypo th esis  ( a pp licatio n   b e n c h m ar k i n g   study)  in  a co n t r o ll ed  en v i ron m en t w h er o n e  can  easily  rep r o d u ce resu lts  [2] .   Th ere are  v a ri ety o f  sim u lat o r too l s for mo d e lling  and  si m u la tio n  of larg e-scale Clo u d  co m p u ting  envi ro nm ent s  [4]  (fi gu re 1 ) Gene ral l y , we can desi gna te  b e tween  two  typ e s o f  sim u lato rs: graph i cal u s er  i n t e rface  ( G U I ) si m u l a t o rs o r   pr o g ram m i ng l a ng ua ge  base sim u l a t o rs (l i k e Java  f o r  exa m pl e).          Fi gu re  1.  C l ou d C o m put i ng  S i m u l a t i on f r am ewo r ks       3.   CLOU D CO MP UTIN SI MUL A TO RS EVAL UATI O N   As de scri bed  on t h e p r e v i o u s  sect i on, t h er e are a di versi t y  of C l ou d C o m put i ng si m u l a t o rs , eac h   with s p ecific  characte r istics and oriente d   for a s p ecifi ob ject i v e .  C h o o si n g  t h e  fi ne st  C l ou d C o m put i n si m u lato r is a  ch allen g i ng  m i ssio n . To  th best o f   ou kn owledg e, it was n o t   v e ry  d i fficu lt to  spo t  Clou dSim  as th e co re  p l atfo rm  for th m o st u s ed  Clou d sim u lato rs  u p  to  t h is m o men t . Clo u d S i m  was estab lish e d as an  ex ten s i o n of the Gri d Sim  si mu lato r in   o r d e r to  in trod u c e th e Cloud  Co m p u ting   v i rt u a lizatio n  layer t h at was  n o t  presen t on  th orig i n al  si m u la to r.  C l ou dSi m  i s   a pro g r am m i ng l a ng ua ge ba sed si m u l a t o and e v en t h ou gh i t  does n o t  sup p o r t  a  gra p hi cal  use r   i n t e rface  f o r  si m u l a t i on, i t   pr op oses  t h e   Clou dAn a lyst ( w hich  is an  ex tensio n of  Cloud Si m )  f o i nvest i g at ors  wh pre f er s u s i ng a  use r - fri endl y  i n t e r f ace  t o  car ry  o u t  t h ei researc h es . C l ou dSi m  pr esent s   itself to the cloud-c o m puting  researc h ers as  a Java ba sed fr am ewor t h at  sup p o rt the main cha r acteristics of  C l ou d C o m put i ng ( I aaS ) wi t h  vi rt ual i zat i on su p p o r t  and  t a sk sche dul i n g (Paa S an d S aaS) an d o p e n  up t h e   do o r  fo r em er gi n g , i n t e g r at i ng a nd t e st i n g ne w al go rith m s  fo r task  sch e d u ling  or n e w ch aracteristics  devel opm ent ,  whi c h hel p e d  o n  del i v eri n g   ne si m u l a t o rs.   Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  I J ECE   Vo l. 6 ,  N o . 4 ,  Au gu st 2 016    18 66  –  1 879  1 868 Ou r c hoi ce f o r  C l ou dSi m  st em s from   i t  openne ss an d cl e a r l o gi c w h i c h  i s  defi ci ent   o n  t h ot he sim u l a t o rs spe c i f i cal l y  wi t h   GU I base d si m u l a t o rs  whe r e we were  not  a b l e  t o  t ackl e  t h e C l oud i n f r ast r uct u re  layer to  b e tter test alg o r ith ms related  to  C P U allo cation   an d  i n tro d u ce  n e w al g o rith ms. Clo u d S im   was th accurate selection for  our re search, which is focu se d on evaluating a nd asses s ing the CPU sche duling  al go ri t h m s  for  reso u r ces al l o c a t i on i n   o r de t o  hel p  C l o ud  pr o v i d er s an users  m a ke pr eci se deci si o n   abo u t   C l ou d C o m put i ng m odel  a d o p t i o n .       4.   CLOU DS IM  AR CHITE C T URE A N D   D E SIGN   Clo u d S im   is a  Jav a  app licatio n  th at was fo un d e d  on  GridSi m ,  wh ich  is a si m u lato r and  a to o l k it for  m o d e lin g  and   si m u latio n  of en tities in  p a rallel an d d i stri b u t ed  co m p u tin g   [5 ],[6 ]. Clou dSim  [5 ] was  d e signed  i n  a l a y e re d a r chi t ect ure a s  s h o w e d   on  fi gu re  2.  At  t h e lowest layer, we  find t h e “ S imJava”  (Disc r et e Eve n t   Si m u latio n )   wh ich  im p l e m en ts th e co re  functio n a lities n eed ed   b y  th h i gh er lev e l o f  si m u la tio n  (Data Cen t er,  Ho st, Vi rtu a mach in e…). Ju st abov e th Si m J av a we  fi n d  th e “Gri d S i m ” to o l k it fo m o d e lin g  m u lt ip le Gri d   in frastru ct u r es, in clud ing   n e tworks an asso ciated   traffic. At  th e n e x t   layer, we find   th e Clo u d S im   si mu latio l a y e r, w h i c pr o v i d es s u p p o rt  f o r m odel i ng a nd si m u l a t i on o f  vi rt ual i zed C l o u d - base dat a  cent e r   envi ronm ents including  de dicated m a nagement  interfaces  for VMs,  m e m o ry , stora g e, and  ba ndwidt h.  This   l a y e r han d l e s t h e f u ndam e nt al  i ssues, s u ch a s  pr o v i s i o ni n g   of  ho st s t o  VM s, m a nagi ng a p pl i cat i on e x ecu t i o n ,   an d  m o n ito ri ng  d y n a m i c  sys t e m  sta t e [2 ]. Th e top  layer in  th e Clo u d S i m  si m u la tio n  to o l k it is th e “User  Code”  which i s  the m a in inte rface  for sim u lation s p ecifi cations a n d cha r a c teristics configuration (num ber  of  machines, a p plications, tas k s,  users ,  sc he duli n g policies and their  basic st ructure).                  Fi gu re  2.  C l ou dSi m  Archi t ect ure         Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       C l ou d C o m put i n g  C P U  Al l o c a t i on  an Sc hed u l i n g  Al g o ri t h ms  Usi n g C l o u dSi m . ...  ( G i b et  Ta ni   Hi ch am)   1 869 5.   C P SC HEDU LING A L GOR I THM S    A clo u d  pro v i d e r m a in  in trest is to  in crease p r o f its  by  achi e vi n g  hi g h  l e vel s  of  use r s’  sat i s fact i o n ,   wh ich  co m e s with  prov i d ing th e end  u s er with  th e b e st  experience.  He nce ,  com e s the importance  of c h oosi n t h e fi nest  sc he dul i n g al g o r i t h m s  for  reso u r c e s al l o cat i on a nd t a s k  sc hed u l i ng. T h key  pu r pose  of  sch e dul i n g   algorithm s  is  the appropriate  allocati on o f  t a sk o r  a j o b t o  t h e ap pr op ri at e reso urce . T h eref ore ,  i t  goes  bac k   always to the period necessa ry to carry  out t h e exec ution of a specific tas k   in  ord e r to  evalu a te th e q u a li ty an d   per f o r m a nce of  t h e sc he dul i n g  al go ri t h m s  [3] , [ 7 ] .        5. 1.   First  Come , F i rst Ser v ed  (F CFS )  Sc heduli n Th e sim p lest [8 ]-[10 ] , algo rit h m  fo resources sch e du lin g is th e “FCFS”  alg o rith m  (It is also  called  FIFO=First In  First Ou t). Th i s  alg o r ith m  is   b a sed  o n  th e a rrival tim e  of the res o urce re que st. To clarify the   p e rform a n ce o f  th e “FC FS” al g o rith m ,  let tak e  th fo llowing Ex am p l e:      Tab l e 1 .  First Ex am p l Task list  Task   O r der   Task  Na m e   Burst Ti m e   1 T a sk- 1   10   2 T a sk- 2   3 T a sk- 3   4 T a sk- 4   20       Th e ex ecu tio sch e d u l will be as fo llow:      Tabl e 2. Fi rst  Exam pl Gant t   C h art   Task -1  Task -2   Task -3   Task -4   0                                                               10                                    14                                                    19                                                                                                                    39      The  waiting time for each task   will be the following:      Tab l e 3 .  First Ex am p l Task s W a itin Tim e   Task   O r der   Task  Na m e   Waiting Ti m e   1 T a sk- 1   2 T a sk- 2   10   3 T a sk- 3   14   4 T a sk- 4   19       Th e av erag e waitin g  tim e will  b e  calcu lated   as fo llo w:     Aw T = (  Tn) / NT     Whe r eas:     AwT:  Av erag W a itin g Tim e     Tn : Task Wai tin g  tim e fo r ex ecu tion       NT: Num b er o f   task s   C onse q uent l y t h e ave r age  w a i t i ng t i m e  wi ll  be:  10 ,7 5.  No w, let ch ang e  th e task  arrival o r d e r t o   match  th e fo llowing     Table  4.  Second E x am ple Tasks list  Task   O r der   Task  Na m e   Burst Ti m e   1 T a sk- 2   2 T a sk- 3   3 T a sk- 1   10   4 T a sk- 4   20       Th e ex ecu tio sch e d u l will be as fo llow:  Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  I J ECE   Vo l. 6 ,  N o . 4 ,  Au gu st 2 016    18 66  –  1 879  1 870 Table  5.  Second E x am ple Ga ntt Chart   Task -2  Task -3   Task -1   Task -4   0                          4                                                 9                                                             19                                                                                                                                       39      The  waiting time for each task   will be the following:      Tab l e 6 .  Second   Ex am p l Task s Waitin Ti me   Task   O r der   Task  Na m e   Waiting Ti m e   1 T a sk- 2   2 T a sk- 3   3 T a sk- 1   4 T a sk- 4   19       Th e av erag e waitin g  ti m e  will  b e 8.  From  the two exam ple s  above,  we  ca n co ncl u de t h at  t a sks o r de r   ch ang e d  m a ssiv e ly th e av erag waitin g time for task  ex ecu tion .  Consequ e n tly, th e “FCFS” presen ts a  weak ness  o n  t a sks a nd  res o u r ces al l o cat i on s c hed u l i n g,  bec a use i f  a  heavy  t a sk t a kes  on t h e l ead  of t h que ue   list, all th e o t her sm all task s will h a v e  to wait u n til th e ex ecu tio n end   fo r t h e lead i n g tasks.  Thi s  basi c sc h e dul i n g al g o ri t h m  gave bi rt t o  a new al g o r i t h m  cal l e d “ Shorte d  Job Firs t ” or “ SJF ”  whi c h we  reco m m e nd on t h i s  pape r i n   or der  t o  en hance t h e C l ou dSi m  algo ri t h m  based  on t h e “FC FS” . The   co n c ep t [8 ],[11], o f  t h is n e w alg o rith m  is th e sam e  as fo r “FCFS”,  ho wever, th e “ SJ F ” alg o rith m  in tro d u ce a  test o n  t h b e g i n n i n g  to  cho o s e th e task  with  th e shortest execu tio n ti m e  in  o r d e r to tak e  t h e lead of the  q u e u e whe r eas t h i s   or deri ng  o f  t a s k red u ce d e x t r e m el y  t h e avera g wai t i ng t i m e (Sec o n d  Exa m pl e above ).     5. 2.   Round  Robin   (RR) Sche duling  The “R o u n d  R obi n” al go ri t h m  [11] -[ 1 3 ] ,  w a s desi g n ed  ba sed o n  t h e di st ri b u t i on  of t h e  C P U t i m e   a m o n g  th e sched u l ed  task s.  On th e sam e  co n t ex t, all  th task g e t on  a  q u e u e  list wh ereas each  task  g e t a  sm al l  uni t  of C P U t i m e  (Qua n t um , usual l y  10- 1 00 m i ll i s econ ds ). I n  o r de r  t o  deepe n  [ 10]  t h e un der s t a n d i ng o f   the “RR” algorith m ,  let take the sam e  example as  before:      Tabl 7. T h i r Exam pl e Tasks  Li st   Task   O r der   Task  Na m e   Ti m e  for Execu ti on  1 T a sk- 1   10   2 T a sk- 2   3 T a sk- 3   4 T a sk- 4   20       If  we con s id er th e “RR” algorith m  with  a static  C P U t i m qua nt um  of  “4 ”, t h e e x ec ut i o n sc hed u l e   will b e  as fo llow:      Tabl 8. T h i r Exam pl e Gant t  C h art   Task -1   Task -2   Task -3   Task -4  Task -1  Task -3  Ta sk -4   Ta sk -1  Ta sk -4   Ta sk -4   Ta sk -4   0                 4                         8                     12                       16                     20                       21                     25                       27                     31                       35               39       The  waiting time for each task   will be the following:      Tab l e 9 .   Th ird  Ex am p l Task s W a itin Tim e   Task   O r der   Task  Na m e   Waiting Ti m e   T a sk- 1   0+( 16- 4) +( 25- 20)  = 17  2 T a sk- 2   T a sk- 3   8+( 20- 12)  = 16  T a sk- 4   12+( 21- 16) +( 27- 2 5 )  = 19      Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       C l ou d C o m put i n g  C P U  Al l o c a t i on  an Sc hed u l i n g  Al g o ri t h ms  Usi n g C l o u dSi m . ...  ( G i b et  Ta ni   Hi ch am)   1 871 The ave r a g e w a i t i ng t i m e  wi ll  be (( 17 + 4  + 16 + 1 9 ) /  4 )  =  14 O n  C l ou dSi m , The R o u n d  R obi n   b a sed  algo rit h m  u s ed  fo r tasks sch e du lin g acts as th fo llo win g :     So rti n g  th e task s sub m itted  t o  th e VM in  ascend i ng   way b a sed  on  th e time n eed ed   for  ex ecu tion   o f  each  task (B urst Tim e   Ex tracting  a st atic ti me Qu antu m  wh ich  is calcu l ated   b a sed  on  t h e nu m b er  of  in st ru ction s  th pro cesso can e x ecute  pe r sec o nd:     TQ = (NP *  MI PS) / 1000     Whe r eas:   TQ =>  Tim e  Quant u m   NP =>  Num b er  of  Process o rs   MIPS => Milli o n  In stru ction   p e r Seco nd      All task s are  qu eu ed   on  th e read y list for ex ecu tio   Fo r each  task on  th e qu eu e list:  o   Th e CPU allo cates th e tim e q u a n t u m  fo r t h task  ex ecu tion     o   If t h e task  is execu ted ,  it is sen t  to  t h fin i sh   q u e u e  list   o   Else th e task  is sen t  t o  th e wai tin g  list    C onse q uent l y , once t h num ber of a t a sk a n d am ount  of i n st ruct i o ns get   hi g h er , t h e t i m e  qua nt um   b eco m e s sm al l e r an d th waitin g  list  g e ts long er,  h e n c e, a  h i g h  av erag waitin g  tim e.   The R o un d R o bi n base d al g o r i t h m  we are pro p o si n g  o n  t h i s  paper t o  s o l v e t h e pr o b l e m  rel a t e d t o   sm al l e r t i m e  quant um  wor k wi t h  a  dy nam i c t i m e  qua nt u m  [14]  an d t h i s  i s  as  fol l o wi n g :     So rti n g  th e task s sub m itted  t o  th e VM in  ascend i ng   way b a sed  on  th e time n eed ed   for  ex ecu tion   o f  each  task (B urst Tim e   Ex tracting  a time Qu an tu m  wh ich  is calcu lated  b a sed as t h Av erag e Execu tio n tim e fo r tasks:     TQ =   Tn  / N T     Whe r eas:   TQ =>  Tim e  Quant u m   Tn =>  Tim e  needed for exec uti ng a  specific  task  (Burst Tim e N T  => Nu m b e r   o f  ta sk     All task s are  qu eu ed   on  th e read y list for ex ecu tio   Fo r each  task on  th e qu eu e list    If t h e task   b u rst ti m e  is s m al le r th an  t h e tim q u a n t u m   o   Th e Tim e  Qu an tu m  is set to  t h e B u rst Tim e  o f  th e task  o   Th e CPU allo cates th e tim e q u a n t u m  fo r t h task  ex ecu tion  o   Th e task  is ex ecu t ed  and  sen t   to  th fin i sh  list    Else   o   Th e CPU allo cates th e tim e q u a n t u m  fo r t h task  ex ecu tion  o   Th e task  is sent to  th waiting list    If t h waitin g list is n o t  em p t y   o   Send  task from  wait in g  list to  th e read y list  o   R e st art  fr om  t h e be gi n n i n g   Here is an illu stratio n   o f  th e alg o rith m  step s flo w :   First , all the  proces ses are s o rte d  in  ascending  way base d   o n  th bu rst  ti m e  o f  task (th e  tim e n eeded  for  execution  of ea ch tas k ) a n d se nt to t h ready  que ue list    nt    nu m b er   of  tasks   co un te   While (RQ != NUL L)   TQ =    Tn  /  NT   // NT = To tal  nu m b er of task // Tn = Tim e  needed fo r th e t a sk  ex ecu tio //RQ = Ready   Que u e   //TQ = Tim e  Quant u m   Second A ssi gn  TQ  t o  (1  t o   n)  task on  t h r e ad y qu eu e list  fo r i =  1 t o   nt  Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  I J ECE   Vo l. 6 ,  N o . 4 ,  Au gu st 2 016    18 66  –  1 879  1 872 if  (Ti < TQ)    T Q    Ti                        Ti   TQ                       Send task t o  fi nish list                                            i   i +1  else                       Ti   TQ                                           Send task  t o   waitin g qu eu e list  end if  en d fo // Assign  TQ t o  all th av ailab l e task s.  Third , Test if th waitin g   qu eu e list is em p t y   if (waitin g  list  != em p t y)    Send  task from  wait in g  list to   read y list    Go  to ste p   1   else   Finish  end if      Let con s id er the fo llo wi n g  task b u rst tim e:       Tabl 10 . F o ur t h  E x am pl e Tasks Li st   Task s   Arrival Ti m e   Burst Ti m e   T1  0 40   T2  0 90   T3  0 20   T4  0 83       The al gorithm  we a r proposi n g arranges  tasks  i n  ascen d i ng   w a y b a sed on  th ei r   b u r s t time:       Table  11. Tas k s List Arra nge m ent  Task s   Arrival Ti m e   Burst Ti m e   T3  0 20   T1  0 40   T4  0 83   T2  0 90       The t i m e quant um  i s  cal culat e d base d o n  t a sks am ount  and t h ei r b u r st  t i m e :   T Q  = 58 ,2 5.  Th ex ecu tion  sch e d u l e will  b e   as fo llow:       Tabl 12 . F o ur t h  E x am pl e Gant t  C h art   Tim e  Q u ant u m  of 58, 25   T3 T1  T4  T2                                                                20                             60                            118,25                           176, 5       The tasks T 3  and T 1  are exe c uted (B urst T i m e   is s m a ller  th an  th e Tim e   Qu an tu m ) . The alg o r ith m   send s th e rem a in in g task s to  t h waitin g  list:      Tabl 13 . F o ur t h  E x am pl e Wai t i ng Li st   Task s  Burst  Ti m e   T4  24, 75   T2  31, 75   Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       C l ou d C o m put i n g  C P U  Al l o c a t i on  an Sc hed u l i n g  Al g o ri t h ms  Usi n g C l o u dSi m . ...  ( G i b et  Ta ni   Hi ch am)   1 873 Dynam i cally, the tim e  quant um will be recalculated as desc ribe d before:  T Q  = 28, 2 5 The execution  sch e d u l will be as fo llow:      Table  14. Fourth E x am ple Gantt cha r t After  Tim e  Quatum  Recalculation  Tim e  Q u ant u m  of 28, 25   T4 T2                                                                           176,5                        201,25                      229,5      The  Task T 4  i s  exec uted (B urst Tim e  is s m alle r th an th Ti m e  Qu an tum ) . Th e algorith m  sen d s  t h rem a in in g  task to  th e waiting   list:       Tabl 15 . F o ur t h  E x am pl e Wai t i ng Li st   Task s  Burst  Ti m e   T2 3,     Dyn a m i call y , t h e ti m e  q u a n t um will b e  set t o  th e burst ti me o f  task  T2 : TQ = 3, 5 . T h e last execution  sch e d u l will be as fo llow:      Table  16. Fourth E x am ple Last Ga ntt chart   Tim e  Q u ant u m  of 3, T2                                                                                  229,                                                 233      Let calculate the a v era g wai ting tim e of ea ch tas k     Tab l 1 7 . Fou r th  Ex am p l e Task Waitin g Ti me   Task s   Burst Ti m e   Waiting Ti m e   T3  20  0  T1  40  20   T4  83   ( 20+40) +( 176, 5– 1 18, 25) = 118, 25   T2  90  ( 20+40+58, 2 5 ) + ( 201, 25– 176, 5) 143       Th erefo r e, Th e av erag waitin g  tim e  fo r all task s is:  70,3 1 .   Using  th e same set tin g s  wi th  Clo u d Si g a v e  us th e fo llo wi n g  resu lts:      Tabl 18 . C l o u d Si m  Out p ut   Task s  Arrival  Ti m e  Burst  Ti m e  Finish  Ti m e   T3  0 20   80   T1  0 40   140   T4  0 83   226   T2  0 90   233       Fro m  th is ou tpu t we ex tracted  th e av erag waitin g  tim e as fo llo w:     Aw T = (  Aw Tn) /  NC   AwTn = FTn   EnT     Whe r eas:     AwT:  Av erag W a itin g Tim e     AwTn :  Cloud let/task  (n)  Av erag W a iting  Ti m e     NC: Num b er of Cloudlets     En T: Cloud let/task  (n) Ex ecu t i o n   Tim e  (Bu r st Ti m e Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  I J ECE   Vo l. 6 ,  N o . 4 ,  Au gu st 2 016    18 66  –  1 879  1 874   FTn :   Fin i sh Ti me o f  Cloud let/task  ex ecu tion    NCI: Nu m b er o f   Clo u d l et/task  In st ru ction s   Co n s equ e n tly, Th e av erag waitin g  tim e f o r all task s is:   11 1, 5.  Th e “RR” sch e du ling  algo rith in trodu ced  a  new p e rcep ti o n  o f  sch e du ling th at d i d  no t ex ist for th e “FCFS” alg o rithm an d  wh ich   is th co n c urren t  ex ecu tio n of task s.  By co m p aring  th e ex am p l es stated   b e fo re,  we can  see th at  th e av erag waitin t i m e  i s  hi ghe wi t h  t h e  “R o u n d  R o bi n”  al g o ri t h m  used  o n  C l ou dSi m  and  t h u s  t h e  al g o ri t h m  we are  pr o posi n o n  th is  p a p e r is m o re in terestin g.       6.   CLOU DS IM  SCHE DULI N POLI CIES   Th v i r t u a lizatio n  techno log y  is on of  th f und amen tal co n c ep ts of  Cloud Co m p u tin g   i n fra st ruct ures .  C l oudSi m  depl oy  en orm o u s l y  t h e vi rt ual i zat i on t echn o l ogy  i n  o r de r t o  sim u l a t e  IaaS and  PaaS  pr ovi si on i ng a n d t o   use  i t  as a base  f o r u s ers  a ppl i c at i ons e x ec ut i o n.  O n  t h e sam e  per s pect i v e  c o m e t h e c h al l e nge   of  de pl oy i n g t h fi nest   res o u r ces al l o cat i o n  an d sc he dul i n g al g o r i t h m .  For  exam pl e, o n ( 1 )   Data cen ter that co n s ists  o f   o n e  (1 ho st with  two   (2 pr o cessi ng  u n i t s  a n d  w h ere  t h e c l ou user i s  t r y i ng t o   in stan tiate two (2)  v i rtu a l m ach in es  with  t w o (2 pr oces sing  units eac h. L o gically, there is  a se pa ration  betwee n the two  virtual m a chines, but in  reality, each  virtual  m achine is l i m ited to t h e processi ng  powe of fere d by  t h e  phy si cal  host ,  t h eref ore we  cann o t  i n st ant i at e bot h vi rt ua l   m achi n e on t h e sam e  host  at  t h sam e  tim e wi t hout  a n  a p pr o p ri at e sche dul i n al go ri t h m  [2] .   In re fere nce to this critical fact or, C l o u d S i m  prop oses t w o l e vel s  of re s o u r ces al l o cat i on  pol i c i e s   b a sed  on  t w o basic sch e d u ling po licies, wh ich  are th e tim e - s h a r ed  and  sp ac e - s h ar ed  a llo ca tio n   p o lic ie s .   T h e s allo catio n   po licies are im p l emen ted   d u ring th v i rtual m a ch in es con s tructio n  and  throu gho u t  t h e applicatio n   execut i o n.  T h e  Space -S hare d  p o l i c y  and  Ti m e -Share p o l i c i e s are de pi c t i ons  of  t h e “ F C FS =  Fi rst   C o m e   Fir s t Ser v ed ” an d “RR = R o un d Rob i n  algor ith m s  r e sp ectiv ely.  In order t o  illustrate clearly th c o ncept of each  alloca tion policy [8],[15] , we   propose  the  followi ng  exam ple:    O n e (1 ) d a ta Cen t er   w ith   On e (1 )   ho st    Th ho st h a s t w o (2 ) pr ocessin g   un its    Th u s er in stantiate two  (2 v i rtu a l m ach in es  th at req u i re  o n e (1 pro cessing   u n it each    Th u s er th en  t r y to  ex ecu t e two (2 ) task s (Clo ud lets)  in e ach  virtual m achine  ( eac h tas k  requires  one  (1)  pr ocessi ng  u n i t  f o r e x ec ut i o n )   Figure 3 re pre s ents a space-s h are d  policy for both   virtual   m achines and tasks.  While each virt ual   mach in e requ ires on (1)  p r o c essin g  un it, each   v i rtu a m ach in will reserv o n e  (1 ) of t h e two   (2 processin g   u n its  o f  th e host, n e v e rth e less on ly on e (1 task  can   g e t execu ted at a sp ecific ti m e  an d   th e seco nd on e will  wait fo r t h first task  to end  i n   o r d e r to   g e t ex ecu ted .           Figu re  3.  S p ac e Sha r e d  P o licy  fo VM s a n d   Tasks       Fi gu re 4  pre s e n t s  a space -sha red  pol i c y  fo vi rt ual  m achi n es and t i m e-shared  pol i c y  fo r  t a sks. Eac h   virtual m achine will reserve one (1) of the  two (2)  pr ocessing units of t h e host,  and while each tasks needs  o n e  (1 ) pro cessin g  un it to   g e t  ex ecu t ed, th p o licy algo rith m  will give ea ch tas k  a  slice of the  processi ng unit   ti m e  u n til b o t h   task s are ex ecuted .   Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       C l ou d C o m put i n g  C P U  Al l o c a t i on  an Sc hed u l i n g  Al g o ri t h ms  Usi n g C l o u dSi m . ...  ( G i b et  Ta ni   Hi ch am)   1 875     F i g u r e   4 .  Sp a c e  S h ar ed  Po lic y f o r   V M s  an T i me  S h a r ed   fo r T a sk     Fi gu re 5  pre s e n t s  a t i m e -shar e d p o l i c y  for  v i rt ual   m achi n e s  and s p ace -sh a red  pol i c y  fo r  t a sks. Eac h   v i rtu a l m ach in e g e ts a slice  o f  th e p r o cessin g  un it ti m e . Th e first v i rtu a m ach in e g e t to  h o l d  th e first  pr ocessi ng  u n i t  of t h h o st  i n  o r der t o  e x e c ut e t h e fi rst  t a sk a nd t h e sa m e  t h i ng g o es  fo r t h e sec o nd  vi rt ua l   mach in e. As  a resu lt, bo th  first  task s o f   bo t h  v i rtu a m ach in es g e to  run  si m u ltan e ou sly.  Th e second  task  o f   b o t h   v i rtu a l m ach in es will ho l d   u n til th first  task  is ex ecu t ed   for  b o t h   VM s.          Figure  5. Tim e  Sha r e d  Policy for  VMs a n d Space Sha r ed for Tas k s       Fi gu re 6  pres ent s  a t i m e -shared  pol i c y  fo r bot h vi rt ual   m achi n es an d t a sks. T h e t i m e  of bot h   p r o cessi n g   u n i ts o f  th h o st will b e  sh ared si m u ltan e o u s l y  b y  th e fou r   task s d e p l o y ed o n  t h e two   v i rtu a l   machines.          Figu re  6.  Tim e  Sha r e d  P o licy  fo VM s a n d  T a sks         Evaluation Warning : The document was created with Spire.PDF for Python.