이 포스트는 서울대학교의 '운영체제의 기초' 강의를 개인 학습용으로 작성한 포스트입니다.
I/O Hardware
I/O device 내부의 register
1. Status register
2. Control register : 장치의 동작을 결정
3. Data register : 입출력할 데이터 임시 보관
Character device : Terminal
Keyboard driver : 키보드로 들어오는 각 character들을 line buffer에 순서대로 저장, End-of-line character가 들어오면 line buffer를 운영체제에 전달
Block device : Disk
Track : Spindle로부터 거리가 동일한 환형의 저장공간
Cylinder : 수직으로 쌓여있는 동일한 반지름 track들의 집합
Sector : Track을 분할하는 디스크 read/write 단위 영역
Disk operation
1. Seek time : Arm을 해당 cylinder까지 이동하는데 걸리는 시간
2. Rotational delay : 해당 sector가 올때까지 회전을 기다림
3. Transfer latency : read/write latency
Flash operation
: Read(page 단위), Write(page 단위), Erase(block 단위)
Erase-before-write : 덮어쓰기가 불가능하여 erase한 후에 write함
Worn-out : Erase 가능한 횟수에 제한 존재
Wear-leveling : Worn-out을 방지하기 위해 전체 영역을 고루 사용하도록 하는 기술
Garbage collection : Invalid한 page옮겨서 erasable한 block 형성
Device Driver
구성
정적 : library, devcie driver를 호출할 때의 API
동적 : ISR
File system 역할 (Device File)
디스크에 있는 data를 읽거나 쓸 수 있는 기능 제공
File이나 Device들에게 Name space 제공
Device File
Type : block/character인지
Major number : 어떤 type의 device인지, major number 1개당 1개의 device driver
Minor number : 루틴이 호출될 대 접근하기 위한 number (argument)
Structure of Character device driver
Structure of Block device driver
* Block buffer cache에 없을시 Request queue를 통해 device에서 가져옴
* Handling request code : 가져오는건 시간이 많이 걸리므로 스케쥴링
* Interrupt - two-level processing : disable이 필요한 중요한 함수 수행하고 나머지는 bottom half에서 수행 (이 때에는 interrupt enable)
General device driver routines
1. Open : read minor number, initialize device driver internal data structure
2. Close : Free allocated data structure
3. Read/Write
4. ioctrl : device specific control
Polling : CPU가 flag를 통해 주기적으로 확인
Interrupt driven : device가 인터럽트 걸어줌
Blocking : ready까지 계속 기다려야함
Non-blocking : ready 꺼지면 바로 return
'Basic Learning > Operating System Concepts' 카테고리의 다른 글
File System (0) | 2020.06.16 |
---|---|
Demand Paging (0) | 2020.06.16 |
Segmentation and Paging (0) | 2020.06.16 |
Dynamic Storage Allocation (0) | 2020.06.16 |
GNU Linker (0) | 2020.06.15 |