4

Why are most computers byte addressable instead of bit addressable?

By B/b addressable I mean that processor can operate on level of single B/b.

  • Bit addressable advantages:

Booleans have size of one bit.

You can directly access single bits in integers (without some dirty hacks like shifting).

  • Byte addressable advantages:

???

Ford O.
  • 223
  • 2
  • 7
  • Possible duplicate of [How many bits' address is required for a computer with n bytes of memory?](http://programmers.stackexchange.com/questions/178921/how-many-bits-address-is-required-for-a-computer-with-n-bytes-of-memory) – gnat Jun 01 '16 at 09:37
  • 2
    @gnat No, it is not duplicate, I am asking about all the advantages while your topic describes only one and only by accident since the author is asking for formula, not for explanation! – Ford O. Jun 01 '16 at 09:53
  • there's your answer, address length to address bits will be much longer than one for bytes. See also [How does word size affect the amount of virtual address space available?](http://programmers.stackexchange.com/questions/267218/how-does-word-size-affect-the-amount-of-virtual-address-space-available) and [What is the history of why bytes are eight bits?](http://programmers.stackexchange.com/questions/120126/what-is-the-history-of-why-bytes-are-eight-bits) – gnat Jun 01 '16 at 10:02
  • 2
    Huge waste of address space with minimum to no gain. This was especially relevant at times when memory addresses where less than 64bit. Though it still would not make much sense. – thorsten müller Jun 01 '16 at 10:08
  • @gnat I wouldn't call 3 extra bits "much longer", especially on 64-bit systems. – CodesInChaos Dec 14 '16 at 11:37

4 Answers4

8

The reason why the hardware isn't bit addressable is the cost and complexity to address to that level of granularity isn't justified. You need more wires the more accurately you address.

A lot of computers aren't really byte addressable either. They tend to move memory around in bigger chunks, 64 bytes is common.

Processors do allow you to read and write specific bytes for convenience. They translate to the actual addressing for you i.e. work out which block to move that contains the byte you are after.

The reason why bytes are chosen to be the convenient size is largely historic. It was a sensible compromise between the size of the word needed to address memory and the, possibly wasted, memory you get back. In the early days, the 8 fold difference in the amount of memory you could effectively address for a given size word was important. Today, with 64-bit systems, it's less so but there's no obvious benefit in causing the huge backwards incompatibility that a change would necessitate.

Alex
  • 3,882
  • 1
  • 15
  • 16
  • _They tend to move memory around in bigger chunks_ - So the extraction of single bytes (done by bit shifting I guess?) is fast enough to make this approach worth? – Ford O. Jun 02 '16 at 19:40
  • 1
    How many bits computers can move in a single chunk is irrelevant, if you can address individual bytes then your computer is byte-addressable. – Dmitry Grigoryev Oct 28 '16 at 11:37
6

Here are some thoughts:

  • You can address 8 times less memory with same size of addresses
  • do you just want to address bit wise and still operate on 8,16,.. bits at once just at bit addressable positions?
  • do you wish assembly commands just working on single bits?
  • registers in the CPU and also the data buses between the components of the hardware have fixed size. If you want to use them with every possible number of bits, the number of possibilities grow a lot on contrast to byte wise usage.
  • How often do you use bit operations? Are the extra efforts to be able to use bit wise addressing and operations worth this?

I think most Data is very suitable to be stored in multibles of 8 bits. e.g. ASCII, little values in 8,16,32,64 bits. So you gain very few by adding bit wise addressing but you get a much more compicated CPU, momory handling, caching, ... .

MrSmith42
  • 1,041
  • 7
  • 12
  • ASCII is technically a 7-bit encoding scheme, so not really the best argument in favor of 8-bit-addressing. – Miguel Bartelsman Nov 27 '21 at 09:42
  • @Miguel Bartelsman: You are right ASCII is 7 bit, but I know of no system where it was not stored as 8 bits. One bit for parity-check or to extend the ASCII code for custom reasons. – MrSmith42 Nov 30 '21 at 08:04
4

There have been bit-addressable architectures; for example, the CDC Cyber 200 series systems. (48 bit addresses)

There was a reason for this, however. The aforementioned machine is a vector (SIMD) machine and bit vectors are very important for controlling vector operations as well as denoting "sparse vectors", where storage for an element need only be allocated when the element is nonzero. The Cyber 200 had a complete set of bit operation, merge and select, as well as operations to generate control bit vectors.

But vector machines are a very different breed from normal scalar machines, which can "make do" with byte or word granularity in addressing.

user256761
  • 41
  • 1
3

There have been bit-addressable computers, with variable-sized words (up to a limit), see (for example) patent US4467443.

However, the more assumptions you can make and the less flexibility you have, the faster you can make your RAM. If you know that you will only ever fetch bytes (or 16-bit words, or 32-bit words, or 16-byte memory lines), you can wire up all of this in parallel, but that is harder (although not impossible) to do with a more flexible design.

There's also been CPUs where the size of the word fetched decides the granularity of the addressing. So bytes can be at any byte-address, 16-bit words must be at an even address, and 32-bit words at an address that is a multiple of four.

Vatine
  • 4,251
  • 21
  • 20