How to create VMs at different time

589 views
Skip to first unread message

Geethapriya Ramakrishnan

unread,
Apr 27, 2016, 12:49:52 AM4/27/16
to cloudsim
Hi,

As a part of my research work, I am in need of instantiating or creating the virtual machines at the different time(arrival time) and allow the cloudlets to run in each virtual machine. 

To my knowledge, in cloudsim, all VMs are created at the same time if required resources(memory, PEs, Bandwidth) are available. Few VMs may not be created if required resources are not available. Once, all the possible VMs are created, corresponding cloudlets are run in each VM and hence, each VM completes its execution at a different time based on the length of the cloudlet and the mips. I understand that the submission time for the cloudlets can be set or by default, it takes 0.0.

My doubt is how to set submission time or arrival time for a VM. I need to create VMs at different time and allow cloudlet to run in the VM.

Is it possible to submit multiple sets of VMs and cloudlets in a single simulation?

I need something as follows

VMID             VMSubmitTime            VMStartTime                  CloudletID       CloudletCPUtime           VMFinishTime
--------------------------------------------------------------------------------------------------------------------------------------------------------- 
   1                          0.0                            0.2                                   1                           500                              500.2
   2                          2                               2.5                                   2                           1000                           1002.5 

Manoel Campos

unread,
Apr 27, 2016, 3:41:46 AM4/27/16
to clou...@googlegroups.com
Try the CloudSimExample7. It shows how to perform some task as a given time.

Manoel Campos da Silva Filho Software Engineer

Computer Science and Engineering PhD Student at University of Beira Interior (Portugal)

Professor at Federal Institute of Education, Science and Technology of Tocantins (Brazil)

http://manoelcampos.com


 about.me

--

---
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/d/optout.

Geethapriya Ramakrishnan

unread,
Apr 27, 2016, 8:01:11 AM4/27/16
to cloudsim
Thanks Manoel. I understand we can create entities dynamically just as broker created dynamically in CloudSimExample7. If I am right, you mean that we can create VMs dynamically by pausing the simulation as in the given example.

But I think there can be only one vmlist that can be submitted only once in a simulation. 

For example, if I assume 

VM1 arrives at time 0, 
VM2 arrives at time 100, 
VM3 arrives at time 200; 

I have set a delay of 100 after each VM creation. Just for the sake of example, I assume the VM requests are arriving at equal intervals. Also, I bind ith VM to ith cloudlet.

What I expect is when VM1 is created at time 0 if required resources are available, execution of cloudlet1 in VM1 should start at time 0. Similarly, if VM2 is created at time 100, execution of cloudlet2 in VM2 should start at time 100 and execution of cloudlet3 in VM3 should start at 200. VMs get destroyed at the different time based on the length of cloudlet and mips of PEs in the VM. 

But what actually happens is cloudlet1 starts execution in VM1 at 300 since I have used a delay of 100 that is set 3 times after creating 3 VMs. I need the cloudlet execution to start in a VM as and when the VM is created. I don't want the cloudlets execution to start after all the VMs have been created.

Please help and let me know how the above scenario can be implemented. 

Thanks and Regards,
Geethapriya

Manoel Campos

unread,
Apr 27, 2016, 8:53:04 AM4/27/16
to clou...@googlegroups.com
It is perfectly possible to have multiple lists of VMs. There isn't any problem with that.
Obviously, you will have more work on managing more than one VM list.

However, using the Example 7, you can create a thread to submit a new VM list at the time you want.
By this way, at the time 200 you can submit a new vmlist with just one VM and at time 300 you submit
another list with another single VM.

You have to try this approach and see if it works as you wish. 

Best regards,

Manoel Campos da Silva Filho Software Engineer

Computer Science and Engineering PhD Student at University of Beira Interior (Portugal)

Professor at Federal Institute of Education, Science and Technology of Tocantins (Brazil)

http://manoelcampos.com


 about.me

Tushar Bhardwaj

unread,
Apr 27, 2016, 2:32:00 PM4/27/16
to cloudsim
Dear All,

Example 7 shows how to create VMs at certain interval and submit cloudlets to them. But I want to create and add the VMs to the existing VMs list after a certain time interval.
For example : Initially 10 cloudlets are submitted to 5 VMs, I calculated the response time, if response time is greater than a value I want to add 2 more VMs to the existing VM list.

I wish this explains my problem.


Thanks in advance.

Tushar

Mario

unread,
May 5, 2016, 7:10:30 PM5/5/16
to cloudsim
Dear all,

We use a different approach. A list of active VMs is created to define the VMs that are running jobs. At the begining of simulation, we create all VMs (all of them are inactive). When a cloudlet arrives, it can be allocated in a VM on the active VM list or active a new VM (and then add the VM to active VM list). When a job finish its exectuion, it is removed from the VM, if there is no more jobs running on the VM then the VM is removed from active VM list. This simulates the start and shut down of VMs.

Regards, Mario.

Geethapriya Ramakrishnan

unread,
May 6, 2016, 2:03:13 AM5/6/16
to cloudsim
        
Thanks, Manoel. As you suggested, I tried to adapt CloudsimExample7 as per my requirement. In this example, they create a broker at time 200, submit new vmlist and cloudletlist to new broker created.

For my work, I am creating a new vm at the specified time(submit_time), my vmlist has only one vm that is submitted to the existing broker itself. i.e., I am not creating new broker, I am creating a new vm at the specified time and submitting that to the existing broker.

Initially I have all the Vms to be created in a Mastervmlist and the corresponding cloudlets in MastercloudletList. The ith VM is bound to ith cloudlet. For each VM to be created, I create a thread and do CloudSim.pauseSimulation((long) submit_time)where submit_time is the arrival time of the corresponding VM. 

When I create threads in a loop, only the last vm is created at its submit time.

Following the code snippet.
        for (int i = 1; i < Mastervmlist.size(); i++) 
        {
                Vm vm = Mastervmlist.get(i);
                Cloudlet cloudlet = MastercloudletList.get(i);
                
                vmlist = new ArrayList<Vm>();
                cloudletList = new ArrayList<Cloudlet>();
                
                vmlist.add(vm);
                cloudletList.add(cloudlet);
                
                ArrayList data = (ArrayList) dataset.get(i);
                double submit_time = Double.parseDouble((String) data.get(1));
                
                Runnable monitor = new Runnable() {
                    @Override
                    public void run() {
                        CloudSim.pauseSimulation((long) submit_time);                      
                        while (true) {                            
                            if (CloudSim.isPaused()) 
                            {                                
                                break;
                            }
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                        }

                        Log.printLine("\n\n\n" + CloudSim.clock() + ": The simulation is paused for 5 sec \n\n");

                        try {
                            Thread.sleep(5000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }                                                

                        //Submit VMs and Cloudlets and send them to broker                       
                        broker.submitVmList(vmlist);
                        broker.submitCloudletList(cloudletList);

                        CloudSim.resumeSimulation();
                    }
                };

                new Thread(monitor).start();
                Thread.sleep(1000);
            }            
            CloudSim.startSimulation();
If I have to create 5 VMs, only the 5th VM is created.

Please help.

Thanks and Regards,
Geethapriya

Geethapriya Ramakrishnan

unread,
May 6, 2016, 7:49:03 AM5/6/16
to cloudsim
CloudSimExample8 helped me to solve my problem.

Thanks and Regards,
Geethapriya

Manoel Campos

unread,
May 7, 2016, 7:23:40 AM5/7/16
to clou...@googlegroups.com
Excellent,

Happy you found a solution and have let us know.

Best regards,

Manoel Campos da Silva Filho Software Engineer

Computer Science and Engineering PhD Student at University of Beira Interior (Portugal)

Professor at Federal Institute of Education, Science and Technology of Tocantins (Brazil)

http://manoelcampos.com


 about.me

Tushar Bhardwaj

unread,
May 8, 2016, 3:40:57 AM5/8/16
to cloudsim
Dear Manoel Campos,

I want to create a new VM after an interval and add it to the existing VM list. So, that the initial cloudlets list get assigned to the new updated VM list. For now what happening is that the new VM list is created and new cloudlets are bound to them. I want to bind the initial cloudlets to the updated VM list.

Kindly, help me out.

Regards,

Tushar Bhardwaj
Reply all
Reply to author
Forward
0 new messages