Pipe buffer size is 4k or 64k?

后端 未结 5 1875
轻奢々
轻奢々 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:04

    In my experience, the single write test produced a total size of 65536, yet when I wrote 2700 at a time, I could only write 16 times, and then the next attempt stalls. I figure that the 'atomic' write needs to be within one 4K block, and that for each of my writes, it goes to the next full block to satisfy the request. So, in effect, the useable pipe size depends on the size of your writes.

提交回复
热议问题