What is meaning that a file is a named pipe (FIFO)?
What is a pipe? and why a file is a named pipe? I am just learning linux.
|
See, for example, this Wikipedia page for general information. FIFO stands for "first in, first out", meaning that it's like a pipe: you put in something from one end and you get it out of the other end in the order the contents were put in. An example: open two terminals. From either one, create a fifo (for example in /tmp):
Code:
mkfifo /tmp/testfifo Code:
cat > /tmp/testfifo Code:
cat /tmp/testfifo Code:
rm /tmp/testfifo Edit: to be a bit more clear, if process A writes to a fifo (or lifo, depending on which order is required) and process B reads from that fifo (or lifo), and it happens so that it cannot be guaranteed that A is ready to write whenever B is ready to read, or vice versa, then the fifo allows storing information (in order) such that A may write to it when it can, and B may read from it when it can. For example if A produces a lot of data, but B can only handle a bunch at a time, then B can read the data piece by piece from the fifo (or lifo) and in principle not care how much A may have written to it, and on the other hand A can write to the fifo (or lifo) without having to care if B is ready to read the fifo just then. |
Thanks a lot. I opened two terminals and they worked just like you said.
|
All times are GMT -5. The time now is 04:42 AM. |