Your task for this assignment is to investigate some of the properties of queues. You should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Your task for this assignment is to investigate some of the properties of queues. You should write a Java, C++, or Phyton program which simulates the queuing system in an email server. Queues are commonly used in network systems. For example, e-mail is placed in queues while it is waiting to be sent and after it arrives at the recipient's mailbox. A problem occurs, however, if the outgoing mail processor cannot send one or more of the messages in the queue. For example, a message might not be sent because the recipient's system is not available. Write an e-mail simulator that processes mail at an average of 30 messages per minute. As messages are received, they are placed in a queue. For the simulation, assume that the messages arrive at an average rate of 30 messages per minute. Remember, the messages must arrive randomly, so you will need to use a random number generator to determine when messages are received. Each minute, you can dequeue up to 30 messages and send them. Assume that 25% of the messages in the queue cannot be sent in any processing cycle. Again, you will need to use a random number to determine whether a given message can be sent. If it cannot be sent, put it back at the end of the queue or enqueue it. Run the simulator for 15 minutes, tracking the number of times each message had to be requeued. At the end of the simulation, print the statistics that show: 1 The total messages processed. 2 The average arrival rate, that is, the average number of messages arriving per minute. 3 The average number of messages sent per minute. 4 The average number of messages in the queue in a minute. 5 The number of messages sent on the first attempt, the number of messages sent on the second attempt, and so forth. 6 The average number of times messages had to be requeued (do not include the messages sent the first time in this average.) NOTE: Since the question is to assess your understanding of the concept of Queue, you are NOT allowed to use the library of the language that implement queue. You need to write the codes (implementation) of Queue for this exercise. (See point (iii).) Sample Output: Please enter the total minutes to run: 30 Total number of messages processed Average arrival rate : 818 : 29.03 : 19.97 Average number of messages sent per minute Average number of messages in the queue per minute Number of messages sent on 1st attempt Number of messages sent on 2nd attempt : 122.77 : 491 : 87 Number of messages sent on 3rd attempt Number of messages sent on 4th attempt Number of messages sent on 5th attempt Average number of times messages had to be requeued 18 : 1 : 2 : 1.30 These are just sample answers to show the output format required from your program. They are NOT necessarily the output that your program must produce because the data generated for this program were randomly generated. Your task for this assignment is to investigate some of the properties of queues. You should write a Java, C++, or Phyton program which simulates the queuing system in an email server. Queues are commonly used in network systems. For example, e-mail is placed in queues while it is waiting to be sent and after it arrives at the recipient's mailbox. A problem occurs, however, if the outgoing mail processor cannot send one or more of the messages in the queue. For example, a message might not be sent because the recipient's system is not available. Write an e-mail simulator that processes mail at an average of 30 messages per minute. As messages are received, they are placed in a queue. For the simulation, assume that the messages arrive at an average rate of 30 messages per minute. Remember, the messages must arrive randomly, so you will need to use a random number generator to determine when messages are received. Each minute, you can dequeue up to 30 messages and send them. Assume that 25% of the messages in the queue cannot be sent in any processing cycle. Again, you will need to use a random number to determine whether a given message can be sent. If it cannot be sent, put it back at the end of the queue or enqueue it. Run the simulator for 15 minutes, tracking the number of times each message had to be requeued. At the end of the simulation, print the statistics that show: 1 The total messages processed. 2 The average arrival rate, that is, the average number of messages arriving per minute. 3 The average number of messages sent per minute. 4 The average number of messages in the queue in a minute. 5 The number of messages sent on the first attempt, the number of messages sent on the second attempt, and so forth. 6 The average number of times messages had to be requeued (do not include the messages sent the first time in this average.) NOTE: Since the question is to assess your understanding of the concept of Queue, you are NOT allowed to use the library of the language that implement queue. You need to write the codes (implementation) of Queue for this exercise. (See point (iii).) Sample Output: Please enter the total minutes to run: 30 Total number of messages processed Average arrival rate : 818 : 29.03 : 19.97 Average number of messages sent per minute Average number of messages in the queue per minute Number of messages sent on 1st attempt Number of messages sent on 2nd attempt : 122.77 : 491 : 87 Number of messages sent on 3rd attempt Number of messages sent on 4th attempt Number of messages sent on 5th attempt Average number of times messages had to be requeued 18 : 1 : 2 : 1.30 These are just sample answers to show the output format required from your program. They are NOT necessarily the output that your program must produce because the data generated for this program were randomly generated.
Expert Answer:
Related Book For
Chemistry The Central Science
ISBN: 978-0321696724
12th edition
Authors: Theodore Brown, Eugene LeMay, Bruce Bursten, Catherine Murphy, Patrick Woodward
Posted Date:
Students also viewed these programming questions
-
Give condition for tracking down the most likely arrangement of grammatical feature (POS) labels that could be used by a stochastic POS tagger. You ought to accept a bigram model. [5 marks] (b) Given...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
While emptying a wheelbarrow, a gardener exerts on each handle AB a force P directed along line CD. Knowing that P must have a 30-lb horizontal component, determine (a) The magnitude of the force P,...
-
Aspirin (acetylsalicylic acid) is prepared by heating salicylic acid, C7H6O3, with acetic anhydride, C4H6O3. The other product is acetic acid, C2H4O2. C7H6O3 + C4H6O3 C9H8O4 + C2H4O2 What is the...
-
A classs responsibilities are __________. a. The objects created from the class b. Things the class knows c. Actions the class performs d. Both b and c
-
Give two examples of studies in which our primary interest is in looking at relationships between variables.
-
Data Set 20 in Appendix B lists data from 100 M&Ms, and 8% of them are brown. Use a 0.05 significance level to test the claim of the Mars candy company that the percentage of brown M&Ms is equal to...
-
Show that the basis vector is orthogonal to both i and. Compute the matrix product of A and B given: A 1 -4 -9 8 6 = 2 24 B = 0 15 2 12 4 1 3 14 0
-
On January 15, 20XY, BVC collected cash for a $10,000 receivable previously written off. Record the appropriate entries. BVC Supplies Inc. sells exercise equipment. BVC notes that at December 31,...
-
What are the components of profit variance? Of revenue variance? Of cost variance?
-
Which method do you think is the most accurate? Which is the least accurate?
-
Why is the budgeted profit and loss (P&L) statement so important?
-
Do the required assumptions depend on the type of organization and the nature of its reimbursement contracts?
-
a. What is a cost pool? b. What is a cost driver? c. How is the cost allocation rate determined?
-
Since its inception in the 1970's there has been controversy surrounding the jury selection in certain cases the use of social scientists and psychologists as consultants in trial preparation and...
-
Interview managers at three companies in your area about their use of ERP. How have their experiences been similar? What accounts for the similarities and differences?
-
(a) Is the interaction between a charged object and an electrically neutral object always attractive? Why or why not? (b) In Figure 27.4, which type of magnetic pole is induced at the top of each...
-
(a) Draw the elementary magnets inside a bar magnet and a horseshoe magnet, using the half-filled-circle format shown in Figures 27.8 and 27.9. (b) How many poles does the magnetized ring in Figure...
-
(a) Which end of a compass needle is a north pole: the end that points toward Earth's North Pole or the other end? (b) If you place a compass near the north pole of a magnet, what happens to the...
Study smarter with the SolutionInn App