Memory Hierarchy - muneeb-mbytes/computerArchitectureCourse GitHub Wiki
MEMORY HIERARCHY : BASIC IDEA
Memory Technologies
Here lets focus on increasing the performance and what we have been attempting to do is to execute as many instruction as possible in as few cycles as possible.
So all this puts great demand on memory because we need to fetch in simple pipeline case one instruction per cycle and if we go for ILP then we have to go for multiple instructions to fetch per cycle so that is the requirement of instruction fetching which is put on the memory; at the same time we also have requirement of data transfer for instruction which accesses memory like load and store.
So far we have assumed that memory is flat that means we have simply an array of words; we give an address we can get the word or you can give an address and data you can write the word.
But with the given memory technology if memory is organized in this particular manner it cannot meet the demands of performance which is placed on it by the processor.
So we need to have a more complex structure which is called memory hierarchy.
There is one category which is solid state semiconductor memory.
Here there are no moving parts involved whereas you have magnetic memory which we find in floppy disk drive and hard disk drive there are moving media for optical memory as CD or DVD these are also moving.
In these the difference is in terms of the way information is getting stored; here information is in magnetic form so let us say on a on a on a surface of a storing medium there region which gets magnetized with one polarity or the other polarity and that distinguishes 1 or 0.
Similarly, in optical memory, there regions which could be opaque or transparent and that makes a difference between 1 and 0 whereas these are purely electronic and consequently they are much faster.
Here some movement is involved which makes things somewhat slower whereas in semiconductor memory there is no movement involved it is only that you give an address and you get the data so these are comparatively much faster.
There is also difference in organization in the sense that these semiconductor memories are random access that is you given an address it takes same time to get a word so all all are all words are organized symmetrically whereas in these memories which have moving parts they there is some sequentiality so you may be able to get some information faster some information slower because things are organized along tracks and one has to move along the track and also across the track in a sequential manner.
So these two factors: mechanical movement and sequentiality make these memories slower.
But, on the other hand, the capacity which you get in these magnetic or optical memory is orders of magnitude higher than the semiconductor memory.
So you could either say that for same price you can get much much more capacity or you could say that the capacity or the cost of storage per bit or per byte or per word is much lower in case of magnetic and optical memories.
Now, within each group there are differences. For example, DVD has much more capacity than a CD; HDD has much more capacity than FDDs; also HDD is faster much much much faster than FDD; within the semiconductor memory there we will focus our immediate attention which is that you have registers which are placed as an integral part of CPU they they are very fast whereas cache memories and main memory which are placed outside are slower comparatively.
So, within these memories SRAM is faster than DRAM; SRAM in SRAM the information is stored in terms of flip-flops.
So you imagine cross coupled gates which can be in one of the two stable states 0 or 1 and information can be stably stored there.
So reading and writing are sensing the state of a flip-flop or changing the state of a flip- flop is much faster than what happened in DRAM where information is stored in terms of charge on a capacitor so it takes much longer to charge or discharge capacitor.
But again typically there is a tradeoff between speed and cost.
So among these are the technologies which are slower offer you larger capacity and vice versa.
The idea of hierarchical structure is to use not just one kind memory but several different kinds of memory and try to get the best of various properties.
So you will place typically the fastest memory close to CPU, next a slower one after that and the slowest one farthest away and typically this the one which is closest will be smallest in size; the cost per bit will be highest and the one which is farthest will be largest in size and cost per bit will be the lowest.
So now what you would like is to get an impression or get an effective feeling of having the speed of this memory and the cost of cost or size of that memory.
If you if you can get these two best of both worlds then it is ideal and in fact the techniques which have been developed over years in organizing the hierarchical memories tend to give you almost that so you will get speed almost same as the fastest memory and you will enjoy the capacity almost as much as the largest memory.