FIFO
|
FIFO is an acronym for First In, First Out. This expression describes the principle of a queue or first-come, first-served behavior: what comes in first is handled first, what comes in next waits until the first is finished, etc. Thus it is analogous to the behaviour of persons "standing in a line" (preferred in American English) or "queueing" (preferred in Commonwealth English), where the persons leave the queue in the order they arrive.
A priority queue is a variation on the queue which does not qualify for the name FIFO, because it is not accurately descriptive of that data structure's behavior. Queuing theory encompasses the more general concept of queue, as well as interactions between strict-FIFO queues.
The expression FIFO can be used in different context:
Contents |
People
- For queues of people, see queue area.
Computer Science
Data Structure
In computer science this term refers to the way data stored in a queue is processed. Each item in the queue is stored in a queue (simpliciter) data structure. The first data to be added to the queue will be the first data to be removed, then processing proceeds sequentially in the same order. This is typical behavior for a queue, but see also the LIFO and stack algorithms.
A typical data structure will look like
struct fifo_node { fifo_node *next value_type value };
class fifo { fifo_node *front fifo_node *back fifo_node dequeue() { return(front) front=front->next } queue(value) { fifo_node tempNode=new fifo_node tempNode.value=value back.next=node } }
Pipes
In computing environments that support the pipes and filters model for interprocess communication, a FIFO is another name for a named pipe.
Electronics
FIFOs are used commonly in electronic circuits for buffering and flow control. In hardware form a FIFO primarily consists of a set of read and write pointers, storage and control logic. Storage may be SRAM, flip-flops, latches or any other suitable form of storage. For FIFOs of non-trivial size a dual-port SRAM is usually used where one port is used for writing and the other is used for reading.
A synchronous FIFO is a FIFO where the same clock is used for both reading and writing. An asynchronous FIFO uses different clocks for reading and writing. Asynchronous FIFOs introduce metastability issues. A common implementation of an ansychronous FIFO uses gray code for the read and write pointers to ensure reliable flag generation.
FIFOs may generate various flags that indicate the status of the FIFO such as full, empty, almost full or almost empty.
Accounting
- In accounting, FIFO is a common method for recording the value of inventory. It is appropriate where there are many different batches of similar products. The method presumes that the next item to be shipped will be the oldest of that type in the warehouse. In practice, this reflects the underlying commercial substance. See also LIFO in this context.
See also
- LIFO (Last in, first out)de:First In - First Out