Linux Operating System Unit 1
Linux Operating System Unit 1
Unit 1 - Introduction
1.1 Operating System
Some popular Operating Systems include Linux Operating System, Windows Operating
System, MacOS, Android, iOS, etc.
Definition:
An operating system is a program that acts as an interface between the user and the
computer hardware and controls the execution of all kinds of programs.
It manages both the primary and secondary memory such as RAM, ROM, hard disk, pen
drive, etc. It checks and decides the allocations and de allocation of memory space to
different processes.
When a user interacts with a system, the CPU is supposed to read or write operations, in
this case, OS decides the amount of memory to be allocated for loading the program
Linux Operating System BCA III
instructions and data into RAM. After this program is terminated, the memory area is
again free and is ready to be allocated to other programs by the OS.
● Keeps tracks of primary memory, i.e., what part of it are in use by whom, what
parts are not in use.
● In multiprogramming, the OS decides which process will get memory when and
how much.
● Allocates the memory when a process requests it to do so.
● De-allocates the memory when a process no longer needs it or has been
terminated.
2. Processor Management
● Keeps tracks of processor and status of process. The program responsible for this
task is known as traffic controller.
● Allocates the processor (CPU) to a process.
● De-allocates processor when a process is no longer required.
3. Device Management
● Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
● Decides which process gets the device when and for how much time.
● Allocates the device in the efficient way.
● De-allocates devices.
4.File Management
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.
Linux Operating System BCA III
● Keeps track of information, location, uses, status etc. The collective facilities are
often known as file system.
● Decides who gets the resources.
● Allocates the resources.
● De-allocates the resources.
Operating system reads the commands entered by the user, checks for errors, interprets
and translates them to machine instructions and gets there executed by the hardware.
It acts as an interface between the user and the hardware. It can be a GUI where you can
see and click elements on the screen to perform various tasks. It enables you to
communicate with the computer even without knowing the computer's language.
8. I/O management:
It manages the input output devices and makes the I/O process smooth and effective. For
example, it receives the input provided by the user through an input device and stores it
in the main memory. Then it directs the CPU to process this input and accordingly
provides the output through an output device such as a monitor.
9. Security:
It has a security module to protect the data or information stored in the memories of the
computer against malware and unauthorized access. Thus, it not only manages your data
but also helps to protect it.
It helps in data management by offering and displaying directories for data management.
You can view and manipulate files, folders, e.g., you can move, copy, name, or rename,
delete a file or a folder.
12. Communication:
It is the facility provided to users to communicate with each other in the same or other
system by sharing or transferring data.
In the 1970s, Batch processing was very popular. In this technique, similar types of jobs
were batched together and executed in time. People were used to having a single computer
which was called a mainframe.
In Batch operating system, access is given to more than one person; they submit their
respective jobs to the system for the execution.
The system put all of the jobs in a queue on the basis of first come first serve and then
executes the jobs one by one. The users collect their respective output when all the jobs
get executed.
The purpose of this operating system was mainly to transfer control from one job to
another as soon as the job was completed. It contained a small set of programs called the
resident monitor that always resided in one part of the main memory. The remaining part
is used for servicing jobs.
For example, the credit card bill generated by banks is an example of batch processing. A
separate bill is not generated for each credit card purchase, rather a single bill that
includes all purchases in a month is generated through batch processing. The bill details
are collected and held as a batch, and then it is processed to generate the bill at the end of
the billing cycle. Similarly, in a payroll system, the salaries of employees of the company
are calculated and generated through the batch processing system at the end of each
month.
Linux Operating System BCA III
Disadvantages of Batch OS
There are five jobs J1, J2, J3, J4, and J5, present in the batch. If the execution
time of J1 is very high, then the other four jobs will never be executed, or they will have to
wait for a very long time. Hence the other processes get starved.
● You need to train the computer operators for using the batch system.
● It is not easy to debug this system.
● If any error occurs in one job, the other jobs may have to wait for an uncertain time.
Examples of Batch based Operating System: Payroll System, Bank Statements, etc.
Advantages of Multiprogramming OS
● Throughout the system, it increased as the CPU always had one program to
execute.
● Response time can also be reduced.
Disadvantages of Multiprogramming OS
The time taken by each job to execute the job is known as quantum. After the interval of
time is over, the operating system moves to the next task. Time-sharing allows the various
number of users to be placed at various terminals so that they can use a particular system
at the same time.
Each user gets the processor's time as they get while using a single system. The duration
of time allocated to a task is called quantum or time slice; when this duration is over, OS
starts the next task.
Time-sharing is sharing the processor’s time with multiple users simultaneously. The
major difference between Time-sharing operating system and Multiprogramming batch
operating system is that the time-sharing operating system aims to minimize the response
time, whereas the Multiprogramming batch operating system is to increase the use of the
processor.
Linux Operating System BCA III
It uses or runs on multiple independent processors (CPUs) to serve multiple users and
multiple real-time applications. The communication between processors is established
through many communication lines such as telephone lines and high-speed buses. The
processors may differ from each other in terms of size and function.
● Its performance is higher than a single system as resources are being shared.
Linux Operating System BCA III
● If one system stops working, malfunctions, or breaks down, other nodes are not
affected.
● Additional resources can be added easily.
● Shared access to resources like printer can be established.
● Delay in processing is reduced to a greater extent.
● Data sharing or exchange speed is high, owing to the use of electronic mail.
A real-time system is defined as a data processing system in which the time interval
required to process and respond to inputs is so small that it controls the environment.
The time taken by the system to respond to an input and display of required updated
information is termed as the response time. So in this method, the response time is very
less as compared to online processing.
Real-time systems are used when there are rigid time requirements on the operation of a
processor or the flow of data and real-time systems can be used as a control device in a
dedicated application. A real-time operating system must have well-defined, fixed time
constraints, otherwise the system will fail.
For example, scientific experiments, medical imaging systems, industrial control systems,
weapon systems, robots, air traffic control systems, etc.
These are used for the applications where timing is critical or response time is a major
factor; even a delay of a fraction of the second can result in a disaster. For example, airbags
and automatic parachutes that open instantly in case of an accident. Besides this, these
systems lack virtual memory.
Linux Operating System BCA III
Soft real-time systems are less restrictive. A critical real-time task gets priority over other
tasks and retains the priority until it completes. Soft real-time systems have limited utility
than hard real-time systems. For example, multimedia, virtual reality, Advanced
Scientific Projects like undersea exploration and planetary rovers, etc.
● The output is more and quick owing to the maximum utilization of devices and
system
● Task shifting is very quick, e.g., 3 microseconds, due to which it seems that several
tasks are executed simultaneously
● Gives more importance to the currently running applications than the queued
application
● It can be used in embedded systems like in transport and others.
● It is free of errors.
● Memory is allocated appropriately.
Mobile operating systems (Mobile OS) manage mobile gadgets like phones and tablets.
These systems run apps. They are not like desktops as mobiles have different needs. An
operating system (OS) for mobile devices manages the basic functions. It runs apps,
controls memory, and connects to networks. These systems provide an easy-to-use
interface.
They’re designed for smartphones, tablets, and wearable tech. Mobile OSes let you
multitask, browse the web and download apps. Popular options include iOS from Apple,
Linux Operating System BCA III
Android from Google, and Huawei’s HarmonyOS. Mobile operating systems power mode-
rn gadgets. With them, phones become portable computers, communication tools, and
entertainment hubs.
1. User Interface (UI): Touch inputs of Graphical User Interface (GUI) provided
by mobile OS are optimized. This is where users can use touch gestures, in other
words, swiping, tapping, and pinching, to interact with their gadgets.
2. Connectivity: It provides a variety of connections such as cellular, Wi-Fi,
Bluetooth, NFC (Near Field Communication) and others to facilitate the
communication of the device with other devices and networks.
3. Application Management: Is a platform that has its own app marketplace or
store which the users utilize to browse, install, run and updates the applications
exclusively for that platform.
4. Resource Management: Efficiently allocates hardware resources like the CPU
,ram , and battery by achieving a balance between performance and battery life
The mobile- world has seen many operating syste-ms. Some are big and powerful. Othe-rs
are small and niche. Here- are the main types of mobile- OS :
1. Android: Made by Google, Android is the most used mobile OS worldwide. It’s an
open-source system built on Linux code-. Android is made mostly for touchscreen
phone-s and tablets. Being open allows companie-s to customize Android for their
gadgets. That le-ads to many different Android device-s.
2. Apple Inc. cre-ated iOS, the operating syste-m for iPhone, iPad, and iPod Touch. Its
smooth interface and tight Apple- ecosystem integration are- hallmarks. However,
Apple’s total control over hardware and software limits customization options, unlike
Android’s ope-n platform.
Smartphones have- different operating syste-ms. Android and iOS are the biggest. But
othe-rs exist for different use-rs. Operating systems cater to dive-rse needs. The-y have
pros, cons, and target markets.
Linux Operating System BCA III
Linux is an open-source operating system like other operating systems such as Microsoft
Windows, Apple Mac OS, iOS, Google android, etc. Linux is around us since the mid-90s.
It can be used from wristwatches to supercomputers. It is everywhere in our phones,
laptops, PCs, cars and even in refrigerators. It is very much famous among developers and
normal computer users.
Unix is also an operating system like Linux. It is an commercial OS. It consists of three
parts: Kernal, Shell and Programs. Most of the Unix and Linux commands are similar in
nature.
Evolution of Linux OS
The Linux OS was developed by Linus Torvalds in 1991, which sprouted as an idea to
improve the UNIX OS. He suggested improvements but was rejected by UNIX designers.
Therefore, he thought of launching an OS, designed in a way that could be modified by its
users.
The Linux operating system's architecture mainly contains some of the components: the
Kernel, System Library, Hardware layer, System, and Shell utility.
Kernel:-
It is the core component of Operating System, interacts directly with hardware, provides
low level services to upper layer components.
The kernel is one of the core section of an operating system. It is responsible for each of
the major actions of the Linux OS. This operating system contains distinct types of
modules and cooperates with underlying hardware directly. The kernel facilitates
required abstraction for hiding details of low-level hardware or application programs to
the system. There are some of the important kernel types which are mentioned below:
● Monolithic Kernel
● Micro kernels
● Exo kernels
● Hybrid kernels
System Libraries:-
These libraries can be specified as some special functions. These are applied for
implementing the operating system's functionality and don't need code access rights of
the modules of kernel.
Hardware layer:-
Linux operating system contains a hardware layer that consists of several peripheral
devices like CPU, HDD, and RAM.
Shell:-
It is an interface among the kernel and user. It can afford the services of kernel. It can
take commands through the user and runs the functions of the kernel. The shell is
available in distinct types of OSes. These operating systems are categorized into two
different types, which are the graphical shells and command-line shells.
The graphical line shells facilitate the graphical user interface, while the command line
shells facilitate the command line interface. Thus, both of these shells implement
operations. However, the graphical user interface shells work slower as compared to the
command-line interface shells.
There are a few types of these shells which are categorized as follows:
● Korn shell
● Bourne shell
● C shell
● POSIX shell
1. Multiuser capability:
Linux OS can also be defined as a multi-user system. It means more than one user can use
the resources of the system such as application programs, memory, or RAM at the same
time.
2. Multitasking:
More than one function can be performed simultaneously by dividing the CPU time
intelligently.
3. Multiprogramming:
4. Portable:
Linux Operating System BCA III
Linux OS can perform different types of hardware and the kernel of Linux supports the
installation of any type of hardware environment.
5. Open source:
Linux operating system source code is available freely and for enhancing the capability of
the Linux OS, several teams are performing in collaboration.
6. Security:
It provides security in three ways namely authenticating (by assigning password and login
ID), authorization (by assigning permission to read, write and execute) and encryption
(converts file into an unreadable format).
7. Live CD/USB:
Almost all Linux distros provide live CD/USB so that users can run/try it without
installing it.
Linux is command line based OS but it can be converted to GUI based by installing
packages.
9. Application support:
It has its own software repository from where users can download and install many
applications.
Provides hierarchical file system in which files and directories are arranged.
11. Shell: Linux operating system facilitates a unique interpreter program. This type of
program can be applied for executing commands of the operating system. It can be
applied to perform various types of tasks such as call application programs and others.
The shell can be defined as a command interpreter within an operating system like
Linux/GNU or Unix. It is a program that runs other programs. The shell facilitates every
user of the computer as an interface to the Unix/GNU Linux system. Hence, the user can
execute different tools/utilities or commands with a few input data.
Linux Operating System BCA III
The shell sends the result to the user over the screen when it has completed running a
program which is the common output device. That's why it is known as "command
interpreter".
The shell is not just a command interpreter. Also, the shell is a programming language
with complete constructs of a programming language such as functions, variables, loops,
conditional execution, and many others.
Broadly, the shell is categorized into two main categories which are explained below:
1) Graphical Shells:
These shells specifies the manipulation of programs that are based on the graphical user
interface (GUI) by permitting for operations like moving, closing, resizing, and opening
windows and switching focus among windows as well. Ubuntu OS or Windows OS could
be examined as a good example that offers a graphical user interface to the user to interact
with the program. Various users don't need for typing in any command for all the actions
2) Command-line Shell:
Various shells could be accessed with the help of a command-line interface by users. A
unique program known as Command prompt in Windows or Terminal in macOS/Linux
is offered for typing in the human-understandable commands like "ls", "cat", etc and after
that, it is being run. The result is further shown to the user on the terminal.
Types of Shell:
SHELL is a program which provides the interface between the user and an operating
system. When the user logs in OS starts a shell for user. Kernel controls all essential
computer operations, and provides the restriction to hardware access, coordinates all
executing utilities, and manages Resources between process. Using kernel only user can
access utilities provided by operating system.
Denoted as sh.
Linux Operating System BCA III
The Bourne shell was developed by Stephen Bourne at Bell Labs and distributed as the
shell for Unix version 7 in the year 1979. It is denoted as sh. It is also the Solaris system
default shell. The command full name path in Bourne shell is /bin/shand /bin/sh. Root
user prompt is # while the non-root user prompt is $.
It gained popularity due to its compact nature and high speeds of operation. It lacks
features for interactive use like the ability to recall previous commands. It also lacks built-
in arithmetic and logical expression handling.
2. Bash Shell:
Denoted as bash.In the bash shell, bash means Bourne Again Shell. It is a default shell
over several distributions of Linux today. It is a sh-compatible shell. It could be installed
over Windows OS. It facilitates practical improvements on sh for interactive and
programming use which contains:
● Job Control
● Command-line editing
● Shell Aliases and Functions
● Unlimited size command history
● Integer arithmetic in a base from 2-64
3. The C Shell:
It was created by Bill Joy in the year 1970 at the University of California at Berkeley. It is
a command processor and it runs in a command window.bin/csh is the command full
pathname, the root user default prompt is # while non-root user default prompt is
hostname %.
The complete path-name for the C shell is /bin/csh. By default, it uses the prompt
hostname# for the root user and hostname% for the non-root users.
In C shell:
it was written and developed by David Korn in the year 1980. It incorporated all the
features from the c shell (csh) and tab c shell (tcsh). It is faster than C shell and is a
powerful high-level programming language. The full pathname of the command is
/bin/ksh, the root user default prompt is # while the non-root default user prompt is $.
● ;
● &
● (
● )
● <
● >
● newline
● space
Linux Operating System BCA III
● tab
ksh Features:
Command-line editing
New cd capabilities – This enables users to return to the previous directory without typing
complete pathname.
Job control- Job running in ksh shell can be pushed to the background using commands
like bg and can be stopped as well.
History mechanism – A file called .sh_history stores all the commands that get executes
in ksh shell and can be later displayed by running the command history.
Tilde expansion – The home directory of any user can be referred to using ~ i.e. tilde
character.
5. Zsh Shell:
Zsh shell is developed to be reciprocal and it combines various aspects of other GNU/Unix
Linux shells like ksh, tcsh, and bash. Also, the POSIX shell standard specifications were
based on the Korn shell.
Also, it is a strong scripting language like other available shells. Some of its unique
features are listed as follows:
● Startup files
● Filename generation
● Login/Logout watching
● Concept index
● Closing comments
● Variable index
● Key index
Function index and various others that we could find out within the man pages.
All these shells do a similar job but take different commands and facilitate distinct built-
in functions.
Summary :
Linux Operating System BCA III
/bin/sh and
Bourne shell (sh) # $
/sbin/sh
The kernel is a computer program that is the core of a computer’s operating system, with
complete control over everything in the system. It manages following resources of the
Linux system –
● File management
● Process management
● I/O management
● Memory management
● Device management etc.
The Linux kernel is the main component of a Linux operating system (OS) and is the core
interface between a computer’s hardware and its processes. It communicates between the
2, managing resources as efficiently as possible.
The kernel is so named because—like a seed inside a hard shell—it exists within the OS
and controls all the major functions of the hardware, whether it’s a phone, laptop, server,
or any other kind of computer.
1. Memory management: Keep track of how much memory is used to store what, and
where
Linux Operating System BCA III
2. Process management: Determine which processes can use the central processing
unit (CPU), when, and for how long
3. Device drivers: Act as mediator/interpreter between the hardware and processes
4. System calls and security: Receive requests for service from the processes
As discussed above, Kernel is the core part of an OS(Operating system); hence it has full
control over everything in the system. Each operation of hardware and software is
managed and administrated by the kernel. It acts as a bridge between applications and
data processing done at the hardware level. It is the central component of an OS. It is the
part of the OS that always resides in computer memory and enables the communication
between software and hardware components.
It is the computer program that first loaded on start-up the system (After the bootloader).
Once it is loaded, it manages the remaining start-ups. It also manages memory,
peripheral, and I/O requests from software. Moreover, it translates all I/O requests into
data processing instructions for the CPU. It manages other tasks also such as memory
management, task management, and disk management.
A kernel is kept and usually loaded into separate memory space, known as protected
Kernel space. It is protected from being accessed by application programs or less
important parts of OS.
Functions of a Kernel
A kernel of an OS is responsible for performing various functions and has control over the
system. Some main responsibilities of Kernel are given below:
Linux Operating System BCA III
1.Device Management
A kernel maintains a list of all the available devices, and this list may be already known,
configured by the user, or detected by OS at runtime.
2. Memory Management
The kernel has full control for accessing the computer's memory. Each process requires
some memory to work, and the kernel enables the processes to safely access the memory.
To allocate the memory, the first step is known as virtual addressing, which is done by
paging or segmentation. Virtual addressing is a process of providing virtual address
spaces to the processes. This prevents the application from crashing into each other.
3. Resource Management
One of the important functionalities of Kernel is to share the resources between various
processes. It must share the resources in a way that each process uniformly accesses the
resource.
The kernel also provides a way for synchronization and inter-process communication
(IPC). It is responsible for context switching between processes.
A kernel is responsible for accessing computer resources such as RAM and I/O devices.
RAM or Random-Access Memory is used to contain both data and instructions. Each
program needs to access the memory to execute and mostly wants more memory than the
available. For such a case, Kernel plays its role and decides which memory each process
will use and what to do if the required memory is not available.
The kernel also allocates the request from applications to use I/O devices such as
keyboards, microphones, printers, etc.
Types of Kernel
There are mainly five types of Kernel, which are given below:
1. Monolithic Kernels
Linux Operating System BCA III
In a monolithic kernel, the same memory space is used to implement user services and
kernel services.
It means, in this type of kernel, there is no different memory used for user services and
kernel services.
2. Microkernel
Microkernels are easier to manage and maintain as compared to monolithic kernels. Still,
if there will be a greater number of system calls and context switching, then it might
reduce the performance of the system by making it slow.
These kernels use a message passing system for handling the request from one server to
another server.
3. Hybrid Kernel
Hybrid kernels allow to run some services such as network stack in kernel space to reduce
the performance compared to a traditional microkernel, but it still allows to run kernel
code (such as device drivers) as servers in user-space.
4. Nano kernel
As the name suggests, in Nano kernel, the complete code of the kernel is very small, which
means the code executing in the privileged mode of the hardware is very small. Here the
term nano defines a kernel that supports a nanosecond clock resolution.