C5P1 cache memory principles

13 0 0
Tài liệu đã được kiểm tra trùng lặp
C5P1 cache memory principles

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Bộ nhớ đệm (Cache)- kiến trúc máy tính. nó bấm chữ thì không được, mà cứ chê bạn mô tả quá ngắn phải bấm chỗ khác rồi dán vô, muốn chửi thề, bấm được 1 chữ thì đơ ra đó mà đòi dài. Cứ cà dựt cà dựt không cho bấm

Trang 1

5.1 Cache Memory Principles

Cache Memory is a special very high-speed, small memory that stores data so

that future requests for that data can be served faster The cache contains a copy of portions of the main memory.

Cache operates as a turbocharger to slower main memory by holding copies of code

and data that are frequently requested from the main system memory by the microprocessor.

 Characteristics of Cache Memory (Optional)

 Cache memory is an extremely fast memory type that acts as a buffer between RAM and the CPU.

 Cache Memory holds frequently requested data and instructions so that they areimmediately available to the CPU when needed.

 Cache memory is costlier than main memory or disk memory but more economical than CPU registers.

 Cache Memory is used to speed up and synchronize with a high-speed CPU.

Levels of Memory

Level 1 or Register (CPU): It is a type of memory in

which data is stored and accepted that are immediately stored in the CPU The most commonly used register is Accumulator, Program counter, Address Register, etc.

Level 2 or Cache memory (L1, L2, L3): It is the fastest

memory that has faster access time where data is temporarily stored for faster access.

Level 3 or Main Memory (RAM): It is the memory on

which the computer works currently It is small in size and once power is off data no longer stays in this memory.

Level 4 or Secondary Memory (Hard disk) : It is

external memory that is not as fast as the main memory Slow

Word

transfer FastBlock transfer

Trang 2

Cache/Memory Structure

Block: The minimum unit of transfer between cache and main memory

Frame: To distinguish between the data transferred and the chunk of physical

Line: A portion of cache memory capable of holding one block, so-called

because it is usually drawn as a horizontal object (i.e., all bytes of the line are typically drawn in one row) A line also includes control information.

Tag: A portion of a cache line that is used for addressing purposes, as explained

subsequently A cache line may also include other control bits.

Trang 4

Cache Operation

When the processor needs to read or write a location in the main memory, it first checks for a corresponding entry in the cache.

If the processor finds that the memory location is in the cache, a Cache Hit

has occurred and data is read from the cache.

Trang 5

If the processor does not find the memory location in the cache, a Cache Miss has occurred For a cache miss, a block of main memory, consisting of

some fixed number of words, is read into the cache and then the word is delivered to the processor.

Because of the phenomenon of locality of reference, when a block of data is fetched into the cache to satisfy a single memory reference, it is likely that there will be future references to that same memory location or to other words in the block.

If a cache miss occurs, two things must be accomplished: the block containing

the word must be loaded in to the cache, and the word must be delivered to the processor.

Trang 6

Cache Performance (Optional)

 The performance of the cache is measured in terms of hit ratio When CPU refers to memory and find the data or instruction within the Cache Memory, it

is known as cache hit If the desired data or instruction is not found in the

cache memory and CPU refers to the main memory to find that data or

instruction, it is known as a cache miss.

Hit + Miss = Total CPU ReferenceHit Ratio(h) = Hit / (Hit+Miss) Miss Ratio = 1 - Hit Ratio(h)Miss Ratio = Miss / (Hit+Miss)

 Average access time of any memory system consists of two levels: Cache and Main Memory If Tc is time to access cache memory and Tm is the time to access main memory then we can write:

Tavg = Average time to access memoryFor simultaneous access

Tavg = h * Tc + (1-h)*Tm For hierarchial access

Trang 7

Tavg = h * Tc + (1-h)*(Tm + Tc)

Trang 8

Cache vs RAM (Optional)

Although Cache and RAM both are used to increase the

performance of the system there exists a lot of differences in which they operate to increase the efficiency of the system

OS interacts with secondarymemory to get data to be stored

in Primary Memory or RAM

OS interacts with primarymemory to get data to be stored

in Cache.It is ensured that data in RAM

are loaded before access to theCPU This eliminates RAM miss

2 https://en.wikipedia.org/wiki/Cache_(computing)3 https://techmonitor.ai/what-is/what-is-cache-memory4 https://www.geeksforgeeks.org/cache-organization-set-1-

5 https://www.geeksforgeeks.org/cache-memory/?ref=lbp

6 operation-in-cache-memory/

https://www.geeksforgeeks.org/locality-of-reference-and-cache-7 organization/

https://www.geeksforgeeks.org/cache-memory-in-computer-5.1 Nguyên lí của bộ nhớ đệm

Trang 9

Bộ nhớ Đệm là một loại bộ nhớ rất nhanh, nhỏ dùng để lưu trữ dữ liệu để các yêu cầu

trong tương lai về dữ liệu đó có thể được phục vụ nhanh hơn Bộ nhớ đệm tương tự như bộ nhớ chính.

Bộ đệm hoạt động như một bộ tăng áp để làm chậm bộ nhớ chính bằng cách giữ các

bản sao mã và dữ liệu thường được bộ vi xử lý yêu cầu từ bộ nhớ hệ thống chính.

Các tầng bộ nhớ

Tầng 1 hay thanh ghi (CPU): Nó là một loại bộ nhớ trong

đó dữ liệu được lưu trữ và chấp nhận được lưu trữ ngay lập tức trong CPU Thanh ghi được sử dụng phổ biến nhất là Thanh ghi tích lũy, Bộ đếm chương trình, Thanh ghi địa chỉ, v.v.

Tầng 2 hay bộ nhớ đệm (L1, L2, L3): Đây là bộ nhớ

nhanh nhất có thời gian truy cập nhanh hơn, nơi dữ liệu được lưu trữ tạm thời để truy cập nhanh hơn.

Tầng 3 hay bộ nhớ chính (RAM): Đây là bộ nhớ mà máy

tính hiện đang hoạt động Nó có kích thước nhỏ và khi tắt nguồn, dữ liệu sẽ không còn lưu trong bộ nhớ này nữa.

Tầng 4 hay bộ nhớ phụ (ổ cứng) : Đó là bộ nhớ ngoài

không nhanh bằng bộ nhớ chính nhưng dữ liệu vẫn tồn tại vĩnh viễn trong bộ nhớ này.

SlowWord

transfer Block transferFast

Trang 10

Cấu trúc bộ đệm/bộ nhớ

• Khối: Đơn vị truyền tối thiểu giữa bộ đệm và bộ nhớ chính.

• Khung: Để phân biệt giữa dữ liệu được truyền và đoạn bộ nhớ vật lý.

• Dòng: Một phần bộ nhớ đệm có khả năng chứa một khối, gọi như vậy vì nó thường

được vẽ dưới dạng đối tượng nằm ngang (tức là tất cả byte của dòng thường được vẽ thành một hàng) Một dòng cũng bao gồm thông tin điều khiển.

• Nhãn: Một phần của dòng bộ đệm được sử dụng cho mục đích đánh địa chỉ, như

được giải thích sau Một dòng bộ đệm cũng có thể bao gồm các bit điều khiển khác.

Trang 11

được đọc vào bộ đệm và sau đó từ đó được gửi đến bộ xử lý.

Do hiện tượng tham chiếu cục bộ, khi một khối dữ liệu được tìm nạp vào bộ đệm để đáp ứng một tham chiếu bộ nhớ duy nhất, có khả năng sẽ có các tham chiếu trong tương lai đến cùng vị trí bộ nhớ đó hoặc tới các từ khác trong khối.

Trang 12

Nếu xảy ra lỗi bộ đệm, hai việc phải được thực hiện: khối chứa từ phải được tải vào bộđệm và từ phải được gửi đến bộ xử lý.

Trang 13

Kết thúc bản dịch Tiếng Việt

Ngày đăng: 17/05/2024, 22:49

Tài liệu cùng người dùng

Tài liệu liên quan