0% found this document useful (0 votes)
55 views24 pages

IO Management

This document discusses operating system responsibilities for input/output (I/O) device management. It describes the key hardware and software components involved, including I/O devices, device controllers, device drivers, and interrupt handlers. Specifically, it covers the roles of block storage devices like disk drives, controllers that interface between CPUs and devices, how device drivers process requests and handle interrupts, and strategies for data transfer like direct memory access and interrupt-driven I/O.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views24 pages

IO Management

This document discusses operating system responsibilities for input/output (I/O) device management. It describes the key hardware and software components involved, including I/O devices, device controllers, device drivers, and interrupt handlers. Specifically, it covers the roles of block storage devices like disk drives, controllers that interface between CPUs and devices, how device drivers process requests and handle interrupts, and strategies for data transfer like direct memory access and interrupt-driven I/O.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Operating Systems

Dr. Mona Farouk

Principles of I/O Device Management


Areas of OS Responsibility
 Hardware
 CPU (managed by proceses)
 Memory
 I/O Devices

 File Systems
 Security
 Networking
Input & Output
 A computer’s job is to process data
 Computation (CPU, cache, and memory)
 Move data into and out of a system (between I/O devices and
memory)
 Challenges with I/O devices
 Categories: storage, networking, interface
 Massive number of device drivers to support
 Goals of the OS
 Provide a generic, consistent, convenient and reliable way to
access I/O devices
 Achieve acceptable I/O performance in a system
Elements of the I/O Subsystem
 Device: the thing that stores data or transfers data in and
out of the system

 Device Controller or Adapter: electronics that interface


between the CPU and the device

 Device Driver: software that interacts with the device


controller

 Interrupt Handler: part of the device driver that is called


when the controller generates an interrupt

4
Elements of the I/O Subsystem
I/O Hardware Components:
Devices
Types of I/O Devices
 Communication
 Transfer
data in and out of the system
 Communicate with humans or other machines
 Examples:
 keyboard, display, network interfaces

 Storage
 Maintain
persistent data
 Examples:
 disks, tapes, CD-ROMs

7
Types of I/O Devices (cont.)
 Block
 Reads, writes and transfers data in multi-byte
blocks
 Usually randomly accessible

 Stream (character)
 Datatransfer one byte at a time
 Sequentially accessible.

8
An Example of Block Storage I/O device
The disk Drive
Block Devices: Disk Drives
 Head: for reading and
writing data
 Arm: assembly of heads
(one per surface)
 Track: circle under a
single head
 Cylinder: group of tracks
for a fixed arm position
 Sector: division of a track;
smallest unit of reading
and writing
10
Block Devices:
Disk Drives

11
Disk Access Time
 Seek time ts: time to move the arm to the
desired cylinder

 Rotational latency tr : time for the platter


to move to the desired sector

 Average access time: average seek time


plus one-half full rotation

12
Example
 Disk drive
 Rotates at 10,000 RPM
 ts = 10 ms
  Time for full rotation = 6 ms
  tr = 3 ms
 ta = 13 ms (average access time)

 Compare to system’s memory with 50ns access


time
 Disk Drive is 260,000 time slower
I/O Hardware Components:
Device Controllers (Adapters)
Device Controller
 Controller has a collection of registers
 Used for communicating with the CPU
 OS performs I/O by writing commands into
these registers.
 When finish controller generates interrupt to
allow OS to gain control of CPU.

15
Controller Interface Programming
 Access:
 Special I/O instructions
 each control register is assigned an I/O port
number
 Memory-Mapped

Memory-Mapped I/O
Addresses

Special I/O instructions:


e.g.
IN REG , PORT
OUT PORT , REG
16
Memory-Mapped I/O

Separate I/O and memory space


Memory-mapped I/O
 Hybrid
Data Transfer
 CPU involved
 Direct Memory Access (DMA): controller transfers data directly
to/from memory without involving the CPU
Important: to verify
checksum & to
Calling Process
control flow of bytes.
blocks

Blocked Process Without involving


wakes-up CPU 18
Interleaving
 Simple controllers can’t make input and
output at the same time
 While doing memory transfer, the sector
passing under the head is lost.
 How many blocks are skipped depends
on the relation between the time to
transfer a block from the controller to
memory and the time to read a block from
disk.
Interleaving
 Skipping blocks to give the controller time to transfer data to
memory is called Interleaving

 Position successive data sectors at physical sectors separated by


others

 Allows OS to read consecutively numbered blocks at the max


speed of the HW.

 With no interleaving an 8-block file in consecutive disk blocks


would take how many rotations?

20
No interleaving Single interleaving Double interleaving
I/O Software Components:
Device Drivers
Device Drivers
 Provides an
interface between a device controller and
the rest of system software.
 Accepts requests from user processes &
other kernel software:
 translates
them into parameters and
commands to drive the controller.
 Handles interrupts from device controller
A Typical Device Driver
Operations
 Initialize devices
 Interpreting commands from OS
 Schedule multiple outstanding requests
 Manage data transfers
 Accept and process interrupts
Data Transfer
 Polling: CPU periodically checks the controller
(Status bits) to see if additional data needs to be
transferred
 Polling not acceptable except for v. small dedicated
systems not running multiple processes

 Interrupt driven: controller generates an


interrupt to CPU when additional data is ready to
be transferred

24

You might also like