CITS2002 Systems Programming  
prev
next CITS2002 CITS2002 schedule  

Units of data: bits, bytes, and words

  • The basic building block is the bit (binary digit), which can contain a single piece of binary data (true/false, zero/one, high/low, etc.).

    Although processors provide instructions to set and compare single bits, it is rarely the most efficient method of manipulating data.

  • Bits are organised into larger groupings to store values encoded in binary bits. The most basic grouping is the byte: the smallest normally addressable quantum of main memory (which can be different from the minimum amount of memory fetched at one time).

    In modern computers, a byte is almost always an 8-bit byte, but history has seen computers with 7-, 8-, 9-, 12-, and 16-bit bytes.

  • A word is the default data size for a processor. The word size is chosen by the processor's designer and reflects some basic hardware issues (such as the width of internal or external buses).

    The most common word sizes are 32 and 64 bits; historically words have ranged from 16 to 60 bits.

  • It is very common to speak of a processor's wordsize, such as a 32-bit or 64-bit processor.
    However, different sources will confuse whether this means the size of a single addressable memory location, or the default unit of integer arithmetic.

  • Some processors require that data be aligned, that is, 2-byte quantities must start on byte addresses that are multiples of two; 4-byte quantities must start on byte addresses that are multiples of four; etc.

    Some processors allow data to be unaligned, but this can result in slower execution as the processor may have to align the data itself.

 


CITS2002 Systems Programming, Lecture 6, p8, 7th August 2024.