what is the capapcity fo mmap?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    what is the capapcity fo mmap?

    I am working on file indexing and found one solution to store keyword index into memory map by converting keyword into integers.But still i am not sure how many digits i can store by using it.
    Like i have one keyword "Network Analysis by Graph theory and statistics"
    if i convert it into integer it will be too lengthy to store as keyword.
    map = (int*)mmap(0, FILESIZE, PROT_READ, MAP_SHARED, fd, 0);
    How can i overcome my pblm.

    Thanks in advance.

    Regards
    Manish
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Do you know about association tables?

    These tables associate a key with an index value:

    Network Analysis by Graph theory and statistics 1
    String Theory for Dummies 2
    My Life as an Analyst 3

    etc...

    The table usually has a value at the beginning of the table for the next index value. One alternative is to have the next index value be the offset into the database. If you do this, your database can be on disc where it can be far larger than your computer memory and never needs to be loaded into memory. Now you can have several computers accessing the database at once. A further variation on this is to identify a database file name with that offset. Now you can look up the integer representing the database and then access at the offset in the association table. Now your database can be on multiple disc drives while being accessed by multiple computers. Etc...

    So you don't convert a key to an integer, instead you associate to an integer.

    The association table can be written to disc and then reloaded the next time you want to run the program.

    You can also provide reverse assocation by associating an integer value to its key.

    You can provide fopr multiple keys by associating several keys to the same integer value.

    The association table is usually stored as a binary tree.

    Comment

    Working...