1 Single Station Queuing System Single Station Queuing System - The M/M/1 System- Q36954485 王俊彥

Slides:



Advertisements
Similar presentations
Introduction to Queuing Theory
Advertisements

Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Chapter Queueing Notation
Lab Assignment 1 COP 4600: Operating Systems Principles Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of.
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
Instructor: Anirban Mahanti Office: ICT 745 Class Location: TRB 101
Queueing Model 박희경.
Nur Aini Masruroh Queuing Theory. Outlines IntroductionBirth-death processSingle server modelMulti server model.
Chap. 20, page 1051 Queuing Theory Arrival process Service process Queue Discipline Method to join queue IE 417, Chap 20, Jan 99.
ECS 152A Acknowledgement: slides from S. Kalyanaraman & B.Sikdar
RAIDs Performance Prediction based on Fuzzy Queue Theory Carlos Campos Bracho ECE 510 Project Prof. Dr. Duncan Elliot.
1 Performance Evaluation of Computer Networks Objectives  Introduction to Queuing Theory  Little’s Theorem  Standard Notation of Queuing Systems  Poisson.
Queueing Theory: Part I
Chapter 5 The Queue M/G/1. 2 M/G/1  Arrival  Service GeneralPoisson 1 srver.
Lecture 11 Queueing Models. 2 Queueing System  Queueing System:  A system in which items (or customers) arrive at a station, wait in a line (or queue),
1 Queueing Theory H Plan: –Introduce basics of Queueing Theory –Define notation and terminology used –Discuss properties of queuing models –Show examples.
Queueing Network Model. Single Class Model Open - Infinite stream of arriving customers Closed - Finite population eg Intranet users Indistinguishable.
Simulating Single server queuing models. Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits.
Queueing Theory Professor Stephen Lawrence Leeds School of Business University of Colorado Boulder, CO
Queueing Theory.
7/3/2015© 2007 Raymond P. Jefferis III1 Queuing Systems.
To accompany Quantitative Analysis for Management, 9e by Render/Stair/Hanna 14-1 © 2003 by Prentice Hall, Inc. Upper Saddle River, NJ Chapter 14.
Introduction to Queuing Theory. 2 Queuing theory definitions  (Kleinrock) “We study the phenomena of standing, waiting, and serving, and we call this.
Lecture 4 Mathematical and Statistical Models in Simulation.
Lab 01 Fundamentals SE 405 Discrete Event Simulation
Internet Queuing Delay Introduction How many packets in the queue? How long a packet takes to go through?
Lecture 14 – Queuing Systems

Graduate Program in Engineering and Technology Management
Location Models For Airline Hubs Behaving as M/D/C Queues By: Shuxing Cheng Yi-Chieh Han Emile White.
___________________________________________________________________________ Operations Research  Jan Fábry Waiting Line Models.
Introduction to Queuing Theory
Queueing Theory Queueing theory definitions (Bose) “the basic phenomenon of queueing arises whenever a shared facility needs to be accessed for.
Waiting Line Models ___________________________________________________________________________ Quantitative Methods of Management  Jan Fábry.
Network Analysis A brief introduction on queues, delays, and tokens Lin Gu, Computer Networking: A Top Down Approach 6 th edition. Jim Kurose.
Queuing models Basic definitions, assumptions, and identities Operational laws Little’s law Queuing networks and Jackson’s theorem The importance of think.
1 Exponential distribution: main limitation So far, we have considered Birth and death process and its direct application To single server queues With.
 Birth Death Processes  M/M/1 Queue  M/M/m Queue  M/M/m/B Queue with Finite Buffers  Results for other Queueing systems 2.
Introduction to Operations Research
Queuing Theory Basic properties, Markovian models, Networks of queues, General service time distributions, Finite source models, Multiserver queues Chapter.
Entities and Objects The major components in a model are entities, entity types are implemented as Java classes The active entities have a life of their.
Queueing Theory What is a queue? Examples of queues: Grocery store checkout Fast food (McDonalds – vs- Wendy’s) Hospital Emergency rooms Machines waiting.
1 Queuing Models Dr. Mahmoud Alrefaei 2 Introduction Each one of us has spent a great deal of time waiting in lines. One example in the Cafeteria. Other.
1 Elements of Queuing Theory The queuing model –Core components; –Notation; –Parameters and performance measures –Characteristics; Markov Process –Discrete-time.
Modeling and Analysis of Computer Networks
CS433 Modeling and Simulation Lecture 12 Queueing Theory Dr. Anis Koubâa 03 May 2008 Al-Imam Mohammad Ibn Saud University.
1 Chapters 8 Overview of Queuing Analysis. Chapter 8 Overview of Queuing Analysis 2 Projected vs. Actual Response Time.
SIMULATION EXAMPLES QUEUEING SYSTEMS.
yahoo.com SUT-System Level Performance Models yahoo.com SUT-System Level Performance Models8-1 chapter11 Single Queue Systems.
SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
Queuing Theory and Traffic Analysis Based on Slides by Richard Martin.
1 Simulation Implementation Using high-level languages.
Waiting Lines and Queuing Theory Models
Structure of a Waiting Line System Queuing theory is the study of waiting lines Four characteristics of a queuing system: –The manner in which customers.
(C) J. M. Garrido1 Objects in a Simulation Model There are several objects in a simulation model The activate objects are instances of the classes that.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Queueing Systems.
Queuing Theory.  Queuing Theory deals with systems of the following type:  Typically we are interested in how much queuing occurs or in the delays at.
CPSC 531: DES Overview1 CPSC 531:Single-Server Simulation Instructor: Anirban Mahanti Office: ICT Class Location: TRB.
COMT 4291 Queuing Analysis COMT Call/Packet Arrival Arrival Rate, Inter-arrival Time, 1/ Arrival Rate measures the number of customer arrivals.
Queueing Fundamentals for Network Design Application ECE/CSC 777: Telecommunications Network Design Fall, 2013, Rudra Dutta.
Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of.
Mohammad Khalily Islamic Azad University.  Usually buffer size is finite  Interarrival time and service times are independent  State of the system.
Simple Queueing Theory: Page 5.1 CPE Systems Modelling & Simulation Techniques Topic 5: Simple Queueing Theory  Queueing Models  Kendall notation.
QUEUING THEORY 1.  - means the number of arrivals per second   - service rate of a device  T - mean service time for each arrival   = ( ) Utilization,
Queuing Theory Simulation & Modeling.
Simulation of single server queuing systems
CPSC 531: System Modeling and Simulation
Queueing Theory 2008.
Kendall’s Notation ❚ Simple way of summarizing the characteristics of a queue. Arrival characteristics / Departure characteristics / Number of servers.
SIMULATION EXAMPLES QUEUEING SYSTEMS.
Presentation transcript:

1 Single Station Queuing System Single Station Queuing System - The M/M/1 System- Q 王俊彥

2 Outline Kendall’s notation 5:00  Introduction M/M/1 system 10:00  Introduction  Parameters setting  Performance measures Simulation modeling 15:00  Intuitive explanation  C/C++ code  Result References 5:00

3 Kendall ’ s notation (A/B/m/K – Z) A / B / m / k – Z A Arrival Process B Service Process m Number of Servers k maximum # of customers in the system Z Queueing Discipline Explanation M Exponential Distribution (memoryless) EkEk Erlang Distribution with k phases HkHk HyperExponential with k phases D Deterministic Distribution (constant) G General Distribution 1 m … Arrival process queue servers Departing jobs Queueing discipline Queueing Discipline FCFS First-come-first-serviced LCFS Last-come-first-served RR Round-robin PS Processor sharing … Page 211 in textbook

4 Examples of Kendall ’ s notation M / M / m / K -FCFS  This would describe a queueing system with an exponential distribution for the interarrival times of customers and the service times of customers, m servers, a maximum of K customers in the queueing system at once, and First-come-first-served for queueing discipline. To practice : M/G/5/K-LCFS

5 Performance measure A queueing model represents a dynamic system, the performance measures vary with time. Normally, however, we are content with results in steady-state (statistical equilibrium).  All transient behavior has ended  The system has settled down  The values of the performance measures are independent of time

6 Performance measure (cont.)

7 1 m … Arrival process queue servers Departing jobs QUEUESERVICE SYSTEM

8 M/M/1 performance measure Recall that in this case, the arrival process is Poisson, the service times are exponentially distributed, and there is a single server. The system can be modeled as a birth-death process with birth rate (arrival rate) λ and death rate (service rate) μ. The birth-death process is in the CH.3 (eq. 3.12)

9 M/M/1 performance measure (cont.) p214 ρ=(1/2), 把它看成進入率與 輸出率都相同,卻有 2 個 servers 。所以有 jobs 在佇 列的機會不高。 server 比較忙, 在整個系統 排隊的人就多。 server 比較閒, 在整個系統 排隊的人就少。

10 Our simulation For expository convenience, we assume that interarrival and service time of customers are below :  A 1 =0.4, A 2 =1.2, A 3 =0.5, A 4 =1.7, A 5 =0.2, A 6 =1.6, A 7 =0.2, A 8 =1.4, A 9 =1.9, ….  S 1 =2.0, S 2 =0.7, S 3 =0.2, S 4 =1.1, S 5 =3.7, S 6 =0.6, ….  Unit-less Time (unit)

11 Exponential random variable int main( ) // Example in C { double u=0, r=0; int mean=2; srand(time(NULL)); u=(double)(1+rand()%100)/(double)100; r=-mean*log(u); printf("r=%2.2f\n", r); return 0; }

12 Q(t) and B(t) arrivals departures Q(t) B(t) 1 0

13 Three quantities

14 Depart state Arrive state

15 Intuitive explanation : t=0 t=0 : initialization Our modeling assumption was initially the system is empty of customs and the server is idle (idle=0 & busy=1). And number of customs in queue is 0. The event list give the times of next occurrence in A and departure time in D. Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event 0.4 ∞ clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

16 Intuitive explanation : t=0.4 Number delayed Server status Event list □ ○ Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD 0.4

17 Intuitive explanation : t=1.6 Area under B(t) Number in queue Time of arrival Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

18 Intuitive explanation : t=2.1 Area under Q(t) 0.4 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

19 Intuitive explanation : t=2.4 Number delayed Total delay Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

20 Intuitive explanation : t=3.1 & t=3.3 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event 0.4 ∞ clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD 2.1

21 Intuitive explanation : t=3.8 & t=4.0 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

22 Intuitive explanation : t=4.9 & t=5.6 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

23 Intuitive explanation : t=5.8 & t=7.2 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

24 Intuitive explanation : t=8.6 Initialization Time= System state Server status Number in queue Time Of arrival Time Of last event clockEvent list Number delayed Total delay Area Under Q(t) Area Under B(t) ADAD

25 C/C++ code – include & parameters #include #include "lcgrand.h" /* Header file for random-number generator. */ #define Q_LIMIT 100 /* Limit on queue length. */ #define BUSY 1 /* Mnemonics for server's being busy */ #define IDLE 0 /* and idle. */ int next_event_type, num_custs_delayed, num_delays_required, num_events, num_in_q, server_status; float area_num_in_q, area_server_status, mean_interarrival, mean_service, sim_time, time_arrival[Q_LIMIT + 1], time_last_event, time_next_event[3], total_of_delays; FILE *infile, *outfile; void initialize(void); void timing(void); void arrive(void); void depart(void); void report(void); void update_time_avg_stats(void); float expon(float mean);

26 C/C++ code – main function main() /* Main function. */ { infile = fopen("mm1.in", "r"); outfile = fopen("mm1.out", "w"); num_events = 2; initialize( ); while (num_custs_delayed < num_delays_required) { timing( ); update_time_avg_stats( ); switch (next_event_type) { case 1: arrive( ); break; case 2: depart( ); break; } report( ); fclose(infile); fclose(outfile); return 0; }

27 C/C++ code – initialize function void initialize(void) /* Initialization function. */ { sim_time = 0.0; server_status = IDLE; num_in_q = 0; time_last_event = 0.0; /* Initialize the statistical counters. */ num_custs_delayed = 0; total_of_delays = 0.0; area_num_in_q = 0.0; area_server_status = 0.0; /* Initialize event list. Since no customers are present, the departure (service completion) event is eliminated from consideration. */ time_next_event[1] = sim_time + expon(mean_interarrival); time_next_event[2] = 1.0e+30; }

28 C/C++ code – timing function void timing(void) /* Timing function. */ { int i; float min_time_next_event = 1.0e+29; next_event_type = 0; for (i = 1; i <= num_events; ++i) if (time_next_event[i] < min_time_next_event) { min_time_next_event = time_next_event[i]; next_event_type = i; } if (next_event_type == 0) { fprintf(outfile, "\nEvent list empty at time %f", sim_time); exit(1); } sim_time = min_time_next_event; }

29 C/C++ code – arrive function void arrive(void) /* Arrival event function. */ { float delay; time_next_event[1] = sim_time + expon(mean_interarrival); if (server_status == BUSY) { ++num_in_q; if (num_in_q > Q_LIMIT) { fprintf(outfile, "\nOverflow of the array time_arrival at"); fprintf(outfile, " time %f", sim_time); exit(2); } time_arrival[num_in_q] = sim_time; } else { delay = 0.0; total_of_delays += delay; ++num_custs_delayed; server_status = BUSY; time_next_event[2] = sim_time + expon(mean_service); }

30 C/C++ code – depart function void depart(void) /* Departure event function. */ { int i; float delay; if (num_in_q == 0) { server_status = IDLE; time_next_event[2] = 1.0e+30; } else { --num_in_q; delay = sim_time - time_arrival[1]; total_of_delays += delay; ++num_custs_delayed; time_next_event[2] = sim_time + expon(mean_service); for (i = 1; i <= num_in_q; ++i) time_arrival[i] = time_arrival[i + 1]; }

31 Depart state Arrive state

32 C/C++ code – update_time_avg_state & expon function void update_time_avg_stats(void) { float time_since_last_event; time_since_last_event = sim_time - time_last_event; time_last_event = sim_time; area_num_in_q += num_in_q * time_since_last_event; area_server_status += server_status * time_since_last_event; } float expon(float mean) /* Exponential variate generation function. */ { /* Return an exponential random variate with mean "mean". */ float u; u=rand (1); return -mean * log(u); }

33 References Java   C/C++ & FORTRAN 

34 Q&A