Design pattern for managing queues and stacks?

2020-08-01 07:43发布


Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the queue and add them to their personal queue.


Design patterns can use queues and stacks, but the queues and stacks themselves don't really implement a design pattern, they implement an interface.

Queues are typically FIFO while stacks are LIFO.

Since many users might be using the data structures simultaneously, you should use proper synchronization to avoid concurrency issues.

Are you looking for concurrency-related design patterns to use?


Most frameworks provide some kind of queue and/or stack implementations. E.g. in .NET - System.Collections.Generic.Queue and System.Collections.Generic.Stack