0% found this document useful (0 votes)
9 views18 pages

IO MGMT

The document outlines the role of I/O management in operating systems, detailing how the OS manages various I/O devices and the communication processes involved. It describes the components of I/O hardware, including device drivers and controllers, and explains different methods of communication like special instruction I/O, memory-mapped I/O, and Direct Memory Access (DMA). Additionally, it covers the organization of I/O software, the functions of device drivers, and the applications of I/O interfaces in facilitating communication between CPUs and I/O devices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

IO MGMT

The document outlines the role of I/O management in operating systems, detailing how the OS manages various I/O devices and the communication processes involved. It describes the components of I/O hardware, including device drivers and controllers, and explains different methods of communication like special instruction I/O, memory-mapped I/O, and Direct Memory Access (DMA). Additionally, it covers the organization of I/O software, the functions of device drivers, and the applications of I/O interfaces in facilitating communication between CPUs and I/O devices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

IO MANAGEMENT

Operating System – I/O Management


• One of the important jobs of an Operating System is to manage the
operations of various I/O devices including mouse, keyboards, touch pad,
disk drives, display adapters, USB devices, Bit-mapped screen, LED,
Analog-to-digital converter, On/off switch, network connections, audio
I/O, printers etc.
• The I/O system of an OS works by taking I/O request from an application
software and sending it to the physical device, which could be an input or
output device then it takes whatever response comes back from the device
and sends it to the application.
• Components of I/O Hardware
• (1). I/O Device: I/O devices such as storage, communications, user-
interface, and others 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.
Cont..
• I/O devices can be divided into two categories −
• Block devices − A block device is one with which the device driver
communicates by sending entire blocks of data. For example, Hard disks,
USB cameras, Disk-On-Key etc.
• Character devices − A character device is one with which the device
driver communicates by sending and receiving single characters (bytes,
octets). For example, serial ports, parallel ports, sounds cards etc.
• (2). Device Driver: Device drivers are software modules that can be
plugged into an OS to handle a particular device. Operating System takes
help from device drivers to handle all I/O devices.
• (3). Device Controller: The Device Controller works like an interface
between a device and a device driver. I/O units (Keyboard, mouse,
printer, etc.) typically consist of a mechanical component and an electronic
component where electronic component is called the device controller
Cont..
• There is always a device controller and a device driver for each device to
communicate with the Operating Systems. A device controller may be able
to handle multiple devices. As an interface its main task is to convert
serial bit stream to block of bytes, perform error correction as
necessary.
• Any device connected to the computer is connected by a plug and socket,
and the socket is connected to a device controller. Following is a model for
connecting the CPU, memory, controllers, and I/O devices where CPU and
device controllers all use a common bus for communication.
Cont..
• Communication to I/O Devices
• The CPU must have a way to pass information to and from an I/O device.
There are three approaches available to communicate with the CPU and
Device.
• 1. Special Instruction I/O: This uses CPU instructions that are specifically
made for controlling I/O devices. These instructions typically allow data to
be sent to an I/O device or read from an I/O device. 
• 2. Memory-mapped I/O: When using memory-mapped I/O, the same
address space is shared by memory and I/O devices. The device is
connected directly to certain main memory locations so that I/O device can
transfer block of data to/from memory without going through CPU.
• While using memory mapped IO, OS allocates buffer in memory and
informs I/O device to use that buffer to send data to the CPU. I/O device
operates asynchronously with CPU, interrupts CPU when finished.
• The advantage to this method is that every instruction which can access
memory can be used to manipulate an I/O device. Memory mapped IO is
used for most high-speed I/O devices like disks, communication interfaces.
Cont..
• Direct Memory Access (DMA): Slow devices like keyboards will
generate an interrupt to the main CPU after each byte is transferred. If a
fast device such as a disk generated an interrupt for each byte, the
operating system would spend most of its time handling these interrupts.
So a typical computer uses direct memory access (DMA) hardware to
reduce this overhead.
• Direct Memory Access (DMA) means CPU grants I/O module authority to
read from or write to memory without involvement. DMA module itself
controls exchange of data between main memory and the I/O device. CPU
is only involved at the beginning and end of the transfer and interrupted
only after entire block has been transferred.
• Direct Memory Access needs a special hardware called DMA controller
(DMAC) that manages the data transfers and arbitrates access to the
system bus. The controllers are programmed with source and destination
pointers (where to read/write the data), counters to track the number of
transferred bytes, and settings, which includes I/O and memory types,
interrupts and states for the CPU cycles.
Cont..
Cont..
• I/O Software
• I/O software is often organized in the following layers –
• User Level Libraries − This provides simple interface to the user program
to perform input and output. For example, stdio is a library provided by C
and C++ programming languages.
• Kernel Level Modules − This provides device driver to interact with the
device controller and device independent I/O modules used by the device
drivers.
• Hardware − This layer includes actual hardware and hardware controller
which interact with the device drivers and makes hardware alive.
• A key concept in the design of I/O software is that it should be device
independent where it should be possible to write programs that can access
any I/O device without having to specify the device in advance. For
example, a program that reads a file as input should be able to read a file
on a floppy disk, on a hard disk, or on a CD-ROM, without having to
modify the program for each different device.
Cont..
Cont..
• Device Drivers
• Device drivers are software modules that can be plugged into an OS
to handle a particular device. Operating System takes help from
device drivers to handle all I/O devices.
• Device drivers encapsulate device-dependent code and implement a
standard interface in such a way that code contains device-specific
register reads/writes.
• Device driver, is generally written by the device's manufacturer and
delivered along with the device on a CD-ROM.
• A device driver performs the following jobs −
• To accept request from the device independent software above to it.
• Interact with the device controller to take and give I/O and perform
required error handling
• Making sure that the request is executed successfully
Cont..
• How a device driver handles a request is as follows:
• Suppose a request comes to read a block N. If the driver is idle at the time
a request arrives, it starts carrying out the request immediately. Otherwise,
if the driver is already busy with some other request, it places the new
request in the queue of pending requests.
• Interrupt handlers: An interrupt handler, also known as an interrupt
service routine or ISR, is a piece of software or more specifically a
callback function in an operating system or more specifically in a device
driver, whose execution is triggered by the reception of an interrupt. When
the interrupt happens, the interrupt procedure does whatever it has in order
to handle the interrupt, updates data structures and wakes up process that
was waiting for an interrupt to happen.
• Device-Independent I/O Software: The basic function of the device-
independent software is to perform the I/O functions that are common to
all devices and to provide a uniform interface to the user-level software.
Though it is difficult to write completely device independent software but
we can write some modules which are common among all the devices.
Cont..
• User-Space I/O Software: These are the libraries which provide richer
and simplified interface to access the functionality of the kernel or
ultimately interact with the device drivers. Most of the user-level I/O
software consists of library procedures with some exception like spooling
system which is a way of dealing with dedicated I/O devices in a
multiprogramming system.
• I/O Libraries (e.g., stdio) are in user-space to provide an interface to the
OS resident device-independent I/O SW. For example putchar(), getchar(),
printf() and scanf() are example of user level I/O library stdio available in
C programming.
• Kernel I/O Subsystem: Kernel I/O Subsystem is responsible to provide
many services related to I/O. Following are some of the services provided.
– Scheduling − Kernel schedules a set of I/O requests to determine a good order in which
to execute them. When an application issues a blocking I/O system call, the request is
placed on the queue for that device. The Kernel I/O scheduler rearranges the order of the
queue to improve the overall system efficiency and the average response time
experienced by the applications.
Cont..

– Buffering − Kernel I/O Subsystem maintains a memory area known as buffer


that stores data while they are transferred between two devices or between a
device with an application operation. Buffering is done to cope with a speed
mismatch between the producer and consumer of a data stream or to adapt
between devices that have different data transfer sizes.
– Caching − Kernel maintains cache memory which is region of fast memory
that holds copies of data. Access to the cached copy is more efficient than
access to the original.
– Spooling and Device Reservation − A spool is a buffer that holds output for a
device, such as a printer, that cannot accept interleaved data streams. The
spooling system copies the queued spool files to the printer one at a time. In
some operating systems, spooling is managed by a system daemon process. In
other operating systems, it is handled by an in kernel thread.
– Error Handling − An operating system that uses protected memory can guard
against many kinds of hardware and application errors.
Cont..
• Device Controllers
• Device drivers are software modules that can be plugged
into an OS to handle a particular device. Operating System
takes help from device drivers to handle all I/O devices.
• The Device Controller works like an interface between a
device and a device driver. I/O units (Keyboard, mouse,
printer, etc.) typically consist of a mechanical component
and an electronic component where electronic component
is called the device controller.
• There is always a device controller and a device driver for
each device to communicate with the Operating Systems. A
device controller may be able to handle multiple devices.
As an interface its main task is to convert serial bit stream
to block of bytes, perform error correction as necessary.
Applications of Input/Output Interface

• There is need of interface whenever any CPU wants to communicate with


I/O devices. The interface is used to interpret address which is
generated by CPU. Thus, interface is used to communicate to I/O devices
i.e. to share information between CPU and I/O devices interface is used
which is called as I/O Interface.
• Various applications of I/O Interface:
• Application of I/O is that we can say interface have access to open any
file without any kind of information about file i.e., even basic information
of file is unknown. It also has feature that it can be used to also add new
devices to computer system even it does not cause any kind of interrupt to
operating system. It can also used to abstract differences in I/O devices by
identifying general kinds. The access to each of general kind is through
standardized set of function which is called as interface.
• Each type of operating system has its own category for interface of
device-drivers. The device which is given may ship with multiple device-
drivers-for instance, drivers for Windows, Linux, AIX and Mac OS,
devices may is varied by dimensions which is as illustrated in the
following table (next slide):
Cont..
Cont..

• 1. Character-stream or Block:
• A character stream or block both transfers data in form of bytes.
The difference between both of them is that character-stream
transfers bytes in linear way i.e., one after another whereas
block transfers whole byte in single unit.
• 2. Sequential or Random Access:
• To transfer data in fixed order determined by device, we use
sequential device whereas user to instruct device to seek to any
of data storage locations, random-access device is used.
• 3. Synchronous or Asynchronous:
• Data transfers with predictable response times is performed by
synchronous device, in coordination with others aspects of
system. An irregular or unpredictable response times not
coordinated with other computer events is exhibits by an
asynchronous device.
Cont..
• 4. Sharable or Dedicated:
• Several processes or threads can be used concurrently by
sharable device; whereas dedicated device cannot.
• 5. Speed of Operation:
• The speed of device has range set which is of few bytes
per second to few giga-bytes per second.
• 6. Read-write, read only, write-only:
• Different devices perform different operations, some
supports both input and output, but others supports only
one data transfer direction either input or output.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy