본문 바로가기

Programming/Linux_Kernel

TLB (Translation Lookaside Buffer)


원문 : http://embedded21.egloos.com/viewer/757087





TLB (Translation Lookaside Buffer)
    
모든 virtual memory reference는 2개의 physical memory access가 필요함.
    
        1. appropriate page table entry
        2. the desired data
        
straightforward virtual memory scheme이 memory access time을 2배로 만든다.

(설명하자면, page table 에서 virtual address 에 매칭된 physical address 를 찾기위해 한번 물리메모리를 access 하고,

얻어온 물리 메모리주소를 기반으로 실제 데이터를 얻어오기 위해서 한번더 access 한다는 의미)

    
이 문제를 극복하기 위해서, 대부분의 virtual memory scheme은 TLB라고 불리는 page table entry들을 위한 특별한 고속의 cache를 사용한다. 이 cache는 memory cache와 동일한 기능을 수행한다. 가장 최근에 사용되었던 page table entry들을 저장한다.



                                                                     <TLB 구조>



동작 방식
    
만약 desired page table entry가 TLB 상에 존재한다면, (TBL hit 면) frame number가 검색되고, read address가 형성된다. desired page table entry가 없다면, processor는 process page table을 indexing하는 page number를 사용하고 이에 대응하는 page table entry를 검사한다. present bit가 set되면, page는 main memory 내에 있는 것이고, 그렇다면, processor는 frame number를 page table entry로부터 검색해서 real address를 구성할 수 있다.
    
processor는 새로운 page table entry를 포함 시키기 위해서 TLB를 update한다. present bit가 not set이면, 원하는 page가 main memory 내에 없다는 것이고, memory access는 fault를 만든다. 이것이 page fault이다. 
    --> page fault 발생
   
이 경우, hardware의 영역을 떠나고, OS를 호출하여 필요한 page를 load하고 page table을 update한다. page fault interrupt는 page fault handling routine을 호출하게 된다. locality에 의해서 대부분의 reference는 page table 내에 존재한다.

'Programming > Linux_Kernel' 카테고리의 다른 글

linxu bash shell script 명령어  (0) 2014.03.19
linux 명령어 dd  (0) 2014.03.12
ffs, ffsl, ffsll, fls, flsl, flsll 함수 설명  (0) 2014.03.07
__builtin_return_address(0)  (0) 2013.11.28
kernel log back ground 로 저장하기  (0) 2013.11.27