Part10 (IO and Disk)
Part10 (IO and Disk)
• I/O Hardware
• I/O System Design and Implementation
– Design Objectives
– Kernel I/O Structure
– Kernel I/O Subsystem
– Performance Consideration
• Disk
– Disk Structure
– Disk Scheduling
!FCFS, SSTF, SCAN, C-SCAN, C-LOOK
– Disk Management
– Disk Reliability
Operating Systems 10.1 Part 10 I/O System & Disk
I/O Hardware
• Efficiency
– Important because I/O operations often form a
bottleneck
– Most I/O devices are extremely slow compared with
main memory and the processor
– The area that has received the most attention is disk
I/O
• Generality
– Desirable to handle all devices in a uniform manner
– Applies to the way processes view I/O devices and
the way the operating system manages I/O devices
and operations
• I/O Scheduling
– Schedule I/O request through rearranging the order of
service, e.g. disk scheduling
– Can improve the system efficiency
• Buffering
– Store data in memory
while transferring
between devices
– To cope with device
speed mismatch
– To cope with device
transfer size
mismatch, e.g. in
networking
• Caching
– Fast memory holding copy of data
– To improve I/O efficiency for files that are
being written and reread rapidly.
• Spooling
– Hold output for a device
– Used in device that can serve only one
request at a time, e.g. printing
b2
b1
Double User
Buffer Process
sử dụng 2 buffer để cho I/O device vừa ghi data vào b1 và process lấy data từ b2 ra
2
9
4 8
5 6
• I/O Hardware
• I/O System Design and Implementation
– Design Objectives
– Kernel I/O Structure
– Kernel I/O Subsystem
– Performance Consideration
• Disk
– Disk Structure
– Disk Scheduling
!FCFS, SSTF, SCAN, C-SCAN, C-LOOK
– Disk Management
– Disk Reliability
Operating Systems 10.13 Part 10 I/O System & Disk
Disk Structure
Sectors
(1 sector = 512 bytes)
Disk heads
Platters
• Some parameters:
• Seek time: 10 ms
• Full rotational time: 8 ms (Rotational latency: 4 ms)
• Sector size: 512 Bytes
• Track size: 1 K sectors per track
• Random Request
– Seek Time + Rotational Latency + Transfer Time
10 ms + 4 ms + (1/1024) ´ 8ms = ~14 ms
= 236
= 236
• Version of C-SCAN
• Head moves from low end to high end of the
disk, servicing requests along
• When reaching the last request, head returns
immediately to the lowest cylinder # request
• From there it services the requests towards the
high end of the disk
Chỉ chạy mũi tên trong max và min của cái queue thôi
= 322
Block 1
Block 5
Block 10
Block 2
Block 6
Block 3
Block 7
• RAID (Redundant-Array-of-Independent-Disks)
improves performance and reliability of the
storage system by storing redundant data
– RAID 0: non-redundant striping
– Mirroring (RAID 1) keeps duplicate of each
disk
– Mirror of Strip (RAID 0+1) or Strip of Mirrors
(RAID 1+0) provides high performance and
high reliability