Understanding Memory

Complete Developer Podcast - A podcast by BJ Burns and Will Gant - Giovedì

Categorie:

Computers store data at different levels throughout the system. The memory hierarchy is a pyramid or triangular structure that helps to visualize the relation between size and speed of different types of physical memory. The top of the hierarchy being the smallest and fastest CPU registers and the bottom being the largest and slowest external storage devices. When a processor needs a particular piece of data it will start at the top of the hierarchy and work it’s way down level by level until it finds that data. The top three tiers of the hierarchy, registers, caches, and main memory are called volatile memory because they rely on power to retain data. When the power source is removed or turned off they will lose the data they are storing. The bottom levels are considered permanent storage because they will retain the data with or without power. This is just a high level overview of the different types of physical memory involved in the computers we use and the programs we write as developers. Each one of these levels can be expanded upon, if you are interested dive deeper into understanding how each work and interact with one another. Use this as a starting point or a refresher to dive deeper into understanding how the systems we use store and transfer data. Episode Breakdown CPU Registers The fastest and smallest of all memory. These are Static RAM that exists on the processor that allow practically instant access. They usually hold a single word (64 or 128 bits). Physical space is highly limited on the processor. This reduces the number of registers as each one takes up a certain amount of space on the processor. Only the most important information is contained in the registers. Different manufactures will put different registers on their processors. Systems designed for complex instruction sets have fewer registers as they are designed for accessing main memory whereas reduced instruction sets have many more registers. The program counter is a register common to all processors. It keeps track of where the next instruction to be run in a program is located. A few other common registers include a register for decision making and an accumulator for math operations. Cache The next fastest after registers, cache can be found on the processor or on another chip closer to the processor than main memory. It is larger than a register but smaller than main memory. Cache contains chunks of data from main memory that are used frequently. The more often a piece of data is called from main memory the higher it’s likelihood of being copied into the cache. From the view of a program or app the cache doesn’t really exist. Programs request information from the main memory and if it’s stored in the cache because of frequent use then it is readily available and takes less time to access. Cache is divided into levels based on size, location, and usage. Single core processors typically have up to two levels of cache whereas multi-core will have 3-4 levels, two per core and then one or two shared levels. Random Access Memory (RAM) Significantly slower than the processor’s memory and generally stored a distance, for electrons, away from the processor the main memory is much larger than memory stored on the processor. Each time the processor has to access main memory it slows the running process down. At the time of this recording it comes in the Gigabyte range. Main memory or RAM contains most of the data and instructions necessary for the programs that are currently running. When there is excess RAM some Operating Systems will “cache” data of common programs to make loading them faster. There are two types of RAM. DRAM (Dynamic RAM) is the most common used in a computer’s main memory. It is made up of a circuit of cells each containing a transistor and a capaci...

Visit the podcast's native language site