I need to read a single file using multiple threads under Linux.
There are reading operations only and no need of writing.
The file reading don't need read the whole file every time.
It need read one or more portions of a file every time.
I store the offset of each portion beforehand.
The file is too large to put into main memory.
So for example, many users want to read such file.
I use a thread or a process to read the file to answer user requests.
What will happen under Linux?
Will all the read operations be queued?
And the OS will complete the file reading one by one?
Is it possible to improve the performance of such operations?
I'm trying to implement a simple inverted index used in information retrieval.
I put dictionary in memory and posting lists in files.
Each file contains a segment of the index.
In the dictionary, I can store something like offset to point to the position of the word's posting list.
When 100 users want to search something in one second, they submit different queries.
So each reading will read different part of the file. I said something wrong when I ask. The file reading don't need read the whole file every time. It need read one or more portions of a file every time. I store the offset of each portion beforehand.
以上就是How to improve performance of file reading by multiple threads?的详细内容，更多请关注web前端其它相关文章！