Search code examples
memoryfilesystemspipeipcnamed-pipes

Aren't Named Pipes in the Filesystem slow?


Isn't it useless to write stream data for IPC into a file in the filesystem and so on to your (HDD o. SSD)? I mean, isn't it better to create a "buffered" pipe in the memory, so that we have more performance on the drive? But I'm new in IPC... or isn't it writing onto the disk? But how is this possible that the system writes into the filesystem without writing into a disk?


Solution

  • Aren't Named Pipes in the Filesystem slow?

    They're no slower than any other sort of pipe.

    isn't it better to create a "buffered" pipe in the memory

    If you aren't memory constrained, then yes (see older OS link below).

    [...] or isn't it writing onto the disk?

    Your guess is correct - on many modern operating systems data going into a named pipe is not being written to the disk; the filesystem is just the namespace that holds something that tells you where the ends of the pipe can be found. From the Linux man page for pipe:

    Note: although FIFOs have a pathname in the filesystem, I/O on FIFOs does not involve operations on the underlying device (if there is one).

    There are older operating systems that buffer pipe data within a filesystem but given your question's phrasing (on such systems ALL pipes go through the filesystem not just named ones) I suspect this is a tangent.