72

I have tried to get a grasp of what "word" means and I have looked in the wiki and the definition is vague. So my question is what is "word size"? Is it the length of the data bus, address bus?

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
kofhearts
  • 3,607
  • 8
  • 46
  • 79
  • 1
    possible duplicate of [word size and data bus](http://stackoverflow.com/questions/11472484/word-size-and-data-bus) – Ken White Nov 06 '13 at 19:48
  • 2
    This incomplete description of [Memory granule terms](https://sites.google.com/site/paulclaytonplace/andy-glew-s-comparch-wiki/memory-granule-terms) taken from Andy Glew's CompArch wiki (which has been down for a while) might be slightly helpful. –  Apr 02 '15 at 12:43
  • 1
    possible bad grammar in question title – MisterGeeky Jan 12 '19 at 19:40

5 Answers5

79

"Word size" refers to the number of bits processed by a computer's CPU in one go (these days, typically 32 bits or 64 bits). Data bus size, instruction size, address size are usually multiples of the word size.

Just to confuse matters, for backwards compatibility, Microsoft Windows API defines a WORD as being 16 bits, a DWORD as 32 bits and a QWORD as 64 bits, regardless of the processor.

ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66
  • 9
    WORD=16 bits is Intel terminology. Modern x86 CPUs evolved from 8086, where the register width and bus width really was 16 bits. 386 added 32-bit mode, but didn't remove 16-bit mode, so Intel kept things sane by sticking with the 8086 definition for all future x86. e.g. [AVX512BW adds SIMD instructions that operate on 8-bit (B) and 16-bit (W) elements.](https://en.wikipedia.org/wiki/AVX-512#New_instructions_in_AVX-512_BW,_VBMI_and_DQ). It's a minor quirk of terminology instead of a major headache (like if the same asm instruction meant different things depending on what mode you're in.) – Peter Cordes Apr 18 '18 at 03:44
  • 2
    Any idea why is it called "word" and not, say, "letter"? – asterite Jul 26 '19 at 16:30
  • @asterite: I think the analogy behind the naming is bytes being letters, and a word composed of multiple letters. (A byte normally *does* hold a single character when working with strings, so that part of the analogy holds. Some early computers (and modern DSPs) only had word-addressable memory, but might still pack multiple characters into each word.) – Peter Cordes Sep 02 '23 at 18:38
12

Consider the following:

CPU (processor), RAM (main memory), I/O devices (mouse, keyboard, printer), Bus (data transfer component).

How would you like these computer parts to communicate and transfer data? you definitely need a fixed size of bits to be considered a single unit of data.

For that, Computer scientists agreed to standardize this unit to be 32 bits or 64 bits (depending on the manufacturer choice).

They gave this unit a name and called it a Word.

So a Word is nothing but a unit of data (bunch of bits (signal charges of zeros and ones)) that moves around from a computer component to another.

For instance buses are built with 32 bits (4 bytes) and some with 64 bits (8 bytes). Likewise with the CPU (hardware) and operating systems (software) are built with either 32 bits or 64 bits.

It just happened to be the standard unit named Word and sized 32 bits or 64 bits.

Ps: Word is one of the many data size units that move around inside the computer, different computer components use different sizes to transport data (signals charges that represent zeros and ones), for instance RAM can use size of 64 bits while Buses can use 32 bits. Hardware designers design the architecture of components taking into account these size differences to either implement Word size of 32 bits on only CPU but 64 bits on RAM, or implement the same size on all components, ...etc. Word size used to be 8 bits (1 byte), but nowadays the most comment unit size is 64 bits on most computer components such as CPU or RAM, or Bus, ...etc.

Fouad Boukredine
  • 1,495
  • 14
  • 18
  • 2
    I/O devices like a USB host controller aren't required to have I/O registers the same width as the CPU word size. A byte is the fundamental unit; and word size isn't even the register width on 64-bit architectures. For example, on 64-bit MIPS, `dadd` is (double-word add) is the instruction for 64-bit add. Or in a modern x86 CPU, data moves around internally on busses much wider than an integer register, e.g. the 64 byte (full cache line) path between L1d and L2 in Haswell/Skylake: [How can cache be that fast?](//electronics.stackexchange.com/a/329955) – Peter Cordes Apr 18 '18 at 03:35
  • 2
    Single byte stores are natively supported in almost all modern CPUs (DEC Alpha in the early 1990s being the most recent mainstream exception) See [Can modern x86 hardware not store a single byte to memory?](//stackoverflow.com/q/46721075). So even between CPU and memory, transfer sizes are not strictly fixed at the word size or bus width, for uncached stores. – Peter Cordes Apr 18 '18 at 04:39
  • 1
    I think you misunderstood my answer. OP asked about Word meaning in computer, I explained in simple English what it is and how it is implied, but I never said a Word is the same size implemented across all components. of course some components may use different sizes than others depending on how they're designed. But thanks for the informative explanation on what unit data size different component use. I've added a "Ps" note to elaborate my point and make it clear to readers. – Fouad Boukredine Apr 18 '18 at 22:41
  • 1
    I still don't think it's a good explanation. It makes "word size" sound much more important than it is. Everything outside your PS implies that a word is the fundamental unit of data between different components, but that's what bytes are. (Except on computers with only word-addressable memory.) Word size is a pretty fuzzy term in modern computing, but is often related to the register width of the CPU. Knowing that the word size of a computer doesn't tell you as much as you might hope; you have to know the details to know what it means for that particular architecture! – Peter Cordes Apr 18 '18 at 23:13
  • You're narrowing down your answer and referring to CISC (Complex Instruction Set Computer), since they use "bytes" for measurement, Yes generally CISC have instructions of various length: 1 to 15 bytes for x86. But there is also RISC (A Reduced Instruction Set Computer) type of ISA where instructions are FIXED in length typically corresponding to the architecture’s word size, such as 32 bits or 64 bits. Now back to the OP question, remember, he asked about what a Word is, not whether Word is used/important in modern computing or not. – Fouad Boukredine Apr 19 '18 at 02:14
  • If you'd actually read [my answer on the question I linked](//stackoverflow.com/q/46721075), you'd see I considered modern RISC ISAs too. MIPS, SPARC, and so on all have load-byte and store-byte instructions *and implement them efficiently, not with a read-modify-write of the containing word*. You still have instruction words, so MIPS is definitely somewhat word-oriented, but it's a mistake to think that words are the only thing a RISC can deal with. MIPS32r6 even requires support for unaligned word load/store. (Modern ARM isn't really RISC, but it too fully supports byte load/store). – Peter Cordes Apr 19 '18 at 03:47
  • Early DEC Alpha is the *only* mainstream CPU architecture since the 1970s to leave out byte load/store and be completely word-oriented (and is an interesting example, being one of the only ISAs that was 64-bit from the start, not an extension to 32-bit). Even Alpha added byte load/stores in the 3rd generation of the architecture. Anyway, more importantly is that 64-bit CPUs don't *only* support 64-bit operations; 32 and 64-bit operand size are usually equally well supported. So it's *not* like the word-size is 64 on MIPS64. Instruction words are still 32-bit. – Peter Cordes Apr 19 '18 at 03:50
  • 2
    You probably already know some of that, and simplified for beginners. But an over-simplified answer that gives the wrong impression about words being all-important leads to wrong ideas like that `uint8_t` is inherently slow for *all* uses. Better to say that the term is kind of muddy. – Peter Cordes Apr 19 '18 at 03:53
  • Yes I see your point, and I'm glad you got mine :) that I just simplified the concept for easy understanding to beginners. But you're right about your points, and thumps up from me – Fouad Boukredine Apr 19 '18 at 15:58
11

One answer is -- not as much as it used to. Way back when, computers could only load/store full "words" of memory, which would be 16/24/32/36/48 bits each (depending on the particular machine). One would have to carefully structure their program design around the word size of the target machine.

But any more computers can access individual bytes or can access strings of data dozens of bytes long, with one relatively seamless operation. Much more significant than the technical word size is the memory buss width, which determines how many bytes can be transferred between CPU and memory in one memory "cycle".

So "word size" is somewhat meaningless, and (as another answer suggests) companies like Microsoft will often define it in an arbitrary manner, with no real relationship to anything.

Hot Licks
  • 47,103
  • 17
  • 93
  • 151
  • These days it's more of a reflection of register size, I think, but even that's a bit blurry with SIMD registers in the mix... – twalberg Nov 06 '13 at 19:57
  • @twalberg - Yeah, you have half, single, and double registers, plus floating-point registers. And that's before you even get close to SIMD. – Hot Licks Nov 06 '13 at 21:11
6

Word size means the no. of bits of data processed by the microprocessor as a unit.

user6739949
  • 71
  • 1
  • 1
2

Word is set of bits acts as a single unit of data processed by microprocessor. However, it can be any set value, common values included: 16, 18, 24, 32, 36, 40, 48, and 64.

Analogy:
In English language, word is a single distinct meaningful element of speech or writing, used with others to form a sentence.

Premraj
  • 72,055
  • 26
  • 237
  • 180
  • 1
    No, a byte is the smallest unit of data you can load or store separately. Most computers have byte-addressable memory and support byte loads/stores as well as word loads/stores. See [Can modern x86 hardware not store a single byte to memory?](//stackoverflow.com/q/46721075) for more details about how all x86 and nearly all modern CPUs of any kind natively support byte stores, rather than emulating them with a read-modify-write of the containing aligned word. The major exception being DSPs which may only support word operations. – Peter Cordes Apr 18 '18 at 03:38
  • 1
    On some CPUs, a word is the *largest* unit of data you can work with, but not all. It's not a well-defined term. – Peter Cordes Apr 18 '18 at 03:39