320 likes | 337 Views
COMP60611 Fundamentals of Parallel and Distributed Systems. Lecture 14 Queueing Theory: Part 2 John Gurd, Graham Riley Centre for Novel Computing School of Computer Science University of Manchester. Analysis of M/M/1 Queue. Diagrammatic representation of the queue at any particular time:
E N D
COMP60611Fundamentals of Paralleland Distributed Systems Lecture 14 Queueing Theory: Part 2 John Gurd, Graham Riley Centre for Novel Computing School of Computer Science University of Manchester
Analysis of M/M/1 Queue • Diagrammatic representation of the queue at any particular time: queue service queue service XXXX X - 4 in queue, none in queue,1 being served none being served • We wish to trace the queue behaviour over time and, hopefully, identify long-term steady-state characteristics. • At time t, let N(t) be a random variable that describes the number (of customers) in the system. Q(t) is a related random variable that describes the number in the queue:
Analysis of M/M/1 Queue • N(t) increases by 1 with each arrival and decreases by 1 with each service completion. N(t) 5 4 3 2 1 A1 A2 A3 A4 A5 S1 A6 S2 S3 …… S6 t • This diagram could represent a general G/G/1 queue. • It will represent an M/M/1 queue if the inter-arrival times A2-A1, A3-A2, … and the service times S1-A1, S2-S1, S3-S2, … both satisfy negative exponential distributions.
Analysis of M/M/1 Queue is referred to as the traffic intensity.
Simple Example • That’s a lot of theory! What does it all mean? • Consider a TV repair shop. TVs arrive for repair at random at an average rate of 4 per day (assume an 8 hour day). A single repair service does the repairs; the average time for repair is 1.5 hours and repair times satisfy a negative exponential distribution. • Arrivals: = 0.5 (0.5 sets per hour in the 8 hour day) • Service: = 2/3 (0.667 repairs per working hour – the average repair time is 1/ = 1.5 working hours).
TV Repair Shop Example 0 2 4 6 8 10
TV Repair Shop Characteristics • Hence, traffic intensity ρ = / = 0.5/0.667 = 0.75 (75%). • Expected number of TV sets in system = L = ρ/(1 – ρ) = 0.75/0.25 = 3.00. • Expected number of TV sets in queue = L – ρ = 2.25. • Mean queueing time = /{( – )} = 0.5/{0.67(0.67 – 0.5)} = 0.5/{0.667*0.183} = 4.5 hours. • Mean time in system = 1/( – ) = 1/(0.667 – 0.5) = 6 hours.
Analysis of M/M/k Queue • We have shown how to analyse a very simple system: M/M/1 queue • We now consider a more challenging and more concurrent scenario: M/M/k queue Arrival of Customers
System Characteristics • Arrivals: Customers arrive, at random, at a rate ; i.e. random arrivals with inter-arrival time a random variable with a negative exponential distribution with parameter . They form a single queue for the multiple servers. • Service: Served by one of k service points, each having a service time which is a random variable with negative exponential distribution with (the same) parameter . • Assuming that < k (the arrival rate is less than the cumulative service rate), there exists a steady state solution.
Simple Example • (See Sasieni, Yaspan & Friedman, 1959). An insurance company has two claims adjusters in its branch office. People with claims arrive in Poisson fashion at an average rate of 20 per 8 hour working day. The length of time an adjuster spends with each claimant satisfies a negative exponential distribution with a mean service time of 40 minutes. What is the average time in the queue and what is the average time in the system? How would this vary if the company employed an extra claims adjuster? • Arrivals: = 2.5 (2.5 claimants per hour in the 8 hour day) • Service: = 1.5 (1.5 claims per working hour – the average service time is 1/ = 0.667 working hours).
Discrete Event Simulation • Thus far, our models of queueing systems have been analytical (and simple); in particular, the assumptions about queueing behaviour and service behaviour have been especially simple. • The behaviour of the queue has been described by equations that have been capable of solution, so that we have been able to predict useful quantities, such as mean queueing time, mean queue length, etc. • The models have enabled the solution of “what if” questions, such as “what happens if we increase the number of service points?”
Discrete Event Simulation • Yet, the analysis was already beginning to get unwieldy! • In real life, queueing systems are fundamentally too complicated to be modelled by such relatively simple analytical models. • The only way to capture the behaviour of more complicated, and complex, queueing systems is by means of simulation models. • This means of study has become known as Discrete Event Simulation.
Discrete Event Simulation • Build a (computational) simulation model so that the behaviour of the simulation model replicates the behaviour of the real system as far as the properties being modelled are concerned. • The simulation model includes parameters such as average arrival rate, average service time, number of service points, etc. • Model inter-arrival times according to some suitable probability distribution, and model service times in a similar way – Monte Carlo simulation. • Evolve the simulation system by tracking from one event to the next: • Arrival if there is an available server, go to be served, else enter queue; • Service completion leave system and, if queue is not empty, begin new service for the task at the head of the queue.
Discrete Event Simulation • Suppose inter-arrival times satisfy a negative exponential distribution with parameter . • Determine a random number that is uniformly distributed in the range [0,1] and use this to predict the inter-arrival time and, hence, the next arrival (see graph on next slide). • Model service times in a similar way: a negative exponential distribution with parameter .
Pr{arrival in (0,t)} 0 2 4 6 8 10 inter-arrival time
Discrete Event Simulation • Thus, given the first arrival (at time t = 0), we can use the sequence of predicted inter-arrival times to predict all subsequent arrival times. • Each arrival enters an ordered queue. • Customers/tasks are removed from the head of the queue whenever there is an available service point. • The time to complete a service is predicted in a similar fashion to the prediction of inter-arrival times, but with a parameter , rather than . • The same uniform random number generator can be used to drive both predictions (inter-arrival times and service times).
Discrete Event Simulation • Discrete event simulation is used in many contexts. • A typical example is given by one of our current research projects, which is using a discrete event simulation package called SimGrid to model the scheduling of the computational tasks constituting a large concurrent application to some number of heterogeneous parallel processors, as typified by the architecture of a modern HPC (High Performance Computing) system. The concurrent tasks are represented by the nodes of a DAG (directed acyclic graph), and the data dependencies between the tasks are represented by the arcs of the DAG. The objective is to schedule the nodes of the DAG to the heterogeneous processors in such a way as to minimise the overall execution time.
Summary • Queueing systems occur in many different situations in real life, and it is frequently necessary to anticipate the way that such systems will behave in practical scenarios. • We have introduced queueing theory as a useful vehicle for analysing the behaviour of (relatively simple) queueing systems. • We have further introduced Discrete Event Simulation as a means of approaching more complicated queueing systems, where analysis becomes too difficult.