Write and explain application of queue.
Application of Queue:
- Queue of people at any service point such as ticketing etc.
- Queue of air planes waiting for landing instructions.
- Queue of processes in OS.
- Queue is also used by Operating systems for Job Scheduling.
- When a resource is shared among multiple consumers. E.g., in case of printers the first one to be entered is the first to be processed.
- When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes. Examples include IO Buffers, pipes, file IO, etc.
- Queue is used in BFS (Breadth First Search) algorithm. It helps in traversing a tree or graph.
- Queue is used in networking to handle congestion.