0% found this document useful (0 votes)
2 views

PDF_OS Module 6

The document discusses I/O management in operating systems, focusing on the organization of I/O functions, disk organization, and various disk scheduling algorithms such as FCFS, SSTF, SCAN, and C-SCAN. It explains how the OS manages I/O devices through device drivers, buffering, caching, and scheduling to optimize performance and ensure efficient data transfer. Additionally, it covers disk organization, allocation methods, and the importance of effective scheduling to minimize seek time and improve overall system efficiency.

Uploaded by

saish.232573101
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)
2 views

PDF_OS Module 6

The document discusses I/O management in operating systems, focusing on the organization of I/O functions, disk organization, and various disk scheduling algorithms such as FCFS, SSTF, SCAN, and C-SCAN. It explains how the OS manages I/O devices through device drivers, buffering, caching, and scheduling to optimize performance and ensure efficient data transfer. Additionally, it covers disk organization, allocation methods, and the importance of effective scheduling to minimize seek time and improve overall system efficiency.

Uploaded by

saish.232573101
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/ 15

CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

OS Module 6: I/O management


Content:
6.1 I/O devices, Organization of the I/O Function, Disk Organization, I/O Management
and Disk Scheduling: FCFS, SSTF, SCAN, CSCAN, LOOK, C-LOOK.

6.1.1 I/O devices:


Input/Output (I/O) devices are the hardware components that allow an operating system (OS)
to communicate with the external world by receiving inputs and providing outputs. The
Operating System (OS) plays a critical role in managing these devices, ensuring smooth data
transfer between them and the system.
I/O devices are categorized into three main types based on their function:
• Input Devices – Devices that send data to the computer.
• Output Devices – Devices that receive and display data from the computer.
• Storage Devices – Devices that store data permanently or temporarily.
The OS manages these devices using device drivers, interrupts, and buffer management to
ensure seamless communication between hardware and software.
I/O Device Management:
A. Device Drivers
• A device driver is a specialized software component that allows the OS to
communicate with hardware.
• It provides a standardized interface so that applications can access hardware without
needing to understand its complexity.
• When a new device is installed, the OS loads the corresponding driver to control it.
• Example: A printer driver translates high-level print commands into signals the printer
understands.
B. Buffering and Caching
• Buffering: Temporary storage area (buffer) where data is held while being transferred
between the OS and the device.
o Improves data transfer efficiency.
o Reduces the time the CPU spends waiting for slow I/O operations.
• Caching: Frequently accessed data is stored in a cache for quicker access.
o Enhances system performance by reducing the need for repeated I/O operations.
C. I/O Scheduling

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

• The OS uses I/O scheduling algorithms to optimize the order in which I/O requests
are handled.
• Scheduling helps avoid long wait times and optimizes throughput.
• Common scheduling algorithms:
o FCFS (First Come, First Serve): Processes requests in the order they arrive.
o SSTF (Shortest Seek Time First): Prioritizes the request closest to the current
head position.
o SCAN (Elevator Algorithm): Moves in one direction, fulfilling requests, then
reverses direction.
D. Interrupt Handling
• Interrupts signal the CPU that an I/O device needs attention.
• The OS uses Interrupt Service Routines (ISRs) to handle interrupts efficiently.
• Steps in interrupt handling:
1. Device sends an interrupt signal.
2. The CPU suspends current operations.
3. The OS executes the corresponding ISR.
4. After handling, the CPU resumes previous operations.
E. Memory-Mapped I/O (MMIO)
• Some systems use Memory-Mapped I/O to communicate with devices.
• Device control registers are mapped into the system’s address space.
• The OS accesses them like regular memory locations, which simplifies I/O operations.
F. Direct Memory Access (DMA)
• DMA is a technique where I/O devices directly access system memory without
involving the CPU.
• Benefits:
o Reduces CPU overhead.
o Improves I/O performance for large data transfers.
• Used by high-speed devices like hard drives and graphics cards.

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

Communication to I/O Devices in Operating System:

Operating systems and input/output devices must interact in order to ensure the smooth
operation of a computer system and user accessibility for a variety of reasons, each with a
distinct purpose.
Input and Output: I/O devices let users provide the operating system input and receive output
from it. Users can issue commands, engage with programs, and traverse the system via input
devices such as keyboards and mice. The user gets information, results, or visual feedback
through output devices like monitors and printers. Users are able to successfully employ the
features of a computer system through seamless interaction facilitated by communication
between the operating system and peripheral devices.
Device Control and Configuration: The operating system must communicate with I/O
devices in order to regulate and control their behavior. This includes actions such as configuring
device settings, initializing devices during system startup, assigning system resources such as
interrupts or memory, and managing power states. The operating system can guarantee that the
devices are correctly set up and working inside the system environment thanks to this
communication. devices.
Data Transfer and Storage: Modern operating systems would struggle to move or store any
kind of digital data without I/O components like hard drives or solid-state drives (SSDs). These
crucial parts help with the process by establishing efficient lines of communication between
your computer’s CPU and motherboard AND storing relevant data such as files, programs,
systems, and data, enabling you to have seamless access due to their speedy reading and writing
capabilities. When working on or saving any type of digital information imaginable, lag-free
performance is ensured by this cooperation between the OS and I/O device.
Peripheral Device Support: Support for numerous peripherals and external hardware
elements is provided via I/O devices. Data exchange through local networks or the internet is
made possible, for instance, by network adapters, which provide the operating system access
to other computers or network devices. Similar to that, USB ports enable the connection of
extra devices including storage devices, printers, scanners, and cameras. The operating system
may make use of these peripherals’ capabilities and offer a smooth user experience by
communicating with them.

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

System Monitoring and Control: Efficient monitoring and management of diverse system
operations require an operating system to interface with specific I/O devices. To maintain the
optimal health of a functioning computer ecosystem while making necessary modifications,
sensors within the hardware or external mechanisms collect data on various environmental
parameters like temperature and voltage. Moreover, effective scheduling of tasks and smooth
time management is facilitated by intercommunication with complementary components such
as a real-time clock or a standard clock.

6.1.2. Organization of the I/O Function


I/O Module Functions:
The I/O module is a special hardware component interface between the CPU and peripherals
to supervise and synchronize all I/O transformation The detailed functions of I/O modules are;
Control & Timing: I/O module includes control and timing to coordinate the flow of traffic
between internal resources and external devices. The control of the transfer of data from
external devices to processor consists following steps:
• The processor interrogates the I/O module to check status of the attached device.
• The I/O module returns the device status.
• If the device is operational and ready to transmit, the processor requests the transfer of
data by means of a command to I/O module.
• The I/O module obtains the unit of data from the external device.
• The data are transferred from the I/O module to the processor.
Processor Communication: I/O module communicates with the processor which involves:
• Command decoding: I/O module accepts commands from the processor.
• Data: Data are exchanged between the processor and I/O module over the bus.
• Status reporting: Peripherals are too slow and it is important to know the status of I/O
module.
• Address recognition: I/O module must recognize one unique address for each peripheral
it controls.
Device Communication: It involves commands, status information and data.
Data Buffering: I/O module must be able to operate at both device and memory speeds. If the
I/O device operates at a rate higher than the memory access rate, then the I/O module performs
data buffering. If I/O devices rate slower than memory, it buffers data so as not to tie up the
memory in slower transfer operation.
Error Detection: I/O module is responsible for error detection such as mechanical and
electrical malfunction reported by device e.g. paper jam, bad ink track & unintentional changes
to the bit pattern and transmission error.

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

I/O Module Structure:

• The I/O bus from the processor is attached to all peripheral interfaces.
• To communicate with the particular devices, the processor places a device address on
the address bus.
• Each interface contains an address decoder that monitors the address line. When the
interface detects the particular device address, it activates the path between the data line
and devices that it controls.
• At the same time that the address is made available in the address line, the processor
provides a function code in the control way includes control command, output data and
input data.

6.1.3. Disk Organization:


Disk organization in an OS refers to how data is structured, stored, and managed on storage
devices like hard disk drives (HDDs), solid-state drives (SSDs), and external storage. The
OS plays a critical role in organizing, accessing, and managing disk operations efficiently to
ensure data integrity, fast access, and optimal resource utilization.
Disk organization defines:
• How data blocks are arranged on the disk.
• The data access method.
• The way the OS handles free space, allocation, and fragmentation.
• Techniques for disk scheduling and performance optimization.
Logical Disk Organization:

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

The OS uses logical disk organization to map physical disk addresses into a logical structure
for file storage and retrieval.
A. Disk Partitions
• A physical disk is divided into partitions, which the OS treats as separate logical disks.
• Each partition has its own file system.
• Types of partitions:
o Primary Partition: The main, bootable partition.
o Extended Partition: Used to create multiple logical drives.
o Logical Partition: A section within an extended partition.
B. File System Organization
• The file system manages how data is stored, organized, and accessed on the disk.
• It uses inodes, directories, and file allocation tables (FAT) to map files to disk blocks.
• Common file systems:
o FAT32 (Windows)
o NTFS (Windows)
o ext3/ext4 (Linux)
o APFS (MacOS)
C. Disk Addressing:
• The OS uses Logical Block Addressing (LBA) to access disk blocks.
• LBA: Converts the cylinder, head, and sector (CHS) address into a single logical
address.
• Simplifies disk access by treating the disk as a linear array of blocks.

Disk Allocation Methods:


The OS uses various allocation strategies to organize files on disk efficiently.
A. Contiguous Allocation
• Files are stored in continuous blocks on the disk.
• Advantages:
o Simple to implement.
o Fast sequential access.
• Disadvantages:

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

o Causes external fragmentation.


o Difficult to expand files.
Example:
File A → Blocks 10, 11, 12
File B → Blocks 13, 14, 15
B. Linked Allocation
• Files are stored in non-contiguous blocks.
• Each block contains:
o Data
o Pointer to the next block.
• Advantages:
o No external fragmentation.
o Easy expansion.
• Disadvantages:
o Slower access due to pointer traversal.
o Additional storage overhead for pointers.
Example:
File A → Block 10 → Block 22 → Block 35
C. Indexed Allocation
• An index block contains a table of pointers to all the blocks of a file.
• The OS maintains the index table separately.
• Advantages:
o Supports random access.
o No fragmentation.
• Disadvantages:
o Extra space required for the index table.
Example:
Index Table:
File A → [Block 10, Block 25, Block 30]

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

Disk Scheduling Terminology:


• Seek time: The time taken by the disk arm to move to the desired track.
• Rotational latency: The delay caused by the disk platter rotating to the right sector.
• Total head movement: The total distance (in tracks) travelled by the disk arm.
• Queue: The sequence of pending disk requests.
• Initial head position: The starting track where the disk head is located.

Disk Scheduling Algorithms:


Disk scheduling algorithms optimize the order of I/O requests to minimize seek time and
improve efficiency.
A. First-Come-First-Serve (FCFS)
• I/O requests are handled in the order of arrival.
• Advantages:
o Simple to implement.
• Disadvantages:
o Inefficient for heavy workloads.
o Long waiting time for some requests.

B. Shortest Seek Time First (SSTF)


• The disk arm moves to the closest request first.
• Advantages:
o Faster access time.
• Disadvantages:
o May cause starvation of far-away requests.

C. SCAN (Elevator Algorithm)


• The disk head moves in one direction until it reaches the last request, then reverses.
• Advantages:
o Prevents starvation.
o Provides fair service.
• Disadvantages:

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

o May result in long waiting times for requests at the end of the queue.
D. C-SCAN (Circular SCAN)
• Similar to SCAN but only moves in one direction, then jumps back.
• Advantages:
o Provides uniform wait time.
• Disadvantages:
o Higher seek time compared to SCAN.

E. LOOK Algorithm
LOOK is a modified version of SCAN. Instead of going to the end of the disk, the head only
goes as far as the last request in each direction, then reverses.
Advantages:
• Reduces unnecessary movements compared to SCAN.
• Prevents starvation.
Disadvantages:
• Seek time depends on the direction of travel.

F. C-LOOK (Circular LOOK)


C-LOOK is similar to LOOK, but it only moves in one direction and jumps back when it
reaches the end.
Advantages:
• Better performance than SCAN.
• Prevents starvation.
Disadvantages:
• Longer seek time due to the jump.

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

Consider the following disk queue example:


• Request queue: 98, 183, 37, 122, 14, 124, 65, 67
• Initial head position: 53
• Total tracks on disk: 200

First-Come-First-Serve (FCFS):
Execution Order:
53 → 98 → 183 → 37 → 122 → 14 → 124 → 65 → 67
Head Movement Calculation:
|53 - 98| = 45
|98 - 183| = 85
|183 - 37| = 146
|37 - 122| = 85
|122 - 14| = 108
|14 - 124| = 110
|124 - 65| = 59
|65 - 67| = 2

Total head movement = 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640 tracks

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

Shortest Seek Time First (SSTF):


Execution Order:
53 → 65 → 67 → 37 → 14 → 98 → 122 → 124 → 183
Head Movement Calculation:
|53 - 65| = 12
|65 - 67| = 2
|67 - 37| = 30
|37 - 14| = 23
|14 - 98| = 84
|98 - 122| = 24
|122 - 124| = 2
|124 - 183| = 59
Total head movement = 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236 tracks

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

SCAN (Elevator Algorithm):


Execution Order:
53 → 65 → 67 → 98 → 122 → 124 → 183 → (reverse) → 37 → 14
Head Movement Calculation:
|53 - 65| = 12
|65 - 67| = 2
|67 - 98| = 31
|98 - 122| = 24
|122 - 124| = 2
|124 - 183| = 59
|183 - 200| = 17
|200 - 37| = 163
|37 - 14| = 23
Total head movement = 12 + 2 + 31 + 24 + 2 + 59 + 17 + 163 + 23 = 333 tracks

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

C-SCAN (Circular SCAN):


Execution Order:
53 → 65 → 67 → 98 → 122 → 124 → 183 → (jump) → 14 → 37
Head Movement Calculation:
|53 - 65| = 12
|65 - 67| = 2
|67 - 98| = 31
|98 - 122| = 24
|122 - 124| = 2
|124 - 183| = 59
|183 - 200| = 17
|200 - 0| (jump back) = 200
|0 - 14| = 14
|14 - 37| = 23
Total head movement = 12 + 2 + 31 + 24 + 2 + 59 + 17+200 + 14 + 23 = 384 tracks

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

LOOK Algorithm:
Execution Order:
53 → 65 → 67 → 98 → 122 → 124 → 183 → (reverse) → 37 → 14
Head Movement Calculation:
|53 - 65| = 12
|65 - 67| = 2
|67 - 98| = 31
|98 - 122| = 24
|122 - 124| = 2
|124 - 183| = 59
|183 - 37| = 146
|37 - 14| = 23

Total head movement = 12 + 2 + 31 + 24 + 2 + 59 + 146 + 23 = 299 tracks

Compiled By: Ms. Priti Rumao


CO 6: Evaluate performance of disk scheduling algorithms using concepts of I/O management.

C-LOOK (Circular LOOK):


Execution Order:
53 → 65 → 67 → 98 → 122 → 124 → 183 → (jump back) → 14 → 37
Head Movement Calculation:
Total head movement = 350 tracks

Compiled By: Ms. Priti Rumao

You might also like