BCS401 Operating System Semester IV · AY 2025-26 onward
Unit 5 · I/O, Disk Scheduling & File Systems

Lecture 1: I/O devices & subsystems

Learning outcomes

  • Summarise the basic types of I/O devices and the structure of I/O subsystems.
Lecture Notes

Main content

I/O Management and Disk Scheduling

These notes explain the basic ideas of I/O management, including I/O devices, device controllers, I/O subsystems, buffering, disk structure, disk scheduling, and RAID. These topics are important because I/O devices are much slower than the CPU, so the operating system must carefully coordinate data transfer and storage access for good overall performance.

I/O Devices I/O Subsystem Buffering Disk Scheduling RAID DMA

1. I/O Devices

1.1 Meaning

An I/O device is any hardware unit used to input data into the computer, output data from the computer, or transfer data between the system and the outside world.

1.2 Examples

  • Input devices: keyboard, mouse, scanner, microphone
  • Output devices: monitor, printer, speaker
  • Storage devices: hard disk, SSD, optical disk, USB drive
  • Communication devices: network card, modem, wireless adapter

Each I/O device works at its own speed and has its own control method. Because of this variety, the operating system hides device-specific details through device drivers and the I/O subsystem.

Key point: The CPU does not usually talk to a raw device directly. It interacts through a controller and driver.

1.3 Device controller and device driver

Component Role
Device Controller Hardware unit that controls a particular device and provides registers / local buffer for communication.
Device Driver Software module inside the operating system that knows how to operate the controller.
User Process I/O Subsystem Device Driver Controller Device
Figure 1: Typical path of an I/O request from process to physical device.

2. I/O Subsystem

2.1 Meaning

The I/O subsystem is the part of the operating system that manages all I/O activity. It provides a uniform interface to different devices and hides low-level hardware complexity from user programs.

2.2 Main functions

  • Device-driver interface
  • Interrupt handling
  • DMA support
  • Buffering, caching, and spooling
  • Error detection and recovery
  • Scheduling of I/O requests
  • Protection and access control for devices

2.3 Programmed I/O, interrupts, and DMA

Method Idea Drawback / Strength
Programmed I/O CPU repeatedly checks device status and transfers data itself. Simple but wastes CPU time.
Interrupt-driven I/O Device interrupts CPU when service is needed or transfer completes. Better CPU utilization.
DMA Direct Memory Access controller transfers a block directly between device and memory. Efficient for high-speed block transfer.
Idea: Programmed I/O keeps the CPU busy with the device, interrupts free the CPU between events, and DMA is best for bulk data transfer.

3. I/O Buffering

3.1 Why buffering is needed

A buffer is a temporary memory area used to hold data while it is being transferred between two devices or between a device and a process.

Buffering is needed because:

  • device speeds differ greatly,
  • producer and consumer may work at different rates,
  • devices may transfer data in blocks while applications process it item by item,
  • it helps overlap I/O and CPU activity.

3.2 Types of buffering

Type Meaning Use
Single Buffering One buffer is used between process and device. Simple, but overlap is limited.
Double Buffering Two buffers are used so one can be filled while the other is processed. Improves overlap of CPU and I/O.
Circular Buffering More than two buffers arranged in a ring. Useful for continuous streams like audio or network traffic.
Input Device Buffer A Buffer B Process
Figure 2: Double buffering allows one buffer to be filled while the other is consumed.

Example

While a disk controller fills Buffer A with the next block, the CPU can process data already present in Buffer B. This overlap improves throughput.

4. Disk Storage

4.1 Basic disk structure

Traditional magnetic disks store data on rotating platters. Each platter surface is divided into:

  • Tracks – concentric circles
  • Sectors – subdivisions of a track
  • Cylinders – corresponding tracks on all platter surfaces

Access time depends on:

  • Seek time – time to move the read/write head to the required track
  • Rotational latency – waiting for the required sector to rotate under the head
  • Transfer time – actual time to read or write the data
Track Sector Read/Write Head Movement
Figure 3: Basic disk organization with tracks, sectors, and head movement.

5. Disk Scheduling

5.1 Why disk scheduling is needed

Many processes may request disk access at the same time. Since seek time is a major delay, the OS uses disk scheduling algorithms to reduce total head movement and improve performance.

5.2 Common algorithms

Algorithm Idea Strength Weakness
FCFS Serve requests in arrival order. Simple and fair. Poor average seek performance.
SSTF Choose request nearest to current head position. Lower seek time than FCFS. May starve far-away requests.
SCAN Head moves in one direction serving requests, then reverses. Good throughput, less starvation. Requests at ends may wait longer.
C-SCAN Serve in one direction only; jump back to start. More uniform waiting time. Extra return movement.
LOOK Like SCAN, but reverses at last actual request instead of physical end. Efficient, avoids unnecessary travel. Still direction-sensitive.

5.3 Example request queue

Request sequence:

98, 183, 37, 122, 14, 124, 65, 67

Initial head position:

53

Illustrative observation

  • FCFS follows the given order exactly.
  • SSTF first chooses 65, then 67, because they are nearest to 53.
  • SCAN moves in one direction servicing requests and then reverses.
  • LOOK behaves like SCAN but avoids unnecessary motion to the disk end.

6. RAID (Redundant Array of Independent Disks)

6.1 Meaning

RAID combines multiple physical disks into one logical unit to improve:

  • performance through parallel access,
  • reliability through redundancy,
  • availability by tolerating disk failures.

6.2 Why RAID is used

One large storage system built from multiple disks can often provide better speed and fault tolerance than a single large disk.

Core idea: RAID trades extra disks and management complexity for speed, reliability, or both.

6.3 Common RAID levels

RAID Level Main Idea Advantage Limitation
RAID 0 Striping only, no redundancy High performance No fault tolerance
RAID 1 Mirroring High reliability, simple recovery Needs double storage
RAID 5 Block striping with distributed parity Good balance of speed and fault tolerance Parity update overhead
RAID 6 Distributed dual parity Can survive two disk failures Higher overhead than RAID 5
RAID 10 (1+0) Mirroring + striping Very good performance and reliability Expensive due to extra disks
RAID 0 A1 B1 A2 B2 RAID 1 A B A B RAID 5 A P B A P B
Figure 4: Simple visual comparison of RAID 0, RAID 1, and RAID 5 ideas.

6.4 RAID 5 and RAID 6

In RAID 5, parity is distributed across all disks rather than placed on a single parity disk. This avoids overloading one parity drive. RAID 6 extends this idea by storing two independent redundant values, allowing recovery from two simultaneous disk failures.

6.5 RAID 0+1 and RAID 1+0

Combined RAID schemes are also common:

  • RAID 0+1: striping first, then mirroring
  • RAID 1+0 (RAID 10): mirroring first, then striping

RAID 10 is often preferred in high-performance environments because it offers both speed and stronger fault tolerance than simple striping.

7. Quick Comparison Snapshot

Topic Main idea What to remember
I/O Devices External hardware for input, output, storage, and communication Different speeds and control methods require OS management
I/O Subsystem OS component that manages device access Uses drivers, interrupts, DMA, buffering
Buffering Temporary storage during transfer Helps match speed differences and overlap CPU/I/O
Disk Scheduling Order of servicing disk requests Reduces head movement and seek time
RAID Multiple disks combined for speed and/or reliability RAID 0 = speed, RAID 1 = mirroring, RAID 5 = parity, RAID 10 = both

8. One-Page Summary

I/O management is the responsibility of the operating system for controlling device access, hiding device differences, and coordinating data transfer efficiently.

I/O devices include input, output, storage, and communication devices. The operating system interacts with them through device drivers and controllers.

I/O buffering uses temporary memory areas to reduce speed mismatch between devices and processes and to improve overlap between I/O and CPU execution.

Disk scheduling improves performance by reducing head movement. Important algorithms include FCFS, SSTF, SCAN, C-SCAN, and LOOK.

RAID combines multiple disks to improve performance, reliability, or both. Common levels are RAID 0, RAID 1, RAID 5, RAID 6, and RAID 10.

9. Likely University Questions

  1. What is I/O management? Explain the role of the I/O subsystem.
  2. Differentiate between programmed I/O, interrupt-driven I/O, and DMA.
  3. What is buffering? Explain single, double, and circular buffering.
  4. Explain disk structure with seek time, rotational latency, and transfer time.
  5. What is disk scheduling? Compare FCFS, SSTF, SCAN, C-SCAN, and LOOK.
  6. What is RAID? Explain RAID 0, RAID 1, RAID 5, and RAID 10.
  7. Differentiate between RAID 5 and RAID 6.
  8. Why is RAID used in storage systems?