Will binary always be the lowest level way to program?
<center> <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/justinabrahms">@justinabrahms</a> serious question: will binary always be the lowest level computer language? Is there (conceivably) a different model?</p>— Justin Jackson (@mijustin) <a href="https://twitter.com/mijustin/status/676640625995845632">December 15, 2015</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> </center>
Justin Jackson asked if binary will always be the lowest level language, or if that might ever change. To answer that, let’s talk about what low level means.
Binary isn’t exactly the lowest level programming language though. Binary isn’t actually a programming language at all. Binary is simply a way to convey information. In some cases, this information is the layout of logic circuits. In others, it might be media like a YouTube video or git checkout streaming to your disk.
So why do we think of binary as a programming language? The main answer here is that computers speak “machine code” at their lowest level. This is streaming information to specific registers of computer hardware. Sometimes, this information is in binary form. We also see it in hexadecimal format. Hexadecimal is the numbers 0-9 and the letters A-F, juxtaposed to binary’s 0 & 1. Here’s an example program in machine code.
8020 78 8021 A9 80 8023 8D 15 03 8026 A9 2D 8028 8D 14 03 802B 58 802C 60 802D EE 20 D0 8030 4C 31 EA
This sends the bytes on the right to the addresses on the left. (via).
Assembly is a program that sits on top of machine code. It makes little aliases for these cryptic bytes so there’s something approaching human readable. It certainly doesn’t look readable through my python-tinted glasses! Here’s an example assembly program which adds two numbers. (via)
print_int: mov byte [buffer+9],'$' ; add a string terminator at the end of the buffer lea si,[buffer+9] mov bx,10 ; divisor print_loop: xor dx,dx ; clear dx prior to dividing dx:ax by bx div bx ; AX /= 10 add dl,'0' ; take the remainder of the division and convert it from 0..9 -> '0'..'9' dec si ; store characters in reverse order mov [si],dl test ax,ax jnz print_loop ; repeat until AX==0 mov ah,9 ; print string mov dx,si int 21h ret buffer: resb 10
Even though binary isn’t a programming language, will this be the lowest level way to represent information? The answer still isn’t so easy..
What is low-level? In this context, it means the most primitive means. The way the deepest components work. Given our electricity based circuitry, this translates into two states: “Is the power on?” and “Is the power off?” From this perspective, binary will be the “lowest level” transmission language for these circuits. There are new circuits being built with the advent of quantum computing. Instead of only having an on or off state, qubits (quantum bits) can have on, off and 2 super position states. Wikipedia, surprisingly, has a pretty accessible definition of what’s going on. This means that in quantum computers, the “lowest level” transmission language will be on qubits (or about 2 bits each).
Will binary be the lowest level thing forever? No, but it’s what we’ve got for now. We’ll eventually end up with qubits, which are quaternary (instead of binary). That will be the newest form of low level data transmission.
Do you have computer science questions you’d like an answer to? Comment or tweet me at @justinabrahms. I’d love to hear them.