본문 바로가기

Computer Science/OperatingSystem

[OS] System calls

반응형

System calls은 operating system에 의해서 서비스가 사용 가능하게 하도록 하는 인터페이스를 제공한다.

 

예를 들어

데이터를 읽고 복사하는 프로그램을 만든다면 첫번째로 input file, output file의 이름을 입력받아야 한다. 그리고 유저에게 파일의 이름을 물어보아야 한다. 이때 필요한 것이 System calls이다.

 

이름입력창을 띄우고 키보드로 2개의 파일 이름을 입력 받는다. 이러한 과정에서 여러가지의 I/O system calls이 사용된다.

 

파일의 이름을 받았으면 input file을 열어야 하는데 만약 파일에 에러가 있거나 파일에 대한 접근 권한이 거부 된경우에 또 다른 System calls이 호출되고 비정상적으로 종료되었다는 것을 console에 출력해 준다.

 

 

위와 같이 간단한 프로그램이 작동할 때에도 수많은 System calls가 호출된다. 

간단한 프로그램이라도 Operating System을 많이 사용한다는 것을 알 수 있다.

 

대부분의 프로그래머들은 System calls level을 주의깊게 살피지 않는다

대신에 application programming interface(API)에 따라서 프로그래밍을 한다.

 

System calls interface caller는 어떻게 system calls 가 구현되는지 또는 실행중에 무엇을 하는지는 하나도 알 필요가 없다. 다만 API 에 복종하고 OS가 system calls의 결과로 어떤 작업을 해야하는지만 알고 있으면 된다.

 

Types of system calls

  • Process conterol
    • end, abort
    • load, execute
    • create process, terminate process
    • get process attributes, set process attributes
    • wait for time
    • wait event, signal event
    • allocate and free memory
  • File management
    • vreate file, delete file
    • open, close
    • read, write, reposition
    • get file attributes, set file attrivutes
  • Device management
    • request device, release device
    • read, write, reposition
    • get device attributes, set device attributes
    • logically attach or detach devices
  • information maintenance
    • get time or date, set time or date
    • get system data, set system data
    • get process, file, or device attributes
    • set process, file, or device attributes
  • Communications
    • create, delete communication connection
    • send, receive, messages
    • transfer status informatino
    • attach or detach remote devices
반응형

'Computer Science > OperatingSystem' 카테고리의 다른 글

[OS] System Structures  (0) 2020.07.06