1

My batch process needs to be reading lines from huge files (1-3G), each of which can be processed independently of another. The files can have 10-50M rows. I was thinking of spawning about a dozen threads each of which would be processing a predetermined range of buffers, e.g. T1 will read range 0-1, T2 1-2, etc. concurrently. That means, of course, that T2 needs to jump instantly into the buffer position 2, without reading 0-2.

Is this type of segmentation of buffered file reading for the purposes of concurrency possible with Java NIO?

4

1 回答 1

0

这没有任何意义。CPU 可能允许多线程,但磁盘仍然是单线程的。所有这一切都会导致磁盘抖动。忘了它。

于 2013-04-06T00:33:32.370 回答