What is the difference between static RAM and dynamic RAM in my computer? Your computer probably uses both static RAM and dynamic RAM at the same time, but it uses them for different reasons because of the cost difference between the two types. If you understand how dynamic RAM and static RAM chips work inside, it is easy to see why the cost difference is there, and you can also understand the names. Dynamic RAM is the most common type of memory in use today. Inside a dynamic RAM chip, each memory cell holds one bit of information and is made up of two parts: a transistor and a capacitor.
These are, of course, extremely small transistors and capacitors so that millions of them can fit on a single memory chip. The capacitor holds the bit of information — a 0 or a 1 (see How Bits and Bytes Work for information on bits). The transistor acts as a switch that lets the control circuitry on the memory chip read the capacitor or change its state. A capacitor is like a small bucket that is able to store electrons. To store a 1 in the memory cell, the bucket is filled with electrons. To store a 0, it is emptied. The problem with the capacitor’s bucket is that it has a leak.
In a matter of a few milliseconds a full bucket becomes empty. Therefore, for dynamic memory to work, either the CPU or the memory controller has to come along and recharge all of the capacitors holding a 1 before they discharge. To do this, the memory controller reads the memory and then writes it right back. This refresh operation happens automatically thousands of times per second. This refresh operation is where dynamic RAM gets its name. Dynamic RAM has to be dynamically refreshed all of the time or it forgets what it is holding.
The downside of all of this refreshing is that it takes time and slows down the memory. Static RAM uses a completely different technology. In static RAM, a form of flip-flop holds each bit of memory (see How Boolean Gates Work for detail on flip-flops). A flip-flop for a memory cell takes 4 or 6 transistors along with some wiring, but never has to be refreshed. This makes static RAM significantly faster than dynamic RAM. However, because it has more parts, a static memory cell takes a lot more space on a chip than a dynamic memory cell.
Therefore you get less memory per chip, and that makes static RAM a lot more expensive. So static RAM is fast and expensive, and dynamic RAM is less expensive and slower. Therefore static RAM is used to create the CPU’s speed-sensitive cache, while dynamic RAM forms the larger system RAM space Inside This Article 1. Introduction to How Caching Works 2. A Simple Example: Before Cache 3. A Simple Example: After Cache 4. Computer Caches 5. Caching Subsystems 6. Cache Technology 7. Locality of Reference 8. Lots More Information |[pic] |
If you have been shopping for a computer, then you have heard the word “cache. ” Modern computers have both L1 and L2 caches, and many now also have L3 cache. You may also have gotten advice on the topic from well-meaning friends, perhaps something like “Don’t buy that Celeron chip, it doesn’t have any cache in it! ” It turns out that caching is an important computer-science process that appears on every computer in a variety of forms. There are memory caches, hardware and software disk caches, page caches and more. Virtual memory is even a form of caching.
In this article, we will explore caching so you can understand why it is so important. A Simple Example: Before Cache Caching is a technology based on the memory subsystem of your computer. The main purpose of a cache is to accelerate your computer while keeping the price of the computer low. Caching allows you to do your computer tasks more rapidly. To understand the basic idea behind a cache system, let’s start with a super-simple example that uses a librarian to demonstrate caching concepts. Let’s imagine a librarian behind his desk. He is there to give you the books you ask for.
For the sake of simplicity, let’s say you can’t get the books yourself — you have to ask the librarian for any book you want to read, and he fetches it for you from a set of stacks in a storeroom (the library of congress in Washington, D. C. , is set up this way). First, let’s start with a librarian without cache. The first customer arrives. He asks for the book Moby Dick. The librarian goes into the storeroom, gets the book, returns to the counter and gives the book to the customer. Later, the client comes back to return the book. The librarian takes the book and returns it to the storeroom.
He then returns to his counter waiting for another customer. Let’s say the next customer asks for Moby Dick (you saw it coming… ). The librarian then has to return to the storeroom to get the book he recently handled and give it to the client. Under this model, the librarian has to make a complete round trip to fetch every book — even very popular ones that are requested frequently. Is there a way to improve the performance of the librarian? Yes, there’s a way — we can put a cache on the librarian. In the next section, we’ll look at this same example but this time, the librarian will use a caching system.
A Simple Example: After Cache Let’s give the librarian a backpack into which he will be able to store 10 books (in computer terms, the librarian now has a 10-book cache). In this backpack, he will put the books the clients return to him, up to a maximum of 10. Let’s use the prior example, but now with our new-and-improved caching librarian. The day starts. The backpack of the librarian is empty. Our first client arrives and asks for Moby Dick. No magic here — the librarian has to go to the storeroom to get the book. He gives it to the client. Later, the client returns and gives the book back to the librarian.
Instead of returning to the storeroom to return the book, the librarian puts the book in his backpack and stands there (he checks first to see if the bag is full — more on that later). Another client arrives and asks for Moby Dick. Before going to the storeroom, the librarian checks to see if this title is in his backpack. He finds it! All he has to do is take the book from the backpack and give it to the client. There’s no journey into the storeroom, so the client is served more efficiently. What if the client asked for a title not in the cache (the backpack)?
In this case, the librarian is less efficient with a cache than without one, because the librarian takes the time to look for the book in his backpack first. One of the challenges of cache design is to minimize the impact of cache searches, and modern hardware has reduced this time delay to practically zero. Even in our simple librarian example, the latency time (the waiting time) of searching the cache is so small compared to the time to walk back to the storeroom that it is irrelevant. The cache is small (10 books), and the time it takes to notice a miss is only a tiny fraction of the time that a journey to the storeroom takes.
From this example you can see several important facts about caching: • Cache technology is the use of a faster but smaller memory type to accelerate a slower but larger memory type. • When using a cache, you must check the cache to see if an item is in there. If it is there, it’s called a cache hit. If not, it is called a cache miss and the computer must wait for a round trip from the larger, slower memory area. • A cache has some maximum size that is much Computer Caches A computer is a machine in which we measure time in very small increments.
When the microprocessor accesses the main memory (RAM), it does it in about 60 nanoseconds (60 billionths of a second). That’s pretty fast, but it is much slower than the typical microprocessor. Microprocessors can have cycle times as short as 2 nanoseconds, so to a microprocessor 60 nanoseconds seems like an eternity. What if we build a special memory bank in the motherboard, small but very fast (around 30 nanoseconds)? That’s already two times faster than the main memory access. That’s called a level 2 cache or an L2 cache. What if we build an even smaller but faster memory system directly into the microprocessor’s chip?
That way, this memory will be accessed at the speed of the microprocessor and not the speed of the memory bus. That’s an L1 cache, which on a 233-megahertz (MHz) Pentium is 3. 5 times faster than the L2 cache, which is two times faster than the access to main memory. Some microprocessors have two levels of cache built right into the chip. In this case, the motherboard cache — the cache that exists between the microprocessor and main system memory — becomes level 3, or L3 cache. There are a lot of subsystems in a computer; you can put cache between many f them to improve performance. Here’s an example. We have the microprocessor (the fastest thing in the computer). Then there’s the L1 cache that caches the L2 cache that caches the main memory which can be used (and is often used) as a cache for even slower peripherals like hard disks and CD-ROMs. The hard disks are also used to cache an even slower medium — your Internet connection The computer you are using to read this page uses a microprocessor to do its work. The microprocessor is the heart of any normal computer, whether it is a desktop machine, a server or a laptop.
The microprocessor you are using might be a Pentium, a K6, a PowerPC, a Sparc or any of the many other brands and types of microprocessors, but they all do approximately the same thing in approximately the same way. If you have ever wondered what the microprocessor in your computer is doing, or if you have ever wondered about the differences between types of microprocessors, then read on. In this article, you will learn how fairly simple digital logic techniques allow a computer to do its job, whether its playing a game or spell checking a document!
A microprocessor — also known as a CPU or central processing unit — is a complete computation engine that is fabricated on a single chip. The first microprocessor was the Intel 4004, introduced in 1971. The 4004 was not very powerful — all it could do was add and subtract, and it could only do that 4 bits at a time. But it was amazing that everything was on one chip. Prior to the 4004, engineers built computers either from collections of chips or from discrete components (transistors wired one at a time). The 4004 powered one of the first portable electronic calculators. [pic] | |Intel 8080 | The first microprocessor to make it into a home computer was the Intel 8080, a complete 8-bit computer on one chip, introduced in 1974. The first microprocessor to make a real splash in the market was the Intel 8088, introduced in 1979 and incorporated into the IBM PC (which first appeared around 1982). If you are familiar with the PC market and its history, you know that the PC market moved from the 8088 to the 80286 to the 80386 to the 80486 to the Pentium to the Pentium II to the Pentium III to the Pentium 4.
All of these microprocessors are made by Intel and all of them are improvements on the basic design of the 8088. The Pentium 4 can execute any piece of code that ran on the original 8088, but it does it about 5,000 times faster! Microprocessor Progression: Intel The following table helps you to understand the differences between the different processors that Intel has introduced over the years. Name |Date |Transistors |Microns |Clock speed |Data | |Microprocessor Progression: Intel The following table helps you to understand the differences between the different processors that Intel has introduced over the years.
Name |Date |Transistors |Microns |Clock speed |Data width |MIPS | |8080 |1974 |6,000 |6 |2 MHz |8 bits |0. 64 | |8088 |1979 |29,000 |3 |5 MHz |16 bits 8-bit bus |0. 33 | |80286 |1982 |134,000 |1. 5 |6 MHz |16 bits |1 | |80386 |1985 |275,000 |1. 5 |16 MHz |32 bits |5 | |80486 |1989 |1,200,000 |1 |25 MHz |32 bits |20 | |Pentium |1993 |3,100,000 |0. 8 |60 MHz |32 bits 64-bit bus |100 | |Pentium II |1997 |7,500,000 |0. 35 |233 MHz |32 bits 64-bit bus |~300 | |Pentium III |1999 |9,500,000 |0. 25 |450 MHz |32 bits 64-bit bus |~510 | |Pentium 4 |2000 |42,000,000 |0. 8 |1. 5 GHz |32 bits 64-bit bus |~1,700 | |Pentium 4 “Prescott” |2004 |125,000,000 |0. 09 |3. 6 GHz |32 bits 64-bit bus |~7,000 | | Compiled from The Intel Microprocessor Quick Reference Guide and TSCP Benchmark Scores Information about this table: • . • rises. • Clock speed is the maximum rate that the chip can be clocked at. Clock speed will make more sense in the next section. • Data Width is the width of the ALU. An 8-bit ALU can add/subtract/multiply/etc. two 8-bit numbers, while a 32-bit ALU can manipulate 32-bit numbers.
An 8-bit ALU would have to execute four instructions to add two 32-bit numbers, while a 32-bit ALU can do it in one instruction. In many cases, the external data bus is the same width as the ALU, but not always. The 8088 had a 16-bit ALU and an 8-bit bus, while the modern Pentiums fetch data 64 bits at a time for their 32-bit ALUs. • MIPS stands for “millions of instructions per second” and is a rough measure of the performance of a CPU. Modern CPUs can do so many different things that MIPS ratings lose a lot of their meaning, but you can get a general sense of the relative power of the CPUs from this column.
From this table you can see that, in general, there is a relationship between clock speed and MIPS. The maximum clock speed is a function of the manufacturing process and delays within the chip. There is also a relationship between the number of transistors and MIPS. For example, the 8088 clocked at 5 MHz but only executed at 0. 33 MIPS (about one instruction per 15 clock cycles). Modern processors can often execute at a rate of two instructions per clock cycle. That improvement is directly related to the number of transistors on the chip and will make more sense in the next section.