ephram@violet.berkeley.edu (04/06/89)
Hi there, I am researching the purchase of a 386 box and I need to know about the different types of cache available. I have heard of "direct mapped"(maps one 32k chunk of memory) and 2 way set associative (splits the 32k into 2 16k chunks). Are there more? The machine will be used for signal processing (audio). The data is probably no going to be within 32k of the code(sometimes it will but there will definately be times that it won't). Is the 2-way type cache what I want? will it matter? Am I missing something? Send mail and I will summarize We must prevent those commies from compromising the integrity of our precious bodily fluids. -Gen. Jack D. Ripper Ephram Cohen ephram@violet.berkeley.edu 466 44th St. #1 3210 Tolman Hall Oakland, CA 94609 Berkeley, CA 94720
terrell@druhi.ATT.COM (TerrellE) (04/07/89)
Cache memories exploit the fact that most programs exhibit locality of memory references. Locality of memory reference means that if a given memory location is accessed, it is likely to be accessed again soon. The memory location could be a program variable or an instruction in the program's executable code. Consider a program that repeatedly executes a tight loop. Inside of this loop, a small set of variables are referenced. This program will tend to speed up significantly if a cache is in use, since there is great locality of reference in the program code (the same instructions are referenced again and again) as well as the program's variables (the same variables are repeatedly referenced). A program that will experience much less speedup is one that is very branchy, and has very scattered variable references. Cache performance depends primarily on locality of memory references, and (except in pathelogical cases) is not greatly affected by where the program instructions and variables are placed in memory. However, one could decimate cache performance by placing program instructions and program variables in memory in a way that the two to use the same cache locations at the same time (i.e. thrash), but this typically doesn't happen in ordinary programs. If you want to find out about different cache organizations (direct-mapped, set associative, etc), see: A. J. Smith, "Cache Memories", Computing Surveys, Vol 14, No. 3, Sept. 1982, pp. 473-530. Smith also wrote a similar (but more up-to-date) article in (if memory serves) IEEE Computer within the last year. In summary, ordinary programs tend to exhibit reasonable locality in memory references for program variables and instructions, and consequently will tend to experience a significant speedup. The locality of memory references is more important to cache performance than where the program instructions and variables are placed in memory, except in pathelogical cases. Eric Terrell (att!druhi!terrell)