队列
特性
FIFO : First In First Out
抽象数据结构
- Enqueue: Add an element to the end of the queue
- Dequeue: Remove an element from the front of the queue
- IsEmpty: Check if the queue is empty
- IsFull: Check if the queue is full
- Peek: Get the value of the front of the queue without removing it
应用场景
- CPU scheduling, Disk Scheduling
- When data is transferred asynchronously between two processes.Queue is used for synchronization. eg: IO Buffers, pipes, file IO, etc
- Handling of interrupts in real-time systems.
- Call Center phone systems uses Queues to hold people calling them in an order
以下是常见的队列: