|
Queue->Concepts |
||||
Haven't you heard
about a bus queue! There the people stand and here a computer element has
to stand waiting for its turn to be processed. As you know, in a real
life queue the one who gets in first, comes out first. Here also, the
element which gets in the Queue first comes out first; and that's why we
call it a FIFO structure( First-in-first-out). Logically, it looks like
this -
Well, its not the case because, as you know, when the first person leaves the queue, its the second person who becomes the Queue's new front. That's why -- each time an element leaves the queue the 'front' gets incremented by one. Referring the above figure, you can make out that 26 was the first one to add itself to the queue then 09,...., and finally 24 is the last one to add itself. As you know, 26 will be the first one to come out, then 09,....and finally 24 will be the last one to come out. When 'front' value becomes greater than the 'rear' value, we say -- the Queue is empty. The queue has one of the best roles to play in computer's resource management like -- it is used in scheduling the jobs to be processed by the processor; a queue schedules the order of the print files to be printed; a server maintains a queue of the client requests to be processed and many more. Related Operations: |
||||
| Index || Doubts / Clarifications || Related Topics || Web Links | ||||