问题
I added randomly Boolean parameter among cloudlet attributes for giving preference below is the code what else can do? What parameters can be added more to cloudlet attributes for giving them priority.
for(int i=0;i<cloudlets;i++){
Random r= new Random(); // for creating random length
Random priortyObj =new Random(); // for creating booleon priorty
cloudlet[i] = new Cloudlet(priorty_cloudlet.priortyObj.nextInt(2),
i, length +r.nextInt(2000),pesNumber,
fileSize, outputSize, utilizationModel,
utilizationModel, utilizationModel);
// setting the owner of these Cloudlets
cloudlet[i].setUserId(userId);`
list.add(cloudlet[i]);
}
回答1:
Priority can be dealt in two different ways: (i) we could prioritize the submission of Cloudlets to a broker, so that high-priority Cloudlets will be mapped to a VM first, or (ii) we could prioritize the execution of Cloudlets inside a VM.
Despite the Cloudlet class in CloudSim has a classType
attribute that is intended to define priority, such an attribute is not used anywhere, so you don't have any kind of priority implemented.
If you need to define Cloudlets' execution priority, you can check CloudSim Plus, it's a full-featured, state-of-the-art, completely re-engineered and actively maintained CloudSim fork. Its CloudletSimple
class has a priority
attribute that is actually used by the CloudletSchedulerCompletelyFair. Such a scheduler is an implementation of the Completely Fair Linux Scheduler that considers a time slice/quantum to run Cloudlets and Cloudlet's priority.
Below is an sample snippet on how to use the mentioned scheduler and set priorities for Cloudlets:
vm.setCloudletScheduler(new CloudletSchedulerCompletelyFair());
for(int i=0; i < 10; i++){
Cloudlet c = new CloudletSimple(CLOUDLET_LEN, CLOUDLET_PES);
c.setPriority(i); //you must define the priority in your own way
cloudletList.add(c);
}
Check the full LinuxCompletelyFairSchedulerExample.
来源:https://stackoverflow.com/questions/51571651/what-kind-of-criteria-can-be-design-to-give-priorties-to-cloudlet-in-cloudsim