Hi all,

Thx for replies. I won't have a chance to try the suggestions until later tonight but Bill your point re data structures is right, its a bit of an unusual lot of data (to me anyway) and I have struggled to decide how to approach it.

Its actually the 16kb sectors of a SSD which broke and I retrieved an image of the NANDs from. So I have a 'physical image' of the drive. However the translation table is partially lost and I am searching for patterns. There are around 16 million sectors ($lpn) and each lbn is sometimes present in many places (up to 20000 for a very few examples, usually 2 places). Each sector has associated with it as well as an ID I have figured out is its lba, up to 128 numbers which might indicate its validity (they might point to expired physical locations but I am not sure yet).

So I need to search it for patterns after I load it into some kind of structure. It will take a lot of memory.

I tried at first with hashes but could not get it working and after thinking about it more decided arrays would be more appropriate (although very sparse as you say).

I need 3 levels of storage, logical address ($lpn - unique), physical address ($ppn, once again unique), and inside each $ppn I need 'sub PPNs' lets call them $subppn, I don't know how unique they will be per $ppn, maybe not. Every element will be a 32 bit integer (in fact only uses 24 bits).

So each $lpn owns several $ppns, each of which owns a list of $subppns.

Structurally what this respresents is PPNs are the actual physical location of the sector, LPN is the logical location that I believe is assigned to this PPN, and subppn is a list that each PPN owns of locations I need to analyse to see what pattern emerges in relation to the PPN and LPN. Many PPNs point to a single LPN sometimes.

Then I need to do:

foreach $ppn { foreach $ppn { # do stuff } }

So in other words I need to for each $lpn, then for each $ppn, check the list of $subppns against all other $ppns in this $lpn.

I hope that makes sense - I am sitting at a table with 2 screaming kids as I type this and having difficulty describing it. If it does not make sense I will provide a better description later.

I guess ideally looking at my description I would like $structure{hash}{hash}array but I could not get it to work, for similar reasons to the one I have hit above (using scalar as reference etc). Edited to correct mistake when I said PPNs are only unique per LPN - this is not the case now I think about it. Thanks, Pete


In reply to Re^2: Adding cols to 3d arrays - syntax by peterrowse
in thread Adding cols to 3d arrays - syntax by peterrowse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.