Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Device Management in Unix

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

Device Management in UNIX

Diwaker Singh

Reg.Id.10808015

B.Tech-MBA (CSE), Lovely Professional University

Punjab

Abstract- This term paper aims to driver translates between the hardware
provide an overview of the concepts of commands understood by the device
device management in UNIX and the stylized programming interface
operating system. It deals with the used by the kernel. The driver layer
meaning of the term device helps keep the kernel reasonably
management, how device management device independent.
is done in case of UNIX operating
system and various terms and concepts In most cases, device drivers are part
related with device management in of the kernel; they are not user
UNIX operating system. processes. However, a driver can be
accessed both from within the kernel
and from user space. User-level access
to devices is usually through special
INTRODUCTION device files that live in the /dev
directory. The kernel maps operations
This term paper deals with the main
on these files into calls to the code of
heading “Device management in
the driver.
UNIX” .In this term paper I am
explaining about the basic meaning of With the remarkable pace at which
the term device management? The new hardware is developed, it is
second part contains the information practically impossible to keep mainline
about basic terms related to device OS distributions up to date with the
management and explanation of latest hardware. Ergo, you will
different concepts that are used for occasionally need to add a device
device management in case of UNIX driver to your system to support a new
operating System. It gives a brief idea piece of hardware.
of how an operating system interact
with external devices. Device drivers are system specific, and
they are often specific to a particular
range of kernel revisions as well.
Drivers for other operating systems
I. DEVICE MANAGEMENT?
(e.g., Windows) will not work. This
should be kept in mind while
purchasing a new hardware. In
 WHAT IS IT?? addition, devices vary in their degree
of compatibility and functionality
A device driver is a program that when used with various Linux
manages the system’s interaction with distributions, so it’s wise to pay some
a particular type of hardware. The attention to the results other sites have
obtained with any hardware we are
considering.

 EXAMPLE OF DEVICE
DRIVER INTERFACE

 DEVICE FILES
AND DEVICE
NUMBERS

Most devices have a corresponding file


in /dev; network devices are notable
exceptions on modern operating
systems. Complex servers may support
hundreds of devices. Solaris handles
this complexity quite nicely by using a
separate subdirectory of /dev for each
type of device: disk, cd-rom, terminal,
etc.

By virtue of being device files, the


 REPRESENTATION OF files in /dev each have a major and
DEVICES IN UNIX minor device number associated with
them. The kernel uses these numbers
All devices are represented by files to map devicefile references to the
called special files that are located in corresponding driver.
/dev directory. Thus, device files and
other files are named and accessed in The major device number identifies
the same way. A 'regular file' is just an the driver with which the file is
ordinary data file in the disk. A 'block associated (in other words, the type of
special file' represents a device with device). The minor device number
characteristics similar to a disk (data usually identifies which particular
transfer in terms of blocks). A instance of a given device type is to be
'character special file' represents a addressed. The minor device number is
device with characteristics similar to a sometimes called the unit number.
keyboard (data transfer is by stream of
bits in sequential order). You can see the major and minor
number of a device file with ls -l:

linux$ ls -l /dev/sda
 DEVICE
MANAGEMENT brw-rw---- 1 root disk 8, 0 Jul 13
ORGANISATION 01:38 /dev/sda

This example shows the first SCSI


disk on a Linux system. It has a major
number of 8 and a minor number of 0.

2
The minor device number is part of the driver. To perform an
sometimes used by the driver to select unusual operation that doesn’t have a
or enable certain characteristics direct analog in the filesystem model
particular to that device. For example, (for example, ejecting a floppy disk), a
a tape drive can have one file in /dev program can use the ioctl system call
that rewinds the drive automatically to pass a message directly from user
when it is closed and another file that space into the driver.
does not. The driver is free to interpret
the minor device number in whatever  DEVICE FILE CREATION
way it wants. Look up the man page
Device files can be created manually
for the driver to determine what
with the mknod command, with the
convention it’s using.
syntax
There are actually two primary types
mknod filename type major minor
of device files: block device files and
character device files. A block device where filename is the device file to be
is read or written one block (a group of created, type is c for a character device
bytes, usually a multiple of 512) at a or b for a block device, and major and
time; a character device can be read or minor are the major and minor device
written one byte at a time. Disks and numbers. If you are manually creating
tapes lead dual lives; terminals and a device file that refers to a driver
printers do not. that’s already present in your kernel,
check the documentation for the driver
Device drivers present a standard
to find the appropriate major and
interface to the kernel. Each driver has
minor device numbers.
routines for performing some or all of
the following functions: Under Linux, the udev system
dynamically manages the creation and
removal of device files according to
the actual presence (or absence) of
devices. The udevd daemon listens for
It is sometimes convenient to messages from the kernel regarding
implement an abstraction as a device device status changes.
driver even when it controls no actual
device. Such phantom devices are Based on configuration information in
known as pseudo-devices. For /etc/udev and /lib/udev, udevd can
example, a user who logs in over the take a variety of actions when a device
network is assigned a PTY (pseudo- is discovered or disconnected. By
TTY) that looks, feels, and smells like default, it just creates device files in
a serial port from the perspective of /dev.
high-level software. This trick allows
programs written in the days when On Solaris systems, /dev is actually
everyone used a terminal to continue composed of symbolic links to files in
to function in the world of windows the /devices directory, which is a
and networks. /dev/zero, /dev/null, separate filesystem. The Device File
and /dev/random are some other System (devfs) manages the device
examples of pseudo-devices. files in /devices. These files are
created automatically at boot time by
When a program performs an devfsadmd, which continues to run
operation on a device file, the kernel after boot to handle update
intercepts the reference, looks up the notifications from the kernel.
appropriate function name in a table, Administrators can use devfsadm to
and transfers control to the appropriate
3
tweak this process, but most /dev/rdsk/dks0d3s0). However, an r
administrators will not need to use it. does not always imply a raw device
file.
The HP-UX kernel creates devices
files at boot time. If new devices are Serial device files are usually named
attached later, administrators must tty followed by a sequence of letters
create the device files manually by that identify the interface the port is
running the mksf, insf, and mknod attached to. TTYs are sometimes
commands. The smh tool also represented by more than one device
incorporates a limited interface for file; the extra files usually afford
viewing device information. access to alternative flow control
methods or locking protocols.
In AIX, the cfgmgr command runs at
boot time to configure devices and to The names of tape devices often
install drivers for devices that weren’t include not only a reference to the
formerly present. It prints warnings for drive itself but also an indication of
any devices for which the software or whether the device rewinds after the
drivers are not installed. Once a device tape device is closed. Each vendor has
is detected, AIX remembers it by a different scheme.
placing an identifier in the Object Data
Manager. cfgmgr creates files in /dev The naming conventions for the files
for devices that are successfully that represent hard disks and SSDs are
detected and initialized. rather complex on most systems.

Given the existence of these various  CUSTOM KERNELS VS


tools for automating the creation of LOADABLE MODULES
device files, system administrators
running current releases of UNIX and
Linux should never need to manually When the system is installed, it comes
manage device files with mknod. with a generic kernel that’s designed to
run most applications on most
hardware. The generic kernel includes
many different device drivers and
option packages. Some drivers may
 NAMING CONVENTIONS also be dynamically inserted into the
FOR DEVICES running kernel. On Linux, the udev
system can also manage real-time
Naming conventions for devices are device changes, such as the insertion
somewhat random. They are often of a USB device.
holdovers from the way things were
done under UNIX on a DEC PDP-11, There are various schools of thought
as archaic as that may sound in this on whether production servers should
day and age. have custom-built kernels. Although
there is some potential for
For devices that have both block and performance gains, especially in
character identities, the character embedded systems without much
device name is usually prefaced with memory, the manageability trade-off
the letter r for “raw” (e.g., /dev/da0 for patching and system upgrades is
vs. /dev/rda0). An alternative usually a deal breaker. Unless there’s a
convention is to store character device legitimate need to wring every last
files in a subdirectory that has a name ounce of performance out of the
that starts with r (e.g., system, we recommend using the
/dev/dsk/dks0d3s0 vs. vendor’s stock kernel.
4
When it comes to kernel device [4] www.programmar.com
support, the wise administrator is
usually also the laziest. Use the [5] www.latrobe.edu.au
dynamic module approach whenever
[6] UNIX and Linux System
possible. Avoid building accustom
Administration handbook by Nemeth,
kernel unless it is strictly necessary.
Snyder, Hein and Whaley
On Linux systems, most USB devices
can be attached with no administrator [7] Operating system principles by
intervention. silberchatz and Galvin

CONCLUSION
From the above text we concluded that
UNIX uses device drivers to interact
with the external devices. Every
connected external device has its own
device driver. Device Driver is
software which acts as interface
between the UNIX kernel and the
device. These Device drivers may be
of three types I/P device drivers, O/P
device driver or I/P device driver.

The device manger manages the


interaction between the operating
system and the device. It creates a list
of all the connected device and using
this list it controls the information flow
between operating system and external
device.

ACKNOWLEDGMENT
I Diwaker Singh Student of B. Tech.-
MBA (CSE) would like to thank my
teacher for the corresponding subject
that is Ms. Neha Bhateja for her
guidance during the preparation of this
term paper. This term paper has surely
enhanced my knowledge. I would also
like to thank my friends who helped
me in gathering information about the
topic.

REFERENCES
[1]www.wikipedia.com

[2] www.answers.com

[3] www.cs.utsa.edu

You might also like