将使用多个线程与RandomAccessFile帮助性能? [英] Will using multiple threads with a RandomAccessFile help performance?
问题描述
我正在开发一个(database-ish)项目,数据存储在一个平面文件中。对于读/写我使用 RandomAccessFile
类。我将从多线程中获得任何东西,并给每个线程一个每个 RandomAccessFile
的实例,或者一个线程/实例是否一样快?在读/写有什么区别,你可以让实例只做读取,不能写?
I am working on a (database-ish) project, where data is stored in a flat file. For reading/writing I'm using the RandomAccessFile
class. Will I gain anything from multithreading, and giving each thread an instance each of RandomAccessFile
, or will one thread/instance be just as fast? Is there any difference in reading/writing, as you can make instances that only do the reading, and can't write?
推荐答案
一个相当常见的问题。基本上使用多线程不会使你的硬盘驱动器更快。
A fairly common question. Basically using multiple threads will not make your hard drive go any faster. Instead performing concurrent request can make it slower.
磁盘子系统,esp IDE,EIDE,SATA设计为以最快的速度顺序读取/写入。
Disk subsystems, esp IDE, EIDE, SATA, are designed to read/write sequentially fastest.
这篇关于将使用多个线程与RandomAccessFile帮助性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!