Shared Practical File
Shared Practical File
Theory:
Oracle VM Virtual Box (formerly Sun Virtual Box, Sun VM VirtualBox and innotek
VirtualBox) is a virtualization software package for x86 and AMD64/Intel64 based
computers from Oracle Corporation as part of its family of virtualization products. It was
created by innotek GmbH, purchased in 2008 by Sun Microsystems and now developed
by Oracle. It is installed on an existing host operating system as an application; this host
application allows additional guest operating systems, each known as a Guest OS, to be
loaded and run, each with its own virtual environment.
Supported host operating systems include Linux, Mac OSX, Windows XP, Windows
Vista, Windows 7, Windows 8, Solaris and Open Solaris.
Emulated Environment:
VirtualBox can load multiple guest OS under a single host operating system (host OS).
Each guest can be started, paused and stopped independently within its own virtual
machine (VM). The user can independently configure each VM and run it under a choice
of software-based virtualization or hardware assisted virtualization if the underlying host
hardware supports this. The host OS and guest OSs and applications can communicate
with each other through a number of mechanisms including a common clipboard and a
virtualised network facility. Guest VMs can also directly communicate with each other if
configured to do so.
Software-enabled virtualization:
Hardware-assisted virtualization:
VirtualBox supports some guests (including 64 bit guests, SMP guests and certain
propreitary OSs ) only on hosts with hardware-assisted virtualization.
PROCEDURE :
1. Open the downloaded exe file of virtual box which is of around 115 MB. Click on it.
Click yes.
2. Click on install.
Then you see this :
Allow it. Click install. It will start installing again.
3. And it’s done!
7. File location and size: It’s the size you want to give your machine. (I gave 15 GB)
Then you see a machine named Ubuntu or whatever you gave in left pane. Select this
machine. Click on the settings.
8. Select system tab. Uncheck floppy. Set hard disk first and optical disk second by using
arrows.
9. Select processor tab: If you 4 cores then set it to 1 or more than 4 then set it to
2.Change execution cap to 90%.
10. Switch to display tab. Change the video memory to half of the available or you can
set it to 64 MB.
12. Switch to storage tab. Click on empty. Now select the cd icon which is present on the
right side. Browse the location where you placed iso image of Ubuntu.
13. Click in OK. All settings are done. Click on the start button to start your newly built
virtual machine. Virtual Machine will start booting process. It takes time. If you
encounter error like ACPI PCC probe failed, do not worry. It is harmless error.
14. Now you see the Ubuntu os asking you to install or try it. Click on try if you want to
try it otherwise install button.
THEORY:
Suppose we need an exact copy of the virtual machine on a different system. In that case,
we need to first clone the machine and then migrate it to other machine.
Some definitions:
1. Cloning: Cloning means making an exact similar copy.
2. Migration: Moving virtual machine from one computer to other.
STEPS:
1. Turn off the virtual machine. You cannot put it to pause. Power it off.
2. Cloning:
A. Select the machine from the left panel which you want to clone. Click ”snapshots”
which is present near upper right side.
It asks for name of clone machine. By default, Virtual box appends word clone to name
of original machine which is being cloned. You can give any other name. But give
different name from original machine. Click next.
D. Type of clone:
You can make two types of clones:
1. Full clone: In this mode you can work with machine without any need of source
Virtual machine. As we are migrating it from one system to other, we will make a full
clone.
2. Linked clone: In this mode new differencing disk images are created where the parent
disk images are the source disk images. If you selected the current state of the source
Virtual Machine as clone point, a new snapshot will be created implicitly.
Select full clone and then click clone.
E. Cloning will start. It took around 2-3 minutes. Then a machine is created. You can see
it in the left pane.
3. Locate the .vdi file of the clone machine. you can find it in Virtual Box Vm folder if
you are on windows.
Copy this file in pen drive and then onto new host system.
4. Create new virtual machine as if you are creating a normal machine, until you see this
step to choose the disk.
In this step, choose the option to use an existing virtual hard disk. Select the .vdi file.
Rest steps are same as if you creating a standard virtual machine. A new machine is
present in the left pane now. Run it. Migrated machine is working.
EXPERIMENT 3
AIM: CloudSim: Installing CloudSim and creating a datacenter with one host and
running one cloudlet.
THEORY:
The primary objective of CloudSim is to provide a generalized and extensible simulation
framework that enables seamless modeling, simulation, and experimentation of emerging
Cloud computing infrastructures and application services. By using CloudSim,
researchers and industry-based developers can focus on specific system design issues that
they want to investigate, without getting concerned about the low level details related to
Cloud-based infrastructures and services.
Main Features:
• support for modeling and simulation of large scale Cloud computing data centers
• support for modeling and simulation of virtualized server hosts, with
customizable policies for provisioning host resources to virtual machines
• support for modeling and simulation of energy-aware computational resources
• support for modeling and simulation of data center network topologies and
message-passing applications
• support for modeling and simulation of federated clouds
• support for dynamic insertion of simulation elements, stop and resume of
simulation
• support for user-defined policies for allocation of hosts to virtual machines and
policies for allocation of host resources to virtual machines
PROCEDURE:
(A) INSTALL CLOUD SIM
Step 1- Download CloudSim zip folder from the link given below. After downloading,
unzip the folder.
https://code.google.com/archive/p/cloudsim/downloads
Step 2: Download Apache Commons Math 3.6.1 from the link given below. After
downloading, unzip the folder.
Step 5: Enter a project name in the window. Also, choose an appropriate version of JRE.
Click on Finish.
Step 6: Right click on your project name and click on export. Select General and then,
file system. Locate your unzipped folder CloudSim 3.0.3. Select all files and click on
Finish.
Step 7: Next, import the common-maths file in the jars folder of our project using the
same steps used above.
Step 8: Now, right click on the project and select properties. Goto Java Build Path >
Libraries > Add jars and select the common-maths jar file imported in step 7.
This ends our CloudSim installation.
AIM: CloudSim: Creating two datacenters with one host each and running one
cloudlet on it.
THEORY:
VIRTUAL MACHINE- A virtual machine (VM) is an emulation of a particular
computer system. Virtual machines operate based on the computer architecture and
functions of a real or hypothetical computer and their implementations may involve
specialized hardware, software, or a combination of both.
PROCEDURE:
Step 1: Open CloudSimExample2.java
Step 2: Create two virtual machines and four cloudlets in the source code.
Step 3: Click on Run once build completes.
//create two VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
id++;
Cloudlet cloudlet3 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet3.setUserId(brokerId);
id++;
Cloudlet cloudlet4 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
HARDWARE REQUIREMENTS
Desktop/ Laptop System with Windows 7 operating system
SOFTWARE REQUIREMENTS
NetBeans
THEORY
Let us take two VM’s VM1 and VM2 that will execute 8 tasks t1, t2, t3, t4, t5, t6, t7 and
t8. Suppose tasks t1, t2, t3 and t4 are going to be executed by VM VM1 and tasks t5, t6,
t7 and t8 will be executed by VM VM2. Then the various possibilities for their execution
will be:
1. Both VM’s and Tasks will be Space Shared
2. VM’s will be Space Shared and Tasks will be Time Shared
3. VM’s will be Time Shared and Tasks will be Space Shared
4. Both VM’s and Tasks will be Time Shared
PROCEDURE
1. Open CloudSimExample2.java
2. Create two virtual machines and four cloudlets in the source code.
3. Import the following package:
import org.cloudbus.cloudsim.CloudletSchedulerSpaceShared;
4. Change the virtual machine definition to:
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
cloudletSchedulerSpaceShared());
5. Click on Run once build completes.
SOURCE CODE
A. Changes made for Time shared
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
vmlist.add(vm1);
vmlist.add(vm2);
broker.submitVmList(vmlist);
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,
utilizationModel,
utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
id++;
Cloudlet cloudlet3 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,
utilizationModel,
utilizationModel, utilizationModel);
cloudlet3.setUserId(brokerId);
id++;
Cloudlet cloudlet4 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,
utilizationModel,
utilizationModel, utilizationModel);
cloudlet4.setUserId(brokerId);
cloudletList.add(cloudlet1);
cloudletList.add(cloudlet2);
cloudletList.add(cloudlet3);
cloudletList.add(cloudlet4);
broker.submitCloudletList(cloudletList);
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerSpaceShared());
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerSpaceShared());
OUTPUT
I. TIME SHARED
II. SPACE SHARED
EXPERIMENT 6
AIM: Assigning priority to cloudlets in Cloudsim.
THEORY
PROCEDURE
package org.cloudbus.cloudsim.examples;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.UtilizationModel;
Step 3: Add the following code to schedule cloudlets on the basis of priority in the
class GlobalBroker. Make changes in the other classes as well.
//cloudlet parameters
int priority = 1;
UtilizationModel utilizationModel = new UtilizationModelFull();
for(int i=0;i<cloudlets;i++){
cloudlet[i] = new NewCloudlet(idShift + i, length,
pesNumber, fileSize, outputSize, utilizationModel, utilizationModel,
utilizationModel, priority);
// setting the owner of these Cloudlets
cloudlet[i].setUserId(userId);
list.add(cloudlet[i]);
priority++;
}
return list;
}
public static void main(String[] args) {
}
public static class GlobalBroker extends SimEntity {
if((list1.get(j).getCloudlet_priority())>(list1.get(i).getCloudlet_priority())) {
temp= list1.get(j);
list1.set(j,list1.get(i));
list1.set(i, temp);
temp= null;
}
}
i++;
}
setCloudletList(list1);
for(i= 0;i<list1.size();i++){
Log.printLine(getCloudletList().get(i).getCloudlet_priority());
}
OUTPUT:
EXPERIMENT 8
THEORY:
Google App Engine (often referred to as GAE or simply App Engine) is a platform as
a service (PaaS) cloud computing platform for developing and hosting web
applications in Google-managed data centers. Applications are sandboxed and run
across multiple servers. App Engine offers automatic scaling for web applications—
as the number of requests increases for an application, App Engine automatically
allocates more resources for the web application to handle the additional demand.
Google App Engine is free up to a certain level of consumed resources. Fees are
charged for additional storage, bandwidth, or instance hours required by the
application. It was first released as a preview version in April 2008 and came out of
preview in September 2011.
PROCEDURE:
Step 1: Follow the link: https://appengine.google.com and sign up for an account.
Step 2: Next, head over to (Google Developers Console)
Step 4: In the following steps, we will be deploying a python app that displays
“Hello, World!” on google app engine. We start with downloading the App Engine
SDK for Python and follow the installation steps.
To install on Linux:
1. Unzip the App Engine SDK file you downloaded
(google_appengine_1.9.36.zip), for example:
unzip google_appengine_1.9.36.zip
2. Add the google_appengine directory to your PATH:
export PATH=$PATH:/path/to/google_appengine/
3. Make sure Python 2.7 is installed on your machine using the following
command:
/usr/bin/env python –V
Step 5: Next, we will test our helloworld application before deploying on the cloud.
For this navigate to your directory from the terminal and enter the following
command.
dev_appserver.py helloworld/
Step 6: The web server is now running, listening for requests on port 8080. Visit
http://localhost:8080/ in web browser to see the app in action.
Step 7: Intialize gcloud to use the project created above. This can be done by
following the command below:
gcloud init
Step 8: Upload your application to Google App Engine by invoking the following
command from inside the helloworld directory.
gcloud preview app deploy
Step 9: Head to http://<YOUR_PROJECT_ID_>.appspot.com/ to see your helloworld
app in action.