SlideShare a Scribd company logo
1 of 19
Download to read offline
I/O Hardware
Operating System
Lecture Topics
 OBJECTIVE
 Principal of I/O Hardware
 Polling
 I/O Devices
 Direct Memory Access
 Device Controllers
 Summary
OBJECTIVE
 Explore the structure of an operating system’s I/O
subsystem.
 Discuss the principles of I/O hardware and its complexity.
PRINCIPAL OF I/O HARDWARE
 Computers operate a great many kinds of devices. General types include
storage devices (disks, tapes), transmission devices (network cards,
modems), and human-interface devices (screen, keyboard, mouse).
 A device communicates with a computer system by sending signals over a
cable or even through the air. The device communicates with the machine
via a connection point termed a port (for example, a serial port). If one or
more devices use a common set of wires, the connection is called a bus.
 When device A has a cable that plugs into device B, and device B has a
cable that plugs into device C, and device C plugs into a port on the
computer, this arrangement is called a daisy chain. It usually operates as a
bus.
PRINCIPAL OF I/O HARDWARE
 A controller is a collection of electronics that can operate a port, a bus, or a
device. A serial-port controller is an example of a simple device controller.
It is a single chip in the computer that controls the signals on the wires of
a serial port.
 An I/O port typically consists of four registers, called the status, control,
data-in, and data-out registers.
 The status register contains bits that can be read by the host. These bits
indicate states such as whether the current command has completed,
whether a byte is available to be read from the data-in register, and whether
there has been a device error.
PRINCIPAL OF I/O HARDWARE
 The control register can be written by the host to start a command or to
change the mode of a device. For instance, a certain bit in the control
register of a serial port chooses between full-duplex and half-duplex
communication, another enables parity checking, a third bit sets the word
length to 7 or 8 bits, and other bits select one of the speeds supported by the
serial port.
 The data-in register is read by the host to get input, and the data out register
is written by the host to send output.
 The data registers are typically 1 to 4 bytes. Some controllers have FIFO
chips that can hold several bytes of input or output data to expand the
capacity of the controller beyond the size of the data register.
PRINCIPAL OF I/O HARDWARE
 A FIFO chip can hold a small burst of data until the device or host is able to
receive those data.
Polling
 Incomplete protocol for interaction between the host and a controller can be
intricate, but the basic handshaking notion is simple.
 The controller indicates its state through the busy bit in the status register.
(Recall that to set a bit means to write a 1 into the bit, and to clear a bit
means to write a 0 into it.)
 The controller sets the busy bit when it is busy working, and clears the busy
bit when it is ready to accept the next command. The host signals its
wishes via the command-ready bit in the command register. The host sets
the command-ready bit when a command is available for the controller to
execute.
Polling
 For this example, the host writes output through a port, coordinating
with the controller by handshaking as follows.
1. The host repeatedly reads the busy bit until that bit becomes clear.
2. The host sets the write bit in the command register and writes a byte
into the data-out register.
3. The host sets the command-ready bit.
4. When the controller notices that the command-ready bit is set, it sets the
Busy.
5. The controller reads the command register and sees the write
command.
6. It reads the data-out register to get the byte, and does the I/O to the device.
Polling
7. The controller clears the command-ready bit, clears the error bit in the
status register to indicate that the device I/O succeeded, and clears the
busy bit to indicate that it is finished.
The host is busy-waiting or polling: It is in a loop, reading the status register
over and over until the busy bit becomes clear. If the controller and device
are fast, this method is a reasonable one. But if the wait may be long, the host
should probably switch to another task
I/O Devices
Categories of I/O Devices :-
1. Human readable
2. machine readable
3. Communication
 Human Readable is :-suitable for communicating with the computer user.
Examples are printers, video display terminals, keyboard etc.
 Machine Readable is :- suitable for communicating with electronic
equipment. Examples are disk and tape drives, sensors, controllers and
actuators.
I/O Devices
 Communication is suitable for communicating with remote devices.
Examples are digital line drivers and modems.
Differences between I/O Devices
1. Data rate : there may be differences of several orders of magnitude between the data
transfer rates.
2. Application: Different devices have different use in the system.
3. Complexity of Control: A disk is much more complex whereas printer requires
simple control interface.
4. Unit of transfer: Data may be transferred as a stream of bytes or characters or in
larger blocks.
5. Data representation: Different data encoding schemes are used for different
devices.
6. Error Conditions: The nature of errors differs widely from one device to another.
DIRECT MEMORY ACCESS
 A special control unit may be provided to allow transfer of a block of data
directly between an external device and the main memory, without continuous
intervention by the processor. This approach is called Direct Memory
Access(DMA).
 DMA can be used with either polling or interrupt software.
DMA is particularly useful on devices like disks, where many bytes of
information can be transferred in single I/O operations. When used in
conjunction with an interrupt, the CPU is notified only after the entire block of
data has been transferred. For each byte or word transferred, it must
provide the memory address and all the bus signals that control the data
transfer.
DIRECT MEMORY ACCESS
 Interaction with a device controller is managed through a device driver.
 Device drivers are part of the operating system, but not necessarily part
of the OS kernel. The operating system provides a simplified view of the
device to user applications (e.g., character devices vs. block devices in
UNIX). In some operating systems (e.g., Linux), devices are also accessible
through the /dev file system
 In some cases, the operating system buffers data that are transferred
between a device and a user space program (disk cache, network
buffer). This usually increases performance, but not always.
DIRECT MEMORY ACCESS
DEVICE CONTROLLERS
A computer system contains a multitude of I/O devices and their respective
controllers:
● network card
● graphics adapter
● disk controller
● DVD-ROM controller
● serial port
● USB
● sound card
Summary
 The basic hardware elements involved in I/O buses, device controllers, and
the device themselves. The work of moving data between devices and main
memory is performed by the CPU as programmed I/O or is offloaded to a
DMA controller. The kernel module that controls a device driver.
 The system call interface provided to applications is designed to
handle several basic categories of hardware, including block devices,
character devices, memory mapped files, network sockets, and programmed
interval timers. The system calls usually block the processes that issue them,
but non blocking and asynchronous calls are used by the kernel itself and by
applications that must not sleep while waiting for an I/O operation to
complete
Summary
 The kernel’s I/O subsystem provides numerous services. Among these are
I/O scheduling, buffering, caching. Spooling, device reservation, and error
handling.

More Related Content

Similar to IOhardware_operting_systems_2022_libya.pdf

Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organizationMazin Alwaaly
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingmadhuributani
 
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.pptxPannaBushratul
 
inputoutput_organization__Morrismano.ppt
inputoutput_organization__Morrismano.pptinputoutput_organization__Morrismano.ppt
inputoutput_organization__Morrismano.pptSeliMohapatra1
 
CO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxCO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxahmedsalik057
 
I/O Hardware-R.D.Sivakumar
I/O Hardware-R.D.SivakumarI/O Hardware-R.D.Sivakumar
I/O Hardware-R.D.SivakumarSivakumar R D .
 
IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREHariharan Anand
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptxSherinRappai
 
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 Systemprakash ganesan
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxLeahRachael
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organizationchidabdu
 
Computer organization
Computer organizationComputer organization
Computer organizationRvishnupriya2
 
Computer organization
Computer organization Computer organization
Computer organization vishnu973656
 
COA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptxCOA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptxRuhul Amin
 

Similar to IOhardware_operting_systems_2022_libya.pdf (20)

Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
 
I/O System
I/O SystemI/O System
I/O System
 
Ch 7 io_management & disk scheduling
Ch 7 io_management & disk schedulingCh 7 io_management & disk scheduling
Ch 7 io_management & disk scheduling
 
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
 
H n q & a
H n q & aH n q & a
H n q & a
 
inputoutput_organization__Morrismano.ppt
inputoutput_organization__Morrismano.pptinputoutput_organization__Morrismano.ppt
inputoutput_organization__Morrismano.ppt
 
CO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxCO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptx
 
I/O Hardware-R.D.Sivakumar
I/O Hardware-R.D.SivakumarI/O Hardware-R.D.Sivakumar
I/O Hardware-R.D.Sivakumar
 
IO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTUREIO SYSTEM AND CASE STUDY STRUCTURE
IO SYSTEM AND CASE STUDY STRUCTURE
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptx
 
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
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organization
 
Computer organization
Computer organizationComputer organization
Computer organization
 
Computer organization
Computer organization Computer organization
Computer organization
 
Ca 2 note mano
Ca 2 note manoCa 2 note mano
Ca 2 note mano
 
COA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptxCOA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptx
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 

Recently uploaded

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

IOhardware_operting_systems_2022_libya.pdf

  • 2. Lecture Topics  OBJECTIVE  Principal of I/O Hardware  Polling  I/O Devices  Direct Memory Access  Device Controllers  Summary
  • 3. OBJECTIVE  Explore the structure of an operating system’s I/O subsystem.  Discuss the principles of I/O hardware and its complexity.
  • 4. PRINCIPAL OF I/O HARDWARE  Computers operate a great many kinds of devices. General types include storage devices (disks, tapes), transmission devices (network cards, modems), and human-interface devices (screen, keyboard, mouse).  A device communicates with a computer system by sending signals over a cable or even through the air. The device communicates with the machine via a connection point termed a port (for example, a serial port). If one or more devices use a common set of wires, the connection is called a bus.  When device A has a cable that plugs into device B, and device B has a cable that plugs into device C, and device C plugs into a port on the computer, this arrangement is called a daisy chain. It usually operates as a bus.
  • 5. PRINCIPAL OF I/O HARDWARE  A controller is a collection of electronics that can operate a port, a bus, or a device. A serial-port controller is an example of a simple device controller. It is a single chip in the computer that controls the signals on the wires of a serial port.  An I/O port typically consists of four registers, called the status, control, data-in, and data-out registers.  The status register contains bits that can be read by the host. These bits indicate states such as whether the current command has completed, whether a byte is available to be read from the data-in register, and whether there has been a device error.
  • 6. PRINCIPAL OF I/O HARDWARE  The control register can be written by the host to start a command or to change the mode of a device. For instance, a certain bit in the control register of a serial port chooses between full-duplex and half-duplex communication, another enables parity checking, a third bit sets the word length to 7 or 8 bits, and other bits select one of the speeds supported by the serial port.  The data-in register is read by the host to get input, and the data out register is written by the host to send output.  The data registers are typically 1 to 4 bytes. Some controllers have FIFO chips that can hold several bytes of input or output data to expand the capacity of the controller beyond the size of the data register.
  • 7. PRINCIPAL OF I/O HARDWARE  A FIFO chip can hold a small burst of data until the device or host is able to receive those data.
  • 8. Polling  Incomplete protocol for interaction between the host and a controller can be intricate, but the basic handshaking notion is simple.  The controller indicates its state through the busy bit in the status register. (Recall that to set a bit means to write a 1 into the bit, and to clear a bit means to write a 0 into it.)  The controller sets the busy bit when it is busy working, and clears the busy bit when it is ready to accept the next command. The host signals its wishes via the command-ready bit in the command register. The host sets the command-ready bit when a command is available for the controller to execute.
  • 9. Polling  For this example, the host writes output through a port, coordinating with the controller by handshaking as follows. 1. The host repeatedly reads the busy bit until that bit becomes clear. 2. The host sets the write bit in the command register and writes a byte into the data-out register. 3. The host sets the command-ready bit. 4. When the controller notices that the command-ready bit is set, it sets the Busy. 5. The controller reads the command register and sees the write command. 6. It reads the data-out register to get the byte, and does the I/O to the device.
  • 10. Polling 7. The controller clears the command-ready bit, clears the error bit in the status register to indicate that the device I/O succeeded, and clears the busy bit to indicate that it is finished. The host is busy-waiting or polling: It is in a loop, reading the status register over and over until the busy bit becomes clear. If the controller and device are fast, this method is a reasonable one. But if the wait may be long, the host should probably switch to another task
  • 11. I/O Devices Categories of I/O Devices :- 1. Human readable 2. machine readable 3. Communication  Human Readable is :-suitable for communicating with the computer user. Examples are printers, video display terminals, keyboard etc.  Machine Readable is :- suitable for communicating with electronic equipment. Examples are disk and tape drives, sensors, controllers and actuators.
  • 12. I/O Devices  Communication is suitable for communicating with remote devices. Examples are digital line drivers and modems.
  • 13. Differences between I/O Devices 1. Data rate : there may be differences of several orders of magnitude between the data transfer rates. 2. Application: Different devices have different use in the system. 3. Complexity of Control: A disk is much more complex whereas printer requires simple control interface. 4. Unit of transfer: Data may be transferred as a stream of bytes or characters or in larger blocks. 5. Data representation: Different data encoding schemes are used for different devices. 6. Error Conditions: The nature of errors differs widely from one device to another.
  • 14. DIRECT MEMORY ACCESS  A special control unit may be provided to allow transfer of a block of data directly between an external device and the main memory, without continuous intervention by the processor. This approach is called Direct Memory Access(DMA).  DMA can be used with either polling or interrupt software. DMA is particularly useful on devices like disks, where many bytes of information can be transferred in single I/O operations. When used in conjunction with an interrupt, the CPU is notified only after the entire block of data has been transferred. For each byte or word transferred, it must provide the memory address and all the bus signals that control the data transfer.
  • 15. DIRECT MEMORY ACCESS  Interaction with a device controller is managed through a device driver.  Device drivers are part of the operating system, but not necessarily part of the OS kernel. The operating system provides a simplified view of the device to user applications (e.g., character devices vs. block devices in UNIX). In some operating systems (e.g., Linux), devices are also accessible through the /dev file system  In some cases, the operating system buffers data that are transferred between a device and a user space program (disk cache, network buffer). This usually increases performance, but not always.
  • 17. DEVICE CONTROLLERS A computer system contains a multitude of I/O devices and their respective controllers: ● network card ● graphics adapter ● disk controller ● DVD-ROM controller ● serial port ● USB ● sound card
  • 18. Summary  The basic hardware elements involved in I/O buses, device controllers, and the device themselves. The work of moving data between devices and main memory is performed by the CPU as programmed I/O or is offloaded to a DMA controller. The kernel module that controls a device driver.  The system call interface provided to applications is designed to handle several basic categories of hardware, including block devices, character devices, memory mapped files, network sockets, and programmed interval timers. The system calls usually block the processes that issue them, but non blocking and asynchronous calls are used by the kernel itself and by applications that must not sleep while waiting for an I/O operation to complete
  • 19. Summary  The kernel’s I/O subsystem provides numerous services. Among these are I/O scheduling, buffering, caching. Spooling, device reservation, and error handling.