CSC/ECE 506 Spring 2011/ch6b df

From Expertiza_Wiki
Revision as of 23:56, 28 February 2011 by Dgfleisc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Translation Lookaside Buffer and Cache Addressing

Programs used virtual addresses to access memory. If the program were to not use virtual addresses, two programs running at the same time would need their own section of memory. For example, if the computer has 512MB of memory and two programs are running at the same time, each program could only use 256MB of the memory. Virtual addresses are used to allow each program the use of the whole memory. Virtual memory can also allow for the memory to appear bigger than it actually is. One problem with the programs accessing memory with virtual addresses is that caches and memory need to be accessed with physical addresses. The Operating System is used to translate these virtual addresses into physical addresses. The OS can be relatively slow at doing this and so we need to create a cache that stores the most recently accessed addresses. This cache is called the Translation Lookaside Buffer or TLB. Virtual addresses are broken up into two parts: a virtual tag and a virtual page offset or VPO. Physical Addresses are broken up into a physical tag and a physical page offset or PPO. THe PPO determines which memory page a given value is in. These pages are handled by the OS through page tables. There are three different ways to use the virtual addresses and the physical addresses to access data. THe three ways are physically addressed, virtually addressed, and physically tagged but virtually addressed.

Physically Addressed

Physically Addressed refers to using the whole physical address to access memory. To access memory, the computer must first translate the virtual address into a physical address using the TLB. After the computer has the physical address, it can index through the cache and pull out the block it needs. The computer then checks the tag to see if it is a hit or miss. This is not ideal because the time it takes to access the TLB is added onto the time it takes to access the cache.

Virtually Addressed

Virtually Addressed refers to using the whole virtual address to access memory.