Pipe

Undraw File Manager Re Ms29

About

pipe are file descriptor used for pipe communication between process (used for inter-process communication)

pipe is the basic block of pipeline (stream) communication on the operating system.

Example

Named Pipe: Minimal Usage

  • Creation
mkfifo my_pipe
  • List
ls -l my_pipe
prw-r--r-- 1 root root 0 May 31 10:15 my_pipe

  • Usage
echo "Hello, World!" > my_pipe &
echo "Hello, World!" > my_pipe &
cat < my_pipe
Hello, World!
Hello, World!
[1]-  Done                    echo "Hello, World!" > my_pipe
[2]+  Done                    echo "Hello, World!" > my_pipe

Anonymous Pipe (Docker)

pipe:[inode_number] indicates an anonymous pipe (not named) identified by its inode number.

Such links are commonly seen in the /proc filesystem, providing insight into the file descriptors and IPC mechanisms used by processes.

Example listing file descriptor for the process 1 in a Docker container

ls -l /proc/1/fd
lrwx------ 1 root root 64 May 30 12:22 0 -> /dev/null
l-wx------ 1 root root 64 May 30 12:22 1 -> 'pipe:[2333507]'
l-wx------ 1 root root 64 May 30 12:22 2 -> 'pipe:[2333508]'
lr-x------ 1 root root 64 May 31 09:57 255 -> /usr/local/bin/entrypoint.sh

pipe:[2333507] indicates that file descriptor 1 (stdout) is connected via a symlink to an anonymous pipe with inode number 2333507.





Discover More
Undraw File Manager Re Ms29
File System - ( Symbolic | ln | Soft) link - File Alias - Symlink - Junction - Reparse Points

A soft link, symlink or a symbolic link is a file that redirects (link) to another file. It's the alias functionality of a file system. Unlike a hard link, a symbolic link can link to any file on any...
Process States
Process - Inter Process Communication (IPC)

An Inter Process Communication (IPC) describes the fact that two or more processes exchange information. IPC is used not just for communication between processes on the same system, but also on different...



Share this page:
Follow us:
Task Runner