What are the differences between pipes in Windows and Linux?

Brian R. Bondy picture Brian R. Bondy · Oct 10, 2008 · Viewed 13.5k times · Source

What are the differences between pipes in Windows and Linux?

Answer

davr picture davr · Oct 10, 2008

One difference that I know of, is that named pipes under Linux are actual entries in the filesystem (you'll see it in a directory listing, they have a special type), whereas on Windows they are stored in some magical repository somewhere (they are all accessed via the path "\\.\pipe\".

Secondly, in Linux you can just write/read from pipes as if they were any other file, using standard file IO methods. Whereas on windows, you have to use the special 'Pipe' functions which are part of the Win32 API.

I like linux's method better, because it lets me use pipes with any app I want. Eg:

mkfifo pipe.wav
decodeMP3 song.mp3 --out pipe.wav &
encodeAVI video.mpeg pipe.wav --out video.avi

This lets me pipe the output of the MP3 decoder directly into the video decoder, instead of having to first decode the entire MP3 into a WAV file on disk. It's handy if you have a dual-core CPU, because then you are running both operations at once, for a nice speedup.