Pipe buffer size is 4k or 64k?

后端 未结 5 1871
轻奢々
轻奢々 2020-11-28 04:46

I read in multiple places that the default buffer size for a pipe is 4kB (for instance, here), and my ulimit -a tends to confirm that statement:



        
5条回答
  •  醉话见心
    2020-11-28 05:07

    The other answers tell you that the pipe size is 64 KB. The reason why PIPE_BUF is 4KB is that PIPE_BUF is the largest size for which writes are guaranteed to be atomic. See http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html

提交回复
热议问题