CloudSim源码分析-Datacenter创建

1、创建物理机列表。List<Host> hostList = newArrayList<Host>();

2、创建PE列表。一个物理机包含一个或多个PECPU)。List<Pe> peList = new ArrayList<Pe>();

3、创建PE,并将其添加到PE列表。peList.add(new Pe(0, new PeProvisionerSimple(mips)));可以设置PEIDmips

4、创建物理机,并添加到物理机列表。物理机的配置参数有:id,内存,存储,带宽,PE列表,虚拟机分配策略(时间共享和空间共享),并加入物理机列表。

  1. int hostId = 0;
  2.         int ram = 2048;// host memory (MB)

  3.         long storage = 1000000;// host storage

  4.         int bw = 10000;

  5.         hostList.add(
  6.             new Host(
  7.                 hostId,
  8.                 new RamProvisionerSimple(ram),
  9.                 new BwProvisionerSimple(bw),
  10.                 storage,
  11.                 peList,
  12.                 new VmSchedulerTimeShared(peList)
  13.             )
  14.         );

5、创建数据中心特征DatacenterCharacteristics对象,用来存储数据中心的属性,包含体系结构、操作系统、虚拟机类型、时区、价格(使用该数据中心单价)、单位内存价格、单位存储价格、单位带宽价格、机器列表。

  1.        String arch ="x86";// system architecture

  2.         String os ="Linux";// operating system

  3.         String vmm ="Xen";
  4.         double time_zone = 10.0;// time zone this resource located

  5.         double cost = 3.0;// the cost of using processing in this resource

  6.         double costPerMem = 0.05;// the cost of using memory in this resource

  7.         double costPerStorage = 0.001;// the cost of using storage in this

  8.                                         // resource

  9.         double costPerBw = 0.0;// the cost of using bw in this resource

  10.         LinkedList<Storage> storageList =newLinkedList<Storage>();// we are not adding SAN

  11.                                                     // devices by now


  12.         DatacenterCharacteristics characteristics =new DatacenterCharacteristics(
  13.                 arch, os, vmm, hostList, time_zone, cost, costPerMem,
  14.                 costPerStorage, costPerBw);

6、创建数据中心对象,它的主要参数有名称、特征对象、虚拟机分配策略(目前只有最简单的,研究者可以替换新策略)、用于数据仿真的存储列表以及调度间隔。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值