Unit III - Applications of Queue
Unit III - Applications of Queue
Introduction
• A queue is a linear data structure that follows the “first-in, first-out” (FIFO)
principle. It is a collection of elements that supports two primary
operations – Enqueue and Dequeue.
• Peek: Return the element at the front of the queue without removing it.
Network protocols: Network protocols like TCP and UDP use queues to manage
packets that are transmitted over the network. Queues can help to ensure that
packets are delivered in the correct order and at the appropriate rate.
Printer queues :In printing systems, queues are used to manage the order
in which print jobs are processed. Jobs are added to the queue as they are
submitted, and the printer processes them in the order they were received.
Web servers: Web servers use queues to manage incoming requests from
clients. Requests are added to the queue as they are received, and they are
processed by the server in the order they were received.
• Arrival time (AT) − Arrival time is the time at which the process arrives in
ready queue.
• Burst time (BT) or CPU time of the process − Burst time is the unit of
time in which a particular process completes its execution.
• Completion time (CT) − Completion time is the time at which the process
has been terminated.
• Turn-around time (TAT) − The total time from arrival time to completion
time is known as turn-around time.
• TAT can be written as,
• Turn-around time (TAT) = Completion time (CT) – Arrival time (AT) or,
TAT = Burst time (BT) + Waiting time (WT)
• Waiting time (WT) − Waiting time is the time at which the process waits
for its allocation while the previous process is in the CPU for execution. WT
is written as,
• Response time (RT) − Response time is the time at which CPU has been
allocated to a particular process first time.
• Consider the given table below and find Completion time (CT), Turn-
around time (TAT), Waiting time (WT), Response time (RT), Average Turn-
around time and Average Waiting time.