SlideShare a Scribd company logo
IO hardware
Prepared By: Mr. Sangram A. Patil
Assistant Professor PVPIT,Budhgaon
overview
 Management of I/O devices is a very important part of the operating system - so
important and so varied that entire I/O subsystems are devoted to its operation.
 I/O Subsystems must contend with two ( conflicting? ) trends:
(1) The gravitation towards standard interfaces for a wide range of devices,
making it easier to add newly developed devices to existing systems, and
(2) the development of entirely new types of devices, for which the existing
standard interfaces are not always easy to apply.
 Device drivers are modules that can be plugged into an OS to handle a particular
device or category of similar devices.
IO Hardware
 Computer operate a great many kinds of devices
 I/O devices can be roughly categorized as storage (Disks and tapes), communications
or transmission devices (network cards, modems ), user-interface (screen, keyboard,
mouse), and other
 Devices communicate with the computer via signals sent over wires or through the air.
 Devices connect with the computer via ports, e.g. a serial or parallel port.
 A common set of wires connecting multiple devices is termed a bus
1. The PCI bus connects high-speed high-bandwidth devices to the memory subsystem
( and the CPU. )
2. The expansion bus connects slower low-bandwidth devices, which typically deliver data
one character at a time ( with buffering. )
3. The SCSI bus connects a number of SCSI devices to a common SCSI controller.
4. A daisy-chain bus, ( not shown) is when a string of devices is connected to each other
like beads on a chain, and only one of the devices is directly connected to the host.
IO hardware
Controllers
 Controllers is collection of electronics that can operate a port, a bus or devices.
 Serial port controller is simple device controller, it is a single chip that controls
signal on the wires of serial port.
 SCSI bus controllers are not simple. SCSI protocol is complex.
Communicating with devices
 One way of communicating with devices is through registers associated with each
port. Registers may be one to four bytes in size, and may typically include ( a
subset of ) the following four:The data-in register is read by the host to get input
from the device.
 The data-out register is written by the host to send output.
 The status register has bits read by the host to ascertain the status of the device,
such as idle, ready for input, busy, error, transaction complete, etc.
 The control register has bits written by the host to issue commands or to change
settings of the device such as parity checking, word length, or full- versus half-
duplex operation.
IO hardware
Communicating with devices
 Another technique for communicating with devices is memory-mapped I/O.
 In this case a certain portion of the processor's address space is mapped to the
device, and communications occur by reading and writing directly to/from those
memory areas.
 Memory-mapped I/O is suitable for devices which must move large quantities of
data quickly, such as graphics cards.
 Memory-mapped I/O can be used either instead of or more often in combination
with traditional registers. For example, graphics cards still use registers for control
information such as setting the video mode.
 A potential problem exists with memory-mapped I/O, if a process is allowed to
write directly to the address space used by a memory-mapped I/O device.
Polling
 One simple means of device handshaking involves polling:
 The host repeatedly checks the busy bit on the device until it becomes clear.
 The host writes a byte of data into the data-out register, and sets the write bit in the
command register ( in either order. )
 The host sets the command ready bit in the command register to notify the device of the
pending command.
 When the device controller sees the command-ready bit set, it first sets the busy bit.
 Then the device controller reads the command register, sees the write bit set, reads the byte of
data from the data-out register, and outputs the byte of data.
 The device controller then clears the error bit in the status register, the command-ready bit,
and finally clears the busy bit, signaling the completion of the operation.
 Polling can be very fast and efficient, if both the device and the controller are fast and if
there is significant data to transfer. It becomes inefficient, however, if the host must wait
a long time in the busy loop waiting for the device, or if frequent checks need to be
made for data that is infrequently there.
Interrupts
 Interrupts allow devices to notify the CPU when they have data to transfer or when
an operation is complete, allowing the CPU to perform other duties when no I/O
transfers need its immediate attention.
 The CPU has an interrupt-request line that is sensed after every instruction.
 A device's controller raises an interrupt by asserting a signal on the interrupt request
line.
 The CPU then performs a state save, and transfers control to the interrupt
handler routine at a fixed address in memory. ( The CPU catches the interrupt
and dispatches the interrupt handler. )
 The interrupt handler determines the cause of the interrupt, performs the necessary
processing, performs a state restore, and executes a return from interrupt instruction to
return control to the CPU. ( The interrupt handler clears the interrupt by servicing the
device. )
IO hardware
 The above description is adequate for simple interrupt-driven I/O, but there are
three needs in modern computing which complicate the picture:
1. The need to defer interrupt handling during critical processing,
2. The need to determine which interrupt handler to invoke, without having to poll all
devices to see which one needs attention, and
3. The need for multi-level interrupts, so the system can differentiate between high-
and low-priority interrupts for proper response.
 These issues are handled in modern computer architectures with interrupt-
controller hardware.
 Most CPUs now have two interrupt-request lines: One that is non-maskable for critical
error conditions and one that is maskable, that the CPU can temporarily ignore during
critical processing.
 The interrupt mechanism accepts an address, which is usually one of a small set of
numbers for an offset into a table called the interrupt vector. This table ( usually located
at physical address zero ? ) holds the addresses of routines prepared to process specific
interrupts.
 The number of possible interrupt handlers still exceeds the range of defined interrupt
numbers, so multiple handlers can be interrupt chained. Effectively the addresses held
in the interrupt vectors are the head pointers for linked-lists of interrupt handlers.
 Figure shows the Intel Pentium interrupt vector. Interrupts 0 to 31 are non-maskable and
reserved for serious hardware and other errors. Maskable interrupts, including normal
device I/O interrupts begin at interrupt 32.
 Modern interrupt hardware also supports interrupt priority levels, allowing systems to
mask off only lower-priority interrupts while servicing a high-priority interrupt, or
conversely to allow a high-priority signal to interrupt the processing of a low-priority
one.
IO hardware
 At boot time the system determines which devices are present, and loads the
appropriate handler addresses into the interrupt table.
 During operation, devices signal errors or the completion of commands via
interrupts.
 Exceptions, such as dividing by zero, invalid memory accesses, or attempts to
access kernel mode instructions can be signaled via interrupts.
 Time slicing and context switches can also be implemented using the interrupt
mechanism.
 The scheduler sets a hardware timer before transferring control over to a user process.
 When the timer raises the interrupt request line, the CPU performs a state-save, and
transfers control over to the proper interrupt handler, which in turn runs the scheduler.
 The scheduler does a state-restore of a different process before resetting the timer and
issuing the return-from-interrupt instruction.
 System calls are implemented via software interrupts, a.k.a. traps. When a
( library ) program needs work performed in kernel mode, it sets command
information and possibly data addresses in certain registers, and then raises a
software interrupt. ( E.g. 21 hex in DOS. ) The system does a state save and then
calls on the proper interrupt handler to process the request in kernel mode.
Software interrupts generally have low priority, as they are not as urgent as devices
with limited buffering space.
 A similar example involves the paging system for virtual memory - A page fault
causes an interrupt, which in turn issues an I/O request and a context switch as
described above, moving the interrupted process into the wait queue and selecting
a different process to run. When the I/O request has completed ( i.e. when the
requested page has been loaded up into physical memory ), then the device
interrupts, and the interrupt handler moves the process from the wait queue into
the ready queue, ( or depending on scheduling algorithms and policies, may go
ahead and context switch it back onto the CPU. )
 Interrupts are also used to control kernel operations, and to schedule activities for
optimal performance. For example, the completion of a disk read operation
involves two interrupts:
 A high-priority interrupt acknowledges the device completion, and issues the next disk
request so that the hardware does not sit idle.
 A lower-priority interrupt transfers the data from the kernel memory space to the user
space, and then transfers the process from the waiting queue to the ready queue.
Direct Memory Access
 For devices that transfer large quantities of data ( such as disk controllers ), it is
wasteful to tie up the CPU transferring data in and out of registers one byte at a
time.
 Instead this work can be off-loaded to a special processor, known as the Direct
Memory Access, DMA, Controller.
 The host issues a command to the DMA controller, indicating the location where
the data is located, the location where the data is to be transferred to, and the
number of bytes of data to transfer. The DMA controller handles the data transfer,
and then interrupts the CPU when the transfer is complete.
 A simple DMA controller is a standard component in modern PCs, and many bus-
mastering I/O cards contain their own DMA hardware.
 Handshaking between DMA controllers and their devices is accomplished through
two wires called the DMA-request and DMA-acknowledge wires.
Direct Memory Access
 While the DMA transfer is going on the CPU does not have access to the PCI bus (
including main memory ), but it does have access to its internal registers and
primary and secondary caches.
 DMA can be done in terms of either physical addresses or virtual addresses that are
mapped to physical addresses. The latter approach is known as Direct Virtual
Memory Access, DVMA, and allows direct data transfer from one memory-
mapped device to another without using the main memory chips.
 Direct DMA access by user processes can speed up operations, but is generally
forbidden by modern systems for security and protection reasons. ( I.e. DMA is a
kernel-mode operation. )
IO hardware
IO hardware
Device Drivers
 Device Drivers are the software through which, the kernel of a computer
communicates with different hardware, without having to go into the details of
how the hardware works.
 It is a software that controls a hardware part attached to a computer and allows the
computer to use the hardware by providing a suitable interface.
 This means that the operating system need not go into the details about how the
hardware part works.
 It also provides a common interface so that the operating system or the Kernel can
communicate with the hardware.
 Thus, the purpose of device drivers is to allow smooth functioning of the hardware
for which it is created and to allow it to be used with different operating systems.
Device Driver Types
 There are device drivers for almost every device associated with a computer – from
BIOS to even virtual machines and more. Device drivers can be broadly be classified
into two categories:
 Kernel Device Drivers
 User Device Drivers
Kernel Device Drivers
 Kernel Device Drivers are the generic device drivers that load with the operating
system into the memory as part of the operating system; not the entire driver but a
pointer to that effect so that the device driver can be invoked as soon as it is
required.
 The drivers are pertaining to BIOS, motherboard, processor, and similar hardware
form part of Kernel Software.
 A problem with Kernel Device Drivers is that when one of them is invoked, it is
loaded into the RAM and cannot be moved to page file (virtual memory).
 Thus, a number of device drivers running at the same time can slow down machines.
That is why there is a minimum system requirement for each operating system. The
different operating systems already add up the resources needed for kernel device
drivers, so that end users need not worry about extra memory requirements.
User Device Drivers
 User Mode Device Drivers are the ones usually triggered by users during their
session on a computer.
 It might be thought of devices that the user brought to the computer other than
the kernel devices. Drivers for most of the Plug and Play devices fall into this
category.
 User Device Drivers can be written to disk so that they don’t act tough on the
resources. However, for the drivers related to gaming devices, it is recommended
to keep them in main memory (RAM).
Block Drivers and Character Drivers
 These two – the block and character device drivers – belong to the category of data
reading and writing. Hard disks, CD ROMs, USB Drives, etc. – might be either Block
Drivers or Character Drivers based on how they are used.
 Character Drivers are used in serial buses. They write data one character at a time. One
character means a byte in a generic sense. If a device is connected to a serial port, it is
using a character driver. A mouse is a serial device and has a character device driver.
 Block drivers refer to writing and reading of more than one character at a time. Usually,
block device drivers create a block and retrieve as much information as the block can
contain. Hard disks, for example, use block device drivers. CD ROMs too, are block device
drivers, but the kernel needs to check that the device is still connected to the computer,
each time the CD ROM is invoked by any application.

More Related Content

PPTX
Multithreading
PPT
File system
PPT
Coda file system
PDF
Inter-Process Communication in distributed systems
PPTX
File system structure
ODP
Distributed operating system(os)
PPTX
Design Goals of Distributed System
PPTX
Multiprocessor Architecture (Advanced computer architecture)
Multithreading
File system
Coda file system
Inter-Process Communication in distributed systems
File system structure
Distributed operating system(os)
Design Goals of Distributed System
Multiprocessor Architecture (Advanced computer architecture)

What's hot (20)

PPT
Linux command ppt
PPTX
System calls
PPT
Chapter 11 - File System Implementation
PPT
System call
PPTX
file system in operating system
PPTX
Process scheduling
PDF
Pipelining
PPT
Protection and Security in Operating Systems
PPTX
Database , 12 Reliability
PPT
CPU Scheduling Algorithms
PDF
Semaphores
PPTX
previous question solve of operating system.
PPTX
Cache coherence ppt
PPTX
directory structure and file system mounting
PPTX
File allocation methods (1)
PPTX
Virtual memory management in Operating System
PDF
Multithreading
PPTX
Introduction to Distributed System
Linux command ppt
System calls
Chapter 11 - File System Implementation
System call
file system in operating system
Process scheduling
Pipelining
Protection and Security in Operating Systems
Database , 12 Reliability
CPU Scheduling Algorithms
Semaphores
previous question solve of operating system.
Cache coherence ppt
directory structure and file system mounting
File allocation methods (1)
Virtual memory management in Operating System
Multithreading
Introduction to Distributed System
Ad

Similar to IO hardware (20)

PPTX
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
PPT
In out system
PPT
Unit2 p1 io organization-97-2003
PPT
I/O System
PPTX
I/O Hardware-R.D.Sivakumar
PPTX
COA-Unit5-ppt2.pptx
PDF
IOhardware_operting_systems_2022_libya.pdf
PPTX
Io system
PPTX
Io system
PPTX
Computer organization
PPTX
Computer organization
PDF
Computer oganization input-output
PPTX
Computer architecture presentation
PPTX
Computer organization I/O organization details
PPT
chapter 4 Device Management systemss.ppt
PPTX
Io pro
DOCX
Io systems final
PPT
02-archsupport.ppt Architecture Support for OPS
PDF
Unit 6
PDF
Ch12 io systems
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
In out system
Unit2 p1 io organization-97-2003
I/O System
I/O Hardware-R.D.Sivakumar
COA-Unit5-ppt2.pptx
IOhardware_operting_systems_2022_libya.pdf
Io system
Io system
Computer organization
Computer organization
Computer oganization input-output
Computer architecture presentation
Computer organization I/O organization details
chapter 4 Device Management systemss.ppt
Io pro
Io systems final
02-archsupport.ppt Architecture Support for OPS
Unit 6
Ch12 io systems
Ad

More from sangrampatil81 (20)

PPTX
Deadlock
PPTX
Memory Management
PPTX
virtual memory
PPTX
File management
PPTX
Disk structure
PPTX
Directory structure
PPTX
Directory implementation and allocation methods
PPTX
Page replacement algorithms
PPTX
Methods for handling deadlock
PPTX
Semaphore
PPTX
Monitors
PPTX
Classical problems of process synchronization
PPTX
System programs
PPTX
System programs
PPTX
Services and system calls
PPTX
Operating system structure
PPTX
Operating system deign and implementation
PPTX
Pointer to array and structure
PPTX
Pointer arithmetic in c
PPTX
Pointer in c
Deadlock
Memory Management
virtual memory
File management
Disk structure
Directory structure
Directory implementation and allocation methods
Page replacement algorithms
Methods for handling deadlock
Semaphore
Monitors
Classical problems of process synchronization
System programs
System programs
Services and system calls
Operating system structure
Operating system deign and implementation
Pointer to array and structure
Pointer arithmetic in c
Pointer in c

Recently uploaded (20)

PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
AI Guide for Business Growth - Arna Softech
PPTX
Cybersecurity: Protecting the Digital World
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Cost to Outsource Software Development in 2025
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PPTX
assetexplorer- product-overview - presentation
PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Autodesk AutoCAD Crack Free Download 2025
"Secure File Sharing Solutions on AWS".pptx
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Oracle Fusion HCM Cloud Demo for Beginners
Designing Intelligence for the Shop Floor.pdf
Time Tracking Features That Teams and Organizations Actually Need
Wondershare Recoverit Full Crack New Version (Latest 2025)
DNT Brochure 2025 – ISV Solutions @ D365
Computer Software and OS of computer science of grade 11.pptx
Tech Workshop Escape Room Tech Workshop
AI Guide for Business Growth - Arna Softech
Cybersecurity: Protecting the Digital World
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Cost to Outsource Software Development in 2025
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
assetexplorer- product-overview - presentation
Patient Appointment Booking in Odoo with online payment
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx

IO hardware

  • 1. IO hardware Prepared By: Mr. Sangram A. Patil Assistant Professor PVPIT,Budhgaon
  • 2. overview  Management of I/O devices is a very important part of the operating system - so important and so varied that entire I/O subsystems are devoted to its operation.  I/O Subsystems must contend with two ( conflicting? ) trends: (1) The gravitation towards standard interfaces for a wide range of devices, making it easier to add newly developed devices to existing systems, and (2) the development of entirely new types of devices, for which the existing standard interfaces are not always easy to apply.  Device drivers are modules that can be plugged into an OS to handle a particular device or category of similar devices.
  • 3. IO Hardware  Computer operate a great many kinds of devices  I/O devices can be roughly categorized as storage (Disks and tapes), communications or transmission devices (network cards, modems ), user-interface (screen, keyboard, mouse), and other  Devices communicate with the computer via signals sent over wires or through the air.  Devices connect with the computer via ports, e.g. a serial or parallel port.  A common set of wires connecting multiple devices is termed a bus 1. The PCI bus connects high-speed high-bandwidth devices to the memory subsystem ( and the CPU. ) 2. The expansion bus connects slower low-bandwidth devices, which typically deliver data one character at a time ( with buffering. ) 3. The SCSI bus connects a number of SCSI devices to a common SCSI controller. 4. A daisy-chain bus, ( not shown) is when a string of devices is connected to each other like beads on a chain, and only one of the devices is directly connected to the host.
  • 5. Controllers  Controllers is collection of electronics that can operate a port, a bus or devices.  Serial port controller is simple device controller, it is a single chip that controls signal on the wires of serial port.  SCSI bus controllers are not simple. SCSI protocol is complex.
  • 6. Communicating with devices  One way of communicating with devices is through registers associated with each port. Registers may be one to four bytes in size, and may typically include ( a subset of ) the following four:The data-in register is read by the host to get input from the device.  The data-out register is written by the host to send output.  The status register has bits read by the host to ascertain the status of the device, such as idle, ready for input, busy, error, transaction complete, etc.  The control register has bits written by the host to issue commands or to change settings of the device such as parity checking, word length, or full- versus half- duplex operation.
  • 8. Communicating with devices  Another technique for communicating with devices is memory-mapped I/O.  In this case a certain portion of the processor's address space is mapped to the device, and communications occur by reading and writing directly to/from those memory areas.  Memory-mapped I/O is suitable for devices which must move large quantities of data quickly, such as graphics cards.  Memory-mapped I/O can be used either instead of or more often in combination with traditional registers. For example, graphics cards still use registers for control information such as setting the video mode.  A potential problem exists with memory-mapped I/O, if a process is allowed to write directly to the address space used by a memory-mapped I/O device.
  • 9. Polling  One simple means of device handshaking involves polling:  The host repeatedly checks the busy bit on the device until it becomes clear.  The host writes a byte of data into the data-out register, and sets the write bit in the command register ( in either order. )  The host sets the command ready bit in the command register to notify the device of the pending command.  When the device controller sees the command-ready bit set, it first sets the busy bit.  Then the device controller reads the command register, sees the write bit set, reads the byte of data from the data-out register, and outputs the byte of data.  The device controller then clears the error bit in the status register, the command-ready bit, and finally clears the busy bit, signaling the completion of the operation.  Polling can be very fast and efficient, if both the device and the controller are fast and if there is significant data to transfer. It becomes inefficient, however, if the host must wait a long time in the busy loop waiting for the device, or if frequent checks need to be made for data that is infrequently there.
  • 10. Interrupts  Interrupts allow devices to notify the CPU when they have data to transfer or when an operation is complete, allowing the CPU to perform other duties when no I/O transfers need its immediate attention.  The CPU has an interrupt-request line that is sensed after every instruction.  A device's controller raises an interrupt by asserting a signal on the interrupt request line.  The CPU then performs a state save, and transfers control to the interrupt handler routine at a fixed address in memory. ( The CPU catches the interrupt and dispatches the interrupt handler. )  The interrupt handler determines the cause of the interrupt, performs the necessary processing, performs a state restore, and executes a return from interrupt instruction to return control to the CPU. ( The interrupt handler clears the interrupt by servicing the device. )
  • 12.  The above description is adequate for simple interrupt-driven I/O, but there are three needs in modern computing which complicate the picture: 1. The need to defer interrupt handling during critical processing, 2. The need to determine which interrupt handler to invoke, without having to poll all devices to see which one needs attention, and 3. The need for multi-level interrupts, so the system can differentiate between high- and low-priority interrupts for proper response.
  • 13.  These issues are handled in modern computer architectures with interrupt- controller hardware.  Most CPUs now have two interrupt-request lines: One that is non-maskable for critical error conditions and one that is maskable, that the CPU can temporarily ignore during critical processing.  The interrupt mechanism accepts an address, which is usually one of a small set of numbers for an offset into a table called the interrupt vector. This table ( usually located at physical address zero ? ) holds the addresses of routines prepared to process specific interrupts.  The number of possible interrupt handlers still exceeds the range of defined interrupt numbers, so multiple handlers can be interrupt chained. Effectively the addresses held in the interrupt vectors are the head pointers for linked-lists of interrupt handlers.  Figure shows the Intel Pentium interrupt vector. Interrupts 0 to 31 are non-maskable and reserved for serious hardware and other errors. Maskable interrupts, including normal device I/O interrupts begin at interrupt 32.  Modern interrupt hardware also supports interrupt priority levels, allowing systems to mask off only lower-priority interrupts while servicing a high-priority interrupt, or conversely to allow a high-priority signal to interrupt the processing of a low-priority one.
  • 15.  At boot time the system determines which devices are present, and loads the appropriate handler addresses into the interrupt table.  During operation, devices signal errors or the completion of commands via interrupts.  Exceptions, such as dividing by zero, invalid memory accesses, or attempts to access kernel mode instructions can be signaled via interrupts.  Time slicing and context switches can also be implemented using the interrupt mechanism.  The scheduler sets a hardware timer before transferring control over to a user process.  When the timer raises the interrupt request line, the CPU performs a state-save, and transfers control over to the proper interrupt handler, which in turn runs the scheduler.  The scheduler does a state-restore of a different process before resetting the timer and issuing the return-from-interrupt instruction.
  • 16.  System calls are implemented via software interrupts, a.k.a. traps. When a ( library ) program needs work performed in kernel mode, it sets command information and possibly data addresses in certain registers, and then raises a software interrupt. ( E.g. 21 hex in DOS. ) The system does a state save and then calls on the proper interrupt handler to process the request in kernel mode. Software interrupts generally have low priority, as they are not as urgent as devices with limited buffering space.  A similar example involves the paging system for virtual memory - A page fault causes an interrupt, which in turn issues an I/O request and a context switch as described above, moving the interrupted process into the wait queue and selecting a different process to run. When the I/O request has completed ( i.e. when the requested page has been loaded up into physical memory ), then the device interrupts, and the interrupt handler moves the process from the wait queue into the ready queue, ( or depending on scheduling algorithms and policies, may go ahead and context switch it back onto the CPU. )
  • 17.  Interrupts are also used to control kernel operations, and to schedule activities for optimal performance. For example, the completion of a disk read operation involves two interrupts:  A high-priority interrupt acknowledges the device completion, and issues the next disk request so that the hardware does not sit idle.  A lower-priority interrupt transfers the data from the kernel memory space to the user space, and then transfers the process from the waiting queue to the ready queue.
  • 18. Direct Memory Access  For devices that transfer large quantities of data ( such as disk controllers ), it is wasteful to tie up the CPU transferring data in and out of registers one byte at a time.  Instead this work can be off-loaded to a special processor, known as the Direct Memory Access, DMA, Controller.  The host issues a command to the DMA controller, indicating the location where the data is located, the location where the data is to be transferred to, and the number of bytes of data to transfer. The DMA controller handles the data transfer, and then interrupts the CPU when the transfer is complete.  A simple DMA controller is a standard component in modern PCs, and many bus- mastering I/O cards contain their own DMA hardware.  Handshaking between DMA controllers and their devices is accomplished through two wires called the DMA-request and DMA-acknowledge wires.
  • 19. Direct Memory Access  While the DMA transfer is going on the CPU does not have access to the PCI bus ( including main memory ), but it does have access to its internal registers and primary and secondary caches.  DMA can be done in terms of either physical addresses or virtual addresses that are mapped to physical addresses. The latter approach is known as Direct Virtual Memory Access, DVMA, and allows direct data transfer from one memory- mapped device to another without using the main memory chips.  Direct DMA access by user processes can speed up operations, but is generally forbidden by modern systems for security and protection reasons. ( I.e. DMA is a kernel-mode operation. )
  • 22. Device Drivers  Device Drivers are the software through which, the kernel of a computer communicates with different hardware, without having to go into the details of how the hardware works.  It is a software that controls a hardware part attached to a computer and allows the computer to use the hardware by providing a suitable interface.  This means that the operating system need not go into the details about how the hardware part works.  It also provides a common interface so that the operating system or the Kernel can communicate with the hardware.  Thus, the purpose of device drivers is to allow smooth functioning of the hardware for which it is created and to allow it to be used with different operating systems.
  • 23. Device Driver Types  There are device drivers for almost every device associated with a computer – from BIOS to even virtual machines and more. Device drivers can be broadly be classified into two categories:  Kernel Device Drivers  User Device Drivers
  • 24. Kernel Device Drivers  Kernel Device Drivers are the generic device drivers that load with the operating system into the memory as part of the operating system; not the entire driver but a pointer to that effect so that the device driver can be invoked as soon as it is required.  The drivers are pertaining to BIOS, motherboard, processor, and similar hardware form part of Kernel Software.  A problem with Kernel Device Drivers is that when one of them is invoked, it is loaded into the RAM and cannot be moved to page file (virtual memory).  Thus, a number of device drivers running at the same time can slow down machines. That is why there is a minimum system requirement for each operating system. The different operating systems already add up the resources needed for kernel device drivers, so that end users need not worry about extra memory requirements.
  • 25. User Device Drivers  User Mode Device Drivers are the ones usually triggered by users during their session on a computer.  It might be thought of devices that the user brought to the computer other than the kernel devices. Drivers for most of the Plug and Play devices fall into this category.  User Device Drivers can be written to disk so that they don’t act tough on the resources. However, for the drivers related to gaming devices, it is recommended to keep them in main memory (RAM).
  • 26. Block Drivers and Character Drivers  These two – the block and character device drivers – belong to the category of data reading and writing. Hard disks, CD ROMs, USB Drives, etc. – might be either Block Drivers or Character Drivers based on how they are used.  Character Drivers are used in serial buses. They write data one character at a time. One character means a byte in a generic sense. If a device is connected to a serial port, it is using a character driver. A mouse is a serial device and has a character device driver.  Block drivers refer to writing and reading of more than one character at a time. Usually, block device drivers create a block and retrieve as much information as the block can contain. Hard disks, for example, use block device drivers. CD ROMs too, are block device drivers, but the kernel needs to check that the device is still connected to the computer, each time the CD ROM is invoked by any application.