Unit 5: I/O Management and Disk Scheduling




I/O Management and Disk Scheduling

I/O Management is the function of the Operating System that controls and coordinates all input and output operations between the computer and external devices.

I/O Devices

I/O devices are hardware components that allow the system to communicate with the external world.

Classification of I/O Devices

TypeExamples
Input DevicesKeyboard, Mouse, Scanner
Output DevicesMonitor, Printer
Storage DevicesHard Disk, SSD
Communication DevicesModem, Network Card

Device Characteristics

CharacteristicDescription
Data Transfer RateSpeed of data transfer
Unit of TransferByte or block
Access MethodSequential or random
I/O ControlPolling, Interrupts, DMA

I/O Subsystems

I/O Subsystem is the OS layer that manages I/O devices efficiently and uniformly.

Functions of I/O Subsystem

FunctionExplanation
Device abstractionHides hardware details
SchedulingOrders I/O requests
BufferingSmooth data transfer
Error handlingDetects and handles errors
Device allocationAssigns devices

Components of I/O Subsystem

ComponentRole
Device DriversInterface between OS and device
Interrupt HandlersRespond to device signals
I/O SchedulerManages request queue
Buffers & CachesTemporary storage

I/O Buffering

Buffering uses main memory as temporary storage during I/O operations to handle speed mismatches.

Why Buffering is Needed

  • CPU faster than I/O devices
  • Avoid data loss
  • Improve system throughput

Types of Buffering

TypeDescription
Single BufferingOne buffer used
Double BufferingTwo buffers alternate
Circular BufferingMultiple buffers in cycle

Advantages

  • Overlapping of I/O and CPU execution
  • Reduced waiting time
  • Smooth data transfer

Disk Storage

Disk Structure Components

ComponentDescription
PlatterCircular disk surface
TrackConcentric circles
SectorSmallest storage unit
CylinderSame track on all platters
Read/Write HeadAccesses data

Disk Access Time

Disk Access Time = Seek Time + Rotational Latency + Transfer Time

TermMeaning
Seek TimeHead movement time
Rotational LatencyWait for sector
Transfer TimeActual data transfer

Disk Scheduling

Disk scheduling decides the order of disk I/O requests to minimize seek time.

Disk Scheduling Algorithms

1. FCFS (First Come First Serve)

FeatureExplanation
OrderArrival order
AdvantageSimple
DisadvantageHigh seek time

2. SSTF (Shortest Seek Time First)

FeatureExplanation
SelectionNearest request
AdvantageReduced seek time
DisadvantageStarvation

3. SCAN (Elevator Algorithm)

FeatureExplanation
MovementBack and forth
AdvantageFair
DisadvantageEnd delay

4. C-SCAN

FeatureExplanation
DirectionOne direction only
AdvantageUniform wait
DisadvantageExtra movement

5. LOOK / C-LOOK

FeatureExplanation
ImprovementStops at last request
AdvantageEfficient

Comparison Table

AlgorithmStarvationPerformance
FCFSNoPoor
SSTFYesGood
SCANNoBetter
C-SCANNoBest

RAID (Redundant Array of Independent Disks)

RAID combines multiple disks to improve performance, reliability, or both.

RAID Levels

LevelTechniqueBenefit
RAID 0StripingHigh speed
RAID 1MirroringHigh reliability
RAID 2Hamming codeError correction
RAID 3Byte-level striping + parity
RAID 4Block-level striping + parity
RAID 5Distributed parityBalanced
RAID 6Dual parityFault tolerance

Popular RAID Comparison

RAIDMin DisksFault Tolerance
RAID 02None
RAID 121 disk
RAID 531 disk
RAID 642 disks

Advantages of RAID

  • Improved performance
  • Data redundancy
  • Fault tolerance
  • High availability

Disadvantages

  • Costly
  • Complex setup
  • Storage overhead

Quick Revision Table

TopicKey Focus
I/O DevicesInput–Output hardware
I/O SubsystemOS management layer
BufferingSpeed mismatch handling
Disk SchedulingSeek time reduction
RAIDPerformance & reliability

FILE SYSTEM

A File System is a method used by the Operating System to store, organize, manage, and protect data on storage devices such as hard disks and SSDs.

File Concept

A file is a named collection of related data stored on secondary storage.

Files provide a logical view of data storage to users and programs.

File Attributes

AttributeDescription
NameHuman-readable identifier
IdentifierUnique file number
TypeText, binary, executable
LocationDisk address
SizeFile length
ProtectionAccess permissions
Time & DateCreation, modification
OwnerUser information

File Operations

OperationDescription
CreateCreate new file
OpenAccess file
ReadRead data
WriteModify data
CloseRelease file
DeleteRemove file

File Organization and Access Mechanism

File organization defines how files are physically stored on disk.

Types of File Organization

TypeDescriptionUse Case
SequentialRecords stored in orderLogs, tapes
IndexedIndex table for fast accessDatabases
HashedHash function maps keysLarge files

File Access Mechanisms

Access MethodExplanation
Sequential AccessData accessed in order
Direct (Random) AccessAccess any block directly
Indexed AccessUses index for quick access

Comparison Table

FeatureSequentialDirectIndexed
SpeedSlowFastVery fast
FlexibilityLowHighHigh

File Directories

A directory is a special file that stores information about other files.

Directory Structures

TypeDescription
Single-LevelOne directory for all files
Two-LevelSeparate directory per user
Tree-StructuredHierarchical structure
Acyclic GraphAllows shared files
General GraphAllows cycles

Directory Operations

OperationDescription
SearchFind a file
CreateAdd file
DeleteRemove file
RenameChange name
TraverseMove through structure

File Sharing

File sharing allows multiple users or processes to access the same file.

Types of File Sharing

TypeExplanation
Local SharingWithin same system
Remote SharingOver network

File Locking

Lock TypePurpose
Shared LockMultiple readers
Exclusive LockSingle writer

Consistency Problems

  • Simultaneous write conflicts
  • Data corruption

Solution: File locking and access control.

File System Implementation Issues

1. File Allocation Methods

MethodDescriptionIssue
ContiguousContinuous blocksExternal fragmentation
LinkedLinked blocksSlow access
IndexedIndex blockExtra overhead

2. Free Space Management

MethodDescription
Bit MapBit per block
Linked ListLinked free blocks
GroupingGroups of free blocks
CountingExtents

3. Directory Implementation

  • Linear list
  • Hash table

4. Disk I/O Performance

  • Block size
  • Cache usage
  • Read-ahead

File System Protection and Security

Need for Protection

  • Prevent unauthorized access
  • Ensure data integrity
  • Maintain privacy

Protection Mechanisms

1. Access Control

Access TypeMeaning
ReadView content
WriteModify content
ExecuteRun file

2. Access Control List (ACL)

UserPermissions
OwnerRWX
GroupRW
OthersR

3. Capability List

  • Users possess capabilities
  • More secure than ACL

4. Encryption

  • Protects data from theft
  • Used in modern file systems

5. Authentication

  • Passwords
  • Biometrics
  • Digital certificates

Comparison: ACL vs Capability List

FeatureACLCapability
Stored WithFileUser
SecurityMediumHigh
FlexibilityHighMedium

Exam-Friendly Summary

TopicKey Point
File ConceptNamed data collection
File AccessSequential, Direct, Indexed
DirectoryFile organization
File SharingMulti-user access
ImplementationAllocation & free space
ProtectionAccess control & security