Data structure alignment

Data structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing. The CPU in modern computer hardware performs reads and writes to memory most efficiently when the data is naturally aligned, which generally means that the data's memory address is a multiple of the data size. For instance, in a 32-bit architecture, the data may be aligned if the data is stored in four consecutive bytes and the first byte lies on a 4-byte boundary.

Comment
enData structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing. The CPU in modern computer hardware performs reads and writes to memory most efficiently when the data is naturally aligned, which generally means that the data's memory address is a multiple of the data size. For instance, in a 32-bit architecture, the data may be aligned if the data is stored in four consecutive bytes and the first byte lies on a 4-byte boundary.
Cs1Dates
eny
Date
enJanuary 2020
Has abstract
enData structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing. The CPU in modern computer hardware performs reads and writes to memory most efficiently when the data is naturally aligned, which generally means that the data's memory address is a multiple of the data size. For instance, in a 32-bit architecture, the data may be aligned if the data is stored in four consecutive bytes and the first byte lies on a 4-byte boundary. Data alignment is the aligning of elements according to their natural alignment. To ensure natural alignment, it may be necessary to insert some padding between structure elements or after the last element of a structure. For example, on a 32-bit machine, a data structure containing a 16-bit value followed by a 32-bit value could have 16 bits of padding between the 16-bit value and the 32-bit value to align the 32-bit value on a 32-bit boundary. Alternatively, one can pack the structure, omitting the padding, which may lead to slower access, but uses three quarters as much memory. Although data structure alignment is a fundamental issue for all modern computers, many computer languages and computer language implementations handle data alignment automatically. Fortran, Ada, PL/I, Pascal, certain C and C++ implementations, D, Rust, C#, and assembly language allow at least partial control of data structure padding, which may be useful in certain special circumstances.
Hypernym
Data
Is primary topic of
Data structure alignment
Label
enData structure alignment
Link from a Wikipage to an external page
bitsavers.trailing-edge.com/pdf/intel/ISIS_II/9800639-04E_8086_Famility_Utilities_Users_Guide_May82.pdf
web.archive.org/web/20200229032355/http:/bitsavers.trailing-edge.com/pdf/intel/ISIS_II/9800639-04E_8086_Famility_Utilities_Users_Guide_May82.pdf
www.eventhelix.com/RealtimeMantra/ByteAlignmentAndOrdering.htm
csapp.cs.cmu.edu/
www.catb.org/esr/structure-packing/
www.codesynthesis.com/~boris/blog/2009/04/06/cxx-data-alignment-portability/
www.ibm.com/developerworks/library/pa-dalign/
fylux.github.io/2017/07/11/Memory_Alignment/
msdn2.microsoft.com/en-us/library/ms253949.aspx
www.cpu2.net/stackalign.html
Link from a Wikipage to another Wikipage
64-bit
Ada (programming language)
Array of structures
Assembly language
Binary numeral system
Bitwise AND
Bitwise NOT
Borland
Byte
C (programming language)
C++
C++Builder
Cache line
Category:Compiler construction
Category:Composite data types
Central processing unit
CodeGear
Compiler
Computer memory
CPU cache
C Sharp (programming language)
D (programming language)
Data structure
Digital Mars
Endianness
Fortran
GNU
GNU Compiler Collection
I
Intel Corporation
Interpreter (computing)
Kibibyte
LP64
Memory management unit
Memory space (computational resource)
Memory word
Microsoft
Modulo operation
Network byte order
Page fault
Pascal (programming language)
Pearson Education
Primitive data type
Record (computer science)
Rust (programming language)
Sizeof
Space–time tradeoff
Translation lookaside buffer
Two's complement
Visual C++
X86
SameAs
Alignement en mémoire
Data structure alignment
m.06z0 z
Parallellstilte data
Q1413745
RBR3
Speicherausrichtung
Zarovnání paměti
Вирівнювання даних
Выравнивание данных
Подравняване на структури от данни
Поравнање структуре података
تراز ساختمان داده
データ構造アライメント
数据结构对齐
Subject
Category:Compiler construction
Category:Composite data types
WasDerivedFrom
Data structure alignment?oldid=1122831118&ns=0
WikiPageLength
25666
Wikipage page ID
2247927
Wikipage revision ID
1122831118
WikiPageUsesTemplate
Template:Anchor
Template:Application binary interface
Template:Citation needed
Template:Cite book
Template:Efn
Template:Math
Template:Mono
Template:Multiple issues
Template:Notelist
Template:Original research
Template:Refimprove
Template:Reflist
Template:Short description
Template:Use dmy dates