System calls → S/W Interrupt 2가지중 하나
- Primitive programming interface provided through interrupt
- System-call interface
Example) POSIX I/O system calls (declared in unistd.h)
int open(const char pathname, int flags, mode_t mode); → 이용해서 fopen() 구현
int close(int fd);
ssize_t read(int fd, void buf, size_t count);
ssize_t write(int fd, const void *buf, size_t count);
// size_t: unsigned int, ssize_t: signed int
➡️ OS 고급기능은 C에는 X, UNIX system call에는 O
System calls: the mechanism used by an application program to request service from OS kernel
- “Function calls to OS kernel available through interrupt” : user mode → kernel mode
- Generally, provided as interrupt handlers written in C/C++ or assembly.
- A mechanism to transfer control safely from lesser privilege modes to higher privileged modes.
Ex) POSIX system calls: open, close, read, write, fork, kill, wait, ...!
→ Interrupt handler와 Sytemcall handler는 약간 다름
: Interrput handler가 처리할때 Systemcall handler를 호출
OS composed(구성) of layers
Layer
- Implementation of abstract objects and operation
- Each layer M can invoke lower-level layers
- Each layer M can be invoked by higher-level layers
Each layer uses functions / services of only lower-level layers
Advantages of layered approach: simple to construct(개발) and debug
- If we develop from lower-level layer to higher-level layer, we can concentrate on only current layer at each stage
- A layer doesn’t need to know detail of lower-level layer
Difficulties of layered approach
- Defining various layers needs careful planning- How to define hierarchy between the modules requires each other- Inefficiency(비효율)
Remedy(해결책)
- Apply fewer(더 적은) layers - Take advantage and avoid difficulties
HGU 전산전자공학부 김인중 교수님의 23-1 운영체제 수업을 듣고 작성한 포스트이며, 첨부한 모든 사진은 교수님 수업 PPT의 사진 원본에 필기를 한 수정본입니다.