[OS] System Calls, API

Ko Hyejung·2021년 10월 11일
0

Operating Systems

목록 보기
5/26

OS Services and System Calls

https://www.geeksforgeeks.org/introduction-of-system-call/

In computing, a system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is executed on.

컴퓨팅에서 시스템 호출은 컴퓨터 프로그램이 실행되는 운영 체제의 커널로부터 서비스를 요청하는 프로그래밍 방식

A system call is a way for programs to interact with the operating system.
A computer program makes a system call when it makes a request to the operating system’s kernel.

시스템 호출은 프로그램이 운영 체제와 상호 작용하는 방법입니다.
컴퓨터 프로그램은 운영 체제의 커널에 요청을 할 때 시스템을 호출

System call provides the services of the operating system to the user programs via Application Program Interface(API).

시스템 호출은 API(Application Program Interface) 를 통해 운영 체제의 서비스를 사용자 프로그램에 제공

  • typically written in a high-level language (C or C++) and provided as a library (e.g., POSIX API or Win32 API).

일반적으로 고급 언어(C 또는 C++)로 작성되고 라이브러리(예: POSIX API 또는 Win32 API)로 제공

  • provides an interface between a process and operating system to allow user-level processes to request services of the operating system.

프로세스와 운영체제 간의 인터페이스를 제공하여 사용자 레벨 프로세스가 운영체제의 서비스를 요청할 수 있도록 함

System calls are the only entry points into the kernel system.
All programs needing resources must use system calls.

시스템 호출은 커널 시스템의 유일한 진입점이다.
리소스가 필요한 모든 프로그램은 시스템 호출을 사용해야 합니다.

Services Provided by System Calls

  • Process creation and management 프로세스 생성 및 관리
  • Main memory management 주요 메모리 관리
  • File Access, Directory and File system management 파일 접근, 디렉토리 및 파일 시스템 관리
  • Device handling(I/O)
  • Protection
  • Networking, etc.

Types of System Calls

There are 5 different categories of system calls
시스템 통화에는 5가지 범주

  • Process control : end, abort, create, terminate, allocate and free memory.
    프로세스 제어 : 메모리 종료, 중단, 생성, 종료, 할당 및 사용 가능
  • File management : create, open, close, delete, read file etc.
    파일관리 : 파일 만들기, 열기, 닫기, 삭제, 읽기 등
  • Device management 기기 관리
  • Information maintenance 정보 유지 관리
  • Communication 통신

API - System Call - OS Relationship

System Call Implementation

Typically, a number associated with each system call.

일반적으로 각 시스템 호출과 관련된 번호

  • System-call interface maintains a table (i.e., system call table) indexed according to these numbers.
    System-call interface는 이 숫자에 따라 색인화된 테이블(시스템 호출 테이블)

The system-call interface invokes intended system call in OS kernel and returns status of the system call and any return values.
시스템 호출 인터페이스는 OS 커널에서 의도된 시스템 호출을 호출하고 시스템 호출의 상태와 반환 값을 반환

The caller needs to know nothing about how the system call is implemented.
호출자는 시스템 호출이 구현되는 방법에 대해 아무것도 알 필요가 없습니다.

  • Just needs to obey API and understand what OS will do as a result of the call.
    API를 준수하고 OS가 호출의 결과로 무엇을 할 것인지 이해하기만 하면 됨
  • Most details of OS interface hidden from programmer by API.
    API에 의해 프로그래머에게 숨겨져 있는 OS 인터페이스의 대부분의 세부 사항
  • Managed by run-time support library (set of functions built into libraries included with compiler).
    런타임 지원 라이브러리(컴파일러에 포함된 라이브러리에 내장된 함수 집합)에 의해 관리

System Call Parameter Passing

Often, more information is required than simply identity of desired system call.
종종, 원하는 시스템 호출의 단순한 신원보다 더 많은 정보가 필요

  • Exact type and amount of information vary according to OS and call.
    OS와 호출에 따라 정확한 정보 종류와 양이 다름

Three general methods used to pass parameters to the OS.
OS에 매개 변수를 전달하는 데 사용되는 세 가지 일반적인 방법

  • Simplest: pass the parameters in registers. In some cases, may be more parameters than registers.
    레지스터에서 매개 변수를 전달. 경우에 따라 registers보다 많은 매개 변수일 수 있습니다.
  • Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register.
    메모리의 block 또는 테이블에 저장된 파라미터와 레지스터의 파라미터로 전달된 블록의 주소
  • Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system.
    프로그램에 의해 '스택'에 배치되고 운영 체제에 의해 스택에서 'pop'된 파라미터
  • Block and stack methods do not limit the number or length of parameters being passed.
    블록 및 스택 메소드는 전달되는 파라미터의 개수나 길이를 제한하지 않습니다

Types of System Calls

  1. Process control
    e.g. end/abort, load/execute, create/terminate process, get/set process attributes, wait for time, wait/signal event, allocate/free memory

공정관리
예를 들어 종료/실행, 로드/실행, 프로세스 생성/실행, 프로세스 특성 가져오기/설정, 시간 대기, 대기/신호 이벤트, 메모리 할당/해제

  1. File management
    e.g. create/delete file, open/close, read/write/reposition, get/set file attributes

파일 관리
예를 들어 파일 생성/삭제, 열기/닫기, 읽기/쓰기/위치 조정, 파일 속성 가져오기/설정

  1. Device management
    e.g. request/release device, read/write/reposition, get/set device attributes, attach/detach devices

장치 관리
예를 들어 요청/해제 장치, 읽기/쓰기/위치 조정, 장치 속성 가져오기/설정, 장치 연결/해제

  1. Information maintenance
    e.g. get/set time/date/process/file/device attributes

정보유지관리
예: 시간/날짜/프로세스/파일/장치 특성 가져오기/설정

  1. Communications
    e.g. create/delete communication connection, send/receive messages, transfer status info, attach/detach remote devices

통신
예를 들어 통신 연결 생성/삭제, 메시지 전송/수신, 상태 정보 전송, 원격 장치 연결/삭제

Windows / Unix System Calls

0개의 댓글