Reputation: 127
Reading files using multiple threads on a multi core system does it increases performance? Is any disk supports parallel access?( not cuncurent access)
Upvotes: 3
Views: 2520
Reputation: 182819
It makes a difference on both SSDs and spinning disks, but largely for different reasons.
For SSDs, if requests come from a single thread, there will be a dead time after the SSD has retrieved the data for one request and before the thread can send its next request. This dead time can be a significant fraction of the SSD's read time because SSDs are so fast.
For spinning disks, the order in which reads are executed can matter. For example, if a read is issued for track 1, track 12, and track 2, it can be more efficient to perform the read for track 2 before the read for track 12. But this cannot happen if the read for track 2 doesn't get issued until after a thread processes the results of the read from track 12.
In the case of SSDs, multiple cores help a lot more than mulitiple threads do. In the case of spinning disks, multiple threads can issue multiple reads that can be re-ordered even if they all have to share the same core.
Upvotes: 3