Page 193 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 193

Fundamentals of Data Structures




                    Notes          6.  .......................... operation is used to add an item to the queue at the rear end.
                                   7.  Head count will be incremented by one after addition of each item until the queue reaches
                                       the .......................... point.

                                   8.  .......................... operation is used to remove an item from the queue at the front end.
                                   9.  The dequeue operation continues until the queue is reaching its .......................... element.

                                   11.2 Applications of Queues

                                   The application areas where the queue concept is implemented are discussed as below:

                                       Print queue – Jobs sent to the printer
                                       Operating system maintain queue in allocating the process to each unit by storing them in
                                       buffer.



                                     Did u know? An operating system always makes use of a queue (ready queue, waiting
                                     queue) for scheduling processes or jobs.

                                       The interrupts that occurs during the system operation are also maintained in queue.
                                       The allocation of memory for a particular resources (Printer, Scanner, any hand held
                                       devices) are also maintained in queue.

                                       Queue is used when things don’t have to be processed immediately, but have to be processed
                                       in First In First Out order like Breadth First Search. This property of Queue makes it also
                                       useful in following kind of scenarios.

                                       When a resource is shared among multiple consumers.
                                       Examples include CPU scheduling, Disk Scheduling.
                                       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.
                                       All the input output calls made by the disk to and from the memory are handled by a
                                       queue.

                                       We have many processors like 80386 and queue plays an active part in there architecture.
                                       Queues can be commercially used in online business applications for processing customer
                                       requests in first in first serve manner.

                                       When a resource like CPU is shared between among multiple consumers, a queue solves
                                       the hatchet.
                                       In all the basic algorithms for searching or sorting, everyone of them make use of queue.
                                       Queues are very efficient when we want to take out elements in the same order we have
                                       put in inside.

                                   Self Assessment

                                   State whether the following statements are true or false:
                                   10.  Operating system maintain queue in allocating the process to each unit by storing them in
                                       buffer.




          186                               LOVELY PROFESSIONAL UNIVERSITY
   188   189   190   191   192   193   194   195   196   197   198