Os Book
Os Book
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1
2
3
4
5
1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
10
11
12
Device Controllers
Device drivers are software modules that can be plugged into an OS to handle
a particular device. Operating System takes help from device drivers to handle
all I/O devices.
The Device Controller works like an interface between a device and a device
driver. I/O units (Keyboard, mouse, printer, etc.) typically consist of a
mechanical component and an electronic component where electronic
component is called the device controller.
There is always a device controller and a device driver for each device to
communicate with the Operating Systems. A device controller may be able to
handle multiple devices. As an interface its main task is to convert serial bit
stream to block of bytes, perform error correction as necessary.
Any device connected to the computer is connected by a plug and socket, and
the socket is connected to a device controller. Following is a model for
connecting the CPU, memory, controllers, and I/O devices where CPU and
device controllers all use a common bus for communication.
Memory-mapped I/O
When using memory-mapped I/O, the same address space is shared by
memory and I/O devices. The device is connected directly to certain main
memory locations so that I/O device can transfer block of data to/from memory
without going through CPU.
While using memory mapped IO, OS allocates buffer in memory and informs
I/O device to use that buffer to send data to the CPU. I/O device operates
asynchronously with CPU, interrupts CPU when finished.
The advantage to this method is that every instruction which can access
memory can be used to manipulate an I/O device. Memory mapped IO is used
for most high-speed I/O devices like disks, communication interfaces.
Step Description
Polling I/O
Polling is the simplest way for an I/O device to communicate with the
processor. The process of periodically checking status of the device to see if
it is time for the next I/O operation, is called polling. The I/O device simply puts
the information in a Status register, and the processor must come and get the
information.
Most of the time, devices will not require attention and when one does it will
have to wait until it is next interrogated by the polling program. This is an
inefficient method and much of the processors time is wasted on unnecessary
polls.
Compare this method to a teacher continually asking every student in a class,
one after another, if they need help. Obviously the more efficient method would
be for a student to inform the teacher whenever they require assistance.
Interrupts I/O
An alternative scheme for dealing with I/O is the interrupt-driven method. An
interrupt is a signal to the microprocessor from a device that requires attention.
A device controller puts an interrupt signal on the bus when it needs CPU’s
attention when CPU receives an interrupt, It saves its current state and invokes
the appropriate interrupt handler using the interrupt vector (addresses of OS
routines to handle various events). When the interrupting device has been
dealt with, the CPU continues with its original task as if it had never been
interrupted.
I/O software is often organized in the following layers −
• User Level Libraries − This provides simple interface to the user
program to perform input and output. For example, stdio is a library
provided by C and C++ programming languages.
• Kernel Level Modules − This provides device driver to interact with the
device controller and device independent I/O modules used by the
device drivers.
• Hardware − This layer includes actual hardware and hardware
controller which interact with the device drivers and makes hardware
alive.
A key concept in the design of I/O software is that it should be device
independent where it should be possible to write programs that can access
any I/O device without having to specify the device in advance. For example,
a program that reads a file as input should be able to read a file on a floppy
disk, on a hard disk, or on a CD-ROM, without having to modify the program
for each different device.
Device Drivers are important for a computer system to work properly. Without
a device driver, the particular hardware fails to work accordingly, which means
it fails in doing a particular action for which it has been created.
Drivers are hardware-dependent and operating-system-specific. They usually
provide the interrupt handling required for any necessary asynchronous time-
dependent hardware interface.
For example, a high-level application interacting with a serial port may have
"send data" and "receive data" functions. A device driver implementing these
functions would communicate to the particular serial port controller installed at
a lower level on a user's computer.
The commands needed to control a 16550 UART are different from those
needed to control an FTDI serial port converter. Still, each hardware-specific
device driver abstracts these details into the same or similar software interface.
Card reader, controller, modem, network card, sound card, printer, video card,
USB devices, RAM, Speakers etc., need Device Drivers to operate. For example,
a printer driver tells the printer which format to print after getting instructions
from OS. Similarly, A sound card driver is there because the 1's and 0's data of
an MP3 file is converted to audio signals, and you enjoy the music.
This Kernel-mode device driver includes some generic hardware that loads with
an operating system as part of the OS. These are BIOS, motherboard,
processor, and some other hardware that are part of kernel software. These
include the minimum system requirement device drivers for each operating
system.
Other than the devices brought by the kernel for working of the system, the
user also brings some devices for use during the using of a system that devices
need device drivers to functions those drivers fall under User mode device
driver. For example, the user needs any plug and play action that comes under
this.
Choosing and installing the correct device drivers for given hardware is often a
key component of computer system configuration. Common levels of
abstraction for device drivers include:
1. For hardware:
o Interfacing directly
o Writing to or reading from a device control register
o Using some higher-level interface (e.g. Video BIOS)
o Using another lower-level device driver (e.g. file system drivers using disk
drivers)
o Simulating work with hardware while doing something entirely different.
2. For software:
almost every major computer platform, including x86, ARM and SPARC, making it one of
applications, and provides some form of user interface. The enormous community for
developers and wide range of distributions means that a Linux version is available for
almost any task, and Linux has penetrated many areas of computing. For example, Linux
has emerged as a popular OS for web servers such as Apache, as well as for network
operations, scientific computing tasks that require huge compute clusters, running
databases, desktop and endpoint computing, and running mobile devices with OS versions
like Android.
The Linux OS can be found in many different settings, supporting many different use
• Server OS for web servers, database servers, file servers, email servers and
applications.
OSes.
• Headless server OS for systems that do not require a graphical user interface
often used for remotely managed networking server and other devices.
networking devices and more. For example, Cisco offers a version of the
Cisco Internetwork Operating System (IOS) that uses the Linux kernel.
many development tools have been ported to Windows or other OSes, Linux
is home to some of the most widely used open source software development
tools. For example, git for distributed source control; vim and emacs for
source code editing; and compilers and interpreters for almost every
programming language.
• Cloud OS for cloud instances. Major cloud computing providers offer access
to cloud computing instances running Linux for cloud servers, desktops and
other services.
Linux is highly configurable and depends on a modular design that enables users to
customize their own versions of Linux. Depending on the application, Linux can be
• networking performance;
• computation performance;
• deployment on specific hardware platforms; and
resources.
Users can choose different Linux distributions for specific applications or adapt a
Linux distributions
Since its initial development, Linux has adopted the copyleft stipulations of the Free Software
Foundation which originated the GNU GPL. The GPL says that anything taken for free and
modified must be distributed for free. In practice, if Linux or other GNU-licensed components
are developed or modified to create a new version of Linux, that new version must be distributed
for free. This prevents a developer or other groups from profiting unfairly from the freely
available.
specific
Hundreds goal,
Distributions
of philosophy,
different Linux
usually
function
versions,
distinguish
or target
also
market.
themselves
known asfrom
distributions
the pack by
or addressing
distros, area
There are distributions tailored for specific target functions, such as servers, desktops, gaming,
security, or embedded devices including Raspberry Pi systems. Most modern distributions are
precompiled and ready to use, while others like Gentoo Linux consist of source code that a user
can compile locally during initial installation to optimize their system configuration. Knoppix
Linux is one of many distros used to recover damaged hard drives and perform other technical
support tasks. Information security professionals use Kali Linux for penetration testing and
automakers have joined Automotive Grade Linux (AGL), an open source project hosted by the
Linux Foundation. For example, Toyota and Lexus vehicles use AGL for their infotainment
systems.
Linux distributions may be community-developed, like Debian, Slackware and Gentoo. Other
distributions are commercial and intended for enterprise use, including Red Hat Enterprise
Linux and SUSE Linux Enterprise Server. Many distributions use a combination of community-
and corporate-supported development, such as Red Hat's Fedora, openSUSE from SUSE and
Linux components to hold copyrights on the various components. The GNU GPL ensures that
those components remain free and freely distributed. While the software remains free, it is
common for some commercial distributions to charge for value-added services, such as support
computer and for starting the Linux kernel. It can also be used to manage systems
• Kernel. The core of the Linux system, the kernel handles network access,
oversees all file system services. The Linux kernel is the software that interfaces
• Init system. The first process to run once the kernel is loaded. A process is an
instance of a program running on a computer, and the init system initializes the
system to enable it to run other processes. Init is a daemon program that acts as
the parent process to all other processes running on the system. Init can be
the system will be running a web server the init system can be configured to load
• Daemons. This is a program that runs in the background, handling requests for a
• Graphical server. This is the software that controls how graphics are displayed on
a computer. Without a graphical server, users can only interact with the Linux
X11 or X, is the most common graphical server for Linux, though not the only
one. X runs as a server daemon on the system and is called upon by applications
controls with which users interact when using Linux as a desktop platform.
System or another graphical system. Each desktop environment defines its own
look, including the way graphical elements like windows, pull-down menus and
files are displayed and manipulated. The desktop environment will also include a
set of default applications for managing files and folders, text editing, running a
• Applications. This is the software that is installed during and after the initial
applications, including both for a networked server and for desktop use.
The Linux kernel mediates interaction between applications and system hardware such
as CPU, memory and devices like storage or printers.
While these components are included in most Linux distributions, they are not necessarily part
of every deployed Linux system. For example, a Linux-based server may not require a graphical
But it is really the many outside developers and GNU projects that offer high-level functions
to the Linux kernel to provide a fully realized OS. For example, there are modules to provide a
command-line interface, implement a GUI, manage security, and offer video input or audio
services -- each of which can be modified and optimized to form unique distributions for
specific tasks.
Desktop environments can also vary widely with different approaches to GUI design and
distributions, is the default desktop for many. Designed to be easy to use and
also designed to be easy to use and reliable. It has spawned other projects,
Package manager software typically adds, updates or removes software components under the
Linux OS. Package managers enable users to install additional software not included with their
distributions. Examples of software package managers include RPM Package Manager, dpkg,
All Linux distributions are based on the Linux kernel, but they can differ depending on factors
such as:
• Kernel modules. This is software that can be loaded and unloaded into the kernel
support:
o device drivers, which use code that controls how attached devices
operate;
o file system drivers, which use code that controls how the kernel
o system calls, which use code that controls how programs request
include only device or file system drivers are used for some specialized
distributions; for example, compiling a kernel for a wireless device without any
The Linux kernel is the one thing that all systems running Linux have in common. Linux works
by:
• Once booted, the kernel manages all system input and output. The system is
• As system processes are started, the system can be used for processes that include
While the kernel may be almost identical -- with some divergence for configuration and
compilation differences -- the user experience can vary widely, depending on how the Linux
system is being used. For example, some Linux use cases with widely different user experiences
include:
• Network servers may not even include a terminal for direct access. These
sessions. Servers may be used by many but should be directly accessed only by
• Thin clients enable users to access a rich desktop environment from a lightweight
Chromebooks.
When using Linux with a desktop environment as a GUI, Linux works much the same as any
GUI-based OS. Applications and other resources can be opened by clicking on icons, and files
Likewise, using the Linux command line is similar to any modern OS command line:
This example shows the default command prompt in the Windows Subsystem for Linux. The
prompt displays, from left to right, userID@hostname, and the full path of the current directory
Experience Linux on Windows 10 (or later) desktop by running the Windows Subsystem
for Linux.
The pros and cons of using Linux
Some advantages of using Linux include:
• Open source software. The Linux kernel is released under the GNU GPL
open source software license. Most distros include hundreds of applications, with
explicit licensing fees. While system support is available for a fee from many
Linux vendors, the OS itself is free to copy and use. Some IT organizations have
to Linux.
security patches. Linux is also considered to be stable, meaning it can run in most
circumstances. Linux also copes with errors when running software and
unexpected input.
updated frequently for security and functional patches, while retaining core
functionality. Configurations and shell scripts are likely to work unchanged even
when software updates are applied. Unlike commercial software vendors that roll
out new versions of their OSes along with new ways to work, Linux and open
source applications generally don't change their modes of operation with new
releases.
be good for optimizing Linux for particular applications, but less so for deploying
standardized server or desktop images. The wide range of options can complicate
support as a result.
• Support costs. While an organization can acquire Linux freely without licensing
fees, support is not free. Most enterprise Linux distributors like SUSE and Red
Hat offer support contracts. Depending on the circumstances, these license fees
be used on Linux desktops, and other proprietary software may be unavailable for
Linux platforms.
• Steep learning curve. Many users struggle to learn to use the Linux desktop or
Linux-based applications.
In some cases, the same Linux attribute can be either an advantage or disadvantage. For
example, having many options for customizing the Linux OS is advantageous for manufacturers
looking for an embedded OS, but it is a disadvantage for enterprises that want a desktop OS
History of Linux
Linus Torvalds started working on Linux as a replacement to the Minix OS while at the
University of Helsinki in Finland. Torvalds recognized the work done on the GNU Project in
software, and noted the GNU as a model for distribution. However, the work on GNU had not
been finished by the time Torvalds sought a Minix replacement, prompting him to develop an
alternate OS kernel dubbed Linux -- a contraction of Linus' Unix -- and adopt the GNU GPL.
Torvalds released the Linux kernel in September 1991. A community of developers worked to
integrate GNU components with Torvalds' kernel to create a complete, free OS known
collectively as Linux. Torvalds continues to develop the Linux kernel and a vast developer
community continues to create and integrate a wide range of components. While Linux still
lags Windows and macOS on the desktop, it continues to challenge the proprietary OS vendors