11_Input Output systems
11_Input Output systems
Synchrono Asynchronous
us
Vectored I/O
• Vectored I/O allows one system call to perform
multiple I/O operations
• For example, Unix readve() accepts a vector
of multiple buffers to read into or write from
• This scatter-gather method better than multiple
individual I/O calls
– Decreases context switching and system call
overhead
– Some versions provide atomicity
• Avoid for example worry about multiple threads
changing data as reads / writes occurring
Kernel I/O Subsystem
• Scheduling
– Some I/O request ordering via per-device queue
– Some OSs try fairness
– Some implement Quality Of Service (i.e. IPQOS)
• Buffering - store data in memory while
transferring between devices
– To cope with device speed mismatch
– To cope with device transfer size mismatch
– To maintain “copy semantics”
– Double buffering – two copies of the data
• Kernel and user
• Varying sizes
• Full / being processed and not-full / being used
• Copy-on-write can be used for efficiency in some cases
Device-status Table
Common PC and Data-center I/O devices and Interface Speeds
Kernel I/O Subsystem
• Caching - faster device holding copy of data
– Always just a copy
– Key to performance
– Sometimes combined with buffering
• Spooling - hold output for a device
– If device can serve only one request at a time
– i.e., Printing
• Device reservation - provides exclusive
access to a device
– System calls for allocation and de-allocation
– Watch out for deadlock
Error Handling
• OS can recover from disk read, device
unavailable, transient write failures
– Retry a read or write, for example
– Some systems more advanced – Solaris
FMA, AIX
• Track error frequencies, stop using device with
increasing frequency of retry-able errors
• Most return an error number or code
when I/O request fails
• System error logs hold problem reports
I/O Protection