Computer Memory Flashcards
What is CPU?
Central Processing Unit. At the heart of a computer is the CPU, or Central Processing Unit. We sometimes simply call it the processor. Modern computers have many kinds of processors, but the CPU is the main one that generally does the most work.
The CPU is a physical bunch of electronic circuitry located in a small package on the main board, or motherboard, of the computer. We can think of it as many tiny gates that let specific patterns of electricity flow along very precisely defined paths (that are etched with light!). By controlling the gates, and altering the flow of the electricity, the CPU does something very important: it executes instructions from software.
The CPU is amazing! Even though all it does is direct the flow of electricity through its circuitry, this lets it perform basic math, logic, control, and data read and write operations. By combining these simple operations with well-designed software (that we are going to write!), the CPU can carry out even the most complex tasks!
Physical Memory
The CPU will process many instructions that require data to be stored.
Physical memory devices hold this data. Like the CPU, physical memory is itself a package of electrical circuits. It holds the patterns of electricity that the CPU interprets as data. The CPU uses physical memory by writing data to it and reading data from it.
RAM
RAM, or Random-access memory, is a form of computer memory. RAM sticks are physical memory devices that attach to a motherboard. RAM has two unique traits compared to other forms of computer memory:
RAM is fast RAM holds data temporarily
RAM is fast! For one, it’s directly connected to the CPU. And no matter the address, the CPU can access any location in RAM in the same amount of time. Imagine being able to access a room on the top floor of a skyscraper just as quickly as a room near the front door! This property is what the “random-access” part of RAM describes.
SAM
In contrast to RAM, there is another memory configuration called SAM, or sequential access memory. It is less common these days, and is most typically used as long-term storage, often in the form of magnetic tape. It’s referred to as “sequential” because if we need to access some data stored in the middle of the tape, we must inspect the tape sequentially, from the beginning, until we reach the data of interest. Compared to RAM, it’s relatively inexpensive, high capacity, and very slow.
How the CPU Uses RAM
The CPU is responsible for running computer programs. When we start a program, first it gets copied into RAM. Then the CPU starts fetching instructions from the RAM containing the program code. As it carries out those instructions, it will also use RAM to read and write the temporary data the application needs while it’s running.
Modern CPUs are very fast, and need a lot of data to stay busy. As a result, the CPU will end up accessing RAM billions of times every second! Fortunately, the connection between the CPU and RAM is direct and dependable, allowing this incredible system to operate reliably.
Memory Versus Storage
We’ve discussed that the memory we call RAM is responsible for storing instructions and data while a program is executing. There are other parts of a computer that are responsible for holding that data when a program isn’t actively running. Somewhat confusingly, modern devices sometimes refer to this as memory too, but it is better described as storage, where data can be kept for the long-term. A common example of this is a hard disk drive in a computer.
Memory Addresses
Memory devices organize the data it stores by having and using memory addresses.
Each piece of data in memory occupies a memory location, which has an assigned memory address that the CPU can use to locate it.