- 分享
- 0
- 人气
- 0
- 主题
- 35
- 帖子
- 91
- UID
- 494988
- 积分
- 286
- 阅读权限
- 14
- 注册时间
- 2012-5-15
- 最后登录
- 2016-6-20
- 在线时间
- 1389 小时
|
这里有一个关于Queue 的题目.
我不是很明白这个的logic 和 source code 怎样写?请大家帮我解释解释谢谢.
Consider the case of an ATM center:
• It may have number of machines (servers) to serve customers
• If a customer arrives, the customer gets in line (queue)
• If the ATM is free and someone is waiting, then the first customer will use the machine.
• While a customer is using the machine, the time remaining for the customer to be served is decremented
• If there are customers in line, the additional minute that they have remained in the queue is recorded.
Develop a time-driven single server/single queue or multiple server/single queue system with following specifications:
• Jobs arrive at an average rate of 20 jobs per minute.
• When a job arrives (random jobID), the job is placed in a queue.
• The service time for a job varies from 3 seconds to 16 seconds (use random number and computer clock time)
• Jobs are served at a maximum of 7 seconds at once, if a job required service time more than 7 seconds, for the remaining service time the job is placed back on the queue (enqueue) again.
•
Run the simulator for 10 minute and report the following statistics:
1. The total number of jobs processed
2. Average number of jobs processed per minute.
3. The average arrival rate per minute
4. The number of jobs processed on the first attempt (one time).
5. The number of jobs had to be requeued once(require 2 times)
6. The number of jobs had to be requeued twice.(3 times)
For Multiple server/ Single queue system
1. Show sample jobs with assigned server ID,
2. Total number of jobs processed by each server |
|