Write to a file from multiple threads asynchronously c#

后端 未结 7 1616
忘掉有多难
忘掉有多难 2020-12-02 14:04

Here is my situation. I would like to make writing to the file system as efficient as possible in my application. The app is multi-threaded and each thread can possibly wr

7条回答
  •  Happy的楠姐
    2020-12-02 14:44

    Have a look at Asynchronous I/O. This will free up the cpu to continue with other tasks.
    Combine with ReaderWriterLock as @Jack B Nimble mentioned

    If by

    writing to the file system as efficient as possible

    you mean making the actual file I/O as fast as possible you are going to have a hard time speeding it up much, disk is just physically slower. Maybe SSD's?

提交回复
热议问题