Chapter 4
Chapter 4
Device Management
Dev ice Manage ment
Operating
System
Intro duct ion
Device Management in Operating system manages all the hardware or virtual devices of
a computer or PC.
The device management system allocates input/output devices to the process on the
basis of priority and deallocated as well either temporarily or permanently depending
upon the conditions.
I/O Dev ices
An input/output (I/O) device is a piece of hardware that can take, output, or process
data.
It can receive data as input and provide it to a computer, as well as send computer data
to storage media as a storage output.
I/O devices can be roughly divided into two categories:
block devices and
character devices.
C ont’d
Block Devices
A block device is one that stores information in fixed-size blocks, each one with its
own address.
Common block sizes range from 512 to 65,536 bytes.
All transfers are in units of one or more entire (consecutive) blocks.
The essential property of a block device is that it is possible to read or write each block
independently of all the other ones.
Hard disks, Blu-ray discs, and USB sticks are common block devices.
C ont’d
Character Devices
Serial Device
Parallel Device
Reasons of buffering
Types of buffering
a) Single Buffering
b) Double Buffering
c) Circular Buffering
C ont’d
Single buffering
Double buffering
When more than two buffers are used, then it is called circular buffering.
It is used to solve the issues associated with the double buffering technique.
Sometimes, the double buffering becomes insufficient, when the process performs
rapid bursts of I/O.
Dir ect Memor y Access
Direct Memory Access (DMA) is a computer system feature that allows hardware
devices to communicate with a computer's RAM memory without using the CPU.
This allows the device to perform tasks without interrupting the main processor, which
improves performance.
DMA is programmed I/O, only with the DMA controller doing all the work, instead of
the main CPU.
Many computers avoid burdening the main CPU with PIO by offloading some of this
work to a special-purpose processor called a direct-memory-access (DMA) controller.
C ont’d
For a device that does large transfers, such as a disk drive, it seems wasteful to use an
expensive general-purpose processor to watch status bits and to feed data into a
controller register one byte at a time—a process termed programmed I/O (PIO).
Many computers avoid burdening the main CPU with PIO by offloading some of this
work to a special-purpose processor called a direct-memory-access (DMA) controller.
To initiate a DMA transfer, the host writes a DMA command block into memory.
C ont’d
This block contains a pointer to the source of a transfer, a pointer to the destination of
the transfer, and a count of the number of bytes to be transferred.
The CPU writes the address of this command block to the DMA controller, then goes
on with other work.
The DMA controller proceeds to operate the memory bus directly, placing addresses
on the bus to perform transfers without the help of the main CPU.
C ont’d
Drive
1. CPU
Main
programs DMA Disk
CPU Memory
The DMA controller controller
controller Buffer
Address
Count
4. ACK
Control
2.DMA requests
Interrupt when done transfer to memory 3. Data transferred
Bus
Recovery from fai lure
The term failure can encompass a wide range of issues, including
hardware malfunctions,
software errors,
data corruption, or other events that disrupt normal operations.
The goal of recovery is to minimize downtime, data loss, and negative impacts on the
system or application.
Cont’d
C o m m o n s c e n a r io s
1. Page Faults
Scenario: A page fault occurs when a program tries to access a portion of memory
that is not currently in physical RAM.
Recovery: The operating system's memory manager responds to page faults by
bringing the required page into RAM from secondary storage (such as a hard
disk).
C on t ’d
2. Out of memory
Scenario: The system runs out of physical memory due to excessive demand from running
processes.
Recovery: The operating system may employ various strategies to handle out-of-memory
situations, such as terminating or suspending certain processes, paging out inactive pages
to disk, or using virtual memory to extend the available address space.
3. Memory Leaks
Scenario: A program allocates memory but fails to release it, leading to a gradual
depletion of available memory.
Recovery: Memory leaks are typically addressed by periodically restarting or terminating
the affected processes.
C on t ’d
4. Hardware Failures
Scenario: Physical memory (RAM) or memory-related hardware components fail.
Recovery: In the case of hardware failures, the operating system may not be able to recover
fully. However, modern server architectures often include features like error-correcting code
(ECC) memory to detect and correct certain types of hardware errors.