In a computer, information travels over wires. The easiest way to convey information in a wire is to consider it "on" or "off", based on how much electricity is going through it.
An "on" wire represents , and an "off" wire represents .
This small piece of information is called a "bit", and it's the smallest piece of information that computers process.
More wires = more bits
A single wire can only represent one bit, one piece of information. We can represent the results of a coin flip with a single bit—by saying that 0 represents tails and 1 represents heads—but we usually need to represent much more information than that in a computer.
The solution? More wires! Each wire adds an additional bit of information, an extra bit that can be considered on or off, 1 or 0.
For example, let's say we want to represent which of three lightbulbs to turn on. We can use three wires, with each wire representing the on/off state of a lightbulb:
In computers, we use bits to represent numbers, using the binary number system. We'll dive deep into binary numbers in the next article.
Behind the abstraction
In actuality, a wire isn't exactly "on" or exactly "off". That's an abstraction that simplifies the details of how computers work. We use abstraction often in computer science so that we can more easily understand the systems that we're building. Let's peek behind the hood to see how this abstraction works.
A wire can have varying amounts of electricity flowing through it, but a computer needs to be able to interpret the electricity in a wire as either definitely or definitely .
In 1947, engineers invented the transistor, a tiny physical device that acts like a digital switch in computers. The transistor turns on when enough electricity flows through and stays off otherwise.
How much electricity is "enough"? That depends on the transistor and its threshold voltage. If an engineer uses a transistor with a threshold voltage of 4.5 volts, then any voltage of 4.5 or higher will turn the transistor on. At lower voltages, the transistor stays off.
Consider a computer that needs to determine whether a USB cable is plugged in. When you plug the cable of a mouse in the computer's USB port, circuitry in the mouse uses the voltage provided by the port to pull up the voltage in the cable above 3.3 volts. Inside the computer, a transistor detects the high voltage and translates it to "on" or . This bit of information tells your computer that a USB device is plugged into the port.
In this case, engineers used a transistor with the threshold voltage of 3.3 volts for the "on" state, and of 0.3 volts for the "off" state.
There's a huge variety in transistors. Engineers choose the transistors that are the best fit for the job, by considering characteristics like the threshold voltage, material, and size.
The transistors inside your computer are so small, we would need a high-powered microscope to see them. However, transistors are also used in other electrical projects and those transistors are ones you could pick up with your fingers. Here are a few examples:
A lot of electrical engineering and physics goes into the physical construction of computer hardware like transistors, and we won't dive deep into that here. If you'd like to learn more, check out this video on how a transistor works.
An important takeaway here is that computers are built on layers of abstraction, like bits abstracting on top of transistors. Those layers enable computer scientists to use and control computers in predictable ways.
Want to join the conversation?
- How many values can a binary digit store?(9 votes)
- What if a wire breaks? Will it just be 'off' forever since electricity can't flow anymore?(4 votes)
- Yes, if a wire breaks, then no electricity will flow through it. So it will be 'off' forever (or until it gets fixed).(15 votes)
- why does the computer only want to know the 0 or 1. if it can measure the electricity flow then won't that be better? so that one wire can store or pass more information?
and how does the wire store information? it can't keep being on or off for a whole year without doing any other things...?(3 votes)
- Regarding your first question, that's not actually doable cause it would be waaay too complicated.
Simplicity is the rule for everything, although it's not quite simple seen as a whole, the way we make complicated things is by building them from simple blocks (in this case a simple "on"=1/"off"=0 wire).(7 votes)
- What exactly is the difference between a transistor and a switch? I understand they both turn on and off given a certain condition.(4 votes)
- A switch receives a current into it and changes its output when a component is physically moved. A transistor uses semiconducting materials to determine the output current based on two input currents. The output of a transistor is analog (unlike switches that can only output a low or high current).(4 votes)
- This is helpful, but for someone who wants to learn about basic circuitry and how that works, are there any good resources or khan courses that would help with that? Thanks.(0 votes)
- One of the topics on Khan Academy is Electrical Engineering which goes over circuits. There is also some information that is relevant to circuits under AP Physic 2.(11 votes)
- Is there a fixed number of transistors inside a computer ? what determines that?(2 votes)
- The people designing the hardware generally decide how many transistors they put in. Although generally speed is important so they will try to pack in as many possible.
Transistor technology is constantly improving (transistors are getting smaller) so you can pack more and more transistors on less space.
An early microprocessor, for instance, held a couple of thousand transistors, today several billion are the norm.
Check out Moore's law if you want to know more about transistor count growth.(6 votes)
- 5.5 volts is the difference in the electrical potential between the starting to the endpoint of conducting wire.(1 vote)
- I have a 64-bit computer. When 1 wire = 1 bit, does it mean that my computer can support 64 wires (or less) of information and will not support anything larger than 64 wires? Where are these wires located? Is it in the motherboard?(3 votes)
- Nope. The information represented by 64 bits is: 2^64-1. Binary doesn’t go 1,2,3,4. It goes 1,2,4,8,16,32,64... 18,446,744,073,709,551,615.
64 bits means there are 64 binary place values, resulting in the value of: 18,446,744,073,709,551,615.
That’s how much information your computer can store.
These wires are all over the computer, but emanate from the CPU, which is in the motherboard somewhere.(2 votes)
- If the transistors are enabling us to develop binary-based computation machines, then what do we use to have Qubit based Quantum computation tools.(3 votes)
- A Qubit is binary-based, but can hold both 0 and 1 simultaneously. So 1 Qubit can represent as much information as 2 bits.(1 vote)