CSAPP Chapter VI concept

CSAPP Chapter VI concept

1. temporal locality : programs tend to access the same data block repeatedly over a period of time

Spatial locality: programs often have access to a tendency to aggregate spatial data block

Examples of spatial locality: we can choose to read the memory blocks when it is near the memory block read incoming (prefetch)

2.B KB MB

1GB=1024MB=1024*1024KB=1024*1024*1024B

3.Tmax rotation = 1 / rate of rotation RPM * 60s / min * 1000ms

Tavg rotation=1/2*Tmax rotation

Tavg transfer = 1 / rate of rotation RPM * 60s / min * 1000ms * 1 / (average number of sectors / track)

4. The number of logic blocks = file size / logical block size of each

Taccess = stochastic logical block number * (Tavg seek + Tavg rotation)

Best case Taccess = (Tavg seek + Tavg rotation) + (File Size / (* sector size (mean number of sectors / track)) * Tmax rotation

5. 6.8 exercises similar in structure memory array

p[0].vel[3] 0 4 8

p[0].acc[3] 12 16 20

P[1].vel[3] 24 28 32

The smaller the loop, the more the number of loop iterations, the better locality

6. cache miss

 

When the tag and valid verification is successful, we called cache hit, then as long as the unit out of the cache, CPU registers can be placed.

 

When valid tag or verification fails, it means that the memory cell to be accessed (and possibly some of the discrete units, then you need to take the memory, appears miss.

 

  Cold miss   the cache starts empty

  Conflict miss some objects are mapped to the same cache block

  Capacity miss cache is too small to handle the work set

Working set (working set) a specific period of time, a process required for memory

T 7.cache address bits from the tag, s bit set index composed of block offset bits and b

 

 

 

The reason to do the bit in the middle of the index 

Spatial locality is found, if the high indexing sequentially scan an array, cache size of the content backup array only one block at any time.

If done intermediate position, the adjacent block is always mapped to different cache lines, the use efficiency is greatly improved, when a cache capable of storing the entire array sheet.

 

 

8.C=B*E*S

Number S-- group

E-- number of rows in each group (cache line)

B-- block size

m-- physical address bits

t=m-(s+b)

s=log2(S)

9. The computer storage system profile (taken from known almost)

Closer from the CPU memory, the faster, the higher the cost per byte, while the capacity and therefore smaller.

Memory hierarchy, makes use of the principle of locality. We can read classic books, for example. I read the book in my hands (register), a book I recently read frequently, on the desk (cache), readily accessible for reading. Of course, the desk can only put a limited number of books. I have more books on the shelves (memory). If there are no books on the shelves, go to the library (disk). I have to read the book if not the hands, then go find the desk, if not on the desk, to look on the shelf, if not go to the library to find on the shelves. May correspond to register is not, taken from the cache, the cache no, taken from the memory to the cache memory, if not, starting with the disk read into memory, read into the cache, read the register.

10.cache Overview

First an area is accessed, it will be copied into the cache, access to the region after the instruction or data, is no longer taken from the main memory.

1)direct-mapped cache

Each group has only one line

2) Set associative cache

S groups, each group a line E

3) Fully associative cache

It consists of a group that contains all of the cache lines of the composition without hash determine the group in which, in the group one by one to find

 

 

Guess you like

Origin www.cnblogs.com/wwqdata/p/11984378.html