LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-22-2008, 02:57 AM   #1
valpa
LQ Newbie
 
Registered: Jun 2007
Posts: 24

Rep: Reputation: 15
TLB and cache difference?


Maybe it is a hardware achitecture question, not a Linux kernel question. But I don't know where to post, so I choose here since here is the most relevent place.


I was told that the TLB orgnization is "full assocc" and cache is "directly mapped". But I think they both use some 01 bits (address) to match the content in it. What is the real difference between their orgnize?
 
Old 08-22-2008, 11:27 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
The TLB (Translation Lookaside Buffer) is an essential part of the virtual memory system: it avoids having to look through segment- and page-tables for each memory-access.

TLB hardware works in parallel: in other words, "anyone in the room who has address $123456, please raise your hand." The virtual address is presented simultaneously to every slot.

The term "cache," per contra, can mean many things in many different contexts. It's a software construction, whereas the TLB is hardware circuitry. (And yet, it could obviously be said that "the TLB is 'a cache.'" because of the purpose that it serves.)
 
Old 08-22-2008, 12:04 PM   #3
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by sundialsvcs View Post
The term "cache," per contra, can mean many things in many different contexts. It's a software construction, whereas the TLB is hardware circuitry.
Yes, a cache could be many things, but I think the OP meant something like the on chip cache in, say, an Intel/AMD processor, which would be hardware.

I hope I can renmember this rubbish; I think I know where my copy of John L. Hennessy and David A. Patterson is, but I wouldn't like to get it out!

I think the OP is trying to ask about set associativity (but I could be wrong).

Assume that you are caching a memory of size (no of address bits needed to unambiguously map the address space) a. There is no point in having a cache unless the cache is a smaller memory than the area of memory being cached, otherwise you would just use the fast cache memory for everything.

Divide the address-space-to-be-cached into to two portions; the most significant n bits and the remaining bits (for an address length, a, the remaining bits will be a-n [ = m] ).

In a direct mapped or one way cache there is one location that relates to each address in the m bit address space, for a two way, there will be two, etc. What this means is that every time that you need to cache a memory adress with a least significant portion (m) of some particular value, no other memory address that has an identical m can be cached. For a two-way that can be two, etc.

So you might think that two-way (or four or eight...) would be bound to be superior. This is incorrect. (This is not a statement that a direct mapped cache is always superior.)

Firstly, a direct mapped cache is simpler to implement and the number of cycles required for access has an impact on system performance and complexity of implimentation relates to access time.

Secondly, with locality of reference the chances are high that the next addresses to be accesed will be in the vicinity if the currently accessed one and so having cache space for 'far away addresses that map over the current one, at some degree of aliasing' may be of less value than you think.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between page cache and buffer cache Nayaka Linux - Kernel 5 09-28-2011 08:23 AM
avoiding TLB flush on process switch kailas Linux - Kernel 7 07-27-2008 09:40 AM
openSUSE 10: Samba failed to create the cache directory in /var/cache mianmajidali Linux - Server 0 05-09-2008 02:00 AM
remove tlb entry ashlesha Linux - Software 0 11-14-2006 12:46 PM
Error: Caching enabled and local cache: //var/cache/yum/base/primary.xml.gz does... dr_zayus69 Linux - Software 2 07-06-2005 04:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration