已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年商业楼宇燃气管理员笔试试题(含答案)
- 2026年国企债务化解管理笔试真题(附答案)
- 小学主题班会课件:自我认识发掘潜能
- 文化场馆运营绩效指标修订公告4篇范文
- 责任担当塑造品格:小学主题班会课件
- 医院放疗科三维水箱测量系统安全评估标准
- 婴儿背带腿部开口尺寸技术指标
- 文化教育合作协议签署确认函3篇范文
- 酒店网络安全漏洞修复与预防措施函5篇
- 2026年人教版新八年级地理上册 专题04主要地区复习【暑假复习】
- 中国制造业AI场景落地之FDE路径研究白皮书2026
- 24J113-1 内隔墙-轻质条板(一)
- 非正常情况接发列车作业标准
- LY-T 3361-2023 沉香提取物标准规范
- 《食品工程原理》第五章-传热
- 2023年浙江嘉兴市嘉善县祥符荡开发建设有限公司招聘笔试题库含答案解析
- GB/T 36507-2023工业车辆使用、操作与维护安全规范
- 福建省流动人口信息登记表-新版实用文档
- 2023年高考历史试题及参考答案(上海卷)
- 生产计划排产表-自动排产
- GA/T 744-2013汽车车窗玻璃遮阳膜
评论
0/150
提交评论