Ive been trying to figure out if multithreading in an io-bound application will actually improve performance or reduce it. Many sources I have read are conflicting.
Take this one for example.
Why multithreading with io-bound is bad
The accepted answer is that if your application is io-bound multithreading will cause contention and slow down your application.
Where as is this example the answer with the highest votes states that it can improve throughput.
Why multithreading with io-bound is good
Am I misunderstanding something here?
In my situation I need to read from n disk locations n times a second. I'm finding it difficult to decide if I should be using threads at all.
For example, if I had 20 files on disk and 20 seperate threads reading from disk in a state of waiting and waking, is this going to completely slow down my system? If a pthread is executing code that reads from disk, would all the other 19 threads doing the same thing on different file be blocked?