The computer is an amazingly useful general-purpose technology, to the point that now cameras, phones, thermostats .. these are all now little computers. This section will cover a lot of ground, introducing major parts and themes of how computer hardware works. "Hardware" refers the physical parts of the computer, and "software" refers to the code that runs on the computer. The piano is the hardware, the music is the software. Hardware and software are deep topics, but many of the basic principles make perfect sense and will give you an insight about what's going on behind the scenes.
Here is a silicon chip inside its plastic package. I pulled this out of the e-waste pile at the Stanford CS building, so it's probably kind of old. This is a small chip with just a few "pins" of electrical connection. Later we'll see a bigger chip with hundreds of pins.
Inside the plastic package is a fingernail sized silicon chip with transistors and other components etched on its surface. Tiny wires connect the chip to the outside. (CC licensed attribution sharealke 3. wikipedia user Zephyris)
Modern computers use tiny electronic components which can be etched onto the surface of a silicon chip. (See: wikipedia chip) Note that silicon (chips, solar panels) and silicone (soft rubbery material) are different!
The most common electronic component is the "transistor" which works as a sort of amplifying valve for a flow of electrons. The transistor is a "solid state" device, meaning it has no moving parts. It is a basic building block used to construct more complex electronic components. In particular, a "bit" (below) can be built with an arrangement of 5 transistors. The transistor was invented in the early 1950's, replacing the vacuum tube. Since then, transistors have been made smaller and smaller, allowing more and more of them to be etched onto a silicon chip.
Moore's law (Gordon Moore, Intel co-founder) states that the density of transistors on a chip doubles about every 2 years or so (sometimes listed as every 18 months). It is not a scientific law, just a broad prediction that seems to keep working. More broadly, it captures the idea that per dollar, computer technology (not just transistors) gets exponentially better as time goes along. This is quite clear if you look at the cost or capability of computers/cameras etc. you have owned. It might mean that each new generation of computer is more capable. OR it could mean that keeping capability constant, computers get cheaper and cheaper .. showing up in more in more places as it becomes cost effective (e.g. in your car, your thermostat, ..).
Now let's talk about the three major parts that make up a computer -- CPU, RAM, and Persistent Storage. These three are found in a laptop, or a smart phone, or a tablet.
The space that data takes up in the computer is measured in by the "byte". One byte is big enough to hold a single typed letter, like 'a'. Here we'll look at storing data in RAM memory and in persistent storage like a hard drive. All of that storage space will be measured in bytes. We'll look at byte arithmetic in more detail later.
RAM - Random Access Memory, or just "memory". RAM is the working scratchpad memory the computer uses to store code and data that are being actively used. RAM is effectively a storage area of bytes under the control of the CPU. RAM is relatively fast, able to retrieve the value of any particular byte in a few nanoseconds (1 nanosecond is 1 billionth of a second). The other main feature of RAM is that it only keeps its state so long as it is supplied with power -- RAM is "volatile", not "persistent".
Suppose you are working on your computer and it suddenly loses power and the screen goes blank. You understand that what you were working on is gone .. RAM has been wiped clean, leaving you only with what you last saved to disk (below).
How a Hard Drive Works Video (Webm is an open standard video format, works in Firefox and Chrome)
Persistent storage - long term storage for bytes as files and folders. Persistent meaning that the bytes are stored, even when power is removed. A laptop might use a spinning hard drive (also known as "hard disk") for persistent storage of files. Or it could use a "flash drive", also known as a Solid State Disk - SSD, to store bytes on flash chips. The hard drive reads and writes magnetic patterns on a spinning metal disk to store the bytes, while flash is "solid state" .. no moving parts, just silicon chips with tiny groups of electrons to store the bytes. In either case, the storage is persistent, in that it maintains its state even when the power is off.
A flash drive is faster and uses less power than a hard disk. However, per byte, flash is significantly more expensive than hard drive storage. Flash has been getting cheaper, so it may take over niches at the expense of hard drives. Flash is much slower than RAM, so it is not a good replacement for RAM. Note that Adobe "flash" is an unrelated concept; it is a proprietary media format.
Flash storage is what underlies USB thumb drives, SD cards for use in cameras, or the built-in storage in a tablet or phone.
The hard drive or flash drive provides persistent storage as a flat area of bytes without much structure. Typically the hard disk or flash disk is formatted with a "file system" which organizes the bytes into the familiar pattern of files and directories, where each file and directory has a somewhat useful name like "resume.txt". When you connect the drive to a computer, the computer presents the drive's file system to the user, allowing them open files, move file around, etc.
Essentially, each file in the file system refers to a block of bytes, so the "flowers.jpg" name refers to a block of 48KB of bytes which are the data of that image. The file system in effect gives the user a name (and probably an icon) for a block of data bytes, and allows the user to perform operations on that data, like move it or copy it or open it with a program. The file system also tracks information about the bytes: how many there are, the time they were last modified.
Microsoft uses the proprietary NTFS file system, and Mac OS X has its Apple proprietary HFS+ equivalent. Many devices (cameras, MP3 players) use the very old Microsoft FAT32 file system on their flash cards. FAT32 is an old and primitive file system, but it is good where wide support is important.
Below images of a low-end Shuttle computer with a 1.8ghz CPU, 512MB of RAM and a 160GB hard drive. It cost about $200 in around 2008. It broke, and so became a classroom example.
Here is the flat "motherboard", a little smaller than a 8.5 x 11 piece of paper, that the various components plug in to. At the center is the CPU. At the far is the RAM memory. Just to the right of the CPU are a couple support chips. Prominently, one of the chips is covered with a copper "heatsink" .. this presses tightly against the chip, dissipating the heat from the chip into the surrounding air. The CPU also had a very large heatsink, but it was removed to make the CPU visible.
The CPU is held tightly against the motherboard by a little lever mechanism. Here the mechanism is released so the CPU can be picked up. The fingernail sized CPU is packaged underneath this metal cover which helps conduct the heat from the CPU up to its heatsink. The gray stuff on the metal chip cover is "thermal paste", a material which helps conduct heat from the chip housing to its (not shown) heatsink.
Flipping the CPU over shows the little gold pads on the bottom of the CPU. Each pad is connected by a very fine wire to a spot on the silicon chip.
Here is a picture of another chip, but with the top packaging removed. You see the pinky-fingernail silicon chip at the center with the tiny transistor details etched onto it. At the chip edge, see the very fine wires connecting parts of the chip to outside pads (linking to wikimedia image by Ioan Sameli, CC licensed).
Now looking from the side, the heatsink and the RAM memory card can be seen more clearly, sticking up from the motherboard.
RAM is built with a few chips packaged together onto a little card known as a DIMM that plugs into the motherboard (dual inline memory module). Here we see the RAM DIMM removed from its motherboard socket. This is a 512MB DIMM built with 4 chips. A few years earlier, this DIMM might have required 8 chips in order to store 512MB .. Moore's law in action.
This is a hard drive that connects to the motherboard with the visible standard SATA connector. This is a 160GB, "3.5 inch" drive referring to the diameter of the spinning disk inside; the whole drive is about the size of small paperback book. This is a standard disk size to use inside a desktop computer. Laptop computers use 2.5 inch drives which are a bit smaller.
This is a USB flash drive that, like a hard drive, provides persistent byte storage. This is also known as a "thumb drive" or "USB key". It is essentially a USB jack connected to a flash storage chip with some support electronics:
Here it is taken apart, showing the flash chip that actually stores the bytes. This chip can store about 1 billion bits .. how many bytes is that? (A: 8 bits per byte, so that's about 125 MB)
Here is a "SD Card" which provides storage in a camera. It's very similar to the USB flash drive, just a different shape.