Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Processor and Memory data alignment with base pointers?

  1. Jun 10, 2017 #1
    Hello, working on a puzzle and I think this may be what I need to do to solve it. I have a long string of characters,752 total with the range 0-9 and a-f. I believe that the data needs to be aligned based off the processor and memory. The Cpu is at 2800MHz and the memory is 1024MB. Is there a simple way or direction someone may be able to point me in regarding separating the data from padding? I know this is a little vague but I'm in unknown waters here, any suggestions would be greatly appreciated! Thanks for your time!
     
  2. jcsd
  3. Jun 10, 2017 #2

    phinds

    User Avatar
    Gold Member
    2016 Award

    What does that even mean ?
     
  4. Jun 10, 2017 #3
    Sorry, let me see if I can straighten that up a bit. The way that data is stored is being based off the Cpu architecture, x86, and that coupled with the memory addresses. Here is a link that explains it some, but I'm just having a hard time wrapping my head around this.
    https://en.wikipedia.org/wiki/Data_structure_alignment
     
  5. Jun 10, 2017 #4

    jedishrfu

    Staff: Mentor

    Its not too hard to understand when you realize that the CPU imposes a certain preference in how it accesses memory.

    Some processors read several words at a time and discard some bytes depending on the instructions. Others may read a byte at a time and shift it into a register. This is where the notion of big endian (mainframes and powerpc used big endian) vs little endian comes from (intel uses little endian).

    This might also imply that there's wasted space in memory as data is aligned on even byte boundaries or even 4 or 8 byte boundaries taking advantage of the processor preference for such boundaries.
     
  6. Jun 11, 2017 #5
    Thank you so much! That was exactly what I needed!!!!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Processor and Memory data alignment with base pointers?
  1. Implementing processor (Replies: 0)

  2. Processor speed (Replies: 5)

Loading...