I'm working on Cloudsim. How can I delay the cloudlet submission by 30 seconds? After the first cloudlet is submitted after 30 seconds, the second cloudlet has to start the execution.
Is there any way to do this?
I'm working on Cloudsim. How can I delay the cloudlet submission by 30 seconds? After the first cloudlet is submitted after 30 seconds, the second cloudlet has to start the execution.
Is there any way to do this?
To add some delay between cloudlets in CloudSim you need to acess the method "submitCloudLets" in the class "DatacenterBroker". In method "submitCloudlets" you need to acess and edit the method "sendNow". The following example code should be inserted:
protected void sendNow(int entityId, int cloudSimTag, Object data) {
if(cloudSimTag==CloudSimTags.CLOUDLET_SUBMIT){
send(entityId, delay /* enter your delay value here or call a method that calculates the delay value randomly */, cloudSimTag, data);
}
else send(entityId, 0, cloudSimTag, data); // CASE the cloudsim tag was not "CLOUDLET_SUBMIT". !!! If you remove this line, your program does not work!!!!
}
I am not sure about the api of Cloudsim, if you just need to add time delay using code, you can do that using java too..
use
Thread.sleep(3000);
You can read more about it at the documentation http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html#sleep(long, int)
CloudSim Plus supports such a feature natively.
You just need to make this single method call broker.submitCloudletList(cloudletList, submissionDelay)
and the Cloudlets will be submitted only after the given delay (in seconds).
This way, you don't need to change the framework code to implement such a basic feature. If you change a framework's class to include a basic feature to be used just for your simulation, you may struggle to update your fork of the framework with the latest versions.
Check feature #8 at https://cloudsimplus.org#main-exclusive-features for more details.