Processor and Memory data alignment with base pointers?

Click For Summary

Discussion Overview

The discussion revolves around the concept of data alignment in relation to processor architecture and memory management. Participants explore how data should be organized based on CPU specifications and memory addresses, particularly in the context of a specific problem involving a long string of characters.

Discussion Character

  • Exploratory
  • Technical explanation

Main Points Raised

  • One participant describes a challenge involving a string of characters and seeks guidance on separating data from padding, indicating a lack of clarity on the topic.
  • Another participant clarifies that data storage is influenced by CPU architecture (specifically x86) and memory addresses, providing a link for further reading.
  • A different participant explains that CPUs have preferences for how they access memory, which can lead to wasted space due to alignment on specific byte boundaries.
  • This participant also introduces the concepts of big endian and little endian, noting their relevance to how data is read by different processors.

Areas of Agreement / Disagreement

Participants generally agree on the importance of understanding data alignment in relation to CPU architecture, but there is no consensus on specific methods for addressing the initial problem posed.

Contextual Notes

The discussion does not resolve the specific question of how to separate data from padding, and assumptions about the nature of the data and its alignment requirements remain unaddressed.

drgibbles
Messages
3
Reaction score
0
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!
 
Computer science news on Phys.org
drgibbles said:
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!
What does that even mean ?
 
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
 
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.
 
Thank you so much! That was exactly what I needed!
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
Replies
6
Views
3K
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
22
Views
5K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 11 ·
Replies
11
Views
4K