# I know why DRAM is slower to write than to read, but why is the L1 & L2 cache RAM slower to write?

DRAM is slower to write than read because it takes time to either charge or discharge a DRAM memory cell. But what about the SRAM in my processor's L1 and L2 caches? It's slower to write as well but AFAIK, SRAM is latched memory based on gates.

So why the slower SRAM writing speed?

Thanks.

-
It would been nice to include the program (name & link) that you used to make the observations in question, and some actual details about the setup where you observes this behavior, such as the CPU model, etc. –  mctylr Jul 29 '11 at 1:53

Are you really sure the caches are slower to write than to read? I suspect what you heard was the overall operation, not just the SRAM read or write time. Writing to a cache is a more expensive operation because eventually the slower memory backing the cache must be written to. It also means a cache block can't simply be reused without flushing it first if it's been written to and that write hasn't been propagated back to the main memory.

The actual write operation is probably the same speed, but the overall process of writing, and all the stuff that ultimately puts in motion, is longer.

-
Correction, the L1 writes as fast as it reads, but the L2 writes slower. Now that I think about it, the 4-way set associativity of the L2 cache probably laso has a delay to choose where to write, whereas reading probably reads out all four sets and then chooses. But yes, I agree that a new datum will push out whatever is there and that will incur a delay. BTW I used this utility to measure how my RAM is performing: home.comcast.net/~fbui/bandwidth.html –  Caladan Jul 29 '11 at 1:35

The web page for this Bandwidth program which you apparently base your observation on, that you don't mention in your original question, answers your question in the Commentary section, under the Computers heading, observation 6.

If the L2 cache is in write-through mode then L2 writing will be very slow and more on par with main memory write speeds.

So, normally L2 cache is quicker, but in the case of the L2 cache being in write-through (alternative explanation from Oracle) mode, the purely write is not faster, but if that same memory is then accessed, it is quickly retrieved as it has already been cached.

If you had checked the graphs, and tables given, you would of seen that normally most computers behave as you would expect, the closer the memory is to the CPU, the faster it is (with CPU registers being the fastest).

-