亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? netex02.java

?? 一個非常著名的網格模擬器,能夠運行網格調度算法!
?? JAVA
字號:
/*
 * Author: Anthony Sulistio
 * Date: November 2004
 * Description: A simple program to demonstrate of how to use GridSim
 *              network extension package.
 *              This example shows how to create user and resource
 *              entities connected via a network topology, using link
 *              and router.
 *
 */

import gridsim.*;
import gridsim.net.*;
import java.util.*;


/**
 * Test Driver class for this example
 */
public class NetEx02
{
    /**
     * Creates main() to run this example
     */
    public static void main(String[] args)
    {
        System.out.println("Starting network example ...");

        try
        {
            //////////////////////////////////////////
            // First step: Initialize the GridSim package. It should be called
            // before creating any entities. We can't run this example without
            // initializing GridSim first. We will get run-time exception
            // error.
            int num_user = 2;   // number of grid users
            Calendar calendar = Calendar.getInstance();

            // a flag that denotes whether to trace GridSim events or not.
            boolean trace_flag = true;

            // Initialize the GridSim package
            System.out.println("Initializing GridSim package");
            GridSim.init(num_user, calendar, trace_flag);

            //////////////////////////////////////////
            // Second step: Creates one or more GridResource entities

            double baud_rate = 1000; // bits/sec
            double propDelay = 10;   // propagation delay in millisecond
            int mtu = 1500;          // max. transmission unit in byte
            int i = 0;

            // more resources can be created by
            // setting totalResource to an appropriate value
            int totalResource = 1;
            ArrayList resList = new ArrayList(totalResource);
            for (i = 0; i < totalResource; i++)
            {
                GridResource res = createGridResource("Res_"+i, baud_rate,
                                                      propDelay, mtu);

                // add a resource into a list
                resList.add(res);
            }

            //////////////////////////////////////////
            // Third step: Creates one or more grid user entities

            // number of Gridlets that will be sent to the resource
            int totalGridlet = 5;

            // create users
            ArrayList userList = new ArrayList(num_user);
            for (i = 0; i < num_user; i++)
            {
                // if trace_flag is set to "true", then this experiment will
                // create User_i.csv where i = 0 ... (num_user-1)
                NetUser user = new NetUser("User_"+i, totalGridlet, baud_rate,
                                           propDelay, mtu, trace_flag);

                // add a user into a list
                userList.add(user);
            }

            //////////////////////////////////////////
            // Fourth step: Builds the network topology among entities.

            // In this example, the topology is:
            // user(s) --1Mb/s-- r1 --10Mb/s-- r2 --1Mb/s-- GridResource(s)

            // create the routers.
            // If trace_flag is set to "true", then this experiment will create
            // the following files (apart from sim_trace and sim_report):
            // - router1_report.csv
            // - router2_report.csv
            Router r1 = new RIPRouter("router1", trace_flag);   // router 1
            Router r2 = new RIPRouter("router2", trace_flag);   // router 2

            // connect all user entities with r1 with 1Mb/s connection
            // For each host, specify which PacketScheduler entity to use.
            NetUser obj = null;
            for (i = 0; i < userList.size(); i++)
            {
                // A First In First Out Scheduler is being used here.
                // SCFQScheduler can be used for more fairness
                FIFOScheduler userSched = new FIFOScheduler("NetUserSched_"+i);
                obj = (NetUser) userList.get(i);
                r1.attachHost(obj, userSched);
            }

            // connect all resource entities with r2 with 1Mb/s connection
            // For each host, specify which PacketScheduler entity to use.
            GridResource resObj = null;
            for (i = 0; i < resList.size(); i++)
            {
                FIFOScheduler resSched = new FIFOScheduler("GridResSched_"+i);
                resObj = (GridResource) resList.get(i);
                r2.attachHost(resObj, resSched);
            }

            // then connect r1 to r2 with 10Mb/s connection
            // For each host, specify which PacketScheduler entity to use.
            baud_rate = 10000;
            Link link = new SimpleLink("r1_r2_link", baud_rate, propDelay, mtu);
            FIFOScheduler r1Sched = new FIFOScheduler("r1_Sched");
            FIFOScheduler r2Sched = new FIFOScheduler("r2_Sched");

            // attach r2 to r1
            r1.attachRouter(r2, link, r1Sched, r2Sched);

            //////////////////////////////////////////
            // Fifth step: Starts the simulation
            GridSim.startGridSimulation();

            //////////////////////////////////////////
            // Final step: Prints the Gridlets when simulation is over

            // also prints the routing table
            r1.printRoutingTable();
            r2.printRoutingTable();

            GridletList glList = null;
            for (i = 0; i < userList.size(); i++)
            {
                obj = (NetUser) userList.get(i);
                glList = obj.getGridletList();
                printGridletList(glList, obj.get_name(), false);
            }

            System.out.println("\nFinish network example ...");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            System.out.println("Unwanted errors happen");
        }
    }

    /**
     * Creates one Grid resource. A Grid resource contains one or more
     * Machines. Similarly, a Machine contains one or more PEs (Processing
     * Elements or CPUs).
     * <p>
     * In this simple example, we are simulating one Grid resource with three
     * Machines that contains one or more PEs.
     * @param name          a Grid Resource name
     * @param baud_rate     the bandwidth of this entity
     * @param delay         the propagation delay
     * @param MTU           Maximum Transmission Unit
     * @return a GridResource object
     */
    private static GridResource createGridResource(String name,
                double baud_rate, double delay, int MTU)
    {
        System.out.println();
        System.out.println("Starting to create one Grid resource with " +
                "3 Machines");

        // Here are the steps needed to create a Grid resource:
        // 1. We need to create an object of MachineList to store one or more
        //    Machines
        MachineList mList = new MachineList();
        //System.out.println("Creates a Machine list");


        // 2. A Machine contains one or more PEs or CPUs. Therefore, should
        //    create an object of PEList to store these PEs before creating
        //    a Machine.
        PEList peList1 = new PEList();
        //System.out.println("Creates a PE list for the 1st Machine");


        // 3. Create PEs and add these into an object of PEList.
        //    In this example, we are using a resource from
        //    hpc420.hpcc.jp, AIST, Tokyo, Japan
        //    Note: these data are taken the from GridSim paper, page 25.
        //          In this example, all PEs has the same MIPS (Millions
        //          Instruction Per Second) Rating for a Machine.
        peList1.add( new PE(0, 377) );  // need to store PE id and MIPS Rating
        peList1.add( new PE(1, 377) );
        peList1.add( new PE(2, 377) );
        peList1.add( new PE(3, 377) );
        //System.out.println("Creates 4 PEs with same MIPS Rating and put them"+
        //        " into the PE list");


        // 4. Create one Machine with its id and list of PEs or CPUs
        mList.add( new Machine(0, peList1) );   // First Machine
        //System.out.println("Creates the 1st Machine that has 4 PEs and " +
        //        "stores it into the Machine list");
        //System.out.println();

        // 5. Repeat the process from 2 if we want to create more Machines
        //    In this example, the AIST in Japan has 3 Machines with same
        //    MIPS Rating but different PEs.
        // NOTE: if you only want to create one Machine for one Grid resource,
        //       then you could skip this step.
        PEList peList2 = new PEList();
        //System.out.println("Creates a PE list for the 2nd Machine");

        peList2.add( new PE(0, 377) );
        peList2.add( new PE(1, 377) );
        peList2.add( new PE(2, 377) );
        peList2.add( new PE(3, 377) );
        //System.out.println("Creates 4 PEs with same MIPS Rating and put them"+
        //        " into the PE list");

        mList.add( new Machine(1, peList2) );   // Second Machine
        //System.out.println("Creates the 2nd Machine that has 4 PEs and " +
        //        "stores it into the Machine list");
        //System.out.println();

        PEList peList3 = new PEList();
        //System.out.println("Creates a PE list for the 3rd Machine");

        peList3.add( new PE(0, 377) );
        peList3.add( new PE(1, 377) );
        //System.out.println("Creates 2 PEs with same MIPS Rating and put them"+
        //        " into the PE list");

        mList.add( new Machine(2, peList3) );   // Third Machine
        //System.out.println("Creates the 3rd Machine that has 2 PEs and " +
        //        "stores it into the Machine list");
        //System.out.println();

        // 6. Create a ResourceCharacteristics object that stores the
        //    properties of a Grid resource: architecture, OS, list of
        //    Machines, allocation policy: time- or space-shared, time zone
        //    and its price (G$/PE time unit).
        String arch = "Sun Ultra";      // system architecture
        String os = "Solaris";          // operating system
        double time_zone = 9.0;         // time zone this resource located
        double cost = 3.0;              // the cost of using this resource

        ResourceCharacteristics resConfig = new ResourceCharacteristics(
                arch, os, mList, ResourceCharacteristics.TIME_SHARED,
                time_zone, cost);

        //System.out.println("Creates the properties of a Grid resource and " +
        //        "stores the Machine list");

        // 7. Finally, we need to create a GridResource object.
        long seed = 11L*13*17*19*23+1;
        double peakLoad = 0.0;        // the resource load during peak hour
        double offPeakLoad = 0.0;     // the resource load during off-peak hr
        double holidayLoad = 0.0;     // the resource load during holiday

        // incorporates weekends so the grid resource is on 7 days a week
        LinkedList Weekends = new LinkedList();
        Weekends.add(new Integer(Calendar.SATURDAY));
        Weekends.add(new Integer(Calendar.SUNDAY));

        // incorporates holidays. However, no holidays are set in this example
        LinkedList Holidays = new LinkedList();
        GridResource gridRes = null;
        try
        {
            // creates a GridResource with a link
            gridRes = new GridResource(name,
                new SimpleLink(name + "_link", baud_rate, delay, MTU),
                seed, resConfig, peakLoad, offPeakLoad, holidayLoad,
                Weekends, Holidays);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("Finally, creates one Grid resource (name: " + name +
                " - id: " + gridRes.get_id() + ")");
        System.out.println();

        return gridRes;
    }

    /**
     * Prints the Gridlet objects
     */
    private static void printGridletList(GridletList list, String name,
                                         boolean detail)
    {
        int size = list.size();
        Gridlet gridlet = null;

        String indent = "    ";
        System.out.println();
        System.out.println("============= OUTPUT for " + name + " ==========");
        System.out.println("Gridlet ID" + indent + "STATUS" + indent +
                "Resource ID" + indent + "Cost");

        // a loop to print the overall result
        int i = 0;
        for (i = 0; i < size; i++)
        {
            gridlet = (Gridlet) list.get(i);
            System.out.print(indent + gridlet.getGridletID() + indent
                    + indent);

            System.out.print( gridlet.getGridletStatusString() );

            System.out.println( indent + indent + gridlet.getResourceID() +
                    indent + indent + gridlet.getProcessingCost() );
        }

        if (detail == true)
        {
            // a loop to print each Gridlet's history
            for (i = 0; i < size; i++)
            {
                gridlet = (Gridlet) list.get(i);
                System.out.println( gridlet.getGridletHistory() );

                System.out.print("Gridlet #" + gridlet.getGridletID() );
                System.out.println(", length = " + gridlet.getGridletLength()
                        + ", finished so far = " +
                        gridlet.getGridletFinishedSoFar() );
                System.out.println("======================================\n");
            }
        }
    }

} // end class

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲最大色网站| 日韩国产欧美在线播放| 日韩专区在线视频| 国产精品1区2区3区| 欧美这里有精品| 成人欧美一区二区三区黑人麻豆 | 欧美撒尿777hd撒尿| 久久天堂av综合合色蜜桃网| 亚洲成人高清在线| 色香色香欲天天天影视综合网| xfplay精品久久| 日本91福利区| 91精品久久久久久久91蜜桃| 亚洲国产综合在线| 欧美午夜精品电影| 亚洲精品中文字幕在线观看| 成人av网站在线| 国产人成亚洲第一网站在线播放| 免费精品99久久国产综合精品| 欧美男生操女生| 亚洲一区二区三区国产| 欧美日韩在线一区二区| 国产欧美一区二区在线| 国产伦精品一区二区三区免费迷| 日韩欧美国产综合在线一区二区三区| 亚洲福利视频三区| 欧美三电影在线| 五月综合激情日本mⅴ| 欧美日韩一级黄| 日韩精品免费专区| 欧美电影影音先锋| 日本成人在线电影网| 欧美一区二区视频网站| 日本sm残虐另类| 久久亚洲二区三区| 国产91丝袜在线播放0| 欧美高清在线一区| 97久久精品人人做人人爽50路| 中文字幕人成不卡一区| 色哟哟精品一区| 首页国产丝袜综合| 欧美v亚洲v综合ⅴ国产v| 国产精品一区二区黑丝| 国产精品乱码久久久久久| 欧美日韩久久不卡| 日韩av不卡一区二区| 日韩欧美一二三区| 东方aⅴ免费观看久久av| 亚洲婷婷在线视频| 欧美亚洲国产怡红院影院| 日韩中文字幕麻豆| 久久先锋资源网| 不卡一区在线观看| 天天影视涩香欲综合网 | 中文在线资源观看网站视频免费不卡| 成人18视频在线播放| 亚洲18影院在线观看| 久久综合中文字幕| 在线精品视频免费播放| 日本不卡一二三区黄网| 国产精品久久久久久户外露出| 日本道在线观看一区二区| 奇米色777欧美一区二区| 国产精品女主播av| 欧美日韩国产片| 国产99久久精品| 亚洲成国产人片在线观看| 久久久夜色精品亚洲| 欧洲一区二区av| 国产黄人亚洲片| 亚洲成人免费观看| 国产精品久久久久久久裸模 | 91视频.com| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲日本va在线观看| 日韩一卡二卡三卡| 91香蕉视频在线| 国产综合色在线视频区| 一区二区三区高清不卡| 国产亚洲欧美一级| 宅男在线国产精品| 91久久精品国产91性色tv| 国产在线一区二区| 天堂午夜影视日韩欧美一区二区| 亚洲精品日日夜夜| 国产免费久久精品| 日韩欧美你懂的| 欧美精品乱码久久久久久| 91在线一区二区三区| 国产成人免费视频精品含羞草妖精| 亚洲成av人在线观看| 亚洲乱码中文字幕综合| 日本一区二区免费在线观看视频| 91精品国产高清一区二区三区| 91丨porny丨国产入口| 国产91在线|亚洲| 国产一区二区三区香蕉| 另类人妖一区二区av| 舔着乳尖日韩一区| 亚洲高清免费视频| 一区二区三区四区不卡视频| 国产精品久久久久精k8| 国产亚洲精品资源在线26u| 日韩亚洲欧美成人一区| 欧美日韩免费视频| 欧洲精品视频在线观看| 色欧美日韩亚洲| 一本大道久久a久久精二百| 91在线一区二区| 91麻豆产精品久久久久久| 不卡在线观看av| 99久久久精品免费观看国产蜜| 成人一区二区三区在线观看| 国产高清不卡一区| 国产成人a级片| 国产传媒欧美日韩成人| 国产suv一区二区三区88区| 国产精品一区二区视频| 成人手机电影网| 97国产精品videossex| 91黄色免费版| 91.xcao| 日韩精品一区二区三区四区视频| 欧美电影免费观看高清完整版在线观看| 日韩亚洲欧美高清| 国产亚洲一区二区三区在线观看| 国产精品午夜在线观看| 亚洲人亚洲人成电影网站色| 亚洲激情在线激情| 婷婷一区二区三区| 国产一区二区三区四区在线观看| 成人一区在线观看| 欧美怡红院视频| 精品日产卡一卡二卡麻豆| 中文在线资源观看网站视频免费不卡| 日韩一区在线看| 日韩不卡手机在线v区| 国产成人精品综合在线观看| 成人性生交大合| 欧美三区在线观看| 精品av久久707| 亚洲情趣在线观看| 日本特黄久久久高潮| 粉嫩av一区二区三区在线播放| 91传媒视频在线播放| 精品国产第一区二区三区观看体验| 久久九九99视频| 亚洲制服丝袜av| 国产一区二区三区免费看| 99久久综合99久久综合网站| 欧美日韩一区二区三区四区五区 | 中文字幕高清不卡| 午夜精品久久久久影视| 国产激情视频一区二区在线观看 | 国产日韩影视精品| 亚洲动漫第一页| 高清视频一区二区| 在线电影院国产精品| 日韩一区在线播放| 国内精品伊人久久久久av影院 | 91欧美激情一区二区三区成人| 制服丝袜亚洲精品中文字幕| 亚洲天堂a在线| 国产一区二区三区av电影| 欧美日韩一区二区三区在线看 | 欧美伊人精品成人久久综合97| 欧美成人精品3d动漫h| 亚洲一区二区三区在线看| 成人精品视频.| 欧美成人综合网站| 一区二区理论电影在线观看| 国产成人免费在线| 日韩精品一区二区三区swag | 欧美一级电影网站| 一区二区三区四区亚洲| 粉嫩一区二区三区性色av| 欧美mv日韩mv| 美女高潮久久久| 欧美精品九九99久久| 又紧又大又爽精品一区二区| 岛国av在线一区| 久久久久久久久久久久久夜| 久久电影网电视剧免费观看| 91精品国产高清一区二区三区蜜臀| 一区二区在线观看不卡| 色婷婷综合视频在线观看| 国产精品黄色在线观看| 成人激情开心网| 中文字幕成人av| 成人性生交大片免费看中文网站 | 日韩亚洲欧美在线| 全国精品久久少妇| 在线电影国产精品| 亚洲一级不卡视频| 欧美日韩精品一二三区| 亚洲成人一区二区在线观看| 欧美私人免费视频| 亚洲电影你懂得| 欧美一区二区三区四区高清| 日韩电影免费在线|