How many random / sequential access per fread / fwrite?

前端 未结 5 1207
孤街浪徒
孤街浪徒 2021-01-21 03:53

I have the following question regarding C file I/O.

At a physical level (harddrive), is it valid to assume that every fread(n_blocks, size, length,FILE fp)

5条回答
  •  盖世英雄少女心
    2021-01-21 04:31

    From the point view of an application programmer, the exact process of reading the blocks is indeterministic. It all goes down to the disk scheduler that organizes the access operations of multiple requests at the same time from multiple processes. There are multiple algorithms to solve this issue, but thinking too simplistic(1 random seek, n sequential seeks) is not realistic at all. In the end, neither the C standard nor the C++ standard define such a thing for clear reasons.

提交回复
热议问题