Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Thanks. (2) What is the advantage of a FIFO over a temporary regular file? (3) The nonlinear connection between processes is actually implemented by tee, not by a FIFO, for example, using tee and a temporary regular file we can achieve the same nonlinear connection too. Commented Mar 25, 2018 at 22:15
  • 1
    The description in APUE opposes FIFOs and files on the one hand, FIFOs and pipes on the other; you can’t conflate the three. When comparing FIFOs and files, the difference is that FIFOs don’t involve hitting the disk for the content written to the FIFO (this addresses your point 2). When comparing FIFOs and pipes, the difference is that FIFOs are named so they can be used in places pipes can’t. APUE doesn’t say you can’t use files to implement non-linear connections, it just says you can’t use pipes. Commented Mar 25, 2018 at 22:18
  • Thanks. What is the advantage of "don’t involve hitting the disk for the content written to the FIFO"? Commented Mar 25, 2018 at 22:21
  • Disks are slow. (At least, they were when APUE was written.) Commented Mar 25, 2018 at 22:21
  • 2
    A pipe (FIFO or whatever) doesn’t hold data, it transfers data between processes. You can see this by running, for example, mkfifo fifo && seq 1 1000000 | tee fifo. You won’t see any input from this initially, because the FIFO doesn’t start accepting data until both its ends are open. Run head fifo, and you’ll see the seq side of the pipe output a bunch of numbers and then stop with exit code 141, i.e. SIGPIPE (128 + 13): the output gives an indication the size of the kernel buffer used for the FIFO, at most a few tens of kilobytes. That’s all the memory that’s used by a pipe. Commented Mar 26, 2018 at 3:42