A producer creates work items and makes them available for downstream processing. In an asynchronous queue, a customer generator produces customers for cashier tasks, which consume them from the queue. A bounded queue controls memory use: when it is full, await queue.put() pauses the producer until a consumer frees space. section 12.1
Supermarket checkout
A customer_generator creates one to five random customers per second and adds them to a queue. Three cashier tasks check customers out concurrently. If customers arrive faster than cashiers process them, the producer waits rather than adding beyond the queue's capacity. section 12.1







