How does behave linux buffer cache when an application is crashing down?

前端 未结 2 1889
耶瑟儿~
耶瑟儿~ 2020-12-18 06:34

Let\'s say I am using c++ files stream asynchronously. I mean never using std::flush nor std::endl. My application writes a lot of data to a file and abruptly crashes down.

2条回答
  •  不知归路
    2020-12-18 07:10

    The stuff in the library buffer (which you flush with std::flush or such) is lost, the data in the OS kernel buffers (which you can flush e.g. with fsync()) is not lost unless the OS itself crashes.

提交回复
热议问题