Task to a cloudlet

3,932 views
Skip to first unread message

Anjan Rai

unread,
Feb 12, 2014, 8:17:34 AM2/12/14
to clou...@googlegroups.com
Hello!!
Can anyone please explain how to assign a particular task to be performed by the cloudlet and how to make sure that the task has been completed successfully or not?
Please quote some example for the same.
Thank you

ery...@gmail.com

unread,
Feb 12, 2014, 8:33:54 AM2/12/14
to cloudsim
Hi,
Hope this will help.
In cloudsim, the tasks/processes are the cloudlets.
so you need to create a cloudlet that mimics the task that you want and assign the cloudlet(task) to a VM.
Unless I got it wrong but this is how I think cloudsim is setup
cloudlet = task/process

Hope it helps.

Regards 

Sent from Windows Mail

--
 
---
You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudsim+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Anjan Rai

unread,
Feb 12, 2014, 9:21:57 AM2/12/14
to clou...@googlegroups.com
Thanx Eric...but i want to know how to make some cloudlet mimic a task programmatically?What are the different parameters i need to set?So,can you plz help me over that. 

Mario Henrique Souza Pardo

unread,
Feb 15, 2014, 10:46:03 AM2/15/14
to clou...@googlegroups.com
Hello Anjan,

  "maybe" you're trying to do something that the simulator isn't made for. CloudSim process tasks (cloudlets) by cloudletLength attribute. The cloudlet length is a number given in MIPs and multiplied by number of PEs used by cloudlet. Generally you play with length and number of PEs to stablish execution time expected to the task.

   But if you really wants to alter the cloudlet characteristics while its execution time, I think that modifications need to be made in CloudletScheduler class (Space/TimeShare) that you're using at your simulation program.

   I hope my tips has been helpful.

   Regards!

Mário Pardo
ICMC-USP / São Carlos / Brazil
mhp...@icmc.usp.br

Anjan Rai

unread,
Feb 15, 2014, 11:21:36 AM2/15/14
to clou...@googlegroups.com
Hello Mario,
Ur reply really helped me....
Thanx a lot!!!!
Regards
Anjan Rai

Anjan Rai

unread,
Feb 19, 2014, 2:59:09 AM2/19/14
to clou...@googlegroups.com
Hey,,
Can you please give me an example to demonstrate how to work with cloudlets? 

Vidya Mohandas

unread,
Feb 21, 2014, 5:14:40 AM2/21/14
to clou...@googlegroups.com

hai everyone , I'm a mtech student doing project in cloudsim 3.0.1. I have a doubt about how can i create a cloudlet that mimic a task. can anyone help me?

Mario Henrique Souza Pardo

unread,
Feb 24, 2014, 11:28:59 PM2/24/14
to clou...@googlegroups.com
Hi Anjan,

  to work with cloudlets you'll implement the tasks characteristics on cloudlet attributes. This mean that you can setup the behavior of cloudlet configuring its: cloudlet length (setted by MIPs - that influence the task execution time in a virtual machine), input and output file (that impact on simulations with storage), number of CPUs (PEs) used by cloudlet (that will impact on MIPs amount used to process the task), utilization model (that defines what behavior you task will do when its using PEs, memory and bandwith).

  For instance you can suppose the following situation. You have three applications on VMs:

   Web Service 1 - (a little one)
   Web Service 2 - (a medium one)
   Web Service 3 - (a big one)

   Then you want to implement you scenary where WS1 take a lowest execution time, WS2 take a execution time bigger than WS1 and WS3 take a lot of time to execute. To build this you'll abstract the code implementation of your web services stablishing different lengths for each one.

   One possible (and single) could be:

   WS 1 - Cloudlet Length is 10000
   WS 2 - Cloudlet Length is 25000
   WS 3 - Cloudlet Length is 75000

   Well, now take in count that your VMs configurations are the following:

   VM TYPE 1 - 1 PE with 5000 MIPS
   VM TYPE 2 - 2 PE with 5000 MIPS
   VM TYPE 3 - 1 PE with 20000 MIPS

   Now you can do a method where you can random the creation of cloudlets with different lengths and returns a cloudlet list containing the tasks list. After, it's just submit your cloudlet list to broker and you'll have a scenary with heterogeneous VMs, cloudlets and services. 

   I don't know is it that you want to know, sometimes I can have understanded wrong, but here it goes! =)

   Hope that help you a little.

   Regards!

Mário Pardo
ICMC-USP / São Carlos / Brazil 

Anjan Rai

unread,
Mar 8, 2014, 2:39:11 AM3/8/14
to clou...@googlegroups.com
Hey Mario,,
Thank u so much for the example..:)
I need your help on some other issue as well.I am trying to implement a model based on fault tolerance using CloudSim.I have introduced the concept of elasticity in that model i.e. if the VM is completing its task correctly within the prescribed time,then its reliability increases and decreases as well if it fails to do so.
There is certain system reliability level,which every VM has to reach that level  so as to be considered as passed;and if it fails by suppose 15 cycles,then also it is given certain elasticity in terms of cycles,so that we can have more passed nodes in comparison to failed nodes.
Now, i ma confused how to give that elasticity,whether  I have to consider the ending time of the virtual machine or something else?
Can you please help me over that?
Regards
Anjan Rai

Mario Henrique Souza Pardo

unread,
Mar 8, 2014, 9:39:24 AM3/8/14
to clou...@googlegroups.com
Hi Anjan,

   Hi Anjan,

   let's see if I can help you with some implementing suggestions... let's discuss by parts:

   1. VM increase/decrease reliability: to do this feature you can modify/extend VM class adding attributes and methods to control reliability level. The code could be more or less as:
   package simulacaoUSP.duvidas.cloudsim;

import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.Vm;

/**
 *
 * @author Mário Pardo
 */

public class ReliabilityVm extends Vm{

    private int reliabilityLevel;
    
    private static final int unclassified_reliability = 0;
    private static final int lightweight_reliability = 1;
    private static final int moderated_reliability = 2;
    private static final int expanded_reliability = 3;
    
    
    public ReliabilityVm(int id, int userId, double mips, int numberOfPes, int ram, long bw, long size, String vmm, CloudletScheduler cloudletScheduler) {
        super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler);
        setReliabilityLevel(0);
    }
    
     public int getReliabilityLevel() {
        return reliabilityLevel;
    }

    public void setReliabilityLevel(int reliabilityLevel) {
        this.reliabilityLevel = reliabilityLevel;
    }
    
    public void increaseReliability() {
        setReliabilityLevel(reliabilityLevel+1);
    }
    
    public void decreaseReliability() {
        setReliabilityLevel(reliabilityLevel-1);
    }

    public void addFail()
    {
        numberOfFails++;
        judgeReliabilityLevel();
    }
    
    public void removeFail() {
        numberOfFails--;
        judgeReliabilityLevel();
    }
    
    public void judgeReliabilityLevel() {
        if (numberOfFails<=10) {
            reliabilityLevel = EXPANDED_RELIABILITY;
        } else if (numberOfFails<=20) {
            reliabilityLevel = MODERATED_RELIABILITY;
        } else if (numberOfFails>=21) {
            reliabilityLevel = LIGHTWEIGHT_RELIABILITY;
        }
    }
    
    //You other codes to reliability model rules...
    
}

---------------------------------

  2. The second question on your implementation is what about handle passing or failures in VMs when you control fullfilment of prescribed finish time of tasks (cloudlets). What I know about this is that will be necessary modify/extend the CloudletScheduler used by your simulation program. It means to control finalizing cloudlet process... where to implement it... maybe in the following method present, for example, into CloudSchedulerSpaceShared as:

    public void cloudletFinish(ResCloudlet rcl) {
        rcl.setCloudletStatus(Cloudlet.SUCCESS);
        rcl.finalizeCloudlet();
        getCloudletFinishedList().add(rcl);
        usedPes -= rcl.getNumberOfPes();
      //TO-DO >>> Your business rules to reliability model
    }

3. I don't know how you want to control the VM cycles, but you can think about syncronize with cloudlet finish in CloudletScheduler to count this kind of event occurrence.

I can't help more than this because the idea of your model is in your mind, but, I hope that these tips helps you to give a start point to your work! Good luck, buddy!

Regards!
Mário Pardo
ICMC-USP / São Carlos / Brazil
Research Gate Profile [LINK]




For more options, visit https://groups.google.com/d/optout.

Anjan Rai

unread,
Mar 13, 2014, 2:27:09 PM3/13/14
to clou...@googlegroups.com
hey Mario..Thank yo so much for your replies..:)
Reagrds
Anjan

Anjan Rai

unread,
Mar 15, 2014, 2:08:56 AM3/15/14
to clou...@googlegroups.com
Hey Mario,
I have made 4 cloudlets and i am trying to assign priority to each of the cloudlet.I have modified the cloudlet constructor in cloudlet.java as following:

 public class MyCloudlet extends Cloudlet
{
private int cloudlet_priority=0;
    private double startTime;
    public MyCloudlet(int cloudletId, long cloudletLength, int pesNumber,
            long cloudletFileSize, long cloudletOutputSize,
            UtilizationModel utilizationModelCpu,
            UtilizationModel utilizationModelRam,
            UtilizationModel utilizationModelBw,double startTime,final int priority) {
        super(cloudletId, cloudletLength, pesNumber, cloudletFileSize,
                        cloudletOutputSize, utilizationModelCpu, utilizationModelRam,
                utilizationModelBw);
                        this.cloudlet_priority=priority;
        // TODO Auto-generated constructor stub
        this.startTime = startTime;
    }
         public int getCloudlet_priority() {
        return cloudlet_priority;
    }

    public void setCloudlet_priority(int cloudlet_priority) {
        this.cloudlet_priority = cloudlet_priority;
    }
    public double getStartTime() {
        return startTime;
    }
    public void setStartTime(double startTime) {
        this.startTime = startTime;
    }
I have used a random function in the main class and through that i am going a give a random priority to the cloudlet.My main aim behind this is to print the priorities that have been assigned to the cloudlets, so that at later point of time i can choose the cloudletI have adopted the following strategy,but its not showing the output.Below is the main class coding related to this:
public static ArrayList<MyCloudlet> priorityList;
                     
                        priorityList=new ArrayList<MyCloudlet>();
                        Random rand = new Random();
                        int number= rand.nextInt(3) + 1;
                        int priority=number;
             
                        MyCloudlet cloudlet1 = new MyCloudlet(0, 10000, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel,startTime[0],priority);
                        MyCloudlet cloudlet2 = new MyCloudlet(1, 25000, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel,startTime[1],priority);
                        MyCloudlet cloudlet3 = new MyCloudlet(2, 75000, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel,startTime[2],priority);
                        MyCloudlet cloudlet4 = new MyCloudlet(3, 90000, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel,startTime[3],priority);
  printpriority(newList,priorityList);
private static void printpriority(List<MyCloudlet> list, List<MyCloudlet> list1) {
        int size = list.size();
        Cloudlet cloudlet;
                Cloudlet cloudlet1;

        String indent = "    ";
        Log.printLine();
        Log.printLine("========== PRIORITIES OF CLOUDLETS ==========");
        Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
            "vm id " + indent + "priority" + indent);

        DecimalFormat dft = new DecimalFormat("###.##");
        for (int i = 0; i < size; i++) {
            cloudlet = list.get(i);
                        cloudlet1=list1.get(i);
                     Log.print(cloudlet.getCloudletId() + indent + indent + indent );

            if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
                Log.print("SUCCESS");

                Log.printLine(indent + indent + cloudlet.getVmId() + indent);
                        //+ indent + indent
                        }
    else
                                Log.print("FAIL");
                }
              
    }
*******
Can you please suggest me a way though which the priorities can be displayed?
Regards
Anjan

Mario Henrique Souza Pardo

unread,
Mar 16, 2014, 10:50:02 PM3/16/14
to clou...@googlegroups.com
Hi Dear Anjan,

I have tested your code and I just gave it some modifications to provide effects according to your purposes. Take a look to the code below and give us your feedback if it execute how you expected.

TEST CLASS:

package simulacaoUSP.duvidas.cloudsim;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerDynamicWorkload;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelStochastic;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEntity;
import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;

/**
 *
 * @author Mario Pardo
 */
public class AnjanTest {

    //private static List<AnjanCloudlet> cloudletList;
    //private static List<Vm> vmlist;

    public static void main(String[] args) {
        int num_user = 2;
        Calendar calendar = Calendar.getInstance();
        boolean trace_flag = false;
        CloudSim.init(num_user, calendar, trace_flag);
       
        Datacenter dc1 = createDatacenter("Datacenter_01", 2);

        DatacenterBroker broker = (DatacenterBroker)createBroker("DCBroker");
        broker.submitVmList(createVM(broker.getId(), 4, 1));
        
        broker.submitCloudletList(createCloudlet(broker.getId(), 10, 1));

        CloudSim.startSimulation();

        List<AnjanCloudlet> newList = broker.getCloudletReceivedList();

        CloudSim.stopSimulation();

        printCloudletList(newList);
        printCloudletPriorities(newList);
        
        dc1.printDebts();
    }

    public static List<Vm> createVM(int userId, int vms, int idShift) {
        //Creates a container to store VMs. This list is passed to the broker later
        LinkedList<Vm> list = new LinkedList<Vm>();

        //VM Parameters
        long size = 10000; //image size (MB)
        int ram = 512; //vm memory (MB)
        int mips = 1000;
        long bw = 1000;
        int pesNumber = 1; //number of cpus
        String vmm = "Xen"; //VMM name

        //create VMs
        Vm[] vm = new Vm[vms];

        for (int i = 0; i < vms; i++) {
            //vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new SampleCloudletScheduler());
            vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerDynamicWorkload(mips, pesNumber));
            //vm[i] = new Vm(idShift + i, userId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
            list.add(vm[i]);
        }

        return list;
    }

    private static List<AnjanCloudlet> createCloudlet(int userId, int cloudlets, int idShift) {
        // Creates a container to store Cloudlets
        LinkedList<AnjanCloudlet> list = new LinkedList<AnjanCloudlet>();

        //cloudlet parameters
        long length = 100000;
        long fileSize = 300;
        long outputSize = 300;
        int pesNumber = 1;
        UtilizationModel utilizationModel = new UtilizationModelStochastic(1);
        //UtilizationModel utilizationModel = new UtilizationModelFull();
        int priority = 0;
        Random rdn = new Random();
        
        
        AnjanCloudlet[] cloudlet = new AnjanCloudlet[cloudlets];

        for (int i = 0; i < cloudlets; i++) {
            priority = rdn.nextInt(3)+1;
            System.out.println("generated random priority number = "+ priority);
            cloudlet[i] = new AnjanCloudlet(idShift + i, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
            cloudlet[i].setUserId(userId);
            cloudlet[i].setCloudlet_priority(priority);
            cloudlet[i].setStartTime(CloudSim.clock()+100); //Just a test...
            list.add(cloudlet[i]);
            
        }

        return list;
    }

    private static Datacenter createDatacenter(String name, int numberOfHosts) {


        List<Host> hostList = new ArrayList<Host>();
        List<Pe> peList1 = new ArrayList<Pe>();

        int mips = 1000;
        int hostId = 0;
        int ram = 16384;
        long storage = 1000000;
        int bw = 10000;

        peList1.add(new Pe(0, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(2, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(3, new PeProvisionerSimple(mips)));
        peList1.add(new Pe(4, new PeProvisionerSimple(mips)));

        for (int i = 0; i < numberOfHosts; i++) {
            hostList.add(
                    new Host(
                    hostId,
                    new RamProvisionerSimple(ram),
                    new BwProvisionerSimple(bw),
                    storage,
                    peList1,
                    new VmSchedulerSpaceShared(peList1)));

            hostId++;
        }


        String arch = "x86";      // system architecture
        String os = "Linux";          // operating system
        String vmm = "Xen";
        double time_zone = 10.0;         // time zone this resource located
        double cost = 3.0;              // the cost of using processing in this resource
        double costPerMem = 0.05; // the cost of using memory in this resource
        double costPerStorage = 0.1; // the cost of using storage in this resource
        double costPerBw = 0.1; // the cost of using bw in this resource
        LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now

        DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
                arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);

        Datacenter datacenter = null;
        try {
            datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return datacenter;
    }

    private static DatacenterBroker createBroker(String name) {

        DatacenterBroker broker = null;
        try {
            broker = new DatacenterBroker(name);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return broker;
    }

    /**
     * Prints the Cloudlet objects
     *
     * @param list list of Cloudlets
     */
    private static void printCloudletList(List<AnjanCloudlet> list) {
        int size = list.size();
        AnjanCloudlet cloudlet;

        String indent = "    ";
        Log.printLine();
        Log.printLine("========== OUTPUT ==========");
        Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
                + "Data center ID" + indent + "VM ID" + indent + indent + "Time" + indent + "Start Time" + indent + "Finish Time");

        DecimalFormat dft = new DecimalFormat("###.##");
        for (int i = 0; i < size; i++) {
            cloudlet = list.get(i);
            Log.print(indent + cloudlet.getCloudletId() + indent + indent);

            if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) {
                Log.print("SUCCESS");

                Log.printLine(indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId()
                        + indent + indent + indent + dft.format(cloudlet.getActualCPUTime())
                        + indent + indent + dft.format(cloudlet.getExecStartTime()) + indent + indent + indent + dft.format(cloudlet.getFinishTime()));
            }
        }
    }

    //Inner-Class GLOBAL BROKER...
    public static class GlobalBroker extends SimEntity {

        private static final int CREATE_BROKER = 0;
        private List<Vm> vmList;
        private List<Cloudlet> cloudletList;
        private DatacenterBroker broker;

        public GlobalBroker(String name) {
            super(name);
        }

        @Override
        public void processEvent(SimEvent ev) {
            switch (ev.getTag()) {
                case CREATE_BROKER:
                    setBroker(createBroker(super.getName() + "_"));

                    //Create VMs and Cloudlets and send them to broker
//                    setVmList(createVM(getBroker().getId(), 5, 100)); //creating 5 vms
//                    setCloudletList(createCloudlet(getBroker().getId(), 10, 100)); // creating 10 cloudlets


                    broker.submitVmList(getVmList());
                    broker.submitCloudletList(getCloudletList());



                    break;

                default:
                    Log.printLine(getName() + ": unknown event type");
                    break;
            }
        }

        @Override
        public void startEntity() {
            Log.printLine(CloudSim.clock() + super.getName() + " is starting...");
            schedule(getId(), 200, CREATE_BROKER);

        }

        @Override
        public void shutdownEntity() {
            System.out.println("Global Broker is shutting down...");
        }

        public List<Vm> getVmList() {
            return vmList;
        }

        protected void setVmList(List<Vm> vmList) {
            this.vmList = vmList;
        }

        public List<Cloudlet> getCloudletList() {
            return cloudletList;
        }

        protected void setCloudletList(List<Cloudlet> cloudletList) {
            this.cloudletList = cloudletList;
        }

        public DatacenterBroker getBroker() {
            return broker;
        }

        protected void setBroker(DatacenterBroker broker) {
            this.broker = broker;
        }
    }
    
    private static void printCloudletPriorities(List<AnjanCloudlet> list) {
        String indent = "\t";
        System.out.println("\n\n\n* * * Printing Cloudlet Priorities * * * ");
        System.out.println("");
        System.out.println("Cloudlet_ID" + indent + "Datacenter_ID" + indent + "VM_ID" + indent + indent + "Priority" );
        
        for (AnjanCloudlet c : list) {
            Log.print(indent + c.getCloudletId() + indent + indent);
            Log.print(c.getReservationId() + indent + indent);
            Log.print(c.getVmId() + indent + indent);
            Log.print(c.getCloudlet_priority()+ indent + indent);
            Log.printLine();
        }
        
        System.out.println("* * * END * * *");
        
    }
}

---------------------------------------------

CLOUDLET CLASS:

package simulacaoUSP.duvidas.cloudsim;

import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.UtilizationModel;

/**
 *
 * @author Mario Pardo
 */
public class AnjanCloudlet extends Cloudlet {

    private int cloudlet_priority = 0;
    private double startTime;

    public AnjanCloudlet(int cloudletId, long cloudletLength, int pesNumber, long cloudletFileSize, long cloudletOutputSize, UtilizationModel utilizationModelCpu, UtilizationModel utilizationModelRam, UtilizationModel utilizationModelBw) {
        super(cloudletId, cloudletLength, pesNumber, cloudletFileSize, cloudletOutputSize, utilizationModelCpu, utilizationModelRam, utilizationModelBw);
    }

    public AnjanCloudlet(int cloudletId, long cloudletLength, int pesNumber,
            long cloudletFileSize, long cloudletOutputSize,
            UtilizationModel utilizationModelCpu,
            UtilizationModel utilizationModelRam,
            UtilizationModel utilizationModelBw, double startTime, final int priority) {
        super(cloudletId, cloudletLength, pesNumber, cloudletFileSize,
                cloudletOutputSize, utilizationModelCpu, utilizationModelRam,
                utilizationModelBw);
        this.cloudlet_priority = priority;
        this.startTime = startTime;
    }

    public int getCloudlet_priority() {
        return cloudlet_priority;
    }

    public void setCloudlet_priority(int cloudlet_priority) {
        this.cloudlet_priority = cloudlet_priority;
    }

    public double getStartTime() {
        return startTime;
    }

    public void setStartTime(double startTime) {
        this.startTime = startTime;
    }

}

---------------------------

Have a happy codification! hehe =)

Regards!
Mário Pardo
ICMC-USP / São Carlos / Brazil
Research Gate Profile [LINK]

Anjan Rai

unread,
Mar 17, 2014, 4:58:45 AM3/17/14
to clou...@googlegroups.com
Hey Mario...
Code is working superb,,but according to my scenario,i want all of the four cloudlets to have unique priority associated with them i.e. if out of 4 cloudlets; cloudlet 1 is having priority1 then no other cloudlet should have that same priority[different cloudlets=different priorities]So,what modification i need to make in that code?.
Hope to get a reply soon :0 :)
Thanx
Regards!
Anjan

Mario Henrique Souza Pardo

unread,
Mar 17, 2014, 11:15:22 AM3/17/14
to clou...@googlegroups.com
Hello Anjan,

this is piece of cake!! =)

Use this new version to createCloudlet method:

private static List<AnjanCloudlet> createCloudlet(int userId, int cloudlets, int idShift) {
        // Creates a container to store Cloudlets
        LinkedList<AnjanCloudlet> list = new LinkedList<AnjanCloudlet>();

        //cloudlet parameters
        long length = 100000;
        long fileSize = 300;
        long outputSize = 300;
        int pesNumber = 1;
        UtilizationModel utilizationModel = new UtilizationModelStochastic(1);
        //UtilizationModel utilizationModel = new UtilizationModelFull();
        int priority = 0;
        Random rdn = new Random();

        AnjanCloudlet[] cloudlet = new AnjanCloudlet[cloudlets];
        List<Integer> lst_pri = new ArrayList<Integer>();
        for (int i = 0; i < cloudlets; i++) {
            while (lst_pri.contains(priority)) {
                priority = rdn.nextInt(3) + 1;
            }
            lst_pri.add(priority);
            System.out.println("generated random priority number = " + priority);
            cloudlet[i] = new AnjanCloudlet(idShift + i, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
            cloudlet[i].setUserId(userId);
            cloudlet[i].setCloudlet_priority(priority);
            cloudlet[i].setStartTime(CloudSim.clock() + 100); //Just a test...
            list.add(cloudlet[i]);

        }

        return list;
    }

----------------------------

Regards!
Mário Pardo
ICMC-USP / São Carlos / Brazil
Research Gate Profile [LINK]

Anjan Rai

unread,
May 8, 2014, 1:20:45 PM5/8/14
to clou...@googlegroups.com
Hello Mario,
I need to ask you that is it possible to assign priority to VMs according to their MIPS i.e. the VM having highest MIPS should have priority=1 and so on?
Regards
Anjan
...

Mario Henrique Souza Pardo

unread,
May 12, 2014, 9:27:57 PM5/12/14
to clou...@googlegroups.com
Hello Anjan,

   yes, it's possible.
 
   Try to use this skeleton code to start you implementation.

---------------------

import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.Vm;

/**
 *
 * @author Mario Pardo
 */

public class VmWithPriority  extends Vm{

    private int vmPriority;
    
    public VmWithPriority(int id, int userId, double mips, int numberOfPes, int ram, long bw, long size, String vmm, CloudletScheduler cloudletScheduler) {
        super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler);
    }

    public VmWithPriority (int id, int userId, double mips, int numberOfPes, int ram, long bw, long size, String vmm, CloudletScheduler cloudletScheduler, int priority){
        super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler);
        this.vmPriority = priority;
    }
    public int getVmPriority() {
        return vmPriority;
    }

    public void setVmPriority(int vmPriority) {
        this.vmPriority = vmPriority;
    }
}

---------------------

    Regards!
Mário Pardo
ICMC-USP / São Carlos / Brazil
Research Gate Profile [LINK]


For more options, visit https://groups.google.com/d/optout.

Anjan Rai

unread,
May 20, 2014, 1:34:35 PM5/20/14
to clou...@googlegroups.com
Hey Mario,
Thank you so much for all your help..I completed my dissertation successfully.All the help provided by you helped me a lot..Thank you once again.
Regards
Anjan
...

Mario Henrique Souza Pardo

unread,
May 20, 2014, 2:04:16 PM5/20/14
to clou...@googlegroups.com
Hi Anjan,

  you're welcome, buddy. Congrats and Success for you!

   Regards,

Mário Henrique de Souza Pardo / PhD Candidate
University of São Paulo / Institute of Mathematical and Computer Science (ICMC)
Laboratory of Distributed Systems and Concurrent Programming (LaSDPC)
São Carlos / SP / Brazil
Research Gate Profile [LINK]
---



--

Dushyant Gupta

unread,
Apr 10, 2015, 6:00:37 AM4/10/15
to clou...@googlegroups.com

Hello mr .Anjan and Mario sir ..
 I have read your priority scheduling algorithm ..sir can you provide its algorithm ,so that i could understand it properly..
Thank tou.. the coding is..

Dushyant Gupta

unread,
Apr 10, 2015, 6:01:20 AM4/10/15
to clou...@googlegroups.com

Pleae sir its urgent..

Mohit Saini

unread,
Aug 3, 2015, 10:31:16 AM8/3/15
to cloudsim


hello 
Anjan sir & Mario sir,

    i am working on task scheduling in cloud computing.  i have create 5 cloud let and  assigned  to 5 VM.   answer is coming right
==================================== OUTPUT ===================================
Task ID    STATUS    Data center ID    VM ID    Time    Start Time    Finish Time
    3        SUCCESS        2            3        10        0.1        10.1
    5        SUCCESS        2            5        10        0.1        10.1
    2        SUCCESS        2            2        20        0.1        20.1
    1        SUCCESS        2            1        40        0.1        40.1
    4        SUCCESS        2            4        80        0.1        80.1 
but when i try to assigned more than one task to any VM  (cloudlet no 6  to  5 vm) ....answer is not coming right,
==================================== OUTPUT ===================================
Task ID    STATUS    Data center ID    VM ID    Time    Start Time    Finish Time
    3        SUCCESS                    2            3        10               0.1        10.1
    2        SUCCESS                    2            2        20                0.1        20.1
    5        SUCCESS                    2            5        20                0.1        20.1
    6        SUCCESS                    2            5        20                0.1        20.1
    1        SUCCESS                    2            1        40                0.1        40.1
    4        SUCCESS                    2            4        80                 0.1        80.1

  task id  5  shoud be   finished 10 second by VM 5 ...............so  there is mistake in answer in line 3......

please help me in this regard

 Mohit kumar
 


 
h_2184412662.pdf
Screenshot from 2015-08-03 18:18:54.png

Binal Parekh

unread,
Nov 19, 2015, 2:49:27 AM11/19/15
to cloudsim
is there any way to findout number of cloudlet on VM in cloudSim?

Dalia Sobhy

unread,
Jul 6, 2016, 12:47:51 PM7/6/16
to cloudsim
Hello

I need some help in determining how to measure the response time & availability of VM instances in cloudsim.

So any help what to do?

Thanks :)

Hiren Patel

unread,
Jul 11, 2016, 3:00:00 AM7/11/16
to clou...@googlegroups.com
hi,
i am not familiar with cloudsim.

i did my work in dcsim.

so if i will have any idea i will message you .

good day.

--

---
You received this message because you are subscribed to a topic in the Google Groups "cloudsim" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cloudsim/XAxjE6QaFPU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cloudsim+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Good Day,
Hiren Patel.

Nikhil Dhakal

unread,
Jul 15, 2016, 2:28:31 AM7/15/16
to cloudsim
Hi Anjan and Mario,
 I just wanted to ask if this algorithm you did is dynamic or static in nature? Hoping for an answer.
Thanks
Message has been deleted

aida nasr

unread,
Aug 29, 2016, 3:48:54 AM8/29/16
to cloudsim
Hello Mario,
I want to apply scheduling algorithm on some cloudlets (in DAG).
cloudlets have dependency. they have priority like t1,t3,t4,t2,t5,t6,t7
when run the program the order of cloudlets is changed .
i want to know Why the order of cloudlets is changed and how to solve this problem? 

for ex.)


Starting Scheduling...
Initialising...

DMSCRO Broker Schedules

Task0 is bound with VM2
Task1 is bound with VM2
Task2 is bound with VM0
Task3 is bound with VM0
Task4 is bound with VM1
Task5 is bound with VM2
Task6 is bound with VM1
Task7 is bound with VM0
Task8 is bound with VM0
Task9 is bound with VM2


Starting CloudSim version 3.0
Datacenter_0 is starting...
Broker is starting...
Entities started.
0.0: Broker: Cloud Resource List received with 1 resource(s)
0.0: Broker: Trying to Create VM #0 in Datacenter_0
0.0: Broker: Trying to Create VM #1 in Datacenter_0
0.0: Broker: Trying to Create VM #2 in Datacenter_0
0.1: Broker: VM #0 has been created in Datacenter #2, Host #0
0.1: Broker: VM #1 has been created in Datacenter #2, Host #0
0.1: Broker: VM #2 has been created in Datacenter #2, Host #0
0.1: Broker: Sending cloudlet 0 to VM #2
0.1: Broker: Sending cloudlet 1 to VM #2
0.1: Broker: Sending cloudlet 2 to VM #0
0.1: Broker: Sending cloudlet 3 to VM #0
0.1: Broker: Sending cloudlet 4 to VM #2
0.1: Broker: Sending cloudlet 5 to VM #1
0.1: Broker: Sending cloudlet 6 to VM #1
0.1: Broker: Sending cloudlet 7 to VM #0
0.1: Broker: Sending cloudlet 8 to VM #0
0.1: Broker: Sending cloudlet 9 to VM #2
7.996746817538896: Broker: Cloudlet 5 received
8.723454892073057: Broker: Cloudlet 2 received
11.650693698043206: Broker: Cloudlet 0 received
15.892560741890447: Broker: Cloudlet 6 received
20.65964148723206: Broker: Cloudlet 3 received
25.221753288474297: Broker: Cloudlet 7 received
26.884066721310116: Broker: Cloudlet 1 received
28.33748287037844: Broker: Cloudlet 8 received
43.77778137784113: Broker: Cloudlet 4 received
55.66584107933367: Broker: Cloudlet 9 received
55.66584107933367: Broker: All Cloudlets executed. Finishing...
55.66584107933367: Broker: Destroying VM #0
55.66584107933367: Broker: Destroying VM #1
55.66584107933367: Broker: Destroying VM #2
Broker is shutting down...
Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down.
Datacenter_0 is shutting down...
Broker is shutting down...
Simulation completed.
Simulation completed.

========== OUTPUT ==========
Cloudlet ID    STATUS    Data center ID    VM ID    Time    Start Time    Finish Time
    5        SUCCESS        2            1        7.9        0.1        8
    2        SUCCESS        2            0        8.62        0.1        8.72
    0        SUCCESS        2            2        11.55        0.1        11.65 t0 if the first cloudlet 
    6        SUCCESS        2            1        7.9        8        15.89
    3        SUCCESS        2            0        11.94        8.72        20.66
    7        SUCCESS        2            0        4.56        20.66        25.22
    1        SUCCESS        2            2        15.23        11.65        26.88
    8        SUCCESS        2            0        3.12        25.22        28.34
    4        SUCCESS        2            2        16.89        26.88        43.78
    9        SUCCESS        2            2        11.89        43.78        55.67   wrong finish time of t9=55.67
EFT0= 11.552238805970148    
EFT1= 26.78731343283582
EFT2= 40.17646240845462
EFT3= 58.72520163159358
EFT4= 77.07198479651433
EFT5= 78.07320922599352
EFT6= 164.9687316140532
EFT7= 189.53084341529544
EFT8= 192.64885583765567
EFT9= 196.85679131554576  correct finish time of t9=196
DMSCRO finished!
 


the right order is t0,t1,t3,t2,t4,t6,t5,t7,t9,t8

and finish time of each cloudlets is wrong 

nafkha manel

unread,
May 7, 2018, 5:59:37 PM5/7/18
to cloudsim
Hi mario,
i need your help please.
sincerly
Reply all
Reply to author
Forward
0 new messages