*** Welcome to piglix ***

First-in, first-out


FIFO is an acronym for first in, first out, a method for organizing and manipulating a data buffer, where the oldest (first) entry, or 'head' of the queue, is processed first. It is analogous to processing a queue with first-come, first-served (FCFS) behaviour: where the people leave the queue in the order in which they arrive.

FCFS is also the jargon term for the FIFO operating system scheduling algorithm, which gives every process central processing unit (CPU) time in the order in which it is demanded.

FIFO's opposite is LIFO, last-in-first-out, where the youngest entry or 'top of the stack' is processed first.

A priority queue is neither FIFO or LIFO but may adopt similar behaviour temporarily or by default.

Queueing theory encompasses these methods for processing data structures, as well as interactions between strict-FIFO queues.

Depending on the application, a FIFO could be implemented as a hardware shift register, or using different memory structures, typically a circular buffer or a kind of List. For information on the abstract data structure, see Queue (data structure).

The following code shows a linked list FIFO C++ language implementation. In practice, a number of list implementations exist, including popular Unix systems C sys/queue.h macros or the C++ standard library std::list template, avoiding the need for implementing the data structure from scratch.

The ends of a FIFO queue are often referred to as head and tail. Unfortunately, a controversy exists regarding those terms:

In computing environments that support the pipes and filters model for interprocess communication, a FIFO is another name for a named pipe.


...
Wikipedia

...