Queues are most commonly used for scheduling and request handling applications.
For example, anything where you have one process creating requests and another process handling the requests you would use a queue to hold the requests.
Normally a queue is in FIFO order – requests are processed in the order they are received, but they can also be ordered in other ways (a priority queue for example).
A few examples:
-
An operating system scheduling threads for execution on a CPU would use a queue to determine which thread is next to execute.
-
A web server handling HTTP requests would use a queue to pass requests on to threads that will actually server up the web pages.
-
A printer handling requests for print jobs.
solved Can you give an example where the Queue data structure can be specially helpful [closed]