Possible Duplicate:
Pipe buffer size is 4k or 64k?
-
In linux, which header file specifies the size available for writes on a pipe ?
-
I capture latency of my main application per configurable cycle and write that data to a pipe. A separate reporting process reads off that pipe. Typically, the main application exchanges about 10,000 messages per second. So, given a cycle of one second, the main application collects 10k latency data points for each message exchange and then writes them off to a pipe on a second’s boundary. I have following questions in this scenario
- Is there way to specify the size of pipe while creation,so i can ensure there is adequate write space in the pipe?
- Are writes to pipe expensive? How is pipe implemented? Do writes to pipe go against some mmap file or in-memory buffer?
F_SETPIPE_SZoperation to set the pipe buffer up to/proc/sys/fs/pipe-max-size. On earlier versions, no, but I suppose you could use the socket mechanism instead. It would be slower for most purposes but you can specify the amount of buffering up to wmem_max, see socket(7), and you have certain other controls over kernel memory allocation.