|
From: | Maria Tsampazi |
Subject: | Απ: M/M/1/4 vs M/M/2/4 queue |
Date: | Sat, 19 May 2018 08:20:47 +0000 |
thank you very much for your time and your help
Από: Moreno Marzolla <address@hidden>
Στάλθηκε: Τρίτη, 15 Μαΐου 2018 11:21 πμ Προς: mari_tsa; address@hidden Θέμα: Re: M/M/1/4 vs M/M/2/4 queue On 13/05/2018 19:59, mari_tsa wrote:
> Here is the code I wrote which is explained in comments. > % system M/M/1/4 > % when there are 3 clients in the system, the capability of the server > doubles. > > clc; > clear all; > close all; > > lambda = 4; > mu = 5; > states = [0,1,2,3,4]; % system with capacity 4 states > % the initial state of the system. The system is initially empty. > initial_state = [1,0,0,0,0]; > > % define the birth and death rates between the states of the system. > births_B = [lambda,lambda,lambda,lambda]; > deaths_D = [mu,mu,2*mu,2*mu]; > > % get the transition matrix of the birth-death process > transition_matrix = ctmcbd(births_B,deaths_D); > % get the ergodic probabilities of the system > P = ctmc(transition_matrix); > > % plot the ergodic probabilities (bar for bar chart) > figure(1); > bar(states,P,"r",0.5); > > % transient probability of state 0 until convergence to ergodic probability. > Convergence takes place P0 and P differ by 0.01 > index = 0; > for T=0:0.01:50 > index = index + 1; > P0 = ctmc(transition_matrix,T,initial_state); > Prob0(index) = P0(1); > if P0-P < 0.01 > break; > endif > endfor > > T = 0:0.01:T; > figure(2); > plot(T,Prob0,"r","linewidth",1.3); > > If I had 2 servers thus a M/M/2/4 queue, what would have changed? How 2 > servers would have affected the code ? > In my opinion, it would make any difference, but is that true? Hello, for a M/M/2/4 system the death rates would be: deaths_D = [mu, 2*mu, 2*mu, 2*mu]; (assuming that the service rates of the servers never change). Have a look at the qsmmmk() function in the queueing package, that handles precisely this kind of queues. See also https://en.wikipedia.org/wiki/M/M/c_queue#Finite_capacity (and the references therein). Moreno. -- Moreno Marzolla EMail: address@hidden WWW : https://www.moreno.marzolla.name/ |
[Prev in Thread] | Current Thread | [Next in Thread] |