• 大小: 28KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: Java
  • 标签: m/m/n  山大计网  

资源简介

多队列模拟        说明:一个传输系统受3个输入和只有一个服务器。 所有输入都以泊松过程为特征,服务时间遵循指数分布。        目标:探索一个能够公平地把服务分配给任何性能测量的输入的调度方案; 获得每个队列的平均队列长度,平均等待时间,队列长度分布和等待时间分布。 报告中应包括任何必要的解释和说明。 Multi-queue simulation Description: a transmission system subject to 3 inputs and only one server. All inputs are characterized by Poisson process and the service time follows an exponential distribution. Goal: explore a scheduling scheme which is able to allocate the service fairly to each of the input in terms of any performance measurement; obtaining the mean queue length, mean waiting time, queue length distribution and waiting time distribution for each queue. Any necessary explaination and statement should be included in the report.

资源截图

代码片段和文件信息

/*
 * To change this license header choose License Headers in Project Properties.
 * To change this template file choose Tools | Templates
 * and open the template in the editor.
 */
package computernetwork;

import com.sun.jmx.remote.internal.ArrayQueue;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayDeque;
import java.util.ArrayList;
import static java.util.Collections.list;
import java.util.Date;
import java.util.Iterator;
import java.util.linkedList;
import java.util.List;
import java.util.Queue;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ASUS
 */
class MyDouble
{

    public MyDouble(double d)
    {
        this.d = d;
    }
    double size;
    double d;

    public void Add(double d)
    {
        this.d += d;
    }
}

public class MM3
{

    String info = ““;
    MyRandom random;
    int next_event_type num_events;
    double[] mean_interarrival = new double[3];//各队列平均到达时间
    double sim_time mean_service end_time;
    double time_next_event[] = new double[4];  //第四个时间是离开
    double tn;
    double chizhi[] = new double[3];//各自队列赤字
    int now_q = 0;//当前队列
    double xiane;//每次限额
    boolean isServerBusy = false;
    List> wait_q = new ArrayList<>();
    //队列中等待的时间
    int last_q;//上次被调度的队列
    int x_max = 100;//横坐标数组大小
    double[][] q_lenth = new double[3][x_max];//3条队列长度分布
    double[][] q_wait = new double[3][x_max];//3条队列时间分布
    double wait_gap;//横坐标数组间距

    double sum_time;
    int num_of_sent[] = new int[3];
    int num_of_come[] = new int[3];

    public void start()
    {
        new Thread(this.new Timer(this)).start();//计时器

        while (sim_time < end_time)
        {
            timing();
            switch (next_event_type)
            {
                case 0:
                case 1:
                case 2:
                    arrive();
                    break;
                case 3:
                    depart();
                    break;
            }
        }
    }

    public void init()
    {
        for (int i = 0; i < 3; i++)
        {
            wait_q.add(new ArrayDeque<>());
        }
        random = new MyRandom();
        sim_time = 0.0;
        end_time = 1.0E6;
        num_events = 4;
        mean_interarrival[0] = 3;
        mean_interarrival[1] = 3.2;
        mean_interarrival[2] = 2.8;
        mean_service = 0.99;
        xiane = 1;
        wait_gap = 0.2;
        for (int i = 0; i < 3; i++)
        {
            time_next_event[i] = MyRandom.getExponentialVariable(1.0/mean_interarrival[i]);//获得
        }
        time_next_event[3] = 1.1e+10;
    }

//    public double getExponentialVariable(double lamda)
//    {
//        double x z;
//        do
//        {
//      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3630  2017-10-15 10:36  ComputerNetwork\build.xml
     目录           0  2017-10-15 10:49  ComputerNetwork\build\
     目录           0  2017-10-15 10:49  ComputerNetwork\build\classes\
     文件           0  2017-10-15 10:49  ComputerNetwork\build\classes\.netbeans_automatic_build
     文件           0  2017-10-15 10:49  ComputerNetwork\build\classes\.netbeans_update_resources
     目录           0  2017-11-19 18:36  ComputerNetwork\build\classes\computernetwork\
     文件        2030  2017-11-19 18:36  ComputerNetwork\build\classes\computernetwork\MM3$Timer.class
     文件        8362  2017-11-19 18:36  ComputerNetwork\build\classes\computernetwork\MM3.class
     文件         434  2017-11-19 18:36  ComputerNetwork\build\classes\computernetwork\MyDouble.class
     文件        3350  2017-11-18 10:52  ComputerNetwork\build\classes\computernetwork\MyRandom.class
     文件          85  2017-10-15 10:36  ComputerNetwork\manifest.mf
     目录           0  2017-10-15 10:36  ComputerNetwork\nbproject\
     文件       79355  2017-10-15 10:36  ComputerNetwork\nbproject\build-impl.xml
     文件         475  2017-10-15 10:36  ComputerNetwork\nbproject\genfiles.properties
     目录           0  2017-10-17 19:49  ComputerNetwork\nbproject\private\
     文件         111  2017-10-15 10:36  ComputerNetwork\nbproject\private\private.properties
     文件         539  2017-11-18 16:42  ComputerNetwork\nbproject\private\private.xml
     文件        2461  2017-11-17 13:52  ComputerNetwork\nbproject\project.properties
     文件         523  2017-10-15 10:36  ComputerNetwork\nbproject\project.xml
     目录           0  2017-10-15 10:36  ComputerNetwork\src\
     目录           0  2017-11-16 19:04  ComputerNetwork\src\computernetwork\
     文件       12147  2017-11-19 18:36  ComputerNetwork\src\computernetwork\MM3.java
     文件        5082  2017-11-18 10:52  ComputerNetwork\src\computernetwork\MyRandom.java

评论

共有 条评论

相关资源