[SW_Jungle] PintOS project 2 background

Jin Lee·2022년 1월 4일
0

PintOS

목록 보기
10/16
post-thumbnail

Process

  • process environment block(PEB)
  • provess identifier(PID)

user stack

유저 모드 프로세스 스택 (user mode process stack)

  • 유저 모드 프로세스 스택의 경우, 알다시피 가상주소로 매핑되어 사용된다. 즉, 물리적으로는 동적으로 다른 주소에 매핑된다는 뜻이다.
    task_struct->mm->mmap (vm_area_struct) 에 VMA 의 하나로써 매핑되는 것이다. 따라서 프로세스마다 동적으로 항상 다른 스택 주소 (물리적으로) 를 가질 수 있다.

  • 유저 모드 프로세스 스택, 힙의 경우 메모리 관리 과정은, 프로세스 최초 생성될 때는 vma 만 세팅되고, 실제 특정 코드 실행하거나 특정 데이터 접근 시에 page fault 발생하면, 그 때 page 단위로 할당되는 것이다.

    프로세스에서 유저 영역의 힙, 스택에 대한 page 는 커널에서는 anonymous page 라고 부르는데, 이는 보통 file 과 연결되지 않는 page 를 의미하는 것이다.
    힙, 스택 접근에 대해 page fault 발생하게 되면,
    handle_pte_fault() -> do_anonymous_page() -> alloc_zeroed_user_highpage_movable() -> alloc_page_vma()
    ==> 위 함수 호출로써, 해당하는 vma 에 맞는 page 를 할당하여 리턴해준다.

sentinel value : 데이터의 종료를 나타내기 위해 사용하는 특수한 값, C 문자열의 끝을 나타내는 널 문자, 연결리스트의 끝을 나타내는 널 포인터

x86_64 calling convention

Register vs Memory

argument vector

Executable Linkable Format (ELF) & loader

!!CAUTION!! some system call’s semantic may differ from POSIX standards

  • filesys related
    • open, close, create, read, write, seek, tell, ...
  • process related
    • halt, exit, exec, fork, wait ...

file descriptor

  • file descriptor table
  • dup2 syscall
profile
깃허브 : https://github.com/jinlee9270

0개의 댓글