SlideShare a Scribd company logo
Unit OS6: Device Management
6.1. Principles of I/O Systems
2
3
Roadmap for Section 6.1
Principles of I/O Hardware
Structuring of I/O Software
Layers of an I/O System
Operation of an I/O System
4
Input/Output –
Principles of I/O Hardware
Major components of a computer system:
CPU, memories (primary/secondary), I/O system
I/O devices:
Block devices – store information in fixed-sized blocks;
typical sizes: 128-1024 bytes
Character devices – delivers/accepts stream of characters
Device controllers:
Connects physical device to system bus (Minicomputers, PCs)
Mainframes use a more complex model:
Multiple buses and specialized I/O computers (I/O channels)
Communication:
Memory-mapped I/O, controller registers
Direct Memory Access - DMA
5
I/O Hardware - Single Bus
CPU Memory
Video
Controller
Keyboard
Controller
Floppy
Controller
Disk
Controller
System bus
Monitor Keyboard Floppy
drive
Disk
drive
6
I/O Hardware - Multiple Buses
Video
controller
Network
controller
IDE disk
controller
USB
interface
keyboard mouse
CPU PCI bridge/
memory
controller
Memory
Cache
SCSI
controller
SCSI disk
SCSI disk
SCSI disk
PCI bus
USB bus
SCSI bus
Memory bus
7
Diversity among I/O Devices
The I/O subsystem has to consider device characteristics:
Data rate:
may vary by several orders of magnitude
Complexity of control:
exclusive vs. shared devices
Unit of transfer:
stream of bytes vs. block-I/O
Data representations:
character encoding, error codes, parity conventions
Error conditions:
consequences, range of responses
Applications:
impact on resource scheduling, buffering schemes
8
Organization of the I/O Function
Programmed I/O with polling:
The processor issues an I/O command on behalf of a process
The process busy waits for completion of the operation before
proceeding
Interrupt-driven I/O:
The processor issues an I/O command and continues to execute
The I/O module interrupts the processor when it has finished I/O
The initiator process may be suspended pending the interrupt
Direct memory access (DMA):
A DMA module controls exchange of data between I/O module and
main memory
The processor requests transfer of a block of data from DMA and is
interrupted only after the entire block has been transferred
9
Flow of a blocking I/O request
1. Thread issues blocking read()
system call
2. Kernel checks parameters; may
return buffered data and finish
3. Thread is removed from run
queue if physical I/O required;
added to wait queue for device;
I/O request is scheduled
4. Device driver allocates kernel
buffer; sends command to
controller
5. Device controller operates the
hardware to perform data
transfer
6. Driver may poll for status and
data; or set up DMA that will
generate interrupt
7. Interrupt occurs; handler
stores data; signals device
driver
8. Device driver receives signal;
determines request status;
signals kernel I/O subsystem
9. Kernel transfers data or return
code to user space; removes
thread from wait queue
10. Thread resumes execution at
completion of read() call
10
Principles of I/O Software
Layered organization
Device independence
Error handling
Error should be handled as close to the
hardware as possible
Transparent error recovery at low level
Synchronous vs. Asynchronous transfers
Most physical I/O is asynchronous
Kernel may provide synchronous I/O system
calls
Sharable vs. dedicated devices
Disk vs. printer
Structuring of
I/O software
1. User-level software
2. Device-independent
OS software
3. Device drivers
4. Interrupt handlers
11
Interrupt Handlers
Should be hidden by the operating system
Every thread starting an I/O operation should block until
I/O has completed and interrupt occurs
Interrupt handler transfers data from device (controller)
and un-blocks process
12
Device Driver
Contains all device-dependent code
Handles one device
Translates abstract requests into device commands
Writes controller registers
Accesses mapped memory
Queues requests
Driver may block after issuing a request:
Interrupt will un-block driver (returning status information)
13
Device-independent I/O Software
Functions of device-independent I/O software:
Uniform interfacing for the device drivers
Device naming
Device protection
Providing a device-independent block size
Buffering
Storage allocation on block devices
Allocating and releasing dedicated devices
Error reporting
14
Layers of the I/O System
User-Space I/O Software
System call libraries
(read, write,...)
Spooling
Managing dedicated I/O
devices in a
multiprogramming
system
Daemon process,
spooling directory
lpd – line printer
daemon, sendmail –
simple mail transfer
protocol
Layer
User process
Device-independent
software
Device drivers
Interrupt handlers
Hardware
I/O
request
I/O
reply
I/O functions
I/O calls, spooling
format I/O
Naming, protection
buffering, blocking
Setup registers,
Check status
Setup registers,
Check status
Wakeup driver
Perform I/O op.
15
Application I/O Interfaces
The OS system call interface distinguished device classes:
Character-stream or block
Sequential or random-access
Synchronous or asynchronous
Sharable or dedicated
Speed of operation
Read/write, read only, write only
16
Example:
4.3 BSD kernel I/O structure
The hardware
socket Plain file
protocols File
system
Cooked
block
interface
Raw
block
interface
Raw
tty
interface
cooked TTY
Line
discipline
Network
interface Block-device driver character-device driver
System-call interface to the kernel
17

More Related Content

Similar to 6.1_IO-Principles.ppt

Operating System Case Study and I/O System
Operating System Case Study and I/O SystemOperating System Case Study and I/O System
Operating System Case Study and I/O System
prakash ganesan
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
Qiyo Jung
 
Multimedia Technology
Multimedia TechnologyMultimedia Technology
Multimedia Technology
mandalina landy
 
IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTURE
Hariharan Anand
 
Chapter 4
Chapter 4Chapter 4
07 Input Output
07  Input  Output07  Input  Output
07 Input Output
Jeanie Delos Arcos
 
I/O Management
I/O ManagementI/O Management
I/O Management
Keyur Vadodariya
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input output
risal07
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
Mazin Alwaaly
 
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptxFANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
PannaBushratul
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
GaganaPurshothama
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / Output
Peter Tröger
 
IO and file systems
IO and file systems IO and file systems
IO and file systems
EktaVaswani2
 
I/O System
I/O SystemI/O System
I/O System
Nagarajan
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
ImranKhan880955
 
Ch1
Ch1Ch1
discuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdfdiscuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdf
info998421
 
Basic Organisation and fundamental Of Computer.pptx
Basic Organisation and fundamental Of Computer.pptxBasic Organisation and fundamental Of Computer.pptx
Basic Organisation and fundamental Of Computer.pptx
hasanbashar400
 
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptxCOMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
PannaBushratul
 
Ch # 04 computer hardware
Ch # 04 computer hardware Ch # 04 computer hardware
Ch # 04 computer hardware
MuhammadRobeel3
 

Similar to 6.1_IO-Principles.ppt (20)

Operating System Case Study and I/O System
Operating System Case Study and I/O SystemOperating System Case Study and I/O System
Operating System Case Study and I/O System
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Multimedia Technology
Multimedia TechnologyMultimedia Technology
Multimedia Technology
 
IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTURE
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
07 Input Output
07  Input  Output07  Input  Output
07 Input Output
 
I/O Management
I/O ManagementI/O Management
I/O Management
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input output
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
 
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptxFANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
FANDAMENTAL OF COMPUTER SCIENCE FOR ENGINEERING.pptx
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / Output
 
IO and file systems
IO and file systems IO and file systems
IO and file systems
 
I/O System
I/O SystemI/O System
I/O System
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
 
Ch1
Ch1Ch1
Ch1
 
discuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdfdiscuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdf
 
Basic Organisation and fundamental Of Computer.pptx
Basic Organisation and fundamental Of Computer.pptxBasic Organisation and fundamental Of Computer.pptx
Basic Organisation and fundamental Of Computer.pptx
 
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptxCOMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
COMPUTER BASIC AND FUNDAMENTAL AND ITS ORGANISATION.pptx
 
Ch # 04 computer hardware
Ch # 04 computer hardware Ch # 04 computer hardware
Ch # 04 computer hardware
 

Recently uploaded

Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
gaafergoudaay7aga
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
IJECEIAES
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 

Recently uploaded (20)

Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 

6.1_IO-Principles.ppt

  • 1. Unit OS6: Device Management 6.1. Principles of I/O Systems
  • 2. 2
  • 3. 3 Roadmap for Section 6.1 Principles of I/O Hardware Structuring of I/O Software Layers of an I/O System Operation of an I/O System
  • 4. 4 Input/Output – Principles of I/O Hardware Major components of a computer system: CPU, memories (primary/secondary), I/O system I/O devices: Block devices – store information in fixed-sized blocks; typical sizes: 128-1024 bytes Character devices – delivers/accepts stream of characters Device controllers: Connects physical device to system bus (Minicomputers, PCs) Mainframes use a more complex model: Multiple buses and specialized I/O computers (I/O channels) Communication: Memory-mapped I/O, controller registers Direct Memory Access - DMA
  • 5. 5 I/O Hardware - Single Bus CPU Memory Video Controller Keyboard Controller Floppy Controller Disk Controller System bus Monitor Keyboard Floppy drive Disk drive
  • 6. 6 I/O Hardware - Multiple Buses Video controller Network controller IDE disk controller USB interface keyboard mouse CPU PCI bridge/ memory controller Memory Cache SCSI controller SCSI disk SCSI disk SCSI disk PCI bus USB bus SCSI bus Memory bus
  • 7. 7 Diversity among I/O Devices The I/O subsystem has to consider device characteristics: Data rate: may vary by several orders of magnitude Complexity of control: exclusive vs. shared devices Unit of transfer: stream of bytes vs. block-I/O Data representations: character encoding, error codes, parity conventions Error conditions: consequences, range of responses Applications: impact on resource scheduling, buffering schemes
  • 8. 8 Organization of the I/O Function Programmed I/O with polling: The processor issues an I/O command on behalf of a process The process busy waits for completion of the operation before proceeding Interrupt-driven I/O: The processor issues an I/O command and continues to execute The I/O module interrupts the processor when it has finished I/O The initiator process may be suspended pending the interrupt Direct memory access (DMA): A DMA module controls exchange of data between I/O module and main memory The processor requests transfer of a block of data from DMA and is interrupted only after the entire block has been transferred
  • 9. 9 Flow of a blocking I/O request 1. Thread issues blocking read() system call 2. Kernel checks parameters; may return buffered data and finish 3. Thread is removed from run queue if physical I/O required; added to wait queue for device; I/O request is scheduled 4. Device driver allocates kernel buffer; sends command to controller 5. Device controller operates the hardware to perform data transfer 6. Driver may poll for status and data; or set up DMA that will generate interrupt 7. Interrupt occurs; handler stores data; signals device driver 8. Device driver receives signal; determines request status; signals kernel I/O subsystem 9. Kernel transfers data or return code to user space; removes thread from wait queue 10. Thread resumes execution at completion of read() call
  • 10. 10 Principles of I/O Software Layered organization Device independence Error handling Error should be handled as close to the hardware as possible Transparent error recovery at low level Synchronous vs. Asynchronous transfers Most physical I/O is asynchronous Kernel may provide synchronous I/O system calls Sharable vs. dedicated devices Disk vs. printer Structuring of I/O software 1. User-level software 2. Device-independent OS software 3. Device drivers 4. Interrupt handlers
  • 11. 11 Interrupt Handlers Should be hidden by the operating system Every thread starting an I/O operation should block until I/O has completed and interrupt occurs Interrupt handler transfers data from device (controller) and un-blocks process
  • 12. 12 Device Driver Contains all device-dependent code Handles one device Translates abstract requests into device commands Writes controller registers Accesses mapped memory Queues requests Driver may block after issuing a request: Interrupt will un-block driver (returning status information)
  • 13. 13 Device-independent I/O Software Functions of device-independent I/O software: Uniform interfacing for the device drivers Device naming Device protection Providing a device-independent block size Buffering Storage allocation on block devices Allocating and releasing dedicated devices Error reporting
  • 14. 14 Layers of the I/O System User-Space I/O Software System call libraries (read, write,...) Spooling Managing dedicated I/O devices in a multiprogramming system Daemon process, spooling directory lpd – line printer daemon, sendmail – simple mail transfer protocol Layer User process Device-independent software Device drivers Interrupt handlers Hardware I/O request I/O reply I/O functions I/O calls, spooling format I/O Naming, protection buffering, blocking Setup registers, Check status Setup registers, Check status Wakeup driver Perform I/O op.
  • 15. 15 Application I/O Interfaces The OS system call interface distinguished device classes: Character-stream or block Sequential or random-access Synchronous or asynchronous Sharable or dedicated Speed of operation Read/write, read only, write only
  • 16. 16 Example: 4.3 BSD kernel I/O structure The hardware socket Plain file protocols File system Cooked block interface Raw block interface Raw tty interface cooked TTY Line discipline Network interface Block-device driver character-device driver System-call interface to the kernel
  • 17. 17