Last Updated on August 30, 2022 by Gokul Kannan
What is the queue?
A queue is basically a linear data structure that works on the principle of FIFO (First in First out) which means an element that is enqueued(Insert) first will be dequeued(Remove)first. Element is enqueued from the rear end of the queue and dequeued from the front end. The insertion operation in the queue is known as enqueue and the deletion operation in the queue is known as dequeue.
The queue is used when the operations are to be performed in the manner of First in First out order just like Breadth-First Search.
For Example A ticket Queue outside a cinema hall where the person enters the queue first will get the ticket first.
What is the device queue?
Device queues are also known as I/O queue, device queue contains the processes which are waiting for the completion of I/O request and the main is each device has its own device queue.
Devices usually have the device controller hardware and device driver software that work as the part of the operating system to control it.
Many device drivers have a device queue in order to handle I/O requests specific to the device.
Let’s take an example, if we type a sentence using a keyboard, the sentence is received by the controller and will put it in the input queue.
This I/O queue is read by a driver and put on an input queue.
From the input data queue, it is moved to the ready queue for CPU processing, then the input request comes from the keyboard, mouse, touchscreen, and other such devices.
After the CPU processing, output requests are sent to output devices.