Computer Memory
From ASM Book
In a computer system, memory is where the central processor directly stores data, or directly retrieves data and instructions. Memory has also been known as main storage, or the main store.
NOTE: Memory was an American term for some types of computer storage. Internationally, manufacturers have adopted this term for semiconductor storage designed as arrays of addressable bits.
NOTE: "core" is obsolete, as it actually refers to an old technology -- ferrite core storage. This is much like the modern use of RAM or DRAM to refer to primary memory (see Scientica's comment in RAM).
According to Webster, memory, or core, is a device or a component of a device in which information can be inserted and stored and from which it may be extracted when wanted. More generally, it is the capacity to store information. Computers need memory as we do too. Memory can be loosely understood as storage. However, storage and memory are considered distinct objects in computer terminology. The term memory (slang) is also used interchangeably with RAM (Random Access Memory). In general, its definition changes according to context and one should be able to comfortably extract it.
Computer memory is as vital for program execution as our memory is for us to remember. Having a whopping 3 GHz microprocessor with a meagre 32 MB of memory (RAM) on board kind of limits the capabilities of the computer system.
Computer memory cannot store "ideas" or information as we do, but it certainly can store electrical voltage states either permanently or temporarily. Each bit-cell of memory can record either a high voltage state or a low voltage state. Computer memory can be either static or volatile. Static memory can save its state even if it lacks a supply of electricity. For example, ROM (Read-Only Memory) chips save programs permanently. The most common form of volatile memory is a RAM (Random Access Memory) module.
- NOTE: Electronic digital systems are built using three kinds of digital circuits: combinatorial circuits for implementing Boolean logic, storage circuits for maintaining state, and pulse generators for generating synchronizing signals. Sequential circuits are digital systems containing all three kinds of circuits. In addition to this, interface circuits allow connections to other systems, electronic (digital or nondigital) or nonelectronic.
- The combinatorial circuits depend on the input states and give a 'result' for each possible entry and this are one reason for what they are called combinatorial this is they give a result for each possible combination of inputs, when the input states are 'lost' the state of the circuit is lost.
- The sequential circuit depend to in the state of the entries and when the entries are lost, the last state is not lost like the combinatorial.
- Example of combinatorial circuit can be a selector for what register to use or the location of memory to access; and a example of sequential circuit can be the hard drive or the RAM, see that the RAM lost is last state when lost the power supply, but not when have this supply even if you don't enter more information to the memory the others locations still have the last state that was 'computed' for this location.
- See that a CD or a floppy disk is not a circuit of any of this two types, can be considered like a medium that preserve a state and can be modified by external factor (magnetism or a laser light and it not accept entries or produce results (by the entries) only they react or change is state by the external power/factor)
Contents |
RAM
Short for Random Access Memory. This kind of memory is often used to mean the primary memory (because this type of memory is used there, it's a similar mistake to the "CMOS circuit" (Complementary Metal-Oxide-Silicon). A longer more detailed explanation of RAM can be found here http://en2.wikipedia.org/wiki/RAM
It is a sequential circuit that can hold is states and can be read written, but itself can not decodificate the address or location.
Like A Finite Set
For What I talk of A Finite set?, is so important understand that you will have a finite set of cells, in each cell you can save a block of bits (binary units) called a byte, the memory in the computer is not infinite, then is important that you calculate the correct computations for administrate in a correct way the space that you will use.
The size of the memory are power of 2, normally you have 8, 16, 32, 64, 128, 256, 512 or 1024 Mb. A simple process can fill less bytes like 200 or 0 when they are not using the memory.
When an operating system loads your program to memory or create a process, it give a specific space in the memory or a subset of the whole memory, the memory that is not available for you directly is the others programs memory, or the used for the OS specific, there normally exist a subspace that is not assigned to a process, then if you need more space, you can take or request to the OS a little space from here.
But see that you need stay always in a correct way or manipulation with your actual set of memory, normally if you access memory outside of your set, you have a page fault or strange results in the computations.
Dividing the set Or Making partitions of the set
A partition of a set is a part of the set, the intersection of each partition in the set is null or not exist. That is, a partition not overlap any other partition or have a intersection with other. The memory can be partitioned like in general way (see that a partition is referred to space of memory): a partition for the OS; a partition for each process; a partition that doesn't have any type of process, that is, free space.
The OS can be considered like a process but is not redundant take here like a separate space of the partition of each process, for what? the partition of the OS is normally always in the same place of the memory or is loaded always at the same partition of memory, with difference on the other process that they not always are not loaded at the same position of memory.
The partition of the free space is important because when a process need be executed or need more memory, is taken from this partition, see that when this happened the partition of all process grown-up, when the free space partition is grown-down.
Lets examine the partition of a specific process. Let p be a process that belongs to the union of all partitions of process, this is any p in the actual executable process tree controlled by the operating system. This p in it space will have a data, the data is the instructions and data, see that when a program is not executed it can be considered like simple data. The size of the data in p can grown-up or can free some memory reducing its space. The addressable memory is inside this space and is in own partition.
Computing the location address
The memory only read and write to a specific location, this location is calculated by the Micro-Processor, the x86 family of processors have different modes of addressing a location.
The Memory Bus
The memory bus is the set of connections between the processor and memory. The memory bus can be divided into three parts. 1) The address bus, which carries the memory address provided by the processor. 2) The data bus, which carries the data being transmitted back and forth between the processor and memory. 3) The control bus, which carries the timing and direction signals for controlling the read and write transactions.
To keep things simple, most data buses have a fixed width, which is the number of data bits that can be transmitted simultaneously. It may or may not correspond with the data width associated with the architecture.
- For example: Intel designed the 8086 as a 16-bit architecture, and built a chip with a 16-bit data bus. However, nothing prevents the designer from building a software compatible chip with an 8-bit data bus. And it didn't, as Intel modified the 8086 to support an 8-bit data bus, calling it the 8088.
- Another example: The first 32-bit x86 architecture designed by Intel was the 80386, which had a 32-bit data bus. The Pentium supports the same instruction set. The Pentium has more instructions, but they are considered to be part of a 32-bit architecture. However, the Pentium data bus is 64-bits in width.
The processor is responsible for handling any mismatches of data size and alignment between the data bus and what the processor instruction requests.
Reading Memory
Ok, a computer can read or they have states that can be held and then read.
How read a memory of a computer?, First we need the location and is computed like was said in the previous section. Then this address is sent through the address bus and is received by the memory.
Remember in memory is read it state in a specific location of memory with a specific size.
- A short description of the process can be
- The processor decodes an instruction that needs to read memory, computes the address using address modes.
- The processor determines how many reads will be required to retrieve the data.
- The address is sent via the address bus, to all memory and address decoders, for read.
- The address decoders (part of motherboard chipset) use part of the address to select (activate) a specific memory bank.
- The selected memory bank uses the rest of the address to retrieve data, and to send the data to the processor.
- If more reads are needed, the previous three steps are repeated with the next address.
Writing Memory
The process is nearly the same as reading a location of memory, the write of memory is important because it can change the states. Consider an iteration that counts from 10 to 0, and stops when 0. The data that holds the counter is in memory, what happens if you cannot change the initial value 10? answer: an infinite loop.
See that in this case is implicit the read/write of memory that use the addressing modes of the processor.
- A short description can be
- The processor decodes an instruction that needs to write to memory, and it computes the address using address modes.
- The processor determines how many writes will be needed to store the data.
- The address is sent via the address bus, to all memory and address decoders, with data, for write.
- The address decoders (part of motherboard chipset) use part of the address to select (activate) a specific memory bank.
- The selected memory bank uses the rest of the address to write the data.
- If more writes are needed, the previous three steps are repeated with the next address.
For What Is Used
The memory in a computer is used for hold states, and then request this old states for make computations with this data.
In a computation like a simple addition like 234+8467 is important remember the two "sumandos" 234 and 8467 and is important to save or write the result 3701.
With the memory of a computer happened similar, but that will be Watched in Data Representation, but see that here we only talk about How the computer get a Address of memory?, What is done in the process of read and write, and we talk about states in the memory that are read or written.
Advanced Memory Topics
Hardware topics, and the segmentation and paging topics in The Microprocessor.
How Semiconductor RAM Works
A RAM chip has address pins and data pins. The address pins select one of many memory cells within the chip. The memory cell may be as small as 1 bit. It may be larger, for example, it may hold 8 or 16 bits. The data pins provide the means to put data into the cell, and to get the data back out.
There are two control pins. One pin tells the RAM if we want to access it or not -- it is called "chip select" or "chip enable". The other pin tells the RAM whether we wish to read (fetch) data from the RAM or to write (store) data into the RAM -- it is often just called the "write enable", if it's not writing, it's reading. This is the minimum configuration. There may be an extra enable pin, "output enable", to further control a data read. This is sufficient for what manufacturers call static RAM.
Static RAM uses a circuit called a flip-flop as its storage element. In the absence of stimuli, static RAM will retain its contents as long as it has power. Dynamic RAM or DRAM, uses a capacitor as its storage element. The capacitor is charged up to hold data. Because of "leakage", it will lose charge, leading to loss of data. The data must be "refreshed" before the data is lost.
Because of the high density of DRAM, it can require a lot of address bits to access every memory cell. To keep the number of pins low, modern DRAMs receive the address in two parts, called row and column. One more pin, Row Address Strobe (RAS), tells the DRAM to capture the row portion of the address. Yet another pin, Column Address Strobe (CAS), tells the DRAM to capture the column portion of the address, from the same set of address pins. When both strobes have been activated, the DRAM will store or output data, depending on the state of the read/write pin. And, lastly, DRAMs are designed to refresh a whole row of memory cells when RAS is strobed.
At this writing, SDRAMs seem to be the most popular form of DRAM, used in PC-100 and PC-133 boards. They have a few extra features which I will not go into. Check the Intel web site for more information about SDRAMs.
