CC File Manjot 4-5
CC File Manjot 4-5
Aim-
Implementation of Shortest Job First algorithm using cloudSim
Program:-
DataBroker.java File
package org.cloudbus.cloudsim;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEntity;
import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.lists.CloudletList;
import org.cloudbus.cloudsim.lists.VmList;
/**
* DatacentreBroker represents a broker acting on behalf of a user. It hides VM management, as vm
* creation, sumbission of cloudlets to this VMs and destruction of VMs.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
*/
public class DatacenterBroker extends SimEntity {
/** The vm list. */
protected List<? extends Vm> vmList;
/** The vms created list. */
protected List<? extends Vm> vmsCreatedList;
/** The cloudlet list. */
protected List<? extends Cloudlet> cloudletList;
/** The cloudlet submitted list. */
protected List<? extends Cloudlet> cloudletSubmittedList;
/** The cloudlet received list. */
protected List<? extends Cloudlet> cloudletReceivedList;
/** The cloudlets submitted. */
protected int cloudletsSubmitted;
/** The vms requested. */
protected int vmsRequested;
/** The vms acks. */
protected int vmsAcks;
/** The vms destroyed. */
protected int vmsDestroyed;
/** The datacenter ids list. */
protected List<Integer> datacenterIdsList;
/** The datacenter requested ids list. */
protected List<Integer> datacenterRequestedIdsList;
/** The vms to datacenters map. */
protected Map<Integer, Integer> vmsToDatacentersMap;
/** The datacenter characteristics list. */
protected Map<Integer, DatacenterCharacteristics> datacenterCharacteristicsList;
/**
* This method is used to send to the broker the list with virtual machines that must be
* created.
*
* @param list the list
* @pre list !=null
* @post $none
*/
public void submitVmList(List<? extends Vm> list) {
getVmList().addAll(list);
}
/ * *
setDatacenterRequestedIdsList(new ArrayList<Integer>());
createVmsInDatacenter(getDatacenterIdsList().get(0));
}
}
/ * *
getVmsToDatacentersMap().put(vmId, datacenterId);
getVmsCreatedList().add(VmList.getById(getVmList(), vmId));
Log.printLine(CloudSim.clock() + ": " + getName() + ": VM #" + vmId
+ " has been created in Datacenter #" + datacenterId + ", Host #"
+ VmList.getById(getVmsCreatedList(), vmId).getHost().getId());
} else {
Log.printLine(CloudSim.clock() + ": " + getName() + ": Creation of VM #" + vmId
+ " failed in Datacenter #" + datacenterId);
} incrementVmsAcks(); // all the requested VMs have been created if (getVmsCreatedList().size() == getVmList().size() -
getVmsDestroyed()) {
submitCloudlets();
} else { // no vms created. abort
Log.printLine(CloudSim.clock() + ": " + getName()
+ ": none of the required VMs could be created. Aborting");
finishExecution();
}
}
}
}
/
*
** Process a cloudlet return event.
* * @param ev a SimEvent
object * @pre ev != $null *
@post $none
}
}
/ * *
* Overrides this method when making a new and different type of Broker. This method is called
* by {@link #body()} for incoming unknown tags.
*
* @param ev a SimEvent object
* @pre ev != null
* @post $none
*/
* @pre $none
* @post $none
*/
protected void submitCloudlets() {
int vmIndex = 0;
List <Cloudlet> sortList= new ArrayList<Cloudlet>();
ArrayList<Cloudlet> tempList = new ArrayList<Cloudlet>();
} sortList.add(smallestCloudlet); tempList.remove(smallestCloudlet);
count++;
}
for (Cloudlet cloudlet : sortList) {
Vm vm;
// if user didn't bind this cloudlet and it has not been executed yet
if (cloudlet.getVmId() == -1) {
vm = getVmsCreatedList().get(vmIndex);
} else { // submit to the specific vm
vm = VmList.getById(getVmsCreatedList(), cloudlet.getVmId());
if (vm == null) { // vm was not created
cloudlet " Log.printLine(CloudSim.clock() + ": " + getName() + ": Postponing execution of
+ cloudlet.getCloudletId() + ": bount VM not available");
continue;
}
} Log.printLine(CloudSim.clock() + ": " + getName() + ": Sending cloudlet "
cloudlet.setVmId(vm.getId()); + cloudlet.getCloudletId() + " to VM #" + vm.getId());
CloudSimTags.CLOUDLET_SUBMIT, cloudlet);
sendNow(getVmsToDatacentersMap().get(vm.getId()),
cloudletsSubmitted++;
vmIndex = (vmIndex + 1) % getVmsCreatedList().size();
} getVmsCreatedList().clear();
}
/ * *
* (non-Javadoc)
* @see cloudsim.core.SimEntity#shutdownEntity()
*/
@Override
public void shutdownEntity() {
Log.printLine(getName() + " is shutting down...");
}
/ *
* (non-Javadoc)
* @see cloudsim.core.SimEntity#startEntity()
*/
@Override
public void startEntity() {
Log.printLine(getName() + " is starting...");
schedule(getId(), 0, CloudSimTags.RESOURCE_CHARACTERISTICS_REQUEST);
}
/ * *
//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];
CloudletSchedulerSpaceShared());
for(int i=0;i<vms;i++){
vm[i] = new Vm(i, userId, mips, pesNumber, ram, bw, size, vmm, new
//for creating a VM with a space shared scheduling policy for cloudlets:
//vm[i] = Vm(i, userId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerSpaceShared());
list.add(vm[i]);
}
}
}
}
Cloud security, also known as cloud computing security, consists of a set of policies, controls, procedures and technologies
that work together to protect cloud-based systems, data, and infrastructure. These security measures are configured to
protect cloud data, support regulatory compliance and protect customers' privacy as well as setting authentication rules for
individual users and devices. From authenticating access to filtering traffic, cloud security can be configured to the exact
needs of the business. And because these rules can be configured and managed in one place, administration overheads are
reduced and IT teams empowered to focus on other areas of the business.
Cloud computing offers organizations many benefits, but these benefits are unlikely to be realized if there are not
appropriate IT security and privacy protection strategies in place when using the cloud. When migrating to the cloud,
organizations must have a clear understanding of potential security risks associated with cloud computing, and set realistic
expectations with providers. The following 8 steps will help enterprise IT and business decision makers analyze the
information security and privacy implications of cloud computing and cloud security management on their business.
Following are the Steps to follow:
1. Ensure effective governance and compliance
Most organizations have security, privacy and compliance policies and procedures to protect their IP and assets.In addition
to this, organizations should establish a formal governance framework that outlines chains of responsibility, authority and
communication.This describes the roles and responsibilities of those involved, how they interact and communicate, and
general rules and policies.
2. Audit operation and business processes
It is important to audit the compliance of IT system vendors that host the applications and data in the cloud.There are three
important areas that need to be audited by cloud service customers: internal control environment of a cloud service
provider, access to the corporate audit trail, and the cloud service facility’s security.
3. Manage people, roles, and identities
Using the cloud means there will be employees from the cloud service provider that can access the data and applications, as
well as employees of the organization that perform operations on the providers system. Organizations must ensure that the
provider has processes that govern who has access to customer data and application. The provider must allow the customer
to assign and manage roles and authorization for each of their users. The provide must also have a secure system in place to
managing the unique identifies for users and services.
4. Proper protection of data
Data is the core of all IT security concerns for any organization. Cloud computing does not change this concern but brings
new challenges because of the nature of cloud computing. The security and protection of data both at rest and in transit
needs to be ensured.
5. Enforce privacy policies
Privacy and protection of personal information and data is crucial, especially as many major companies and financial
institutions are suffering data breaches. Privacy of personal information is related to personal data that is held by an
organization, which could be compromised by negligence or bugs. It is critical that privacy requirements be addresses by the
cloud service provider. If not, the organization should consider seeking a different provider or not placing sensitive data in
the cloud.
6. Assess security considerations for cloud applications
Organizations are constantly protecting their business applications from internal and external threats.Application security
poses challenges to both the provider and organization, and depending on the type of cloud deployment model (IaaS, PaaS,
or SaaS), there are different security policy considerations.