FileStream.Seek vs. Buffered Reading

后端 未结 2 901
太阳男子
太阳男子 2021-01-18 07:10

Motivated by this answer I was wondering what\'s going on under the curtain if one uses lots of FileStream.Seek(-1).

For clarity I\'ll repost the answe

2条回答
  •  感动是毒
    2021-01-18 07:40

    Here is a pointer on File Caching in Windows

    The behavior may also depends on where physically resides the file (hard disk, network, etc.) as well as local configuration/optimization.

    An also important source of information is the CreateFile API documentation: CreateFile Function

    There is a good section named "Caching Behavior" that tells us at least how you can influence file caching, at least in the unmanaged world.

提交回复
热议问题