1
Device Management
CS Year III, 2023 Compiled by: Adane B.
2 Outline
Introduction to Device
management
I/O device
Buffering strategies
Direct memory access
Recovery from failure
CS Year III, 2023 Compiled by: Adane B.
3 Introduction
Humans interact with machines by providing information through IO devices.
Management of these devices can affect the throughput of a system.
Communication with an IO device is required at the following levels:
The need for a human to input information and output from a
computer.
The need for a device to input information and receive output from a
computer.
The need for computers to communicate over networks.
CS Year III, 2023 Compiled by: Adane B.
4 Introduction
Device management refers to the process of controlling, configuring, and
maintaining the various devices by the operating system.
Devices usually refer to physical/hardware devices such as computers, laptops,
servers, mobile phones and more.
They could also be virtual, however, such as virtual machines or virtual
switches.
In Windows, device management is also an administrative module that is used
for managing or configuring the physical devices, ports and interfaces of a
computer or server
One of the main functions of the operating system is to control all the
computers I/O devices
CS Year III, 2023 Compiled by: Adane B.
5 Device Management Functions
Keeping track of all devices and their status
Allocating devices to processes or users as requested
Deallocating devices when they are no longer needed or requested
Handling device errors and failures
Providing a uniform interface for different types of devices
Implementing device drivers and interrupt handlers
CS Year III, 2023 Compiled by: Adane B.
6 I/O Device
I/O devices:
Communication devices
Input only (keyboard, mouse, joystick)
Output only (printer, display)
Input/output (network card)
Storage devices
Input/output (disk, tape)
Input only (CD-ROM)
CS Year III, 2023 Compiled by: Adane B.
7
Types of devices
Dedicated Devices
Assigned to only one job at a time and serve that job for entire time it’s
active.
E.g., tape drives, printers, and plotters, demand this kind of allocation scheme,
because it would be awkward to share
Shared Devices:-
Can be shared by several processes at same time by interleaving their
requests.
Interleaving must be carefully controlled by Device Manager.
All conflicts must be resolved based on predetermined policies to
decide which request will be handled first.
E.g., disk pack
CS Year III, 2023 Compiled by: Adane B.
8 Type of device
Block devices
Store information in fixed-size blocks, each with its own address.
Block-oriented devices transfer data in fixed-size blocks or chunks.
Data is organized into blocks before being transferred.
Examples include hard drives, memory cards.
Character devices
A character device delivers or accepts streams of characters, without
regard to any block structure.
Single character can be read, send in between devices.
Printers, Mice, keyboards and other devices that are not disk-like can
be seen as character devices
CS Year III, 2023 Compiled by: Adane B.
9 I/O HW device component
I/O devices(keyboard, mouse….) signals from I/O devices interface with
computer
Port – connection point for device
Bus - daisy chain or shared direct access
PCI (Peripheral Components Interconnect) bus common in PCs and servers
Expansion bus connects relatively slow devices
Controller (host adapter) – to make communication with system and Bus
Its control or operate port, bus, device
I/O Instruction control device (register….)
Device address
CS Year III, 2023 Compiled by: Adane B.
10 Port
Port refers to a specific connection point or interface through which
external devices can be connected to the computer.
Serial Ports: Transmit data one bit at a time over a single wire. Common types
include RS-232 ports.
Parallel Ports: Transmit multiple bits simultaneously using multiple wires.
Examples include the parallel ports used for printers.
USB Ports (Universal Serial Bus): Widely used for connecting a variety of
devices, including keyboards, mice, printers, and external storage.
Ethernet Ports: Used for network connectivity, allowing computers to connect
to local area networks (LANs) or the internet.
Audio Ports: Used for connecting speakers, microphones, and other audio
devices.
Video Ports: Connect monitors and display devices. Examples include HDMI,
DisplayPort, and VGA ports.
CS Year III, 2023 Compiled by: Adane B.
11 I/O Devices register
Devices usually have registers where device driver places commands,
addresses, and data to write, or read data from registers after command
execution.
Data-in register:- host get to in put
Data-out register:- host write to send the output
Status register :-contain whether the current command is complete, byte
available, any error…
Control register:- host determine to start a command or to change the
mode of the device.
CS Year III, 2023 Compiled by: Adane B.
12 Typical PC Bus Structure
CS Year III, 2023 Compiled by: Adane B.
13 Buffering
Buffering in I/O (Input/Output) operations refers to the use of
temporary storage areas, known as buffers.
Buffering helps smooth out differences in data transfer rates between
devices, minimizes delays, and improves overall system performance.
Purpose of Buffering:
Data Rate Mismatch: Devices often operate at different speeds, and
buffering helps reconcile differences in data transfer rates.
Efficiency: Buffering allows the system to continue processing data
even if the rate at which data is produced or consumed by a device is
not constant
CS Year III, 2023 Compiled by: Adane B.
14 Buffering….
How Buffering Works:
When data is read from a device, it is stored in a read buffer.
The CPU then retrieves data from the buffer at its own pace, allowing the
device to continue its operation.
Similarly, when data is written by the CPU, it is placed in a write buffer
before being sent to the output device at its own rate
Advantages of Buffering:
Smoothing Data Flow: Buffers smooth out variations in data transfer rates
between devices and the CPU.
Reducing Delays: By holding data temporarily, buffering reduces the
impact of delays caused by differences in device speeds.
Optimizing CPU Utilization: Buffers allow the CPU to work on other
tasks while waiting for data transfers to complete.
CS Year III, 2023 Compiled by: Adane B.
15 Types of Buffering
A. No Buffering:-
there is no buffer between I/O device and processor.
When the I/O device write, the processor must wait to read from the
main memory.
drawback:- processor wait for long time to read character or block
B. single Buffering:-
Only one buffer in the main memory.
I/O device write on buffer and the processor read from buffer.
Both I/O device and processor is done operation simultaneously.
CS Year III, 2023 Compiled by: Adane B.
16 Types of Buffering
C. Double buffering –
Two buffers are present in main memory, channels, and control
units.
While one record is being processed by CPU another can be
read or written by I/O device.
Operation is done concurrently from different buffer.
D. Circular Buffering:
Buffers are organized in a circular fashion, allowing continuous
data flow.
CS Year III, 2023 Compiled by: Adane B.
17 Types of Buffering
CS Year III, 2023 Compiled by: Adane B.
18
Communication to I/O Devices
The CPU must have a way to pass information to and from an I/O
device.
There are three approaches available to communicate with the
CPU and Device
Programmed I/O
Interrupt driven I/O
Direct Memory Access (DMA)
The choice depends on factors such as the speed of the devices, the
volume of data to be transferred, and the desired level of CPU
involvement
CS Year III, 2023 Compiled by: Adane B.
19 Programmed I/O
In programmed I/O CPU is directly
responsible for managing the data
transfer process.
The CPU actively participates in each
step of the I/O operation.
The CPU initiates the data transfer by
sending commands to the I/O device.
CPU waits for the I/O device to finish
its task before proceeding.
CS Year III, 2023 Compiled by: Adane B.
20 Interrupt driven I/O
In Interrupt driven I/O the CPU is not continuously involved in
waiting for I/O operations to complete.
The CPU initiates the I/O operation by sending a command to
the I/O device
After initiating the I/O operation, the CPU is free to execute
other instructions or processes.
During this time, the CPU can perform other tasks, improving
overall system efficiency.
Once the I/O device completes the operation, it generates an
interrupt signal to the CPU
The CPU responds to the interrupt and then process the results
of the I/O operation or initiate additional tasks.
CS Year III, 2023 Compiled by: Adane B.
Direct memory access (DMA)
21
Direct Memory Access (DMA) is a feature that allows
peripherals to transfer data to and from the memory without
involvement of CPU.
It significantly enhances system performance by reducing the
burden on the CPU for data transfer operations
DMA module controls exchange of data between memory and
an I/O module
CS Year III, 2023 Compiled by: Adane B.
22 How the operation is performed with DMA
Steps for I/O device went to send data to
memory
I. I/O device is send DMA request to DMA
controller
II. DMA controller send Hold request to CPU
and wait for the CPU to send hold ACK.
III. CPU leaves the control over bus ACK signal
to DMA controller
IV. CPU is in the hold state or done other activity
and DMA controller manage the operation
without CPU .
CS Year III, 2023 Compiled by: Adane B.
23 Device Recovery
Device Recovery" generally refers to the processes and mechanisms
in place to handle errors and recover from failures related to
hardware devices
Error Detection:
Device recovery starts with the detection of errors or failures in
hardware devices
Error Reporting:
Once an error is detected, the operating system typically generates
error reports or logs that provide information about the nature of the
problem
CS Year III, 2023 Compiled by: Adane B.
24
CS Year III, 2023 Compiled by: Adane B.