[운영체제] Ch2(1) OS Services & System call
OS Services
운영체제는 프로그램을 수행하기 위한 환경을 만들고 유저들에게 다양한 경험을 주어야 한다.
[OS Services 종류들]
- User interface(명령어를 입력하기 위해)
- Program execution(프로그램 수행 과정 지원)
- I/O operations
- File-system manipulation
- Communications
- Error detection
- Resource allocation(Cpu cycles, main memory, file storage, I/O devices)
- Logging
- Protection and Security
User interface
CLI(Command Line Interface)
- 사용자가 명령어를 알아서 찾아 입력해야 함. (주로 개발자가 사용)
- 일반적으로 shell이라고 한다.
GUI(Graphic User Interface)
- 사용자에게 친절한 인터페이스
- 마우스, 키보드, 모니터, 스마트폰의 아이콘, 음성 인식 등
대부분의 시스템은 CLI와 GUI를 함께 가지고 있다.
System Calls
System call: 여러가지 프로그램에서 필요한 명령어들을 운영체제에서 구현해 놓은 것.
API(Application Programming Interface): System call를 사용하여 만든 다양한 용도의 함수의 집합체
System call implementation
운영체제에서는 다양한 system call이 있기 때문에 table에서 index로 접근한다.
1. user application에서 open()[system call]를 사용한다.
2. user mode에서 kernel mode로 trap[software interrupt]를 건다.
3. user mode는 kernel mode에게 open()에 해당하는 index를 trap을 통해 전해준다.
4. kernel mode에서는 해당하는 index를 수행하고 user에게 결과를 반환한다.
이 때 system call parameter를 넘기는 방법
1. parameter의 size가 작을 때: register를 통해 parameter를 넘긴다. (대부분의 경우)
2. parameter의 size가 클 때: memory에 있는 block이나 table에 저장하고 그 주소를 register를 통해 넘긴다.
system call의 종류
1.Process control
- create process, terminate process
- end, abort
- load, execute
- get process attributes, set process attributes
- wait for time
- wait event, signal event
- allocate and free memory
- Dump memory if error
- Debugger for determining bugs, single step execution
- Locks for managing access to shared data between processes
2. File management
- create file, delete file
- open, close file
- read, write, reposition
- get and set file attributes
3. Device management
.... 등등 엄청 많음.
System Services
system call을 사용해 더 많은 서비스를 제공하는 것.
[system services의 종류들]
- File manipulation
- Status information sometimes stored in a file
- Programming language support
- Program loading and execution
- Communications
- Background services
- Application programs 등