1. Consider N = 5 servers, where each server completes a job with probability =
ID: 3592108 • Letter: 1
Question
1. Consider N = 5 servers, where each server completes a job with probability = 0:5 in each
time slot. Assume that the number of jobs that arrive in each time slot is a Binomial random
variable with parameters N and . When each job arrives, let the job join the queue with
the fewest number of waiting jobs, i.e., join the shortest queue. If multiple jobs arrive in a
time slot, do this for one job at a time, update the queue lengths, and then do this again for
the next job.
Plot the mean delay as a function of . You should keep track of each job to obtain
the delay of the job. Choose = [0:2; 0:3; 0:4; 0:45; 0:49; 0:495]. You should run the
simulations for 106 time slots.
Plot a histogram of the delays for = 0:45, i.e., the x-axis would be the possible delays,
1 time slot, 2 time slots, etc. The y-axis would be the fraction of jobs that experience a
delay of 1 time slot, 2 time slots, 3 time slots, etc.
Note:
Choose one programming language to do the simulation from C/C++, Matlab, Python, Java, and R.
Report should include the plot, and simulation code and annotations.
Explanation / Answer
include #include #include #include struct Data { double x, y; }; void Plot(struct Data center, struct Data *data, int number_of_data) { // This function plots the circle int i; FILE *file; file = fopen("C:/Test-Programm/center.txt","w"); fprintf(file, "%lf,%lf ", center.x, center.y); // Coordinates of the center are written into the file center.txt fclose(file); file = fopen("C:/Test-Programm/output.txt","w"); for(i = 0; i 1 && !marker) radius--; // Decrease radius to a minimum of 1 if(radius == 10) marker = 0; // Change direction if(radius == 1) marker = 1; // Change direction Plot(center, circle, 100); // Calls the function to plot the circle } return 0; } set xzeroaxis set yzeroaxis set xrange [-11:11] set yrange [-11:11] set datafile separator "," plot "center.txt" using 1:2 notitle with points pointtype 7, "output.txt" using 1:2 notitle with points, "output.txt" using 1:2 notitle with lines replot pause 1 rereadRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.