[OS] 03. System Call

nick·2024년 3월 13일

OS

목록 보기
3/4

해당 내용은 아주대학교 '김상훈' 교수님의
'운영체제' 수업을 바탕으로 작성되었습니다.


[목차]

  1. OS가 제공하는 2가지 중요한 기능

  2. Priviledged instructions

  3. Multi-mode CPU

  4. Interrupt

  5. User mode → Kernel mode

  6. System Call

  7. OS의 전반적인 services

  8. System call의 종류들

1. OS가 제공하는 2가지 중요한 기능

  1. 중요한 코드를 아무나 실행하지 못하도록 관리 ( = 자원 관리 )
  2. 실행하던 흐름을 가로채기 ( = 모드 변경 )

2. Priviledged instructions

  • 아무나 실행시킬 수 없는 instruction들 ( = 조심히 실행시켜야 할 instruction )
  • System register( ex. IDT, Control registers )에 접근하거나 조작하려는 instruction
  • Memory 상태 관리( ex. Page table updates, TLB loads ... ) 관련 instruction

3. Multi-mode CPU

  • 전통적인 CPU를 기준으로 2가지 mode가 존재 ( 최근 CPU들은 2개 이상의 mode 존재 )
  • User mode & Kernel mode
  • 앞서 설명한 priviledged instruction은 kernel mode에서만 실행 가능하다
  • 이렇게 user modekernel mode 분리를 통해 OS와 여러 system 요소들을 지킬 수 있음
  • instruction들 실행하면서 resource에 접근하려고 할 때, OS를 통해서만 접근할 수 있도록 설정해 resource를 보호할 수있음

4. Interrupt

  • Interrupt의 2가지 종류

1. Asychronous interrupt

  • hardware interrupt 라고도 함

  • 주로 interrupt 라고 부름

  • hardware devices에서 발생된다

  • 아무때나 막 interrupt가 발생된다

2. Sychronous interrupt

  • 주로 Exception 이라고 부름

  • software 실행중에 발생된다

  • 주로 user mode에서 privileged instruction 실행하려다가 발생

  • CPU가 instruction을 실행시킬 때 Exception이 발생하기 때문에 sychronous 하다고 함


5. User mode → Kernel mode

  • App이 user mode에서 진행하다가 kernel mode로 transition 하고 싶을 때 interrupt 사용

  • CPU가 user mode에서 실행하다가 interrupt를 catch하면 Kernel mode로 넘어가서 해당하는 interrupt에 대한 interrupt handler를 실행시킨다

  • interrupt handling이 끝나면 다시 user mode로 복귀


6. System Call

  • OS가 제공하는 software interrupt의 interface 라고 생각하면 된다

  • user mode에서 system call을 활용해 kernel mode로 넘어간다


7. OS의 전반적인 services

os구조

  • user interface에서 system call을 통해 kernel mode로 넘어가서 해당하는 service를 제공받을 수 있다

8. System call의 종류들

Process control

  • create process, teminate process
  • load, execute
  • allocate and free memory
  • etc...

File management

  • create file, delete file
  • open, close file
  • read, write operation
  • etc ...

Protection

  • control access to resources
  • allow and deny user access
  • etc ...

self quiz 링크
https://overjoyed-goldfish-618.notion.site/f81e3c203cff4bfcb5841da8e9bfbc02?pvs=4

profile
티스토리로 이전 : https://andantej99.tistory.com/

0개의 댓글