Ok, I am writing a program in C++ that simulates a M/D/1 multiplexor. Basically, I have the command line params like N (# of lines to wait in), R (Rate bps), alpha (busy time), M (output capacity), closeTime. What the program needs to do is generate random customers to wait in N. The R is the speed at which things are to be done. I'm not to sue what alpha is to be used for.. (sorry...) and M is the maximum output avaliable for the machine.
For those of you who are still with me, thanks for continuing to read. I need to write this to have three modules. One to generate the customers. This generates them with an exponential interarrival time distribution with mean 1/lambda. If the server is busy, the customer is to go into FIFO line. Wake up and generate the next customer after the 1AT. This continues until closing time.
The second module is to serve the customer. It is to pick up the next customer from the line and serve them, if there aren't any, sleep.
The third is the Stats. Compute the mean arrival time, mean service rate, mean time customers spends in system, mean wait time, etc.. and write to an output file.
Ok, now this was given to me as a program from my work and I am new to this. I understand the third module and how to do that just fine. It's the first two that I'm not clear on. A co-worker told me that I am to use GSL to generate the random customers and I believe I can do that, ex:
T = gsl_rng_default;
r = gsl_rng_alloc;
Now from what I understand that will install the GSL enviroment and being to generate random customers with the help of:
customer = gsl_ran_exponential(r, 1/mu);
I'm just not to sure how the heck to get it to go into a FIFO if there are two many customers... Same with sleep if there aren't too many.
On the second module, I'm not sure what my boss wants me to do to serve the customer but since he didn't specify it could probably something simple like have it do a calculation of some sort. Now how could I keep track of the time spent here?
I know this is a huge problem and if anyone has any insight it will more than likely help me keep my job.
Thanks for any insight!!