[태그:] stack growth

  • Pintos Project 3 한국어 설명서 (design report) – Virtual Memory, Frame table

    목차

    0. Background
    0.1. Memory
    0.1.1. virtual memory
    0.1.2. physical memory
    0.2. pintos virtual memory
    0.2.1. user virtual memory
    0.2.2. Kernel virtual memory
    0.2.3. page fault 발생 원인
    0.3. memory allocation
    0.3.1. page allocator
    0.3.2. block allocator
    0.4. hash table
    0.5. paging

    1. Frame Table
    1.1. Meaning of Frame Table
    1.2. Necessity of Frame Table
    1.3. Current Implementation
    1.4. New Implementation

    2. Lazy loading
    2.1. Meaning of Lazy Loading
    2.2. Necessity of Lazy Loading
    2.3. Current Implementation
    2.4. New Implementation

    3. Supplemental page table
    3.1. Meaning of Supplemental Page Table
    3.2. Necessity of Supplemental Page Table
    3.3. Current Implementation
    3.4. New Implementation

    4. Stack growth
    4.1. Meaning of Stack growth
    4.2. Necessity of Stack growth
    4.3. Current Implementation
    4.4. New Implementation

    5. File memory mapping
    5.1. Meaning of File memory mapping
    5.2. Necessity of File memory mapping
    5.3. Current Implementation
    5.4. New Implementation

    6. Swap table
    6.1. Meaning of Swapping
    6.2. Necessity of Swap table
    6.3. Current Implementation
    6.4. New Implementation

    7. On process termination
    7.1. Necessity of On process termination
    7.2. Current Implementation
    7.3. New Implementation

    본문내용

    0. Background
    1. Memory
    31 12 11 0 31 12 11 0
    +——————-+———–+ +——————-+———–+
    | Page Number | Offset | | Frame Number | Offset |
    +——————-+———–+ +——————-+———–+
    Virtual Address Physical Address
    virtual address (=page)
    32-bit의 address = 20 bit의 frame number + 12 bit의 frame offset
    physical address (=frame)
    32-bit의 address = 20 bit의 frame number + 12 bit의 frame offset
    1.1. virtual memory
    virtual memory는 physical memory를 보조하는 개념
    process가 필요한 data는 virtual memory에서 physical memory로 load해오고, 필요없는 data는 virtual memory (ex : disk) 에 저장함으로써 physical memory 공간 확보
    각 process는 virtual address와 physical address 를 mapping하는 table을 가지고 있어 virtual address로 physical address를 찾아갈 수 있다.
    virtual memory는 page의 형태로 disk에 저장되어 있으며, 필요할 때마다 physical memory로 swap in되어 사용된다.

    출처 : 해피캠퍼스

  • Pintos Project 3 final report – Virtual Memory, Frame table

    목차

    1. frame table
    1.1. Algorithm
    1.2. Data Structure
    1.3. Function

    2. lazy loading
    2.1. Algorithm
    2.2. Function

    3. Supplemental page table
    3.1. Algorithm
    3.2. Data Structure
    3.3. Function

    4. stack growth
    4.1. Algorithm
    4.2. Function

    5. File memory mapping
    5.1. Algorithm
    5.2. Data structure
    5.3. Function

    6. Swap table
    6.1. Algorithm
    6.2. Data structure
    6.3.Function

    7. On process termination
    7.1. Algorithm
    7.2. Function

    8. discussion

    본문내용

    1. frame table
    어떤 page에 frame을 할당하기 위해 frame table을 순회하였을 때
    1. free frame이 존재하는 경우
    해당 frame을 할당하면 된다.
    2. free frame이 존재하지 않는 경우
    다른 frame의 page를 evict하여 새로운 free frame을 만들어야 한다
    이때 page replacement algorithm을 통해
    evict할 frame을 고른 후,
    현재 frame에 참조중인 모든 page table의 reference를 제거하고,
    page에 변화가 있다면 write back이나 swap을 수행한다.
    evict된 frame은 새로운 page를 저장하기 위해 사용된다.
    project 3에서
    frame에서의 eviction을 위해 사용할 page replacement algorithm은 Clock algorithm이다.
    이 알고리즘은
    frame table을 순회하여
    page의 accessed bit이 1인 경우 0으로 바꿔주고,
    page의 accessed bit이 0인 경우 이를 선택한다.
    1.1. Algorithm
    Frame 생성
    Frame 생성을 위한 memory공간을 할당하기 위해 frame_allocate을 호출한다.
    이때, palloc_get_page(PAL_USER) 를 통해 user pool로부터 page를 생성한다.
    page allocation 성공
    생성한 주소 그대로 사용
    page allocation 실패
    free frame을 확보하기 위해 eviction()을 호출한다.
    palloc_get_page()를 다시 호출한다.
    frame을 생성하기 위해 malloc()을 호출한다.
    frame을 frame table에 추가한다.
    Frame 제거
    Frame 제거를 위한 frame_deallocate()를 호출한다.
    Frame table에서 해당 frame을 찾으면,
    page를 해제해주고,
    frame table에서 frame을 제거한다.

    출처 : 해피캠퍼스