Why does Unix block size increase with bigger memory size?

I am profiling binary data which has

  • increasing Unix block size (one got from stat > Blocks) when the number of events are increased as in the following figure
  • but the byte distance between events stay constant
  • I have noticed some changes in other fields of the file which may explain the increasing Unix block size
  • 在这里输入图像描述

    The unix block size is a dynamic measure. I am interested in why it is increasing with bigger memory units in some systems. I have had an idea that it should be constant. I used different environments to provide the stat output:

  • Debian Linux 8.1 with its default stat
  • OSX 10.8.5 with Xcode 6 and its default stat
  • Greybeard's comment may have the answer to the blocks behaviour:

    The stat (1) command used to be a thin CLI to the stat (2) system call, which used to transfer relevant parts of a file's inode. Pretty early on, the meaning of the st_blksize member of the C struct returned by stat (2) was changed to "preferred" blocksize for efficient file system I/O, which carries well to file systems with mixed block sizes or non-block oriented allocation.

    How can you measure the block size in case (1) and (2) separately?

    Why can the Unix block size increase with bigger memory size?


    "Stat blocks" is not a block size. It is number of blocks the file consists of. It is obvious that number of blocks is proportional to size. Size of block is constant for most file systems (if not all).

    链接地址: http://www.djcxy.com/p/28392.html

    上一篇: 如何在单例模式中保存javascript“this”上下文?

    下一篇: 为什么Unix块的大小随着更大的内存大小而增加?