




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
CloudSim首要目标:在云计算基础设施上(软件、硬件、服务)上,对不同应用和服务模型的调度和分配策略的性能进行量化和比较。 Example oneA simple example showing how to create a datacenter with one host and run one cloudlet on it.静态数据:/* The cloudlet list.小云朵集合 */private static List cloudletList;/* The vmlist. 虚拟机集合*/private static List vmlist;一、初始化云库: Initialize the CloudSim package. It should be called before creating any num_user = 1; / number of cloud usersCalendar calendar = Calendar.getInstance();boolean trace_flag = false; / mean trace events/ Initialize the CloudSim libraryCloudSim.init(num_user,calendar,trace_flag);二、创建数据中心: Create Datacenters ,Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation。Datacenter datacenter0 = createDatacenter(“datacenter0”);三、创建中间代理:Create Broker ,同时获得代理IDDatacenterBroker broker = createBroker();int brokerId = broker.getId();四、/ 创建一个虚拟机,并将虚拟机列表注册到中间代理上: Create one virtual machinevmlist = new ArrayList();/ VM descriptionint vmid = 0;int mips = 1000; /每秒百万条指令long size = 10000; / image size (MB)int ram = 512; / vm memory (MB)long bw = 1000;int pesNumber = 1; / number of cpusString vmm = Xen; / VMM name/ create VMVm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared();/ add the VM to the vmListvmlist.add(vm);/ submit vm list to the brokerbroker.submitVmList(vmlist);五、创建一片云朵并将云列表注册到中间代理者上:Create one Cloudlet/ Cloudlet propertiesint id = 0;long length = 400000;long fileSize = 300;long outputSize = 300;UtilizationModel utilizationModel = new UtilizationModelFull(); /使用模型Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);cloudlet.setUserId(brokerId);cloudlet.setVmId(vmid);/ add the cloudlet to the listcloudletList.add(cloudlet);/ submit cloudlet list to the brokerbroker.submitCloudletList(cloudletList);六、开始和停止仿真仿真: Starts the simulationCloudSim.startSimulation();CloudSim.stopSimulation();七、打印结果:Print results when simulation is overList newList = broker.getCloudletReceivedList();printCloudletList(newList);关于如何创建数据中心private static Datacenter createDatacenter(String name) / Here are the steps needed to create a PowerDatacenter:/ 1. We need to create a list to store/ our machine创建一个列表存储我们的主机List hostList = new ArrayList();/ 2. A Machine contains one or more PEs or CPUs/Cores./ In this example, it will have only one core.List peList = new ArrayList();int mips = 1000;/ 3. Create PEs and add these into a list.peList.add(new Pe(0, new PeProvisionerSimple(mips); / need to store Pe id and MIPS Rating/ 4. Create Host with its id and list of PEs and add them to the list/ of machinesint hostId = 0;int ram = 2048; / host memory (MB)long storage = 1000000; / host storageint bw = 10000;hostList.add(new Host(hostId,new RamProvisionerSimple(ram),new BwProvisionerSimple(bw),storage,peList,new VmSchedulerTimeShared(peList); / This is our machine/ 5. Create a DatacenterCharacteristics object that stores the/ properties of a data center: architecture, OS, list of/ Machines, allocation policy: time- or space-shared, time zone/ and its price (G$/Pe time unit).String arch = x86; / system architectureString os = Linux; / operating systemString vmm = Xen;double time_zone = 10.0; / time zone this resource locateddouble cost = 3.0; / the cost of using processing in this resourcedouble costPerMem = 0.05; / the cost of using memory in this resourcedouble costPerStorage = 0.001; / the cost of using storage in this resourcedouble costPerBw = 0.0; / the cost of using bw in this resourceLinkedList storageList = new LinkedList(); / we are not adding SAN devices by nowDatacenterCharacteristics characteristics = new DatacenterCharacteristics(arch, os, vmm, hostList, time_zone, cost, costPerMem,costPerStorage, costPerBw);/ 6. Finally, we need to create a PowerDatacenter obj
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年物资储备管理专业知识面试题集
- 2025年初级市场营销师考试试题集与答案详解
- 2025年初级财务经理面试技巧及模拟题答案
- 三球仪演示教学课件
- 2025年经济师职业资格认证考试模拟题及解析全解版
- 2025年行政助理招聘面试模拟题及答案集
- 2025年嵌入式系统工程师中级考试预测题及备考指南
- 电信运营行业知识培训内容课件
- 2025年采购与供应链管理师中级实务操作模拟题及答案详解
- 2025年行政主管面试指南与常见问题解答
- 2025-2026学年人教版(2024)初中数学七年级上册教学计划及进度表
- 高速天桥拆除方案(3篇)
- 第1课 鸦片战争 课件 历史统编版2024八年级上册
- 2025年中国冷链物流行业投资前景分析、未来发展趋势研究报告(智研咨询发布)
- 2025合作合同范本下载
- 手外伤急救诊疗流程标准化
- 2025年安徽省中考历史试卷真题(含答案)
- GB/T 19867.5-2008电阻焊焊接工艺规程
- GB/T 1706-2006二氧化钛颜料
- 2023年安徽省国有金融资本投资管理有限公司招聘笔试题库及答案解析
- 新外研版英语七年级上册单词默写表
评论
0/150
提交评论