TVTropes Now available in the app store!
Open

Follow TV Tropes

Binary Bits and Bytes

Go To

"If you can count to two, you can count to anything!"

First things first. Despite being represented as zeroes and ones, binary is not actually made of them. It can be any two distinct states; it's commonly represented as zeroes and ones because "00011101" is much easier to read and comprehend than "off, off, off, on, on, on, off, on". The states can be hole or no hole (ye olde punchcarde), voltage/no voltage (RAM), magnetic field polarities (Magnetic Disks), reflective/not reflective (Optical Discs, e.g. Compact Discs), or anything else; the binary 0s and 1s are simply practical methods to represent the state of the electronic hardware. Which state represents which "digit" varies by architecture, but it's canonical to say either 0 or "off" and 1 or "on". Nowadays in some cases, it is not even a state that is represented by ones and zeroes, it is the change of the state, with 1 being an increase of some value, and 0 being a drop, for example.

What is a bit and a byte?

A bit is one of these pieces of information. Its value - the state - can either be 1 or 0. A bit is the smallest single unit of information possible in an electronic device. Everything you work with on your computer is composed of nothing but a long series of bits, and all numbers are internally represented as a binary number. It is technically possible to build a computer that counts in regular decimal numbers, and some early ones were in fact built this way, until the benefits of a binary system were understood, but bits are used for various reasons: they're easier to handle, the underlying electronics are cheaper, and because it also allows for logical operations in addition to your standard addition and subtraction. In practice, it's common to write binary numbers in hexadecimal (base 16), because hexadecimal is easier to read than binary and converts easily to and from binary.

A byte is a set of eight bits. Why not ten, since we count in base ten? There's several reasons for this:

  • The biggest one is it's a power of 2, which makes it much easier to work with when using binary math.
  • It's still large enough to be relatively useful. Historically computers used the number of bits needed to encode a character. 7-bit was popular for a time, but adding an additional bit allowed for some useful tricks. One such is using the 8th bit to determine when printing a character to display it normally (say black on white) or inversely (white on black), so you could theoretically get twice the characters without needing to use twice the ROM space.
  • It can be represented in two hexadecimal digits for easier reading. Or 3 octal digits if you use a system that prefers that.

A single bit isn't very useful, which is why from the earliest days of computing they were grouped in bytes, (which is actually a pun). They usually were the smallest unit that could be looked up in memory. On the other hand, while processing information it was usually handled in different groupings based on the Central Processing Unit design, called 'words', and each computer had its own word length. Some computers, especially military ones, could have decidedly odd word lengths, like 21 or 37 bits, and thus byte length varied from 5 to 11 bits (a word length usually being a multiple of a byte length). Smaller processors and microcontrollers could even have a sub-byte word lengths — for example, Intel 4004, the very first microprocessor ever, had a word that was 4 bits long. There is even a term for 4 bits, a "nybble" or "nibble," since it's "half a byte."

When they were building minicomputers and mainframes in the 1950s and 1960s nobody knew exactly what standard for byte and word size would become standard. Control Data made 60-bit word Cyber mainframes and six-bit bytes; Digital Equipment Corporation made 36-Bit DEC 10 and DEC 20 mainframes with 9 bit bytes, and other companies picked other sizes. Standardization wouldn't occur until someone made a huge number of sales.

It was the IBM System/360 mainframe of 1964, an incredibly influential computer system, that standardized the 8-bit byte, because it was one of the first systems geared for text processing in addition to pure number crunching. It encoded text as 8 bits per symbol, so it was quite logical to have a 8-bit byte; the computer could then address each symbol separately, saving the work on transcoding. For the same reason it also codified words constructed out of bytes — before that the "byte addressing" described above wasn't a given, a lot of machines had pure "word addressing", without breaking it to bytes. This resolved a conflict between processing, where a longer word is more efficient, and addressing, where a shorter word is more efficient. Each address in the 360 corresponded to one byte, but it processed data in words that were four bytes (32 bits) long.

A byte has 28, or 256 unique combinations to work with. For example, a single byte can represent any integer between 0 and 255 if unsigned, or between -128 and +127 if you use one of the bits to indicate whether the number is positive or negative (27 = 128), a signed integer note . The maximum representable number is always one less than two to the power of the number of bits, because zero takes up one combination of all the possible bit permutations.

So, what does that 8-bit, 16-bit, 32-bit, or 128-bit on a gaming system mean?

It means word length. Computer processors deal with words, and it's easiest to use words that are a multiple of the eight bit byte. In most cases, this doesn't matter. You can still program a 16-bit processor such that it displays numbers above 65,535 (assuming that you have enough RAM to do so); it will simply use two words to store the number. It's not going to block you from getting a high score or anything. These limitations can be gotten around with clever programming and knowledge of binary arithmetic.

However, this limits the processor in terms of how much it can calculate in a given amount of time. A 16-bit processor has to use two add instructions to get the answer to the question, "What is 70,000 + 1?" through integers, while a 32-bit computer can do so in one instruction. This has a knock-on effect on the speed of the processor; while a 16-bit and a 32-bit processor might both have the same absolute speed rating (say ten million instructions per second, or 10MHz), the 16-bit processor will require twice as many instructions, and therefore twice as much time, to handle numbers which don't fit in a single one of its words.

A commonly said part of the processor that's affected by word size is the processor's address space, or how many words it can individually access. Though this isn't true for a lot of processors. Most early 8-bit CPUs had a 16-bit address space and 16-bit CPUs tended to have at least a 20-bit address space. Today, while 64-bit processors do have a 64-bit address space, only 48 or 52 bits are used due to practicality (48 bits is enough to handle 256 TB of memory, far more than any computer can physically fit in, as of 2025, and this saves wasting silicon on handling address sizes that will never be used). It was the 32-bit CPU era where things got a little more interesting.

During the late 1990s to the early 2000s, the 32-bit computing space had an interesting problem. The 4GB of memory that the computer could address was running out, first with servers and supercomputers, then eventually to home computers as hobbyists could afford more RAM. To address this, a lot of CPU manufacturers (such as MIPS and DEC) simply jumped to a 64-bit version of the CPU. Intel created a new addressing mode called Physical Address Extensions (PAE) which bumped up the total address space to 36-bit, or 64GB of RAM. However, apps were still limited to 32-bit addressing, each being allocated its own virtual address space which the CPU then transparently mapped into the real larger address space under the hood. This was rendered obsolete once AMD introduced the 64-bit version of x86.

Another aspect with addressing space is in early computers, the CPU could directly access all memory and inputs on the system. As long as you knew the address of a memory device or an input pin, the CPU could read from it and get a value. However, as the amount of stuff that a computer could hold grew way more than what the memory space could hold, ways to address more stuff had to be developed. An early take on this was with ROM and RAM chips known as bank switching. By feeding the ROM or RAM control bits, it would connect a different bank of ROM or RAM to the CPU (hence the name). This later evolved into a system where the CPU talked to a controller and then fed it a stream of data or read a stream of data. This allowed a computer to address a lot more stuff than it was actually capable of.

Why is digital communication speed reported in bits per second?

Despite that bytes being 8-bits has been standardized around the world, communication systems still express how much stuff they can transfer as bits per second. How come they don't use bytes per second?

The basic explanation is that the transmitter may use extra bits in order to make transmission of the signal reliable or efficient. The receiver also knows when certain bits are not part of the data, so they can drop it. Since not every bit the transmitter transmits is actually data, it doesn't make sense to use "bytes per second." In addition, some transmitters may not use bits in the same fashion as another. So expressing speed in bits per second is unambiguous as to the actual physical capacity of the transmission system. Though more technically, the term is called symbol rate or baud, as it describes the fastest the transmitter can switch to unique symbols. note 

But for the long explanation:

  • Devices aren't always transmitting so the receiver has no way of knowing when something actually happened. Rather than use more wires or wasting the first data packet to tell the other side "I'm transmitting!", bits are used to tell the receiver the transmitter has started and has ended. The most simple usage of this is in most serial communication, where 1 bit is used to signal the start of the transmission and 1 bit (usually the opposite value) is used to signal the end. In this case, 10 bits are used to send an 8-bit byte.
    • Regarding serial communication, most also allow for 7-bit data or 9-bit data. 7-bit data mostly implies the channel is sending ASCII data, though this is mostly kept for historical reasons. 9-bit data systems use the extra bit more as a flag. A common use case is to let the receiver know if the other eight bits are for an address (in the case where multiple devices share the same serial line) or represents data.
  • In some cases where the transmission rate is not known ahead of time, the transmitter embeds a clock signal with the data. This requires twice the number of bits to send the same data as the signal has to guarantee a bit flip at a certain rate. One widely used system is known as Manchester Code. In this case, assuming no other bits are used for anything, 16 bits are used to send an 8-bit byte.
  • For high speed communication, filter caps are used to make sure lower frequency noise doesn't make it into the communication channels. However, if the overall voltage is greater than 0V, due to perhaps there being a string of 1s, this can charge the capacitor up which will cause the communication channel to get stuck in a higher voltage. To combat this, encoding schemes use extra bits to ensure the average voltage across the channel is 0V. One popular method is the 8b/10b encoding which uses 10 bits to transmit 8 bits.
  • Transmission from some media, where it's expected that errors can happen, have error correction bits built-in. For example, the Hamming Codes error correcting algorithm needs a certain amount of bits for the error detection and correcting system to work. A common format is Hamming(7,4), where 3-bits of parity information are added for every 4-bits of data. This expands out in powers of two, so the more data bits you have, the percentage of parity bits used goes down. Thus for devices using some error correcting code, it doesn't make sense to read the data as 8-bit bytes anyway.


Alternative Title(s): Binary Code, Bit, Byte

Top
Morty Proxy This is a proxified and sanitized view of the page, visit original site.