Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Happybobjr on January 26, 2015, 03:27:31 am

Title: Queueing problems in Data and Structures class [C]
Post by: Happybobjr on January 26, 2015, 03:27:31 am
I don't really understand these, nor how to utilize google for help so if any of you have an idea where to start, I would appreciate it :)

Q1. If an array holding a queue is not considered circular, then each remove operation must shift down every remaining element of a queue.  An alternative method is to postpone shifting until rear equals the last index of the array.  When that situation occurs and an attempt is made to insert an element into the queue, the entire queue is shifted down, so that the first element of the queue is in position 0 of the array.  What are the advantages of this method over performing a shift at each remove operation?  What are the disadvantages?
 
Q2.  Given that jobs are serviced at a rate of 30 jobs per hour, determine the arrival rate in jobs per hour which will achieve the expected queue length to be 9.
 
Q3. Jobs arrive at the rate of 20 jobs per minute, and each job requires 2 seconds of service time, on the average. Determine the average waiting time in the queue. What is the probability that at a given time the system is not empty?
 
Q 4. Given that on the average 2 customers can be serviced per minute, determine the average arrival rate of the customers that achieves the average waiting time in the system (including the service time) to be 5 minutes per customer.

 
Title: Re: Queueing problems in Data and Structures class [C]
Post by: harold on January 26, 2015, 03:41:53 am
It depends on whether the service rate is deterministic or also random, and that's not clear in Q2
Title: Re: Queueing problems in Data and Structures class [C]
Post by: Happybobjr on January 26, 2015, 03:43:47 am
Could you tell me how to do it both ways then?
thank you, and sorry for the trouble.
Title: Re: Queueing problems in Data and Structures class [C]
Post by: harold on January 26, 2015, 03:46:46 am
Actually on second thought I think they're all supposed to be M/M/1, so the formulas are:

Waiting time = arrival_rate / (service_rate * (service_rate - arrival_rate))
Expected queue length = arrival_rate * waiting time

Those questions are then just applying those or solving for some parameter.
Title: Re: Queueing problems in Data and Structures class [C]
Post by: Happybobjr on January 26, 2015, 03:51:58 am
Thank you. I think I slightly understand.  Shouldn't there be factorial in there?

So I need to use a PDF function?
What does M stand for? Exponential?
Title: Re: Queueing problems in Data and Structures class [C]
Post by: harold on January 26, 2015, 03:59:23 am
The first M means the arrivals are determined by a Poisson process, the second M means the service times have an exponential distribution. The 1 means there is 1 server. There are no PDFs or factorials involved under these circumstances, though in general there may be (for example for more than one server, the factorial of the number of servers shows up all over the place - of course in this special case that's just 1).
Title: Re: Queueing problems in Data and Structures class [C]
Post by: Happybobjr on January 26, 2015, 04:03:05 am
Thank you very much
Title: Re: Queueing problems in Data and Structures class [C]
Post by: Happybobjr on January 26, 2015, 07:25:43 pm
How did you derive those formulas?
Title: Re: Queueing problems in Data and Structures class [C]
Post by: harold on January 27, 2015, 04:10:13 am
I just looked them up, they were probably derived by someone much smarter than me (but I don't know who)