101

What were the historical forces at work, the tradeoffs to make, in deciding to use groups of eight bits as the fundamental unit?

There were machines, once upon a time, using other word sizes. But today, for non-eight-bitness, you must look to museum pieces, specialized chips for embedded applications, and DSPs. How did the byte evolve out of the chaos and creativity of the early days of computer design?

I can imagine that fewer bits would be ineffective for handling enough data to make computing feasible, while too many would have lead to expensive hardware. Were other influences in play? Why did these forces balance out to eight bits?

(BTW, if I could time travel, I'd go back to when the byte was declared to be 8 bits, and convince everyone to make it 12 bits, bribing them with some early 21st century trinkets.)

DarenW
  • 4,433
  • 3
  • 22
  • 43
  • 8
    This might be one of those questions where we can't answer it better than good old [Wikipedia](http://en.wikipedia.org/wiki/Byte). – Scott Whitlock Nov 16 '11 at 19:53
  • 11
    So why would you prefer 12 bits to 8? – FrustratedWithFormsDesigner Nov 16 '11 at 19:59
  • 1
    @Scott: Yeah, I was going to say it was the IBM 360 (of which *Stretch* was the forerunner) but Wikipedia's got it all in there. They don't seem to mention the PDP-11, which brought bytes into the non-punch-card world. They also don't mention Univac, which had 9-bit bytes. – Mike Dunlavey Nov 16 '11 at 20:00
  • 8
    Is the last sentence in jest? A 12-bit byte would be inconvenient because it's not a power of 2. – Rob Nov 16 '11 at 20:00
  • 19
    Memory and registers weren't so cheap back then, so 8 bits was a good compromise, compared to 6 or 9 (fractions of a 36-bit word). Also, address calculations are a heck of a lot simpler with powers of 2, and that counts when you're making logic out of raw transistors in little cans. – Mike Dunlavey Nov 16 '11 at 20:05
  • 2
    Re 12 bits: Back when I first learned digital electronics, in the days of 7400 series TTL, logic gates usually came 4 or 3 to a chip, or 6 inverters on a chip. Handling a 12-bit word would have been doable different ways. As for addressing and powers-of-two wordsizes, did those early pioneers use addresses to individual bits? – DarenW Nov 17 '11 at 05:50
  • 9
    Using word sizes that were powers of 2 were not so important in the "early days". The DEC-10 had a 36 bit word, and the CDC 6000 series had 60 bit words, and index registers with 18 bits. – Jay Elston Nov 17 '11 at 18:53
  • 4
    I really wonder why 10 bits for a byte were never considered. Number of bits should not be a power of two - we don't need to address bits, only bytes. 10 bits bytes would be very good for begginers in computers: one byte can address one kilobyte, two bytes can address one megabytes, etc... it just feels so natural and eases understanding and programming! 10 bits fit more values and still we can use digits and letters for representation (as we do with hex) - base32 encoding. 10 bits bytes looks like a fair and convenient compromise, hope we will have the chips soon. – wobmene Jan 02 '14 at 00:00
  • 2
    @khrf9 Building a mental model of mutation (especially when most mainstream languages abuse the = sign for something that's very much not equality), pointers/references/aliasing, and recursion are *much* bigger hurdles to beginning programmers. Beginners don't even need to understand there's a limit to 32-bit integers just yet, and in any exercise where it would matter they don't need to know the precise number since they should be comparing against a predefined constant. – Doval Jul 29 '16 at 14:45
  • 1
    > As for addressing and powers-of-two wordsizes, did those early pioneers use addresses to individual bits? < is that also a serious question? in `BIT SET`, `BIT CLR`, `BIT TGL`, and `BIT TST` operations there is a field in the opcode that defines which bit. 5 bit field for 32-bit words. – robert bristow-johnson Jul 29 '16 at 21:45

7 Answers7

81

A lot of really early work was done with 5-bit baudot codes, but those quickly became quite limiting (only 32 possible characters, so basically only upper-case letters, and a few punctuation marks, but not enough "space" for digits).

From there, quite a few machines went to 6-bit characters. This was still pretty inadequate though -- if you wanted upper- and lower-case (English) letters and digits, that left only two more characters for punctuation, so most still had only one case of letters in a character set.

ASCII defined a 7-bit character set. That was "good enough" for a lot of uses for a long time, and has formed the basis of most newer character sets as well (ISO 646, ISO 8859, Unicode, ISO 10646, etc.)

Binary computers motivate designers to making sizes powers of two. Since the "standard" character set required 7 bits anyway, it wasn't much of a stretch to add one more bit to get a power of 2 (and by then, storage was becoming enough cheaper that "wasting" a bit for most characters was more acceptable as well).

Since then, character sets have moved to 16 and 32 bits, but most mainstream computers are largely based on the original IBM PC. Then again, enough of the market is sufficiently satisfied with 8-bit characters that even if the PC hadn't come to its current level of dominance, I'm not sure everybody would do everything with larger characters anyway.

I should also add that the market has changed quite a bit. In the current market, the character size is defined less by the hardware than the software. Windows, Java, etc., moved to 16-bit characters long ago.

Now, the hindrance in supporting 16- or 32-bit characters is only minimally from the difficulties inherent in 16- or 32-bit characters themselves, and largely from the difficulty of supporting i18n in general. In ASCII (for example) detecting whether a letter is upper or lower case, or converting between the two, is incredibly trivial. In full Unicode/ISO 10646, it's basically indescribably complex (to the point that the standards don't even try -- they give tables, not descriptions). Then you add in the fact that for some languages/character sets, even the basic idea of upper/lower case doesn't apply. Then you add in the fact that even displaying characters in some of those is much more complex still.

That's all sufficiently complex that the vast majority of software doesn't even try. The situation is slowly improving, but slowly is the operative word.

Jerry Coffin
  • 44,385
  • 5
  • 89
  • 162
  • 9
    I thought I read somwehere 8 came from the 7bit ASCII plus a validation bit that was needed because the nearly transmission protocols were not as loss-less as the designers wanted :-). – Martin York Nov 16 '11 at 22:42
  • 3
    @LokiAstari, Yes, it's called a parity bit, and can be used for crude forms of error detection or recovery. [Wikipedia: Parity bit](http://en.wikipedia.org/wiki/Parity_bit) – user Nov 17 '11 at 12:53
  • 2
    Not sure what the IBM PC has to do with this. "8 bit per byte" was already standard in the CP/M era (<1980), which started on the 8080 CPU (a predecessor of the 8086/8 of the IBM PC era) – MSalters Nov 17 '11 at 15:11
  • 1
    @MSalters: Primarily that it has (arguably) "stunted" the evolution of hardware. No, 8-bits/byte wasn't *new* with the PC, *but* until then, most architectures were replaced every few years. The PC has largely stopped that, and taken an architecture that wasn't even particularly progressive when it was new, and preserved it for *decades*. – Jerry Coffin Nov 17 '11 at 15:16
  • @LokiAstari: yes, parity was often stored in the "last" bit, but I think that was mostly just making use of it because it was there. Many of the even older 6-bit machines working with even less dependable storage/transmission still did perfectly well without that parity bit for each byte. – Jerry Coffin Nov 17 '11 at 15:19
  • 1
    On the IBM PC compatibles I was supporting in the 80s, parity was stored in a NINTH bit, one that was inacessible to software. I never ran into anything that used the eighth bit for parity. NOT saying it didn't happen, 'cos, oh gods, computer hardware of the 70s and 80s, EVERYTHING happened. – mjfgates Nov 17 '11 at 18:20
  • 1
    @mjfgates: It wasn't quite so common for *storage*, but 7-1-1 (7 data bits, one parity bit, one stop bit) *transmission* was pretty common for a long time (and much of the original reason for things like uuencode and such). – Jerry Coffin Nov 17 '11 at 18:51
  • It's also the case that IBM were *huge* supporters of EBCDIC (and Google *that* if you want to see what happens when the abyss stares back at you) which was an 8-bit character set. – Maximus Minimus Dec 11 '12 at 15:36
  • Another thread on superuser http://superuser.com/a/609841/78897 has some info too. – Pacerier Sep 15 '14 at 14:30
  • @Pacerier: Unfortunate, some of the information there is just plain wrong (e.g., it says the PDP-10 was a 32-bit machine, but it was actually a 36-bit machine). – Jerry Coffin Sep 15 '14 at 15:02
  • @JerryCoffin, Would be good to comment there directly so the writer can make the amendments – Pacerier Sep 16 '14 at 16:45
  • @Pacerier: Feel free. I'm not going to sign up for a site I don't care about just to correct them on a subject that doesn't matter much anyway. – Jerry Coffin Sep 16 '14 at 16:46
  • 1
    So in other words, 8 bit bytes just happened to be popular when the music stopped? – user253751 Aug 11 '16 at 23:26
  • 5
    Current character sets aren't 16 or 32 bits, nor do Java and Windows use such. The current character set is Unicode, which is needs 21 bits to map directly. Current software uses encodings based on 8 (UTF-8), 16 (UTF-16) or 32 (UTF-32) bit code units, combining multiple code units to form a single code point where necessary, but those bits sizes are a consequence of the hardware, not of the character set. – Sebastian Redl Aug 14 '16 at 22:45
  • @SebastianRedl It’s a software decision to store Unicode data in 8, 16, or 32-bit code units instead of, say 24-bit code units. And a lot of programs still do the wrong thing outside the BMP, so I would say those programs use 16-bit characters. Even in Java, the `char` type is 16 bits, and it’s easy to get supplementary plane stuff wrong. – Daniel H May 17 '17 at 20:24
12

Seven bits for ASCII information, and one for error-detecting parity.

Jay Elston
  • 2,680
  • 22
  • 30
DeadMG
  • 36,794
  • 8
  • 70
  • 139
  • 31
    7bits for ASCII and one extra bit that has been used for all sorts of things – Martin Beckett Nov 17 '11 at 06:58
  • 1
    Parity was very important when dealing with early memory. Even after moving to 8 bit data bytes, there were memory chips with 9 bits to allow for parity checking. – Jim C Nov 17 '11 at 13:13
  • 2
    This is an interesting assertion. Is there any historical data to support the idea? – david Jan 17 '13 at 08:28
5

Take a look at Wikipedia page on 8-bit architecture. Although character sets could have been 5-, 6-, then 7-bit, underlying CPU/memory bus architecture always used powers of 2. Very first Microprocessor (around 1970s) had 4-bit bus, which means one instruction could move 4-bits of data between external memory and the CPU.

Then with release of 8080 processor, 8-bit architecture became popular and that's what gave the beginnings of x86 assembly instruction set which is used even to these days. If I had to guess, byte came from these early processors where mainstream public began accepting and playing with PCs and 8-bits was considered the standard size of a single unit of data.

Since then bus size has been doubling but it always remained a power of 2 (i.e. 16-, 32- and now 64-bits) Actually, I'm sure the internals of today's bus are much more complicated than simply 64 parallel wires, but current mainstream CPU architecture is 64-bits.

I would assume that by always doubling (instead of growing 50%) it was easier to make new hardware that coexists with existing applications and other legacy components. So for example when they went from 8-bits to 16, each instruction could now move 2 bytes instead of 1, so you save yourself one clock cycle but then end result is the same. However, if you went from 8 to 12-bit architecture, you'd end breaking up original data into halfs and managing that could become annoying. These are just guesses, I'm not really a hardware expert.

DXM
  • 19,932
  • 4
  • 55
  • 85
  • 6
    *"Very first CPU (around 1970s) ..."*. You need to do some reading on the history of computing!! The very first CPU for a von Neumann architecture computer was built during World War II ... or before (depending on whose version of history you believe.) – Stephen C Nov 17 '11 at 03:20
  • and there were computing devices in 19th century and I'm sure egyptians had some kind of calculator pot. That info came from the Wikipedia page that I linked. Like I said, I'm not a hardware expert and I'm certainly not a historian, but if you feel that I'm so far off, you might want to go update that wikipedia page. – DXM Nov 17 '11 at 04:02
  • I guess it would help if I didn't screw up the link as I was entering in. I also I apologize for saying "first CPU". Since I was quoting the wiki page, I should have said "first microprocessor". That's what I meant. Sorry about that. – DXM Nov 17 '11 at 04:05
  • A solution to the "pre-electron" computer is to say modern computer or I suppose the electron computer. Even today you could build a mechanical computer. It wasn't until we started to use electron fields to our advantage did we build a micro-processor. – Ramhound Nov 17 '11 at 13:37
  • The 8-bit byte and 16-bit word size used by the PDP series may have also played a factor in the popularity of 8-bit bytes. – Jay Elston Nov 17 '11 at 18:56
4

A byte has been variously (at least) 1, 4, 6, 7, 8, 9, 12, 18, 20 and possibly 36 bits, depending on what computer you are looking at. I am taking "byte" here to mean "smallest addressable unit of memory", rather than using any sort of text-centric interpretation. (For example, the Saturn CPU, a 64-bit CPU used in the popular HP48SX/GX calculator line addresses memory in nibbles -- 4-bits.)

The 20-bit bytes were extremely common in the "IAS machines", in the 50s. 6, 12, 18 (and maybe 36) were quite popular in a variety of architectures in the 60s, 70s and to some degree 80s.

In the end, having a nice correspondence between "powers of 2" and "bits in an addressable unit" seem to have won out.

Michaelangel007
  • 213
  • 1
  • 5
Vatine
  • 4,251
  • 21
  • 20
  • And never 10 bits? All I could find with Google is some recent video processors are 10 bits. – wobmene Jan 02 '14 at 00:07
  • @khrf It's possible, I just can't recall any architecture that had it (I mostly considered general-purpose computers). – Vatine Jan 02 '14 at 12:08
  • Yes, I consider general-purpose computers too. It's strange because I imagine how nice it would be with 10-bits-byte to know that you can address 1 kilobyte with 1 byte, 1 megabyte with 2 bytes, etc. Of course, it's just a caprice on comfort :) – wobmene Jan 06 '14 at 15:03
4

First a bit of clarification: Octets (8-bit units) are not really a fundamental unit in modern computer architectures. At least not any more fundamental than other powers of two - 2, 4, 16, 32, 64, 128 etc. Octets were the fundamental unit for 8-bit processors (hence the name!), but modern architectures typically work with larger bit-sets internally. E.g. the x86_64 has 64 bit integer registers and 80 bit floating point registers. RAM is read and written in 64-bit chunks, and the processor just uses a bit of magic to make it look like you can address individual 8-bit bytes.

For older architectures, "byte" indicated the size of the data bus, and as the original question states, a lot of different bus sizes existed (4, 5, 6, 8, 12 etc.). But since 1993 a byte has been defined as 8 bits, in order to have a standardized SI unit for data sizes. Hence the meaning of "byte" has changed from being an architecture-dependent unit to an architecture-independent standardized unit.

So these days, bytes are the standard unit for addressing and quantifying data, but not really fundamental otherwise.

Octets unit became the de-facto standard for storage primarily due to concerns about storing text. For storing text you ideally want one byte to store one character. Two factors were important:

  • Having units which are powers of two (2, 4, 8, 16, 32 etc.) is more convenient when designing digital systems.
  • 8-bit is enough to store a single character in the ASCII character set (with room to spare for extending the character set to support say Cyrillic).

Of course 8-bits are not enough to support all scripts - something like Japanese requires at least 16 bits (and for what it is worth, Unicode is 21 bits), but at that point in time bits were expensive and most digital text were in the ASCII range anyway.

These days, text is typically stored in variable-width encodings like UTF-8, and with things like Unicode combining characters, the "one byte equals one character" have long been a thing of the past. Today byte is really just the standard for historical reasons.

JacquesB
  • 57,310
  • 21
  • 127
  • 176
  • "the processor just uses a bit of magic to make it look like you can address individual 8-bit bytes." it's not that simple, you can't just have the processor turn an 8 bit operation into a 64-bit read-modify-write operation because there might be more than one processor in the system and because memory mapped IO devices may respond differently to different sizes of write. – Peter Green Sep 08 '22 at 20:50
1

A byte doesn't have to be 8 bits, but it appears that C and C++ define a byte as being at least 8 bits (although it could be more). This question on Stack Overflow mentions a few systems where 1 byte is not 8 bits.

Thomas Owens
  • 79,623
  • 18
  • 192
  • 283
1

According to my information the word byte itself was derived from the phrase by-eight which was eight (8) bits words. the convenience we find in 8 bits words is the conversion to hexadecimal values since the value 00000000 = 00 & 11111111 = FF (Dec 255 for unsigned and -127 for signed) it is easy to do all arithmetic operations on such structure including bit-wise operations.

I see bytes (8 bits words) as a natural evolution of word sizes from catastrophically small 3 bits up to ridiculously big 60 bits words

A.Rashad
  • 594
  • 3
  • 19
  • I'd like to see a reference for that. I seriously doubt it. Especially as the word "byte", as used in the C Standard and incorporated in the C++ standard, doesn't mean "8 bit". An 8 bit quantity is an octet. – gnasher729 Aug 11 '16 at 21:21
  • @gnasher729 I read the same etymological explanation (by-eight), don't remember where and cannot find a reference so this may have been made up later. Octet is defined as a sequence/unit of 8 bits but that does not strike me as a data type. It is what you use when you refer to a particular set of bits within a word, a range. I am yet to see a programming language that uses the keyword octet for an 8-bit unsigned integer. And I haven't seen one programming language that has a keyword byte that does not unambiguously mean 8-bit unsigned integer. So it seams to me this debate is purely academic. – Martin Maat Sep 07 '22 at 10:35