Skip to content

feat: swap, not merge#39

Open
SangChunn wants to merge 4 commits intomainfrom
SC-SS
Open

feat: swap, not merge#39
SangChunn wants to merge 4 commits intomainfrom
SC-SS

Conversation

@SangChunn
Copy link
Member

No description provided.

@SangChunn SangChunn self-assigned this Dec 9, 2025
@SangChunn SangChunn added the feat label Dec 9, 2025
@SangChunn
Copy link
Member Author

frame.c

frame_table_add

  • 새로 확보한 프레임을 전역 frame_table 리스트에 등록
  • 이미 올라간 프레임인지 확인하고, frame_elem을 리스트에 붙인 뒤 clock-hand가 비어 있으면 갱신
  • 프레임을 eviction 후보 집합에 편입
  • frame->on_table = true는 “이 프레임의 frame_elem이 현재 frame_table 리스트에 올라가 있다”는 표시
    • 즉 이걸 보고 위에 있으면 remove를 가능

frame_table_remove

  • hand : 지금 제거하려는 프레임이 clock hand가 가리키고 있던 프레임인가?
    • 리스트에서 프레임을 빼도 clock hand가 유효한 프레임을 가르킴
  • 삭제 대상이 바로 현재 clock hand? → 리스트에 빼는 순간 hand가 유효한 node 안가르킴 → next 로 핸드 옮겨줌 + 리스트 끝? → list_begin
  • 삭제 대상이 아니다? → hand 그대로 냅둠

vm_frame_free

  • frame_table_remove 호출해서 프레임을 frame_table 리스트에서 빼고, clock hand도 필요한 경우 다음 프레임으로 → eviction 후보 집합에서 제외
  • 리스트에서 빠진 뒤 실제 물리 페이지 frame->kvapalloc_free_page()로 반환하고, struct frame 자체도 free()로 해제

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant