1

Is it possible to keep a datas address which is placed in hard disk or solid state disk in a container in RAM?

For my application (C++/visual studio 2008) I'm going to create a repository(directory) on a SSD drive and in that repository there will be thousands (lets say 100000 files with size like 3 MB for each) of binary files (the names of the files are Unique Id's)

Some applications have to perform search operation on tihs directory with the names (Id's).

So I thought that, if I create a container like a map in RAM and set the key column ID (name of the file) and the value to the physical address of the file (which is in the SSD) and let the applications perform the search in this map (in RAM) and if the data found, retreive the data with the address(since we have the physical address) wouldn't be much more faster?

So is it possible to do something like that?

Vecihi
  • 261
  • 4
  • 12
  • You don't have "physical" addresses like that on hard-drives (especially in user-space programs), much less on modern SSDs where blocks can move around. – Some programmer dude Jan 29 '14 at 07:31
  • so to be able the perform a search in one directory full with thousands of files we have to look all the item names one by one? Any kind of indexing or other operation can't be done to make the search faster? – user2955554 Jan 29 '14 at 07:37
  • @JoachimPileborg: Modern databases definitely do, and they are fairly ordinary user-space programs. The SSD stuff doesn't matter, even HDD's could do block remapping. The important part is that no file **system** is remapping addresses. – MSalters Jan 29 '14 at 08:42

1 Answers1

1

There are a few easy options: use a database, or memory map the bunch of files. In the latter case, you'll have to be aware that apparent memory operations are in fact disk I/O's, and much slower. But the result of memory mapping a file is still a fairly ordinary pointer to its contents. This is even easier than the "physical addresses" you're proposing.

MSalters
  • 173,980
  • 10
  • 155
  • 350