590 likes | 1.36k Views
Queuing Theory. Queuing Theory. Queuing theory is the study of waiting in lines or queues. Server. Rear of queue. Front of queue. Server. Line (or queue) of customers. Server. Pool of potential customers. List of servers able to service the customers. Queuing Theory -- cont.
E N D
Queuing Theory • Queuing theory is the study of waiting in lines or queues. Server Rear of queue Front of queue Server Line (or queue) of customers Server Pool of potential customers List of servers able to service the customers
Queuing Theory -- cont. What do we want to know about a queuing system? • The average or expected wait time • The percentage of customers who experience long wait times • The probability that a customer must wait(The probability that all servers are busy) • The average number of customers in the queue. • The probability that servers are idle
Simulations • Simulation is a method of evaluation without using methmatical models such as queuing theory. • In general, a simulation is a computer-programmed model of something. • The best test of an OS: the real marketplace. • The next best test: create situation similar to the real world. • Simulations play a key role in the development of complex system such as computer networks, databases, and OS
Queueing Theory • Customer arrive at a queueing system randomly at time (arrival times) • Poisson arrival process: the interarrival times are distributed exponentially: l : constant average arrival rate = customer/unit time The # of arrivals / unit time is poisson distributed with mean l = interarrival times = the time between successive arrivals
y y = 1 P(t < t) = Probability of an arbitrary interarrival time t being less than t for small l for large l t = 0 t (time)
Example: arrival rate: one every two minutes The rate of one customer every two minutes = 0.5 customers per minute l t P(t) ------------------------------------- 0 0 1 .393 2 .632 3 .777 4 .865 5 .918 .. .. 10 .993 .. .. 20 .99995 The probability function does not tell us when customers will arrive. It does, however, provide information about the random arrival process.
Total # of customers in the queueing system N Server 1 Ns # of customers in the queue Average arrival rate # of customers in service Nq l t q Service time interarrival time Time spent in the queue S Server C W Total time a customer spends in the queueing system
The probability that exactly n customers will arrive in any time interval of length t is • Let Sk denotes the service time that the Kth arriving customer requires from the system. An arbitrary service time is referred to as S, and the distribution of service time is For random service with average service rate m
Queue Disciplines • A queue discipline is the rule used for choosing the next customer from the queue to be serviced. • Kendall notationA/B/c A is the interarrival time distributionB is the service time distributionc is the number of serversA and B may be • GI for general independent interarrival time • G for general service time • M for exponential interarrival or service time distribution • D for deterministic interarrival or service time distribution • M/M/1 • M/M/c
Traffic Intensity arrival rate • A measure of that system's ability to service its customer effectively It is useful for determining the minimum number of identical servers a system will need in order to service its customer without its queue becoming indefinitly large or having to turn customer away. • Ex: E(s) = 17 sec E(t) = 5 sec u = 17/5 = 3.4 need at least 4 servers service rate
Case StudiesA shared Laser printer • An average of 64 requests occurring at random times during eight-hour day. • Each request require an average of about 5 minutes to print. • Receiving compaints from employees that they must wait nearly half an hour for their printout. 8 requests/hour l = 2/15 requests/minute 12 requests/hour m = 1/ 5 request/minute
Server Utilization • Server utilization r is defined as the traffic intensity per server • is the probability that a particular server is busy • this is approximately the fraction of time that each server is in use • For single-server system, u = r r = 2/3
Probability of All Server Idle When c= 1 (1 - 2/3 = 1/3)
Probability of All Server Busy • Erlang’s C Formula: When c = 1 (2/3)
Expected Number of Customers • The expected number of customers in the queue: When c = 1 (2/3)2/(1-2/3)=4/3
Expected Wait Time • Little’s Formula • Expected wait time (2/15)* 10 = 4/3 When c = 1 [(2/3)/0.2]/(1-2/3) = 10 minutes
90th Percentile Wait Time • 90% of the customers wait less than When c = 1 ln(10*2/3)/(1/5 - 2/15) = 28.4 minutes
Case Study 2Master Scheduler • Computer running simulation programs requires a lot of CPU time and scheduled on a FIFO basis. • Generally submit about 100 programs per day • The programs require an average of about one hour of CPU time. • 100 requests/day • l = 100/24 = 4.2 requests/hour • 1 requests/hour • m = 1 request/hour
Example 1 • The election of the President of Student Association(學生會)is just finished in Tamkang University. There are 27,000 students and the average rate of voting is 15%. The official voting period was 5 days, from 8:00 to 17:00. The association prepared only one counter for everyone to vote and each voting requires half minute to complete. Use the equation provided to analyze the condition of student getting in-line and wait for the voting. You must explain the meaning of each equation. (ln(2.5)=0.9, ln(7.5)=2, ln(15)=2.7)
Example 2 • There are 36 programmers per day, in average, come in to use the mainframe computer in the computing center. Each programmer uses the computer for about 15 minutes. Use the equation provided to analyze the usage of the computer. You must explain the meaning of each equation.