#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • 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++;
    ……;
    …….;
    }
    }
    }