Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to allocate the cloudlets tasks to VM?

  • In cloudsim, the broker only will decide which cloudlet should allocate to which VM. After the VMs are created, the cloudlets are created and submitted to the broker. To perform one’s own idea of cloudlets allocation to VM, have to extend the “DatacenterBroker”class and give the implementation in “submitCloudlets()” method.
  • Here, for example the cloudlet is allocated to the VM which has minimum expected execution time.

    public class CreatedBroker extends DatacenterBroker{
    CreatedBroker(String name) throws Exception{
    super(name);
    }
    protected void submitCloudlets() {
    ……
    ……
    ** Get the Cloudlets created list
    getCloudletList();
    ** Get the VMs created list
    getVmsCreatedList();
    ** each cloudlet’s execution time on all vms are calculated and choosing the VM which less Expected execution time.
    for (Cloudlet cloudlet : getCloudletList()) {
    long length = cloudlet1.getCloudletLength(); // total length
    long insize = cloudlet1.getCloudletFileSize(); // input size
    **Convert the long values into double for calculation**
    Long l1 = length;
    double tlength = l1.doubleValue();
    Long l2 = insize;
    double input = l2.doubleValue();
    for( Vm vm: getVmsCreatedList()){
    double mip = vm.getMips();
    int pcount = vm.getNumberOfPes();
    long band = vm.getBw();
    **Convert the int, long values into double values**
    Integer x = new Integer(pcount);
    double pecount = x.doubleValue(); //int to double conversion
    Long b = band;
    double bw = b.doubleValue(); // long to double conversion
    exec[i]=(tlength/pecount*mip)+(input/bw);
    }
    Vm v= //select the vm which has minim execution time from the exec[];
    sendNow(getVmsToDatacentersMap().get(v.getId()), CloudSimTags.CLOUDLET_SUBMIT,cloudlet); // here cloudlet is allocated
    to the selected VM v;
    cloudletsSubmitted++;
    ……;
    …….;
    }
    }
    }