I have one program writing to mkfifo created device 7 lines of text data every 3 seconds using printf()
. I am trying to read it with cat /path/to/device
in another terminal window. But instead of updating every 3 seconds, it will print something only once every 25 seconds. Why? How to make it update faster? (Ubuntu Wily)
Asked
Active
Viewed 59 times
0

exebook
- 32,014
- 33
- 141
- 226
-
are you using concurrency with other shells scripts ? – deimus Dec 07 '15 at 13:47
1 Answers
1
One or both ends of the pipe is buffering more than you want. In your writing program, fflush
when you finish writing your 7 lines, and read the output with cat -u
(if your cat
is not GNU cat).

Toby Speight
- 27,591
- 48
- 66
- 103