Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Urgent !! help me plss if u can!
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 recipients's mail box. 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 no available.
Write an email simulator that processes mail at an average of 40 messages per minute. As message are received, they are placed in a queue. for this 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 40 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 10 to 15 minutes, tracking the number of times each message had to be requested. At the end of the simulation, print the statistics that show:
1. the total messages processed
2. the average arrival rate
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 sent on the second attempt, and so forth
6. the average number of times message had to be requeued (do not include the message sent the first time in this average)