Queuing theory is used to model waiting lines in systems where demand fluctuates. It can be used to optimize resource allocation to minimize costs associated with customer wait times and unused service capacity. The key elements of a queuing system include arrivals, a queue or waiting line, service channels, and a service discipline for determining order of service. Customers arrive according to a Poisson distribution and service times follow an exponential distribution. The goal of queuing analysis is to determine the number of service channels needed to balance wait time costs and idle resource costs.