Unit 6 O.S

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Unit 6

Device Management in Operating System


Device management in an operating system means controlling the
Input/Output devices like disk, microphone, keyboard, printer, magnetic
tape, USB ports, camcorder, scanner, other accessories, and supporting units
like supporting units control channels. A process may require various
resources, including main memory, file access, and access to disk drives, and
others. If resources are available, they could be allocated, and control
returned to the CPU. Otherwise, the procedure would have to be postponed
until adequate resources become available. The system has multiple
devices, and in order to handle these physical or virtual devices, the
operating system requires a separate program known as an ad device
controller. It also determines whether the requested device is available.

The fundamentals of I/O devices may be divided into three categories:

1. Boot Device
2. Character Device
3. Network Device

Boot Device
It stores data in fixed-size blocks, each with its unique address. For example-
Disks.

Character Device
It transmits or accepts a stream of characters, none of which can be
addressed individually. For instance, keyboards, printers, etc.

Network Device
It is used for transmitting the data packets

Types of devices
There are three types of Operating system peripheral devices: dedicated,
shared, and virtual. These are as follows:
1. Dedicated Device
In device management, some devices are allocated or assigned to only one
task at a time until that job releases them. Devices such as plotters, printers,
tape drivers, and other similar devices necessitate such an allocation
mechanism because it will be inconvenient if multiple people share them
simultaneously. The disadvantage of such devices is the inefficiency caused
by allocating the device to a single user for the whole duration of task
execution, even if the device is not used 100% of the time.

2. Shared Devices
These devices could be assigned to a variety of processes. By interleaving
their requests, disk-DASD could be shared by multiple processes
simultaneously. The Device Manager carefully controls the interleaving, and
pre-determined policies must resolve all difficulties.

3. Virtual Devices
Virtual devices are a hybrid of the two devices, and they are dedicated
devices that have been transformed into shared devices. For example, a
printer can be transformed into a shareable device by using a spooling
program that redirects all print requests to a disk. A print job is not sent
directly to the printer; however, it is routed to the disk until it is fully
prepared with all of the required sequences and formatting, at which point it
is transmitted to the printers. The approach can transform a single printer
into numerous virtual printers, improving performance and ease of use

Features of Device Management


Here, you will learn the features of device management in the operating
system. Various features of the device management are as follows:

1. The OS interacts with the device controllers via the device drivers while
allocating the device to the multiple processes executing on the system.
2. Device drivers can also be thought of as system software programs that
bridge processes and device controllers.
3. The device management function's other key job is to implement the API.
4. Device drivers are software programs that allow an operating system to
control the operation of numerous devices effectively.
5. The device controller used in device management operations mainly contains
three registers: command, status, and data.

Shared devices:- These devices can be allocated o several processes. Disk-


DASD can be shared among several processes at the same time by
interleaving their requests. The interleaving is carefully controlled by the
Device Manager and all issues must be resolved on the basis of
predetermined policies.

Virtual Devices:- These devices are the combination of the first two types and
they are dedicated devices which are transformed into shared devices. For
example, a printer converted into a shareable device via spooling program
which re-routes all the print requests to a disk. A print job is not sent straight
to the printer, instead, it goes to the disk(spool)until it is fully prepared with
all the necessary sequences and formatting, then it goes to the printers. This
technique can transform one printer into several virtual printers which leads
to better performance and use.

Disk Scheduling Algorithms

On a typical multiprogramming system, there will usually be


multiple disk access requests at any point of time. So those
requests must be scheduled to achieve good efficiency. Disk
scheduling is similar to process scheduling. Some of the disk
scheduling algorithms are described below.

First Come First Serve

This algorithm performs requests in the same order asked by


the system. Let’s take an example where the queue has the
following requests with cylinder numbers as follows:

98, 183, 37, 122, 14, 124, 65, 67


Assume the head is initially at cylinder 56. The head moves
in the given order in the queue i.e., 56→98→183→…→67.

SCAN algorithm

This algorithm is also called the elevator algorithm because


of it’s behavior. Here, first the head moves in a direction (say
backward) and covers all the requests in the path. Then it
moves in the opposite direction and covers the remaining
requests in the path. This behavior is similar to that of an
elevator. Let’s take the previous example,

98, 183, 37, 122, 14, 124, 65, 67


Assume the head is initially at cylinder 56. The head moves
in backward direction and accesses 37 and 14. Then it goes
in the opposite direction and accesses the cylinders as they
come in the path.

Spooling in Operating System


In Operating System, we had to give the input to the CPU, and the CPU
executes the instructions and finally gives the output. But there was a
problem with this approach. In a normal situation, we have to deal with many
processes, and we know that the time taken in the I/O operation is very large
compared to the time taken by the CPU for the execution of the instructions.
So, in the old approach, one process will give the input with the help of an
input device, and during this time, the CPU is in an idle state.

What is Spooling
Spooling is a process in which data is temporarily held to be used and
executed by a device, program, or system. Data is sent to and stored in
memory or other volatile storage until the program or computer requests it
for execution.

SPOOL is an acronym for simultaneous peripheral operations online.


Generally, the spool is maintained on the computer's physical memory,
buffers, or the I/O device-specific interrupts. The spool is processed in
ascending order, working based on a FIFO (first-in, first-out) algorithm.

How Spooling Works in Operating System


In an operating system, spooling works in the following steps, such as:

1. Spooling involves creating a buffer called SPOOL, which is used to hold off
jobs and data till the device in which the SPOOL is created is ready to make
use and execute that job or operate on the data.
2. When a faster device sends data to a slower device to perform some
operation, it uses any secondary memory attached as a SPOOL buffer. This
data is kept in the SPOOL until the slower device is ready to operate on this
data. When the slower device is ready, then the data in the SPOOL is loaded
onto the main memory for the required operations.

3. Spooling considers the entire secondary memory as a huge buffer that can
store many jobs and data for many operations. The advantage of Spooling is
that it can create a queue of jobs that execute in FIFO order to execute the
jobs one by one.
What is Interrupt in OS?
An interrupt is a signal emitted by hardware or software when a process or
an event needs immediate attention. It alerts the processor to a high-priority
process requiring interruption of the current working process. In I/O devices,
one of the bus control lines is dedicated for this purpose and is called
the Interrupt Service Routine (ISR).

When a device raises an interrupt at the process, the processor first


completes the execution of an instruction. Then it loads the Program
Counter (PC) with the address of the first instruction of the ISR. Before
loading the program counter with the address, the address of the interrupted
instruction is moved to a temporary location. Therefore, after handling the
interrupt, the processor can continue with the process.

Types of Interrupt
Interrupt signals may be issued in response to hardware or software events.
These are classified as hardware interrupts or software interrupts,
respectively
Sequential Access

In sequential access, the OS read the file word by word. A pointer is maintained
which initially points to the base address of the file. If the user wants to read first
word of the file then the pointer provides that word to the user and increases its
value by 1 word. This process continues till the end of the file.
Direct Access
The Direct Access is mostly required in the case of database systems. In
most of the cases, we need filtered information from the database. The
sequential access can be very slow and inefficient in such cases.

Suppose every block of the storage stores 4 records and we know that the
record we needed is stored in 10th block. In that case, the sequential access
will not be implemented because it will traverse all the blocks in order to
access the needed record.

Indexed Access
If a file can be sorted on any of the filed then an index can be assigned to a
group of certain records. However, A particular record can be accessed by its
index. The index is nothing but the address of a record in the file.

In index accessing, searching in a large database became very quick and


easy but we need to have some extra space in the memory to store the
index value.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy