0% found this document useful (0 votes)
19 views22 pages

Chapter 4

Device management in operating systems handles all hardware and virtual devices. It allocates devices to processes based on priority and deallocates them when needed. Input/output devices are divided into block devices, which access fixed-size blocks, and character devices, which access streams of characters. Buffering helps synchronize devices with different speeds by temporarily storing data. Direct memory access allows hardware devices to access memory without using the CPU.

Uploaded by

samebisa3404
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)
19 views22 pages

Chapter 4

Device management in operating systems handles all hardware and virtual devices. It allocates devices to processes based on priority and deallocates them when needed. Input/output devices are divided into block devices, which access fixed-size blocks, and character devices, which access streams of characters. Buffering helps synchronize devices with different speeds by temporarily storing data. Direct memory access allows hardware devices to access memory without using the CPU.

Uploaded by

samebisa3404
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/ 22

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

 A character device delivers or accepts a stream of characters, without regard to any


block structure.
 It is not addressable and does not have any seek operation.
 Printers, network interfaces, mice (for pointing ) and most other devices that are not
disk-like can be seen as character devices.
Seri al and Par allel d evic es

Serial Device

 Serial: Bit by bit, one after another, over a single channel.


 In a serial device, data is transmitted sequentially, one bit at a time, over a single
communication channel or wire.
C ont’d

Parallel Device

 Parallel: Multiple bits simultaneously, each on a dedicated channel.


 In a parallel device, multiple bits of data are transmitted simultaneously over multiple
communication channels or wires.
Buf fer ing

 A buffer is a region of memory designated to temporarily store data.


 It acts as an intermediate storage space between the source of data and the
destination.
 Buffering in operating system is a method of storing data in a buffer or cache
temporarily, this buffered data then can be accessed more quickly as compared to the
original source of the data.
 Buffer can store data before it is sent to or retrieved from the storage device.
C ont’d

Reasons of buffering

• Buffering creates a synchronization between two devices having different


processing speed.
 For example, if a hard disc (supplier of data) has high speed and a printer (accepter of
data) has low speed, then buffering is required.
• Buffering is also required in cases where two devices have different data block
sizes.
• Buffering is also required to support copy semantics for application I/O operations.
C ont’d

Types of buffering

a) Single Buffering
b) Double Buffering
c) Circular Buffering
C ont’d

Single buffering

 It is the simplest buffering that operating system can support.


 only one buffer is used to transfer the data between two devices.
 The producer produces one block of data into the buffer.
 After that, the consumer consumes the buffer.
C ont’d

Double buffering

 Double buffering is an extended variant of single buffering.


 In this type buffering, a process can transfer data to or from one buffer while the
operating system removes or fills the other.
C ont’d
Circular 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.

You might also like