0% found this document useful (0 votes)
53 views

Linux Operating System Unit 1

Uploaded by

sdpatil3742
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Linux Operating System Unit 1

Uploaded by

sdpatil3742
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Linux Operating System BCA III

Unit 1 - Introduction
1.1 Operating System

An Operating System (OS) is an interface between computer user and computer


hardware. An operating system is software which performs all the basic tasks like file
management, memory management, process management, handling input and output,
and controlling peripheral devices such as disk drives and printers. An operating system
is a type of software without which you cannot operate or run a computer. It acts as an
intermediary or translation system between computer hardware and application
programs installed on the computer.

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.

1.2 Functions of Operating System


1. Memory management:

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.

An Operating System does the following activities for memory management −

● 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

In multiprogramming environment, the OS decides which process gets the processor


when and for how much time. This function is called process scheduling.

An Operating System does the following activities for 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

An Operating System manages device communication via their respective drivers. A


driver is a type of translation software that allows the operating system to communicate
with devices, and there are different drivers for different devices as each device speaks a
different language.

It does the following activities for 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

An Operating System does the following activities for file management −

● 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.

5. Run software applications:

It offers the environment to run or use software applications developed to perform


specific tasks, for example, MS Word, MS Excel, Photoshop, etc.

6. Command Interpretation and execution:

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.

7. Provides user interface:

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.

10. Data management:

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.

11. Deadlock Prevention:


Linux Operating System BCA III

Sometimes a resource that is supposed to be shared by two or more processes is held by


one process due to which the resource cannot continue. This situation is known as
deadlock. The OS does not let this situation arise by carefully distributing the resources
among the different processes.

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.

1.3 Types of Operating System

An operating system is a well-organized collection of programs that manages the


computer hardware. It is a type of system software that is responsible for the smooth
functioning of the computer system.

1. Batch Operating System:

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

Advantages of Batch OS:

● Repeated jobs can be completed easily without any human intervention


● Hardware or system support is not required to input data in batch systems
● It can work offline, so it causes less stress on the processor as it knows which task
to process next and how long the task will last.
● It can be shared among multiple users.
● You can set the timing of batch jobs so that when the computer is not busy, it can
start processing the batch jobs such as at night or any other free time.

Disadvantages of Batch OS

● Starvation: Batch processing suffers from starvation.

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.

2. Multiprogramming Operating System

Multiprogramming is an extension to batch processing where the CPU is always kept


busy. Each process needs two types of system time: CPU time and IO time. In a
multiprogramming environment, when a process does its I/O, The CPU can start the
Linux Operating System BCA III

execution of other processes. Therefore, multiprogramming improves the efficiency of the


system.

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

● Multiprogramming systems provide an environment in which various systems


resources are used efficiently, but they do not provide any user interaction with the
computer system.

3. Multitasking Operating System/ Time Sharing Operating System:

The Time-sharing systems are also called Multitasking systems. In Time-sharing


operating system, we assign some time to each job so that all the jobs work efficiently
and smoothly. The task may be from a single user as well as multiple users.

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.

A time-sharing operating system allows many users to be served simultaneously,


so sophisticated CPU scheduling schemes and Input/output management are required.

Time-sharing operating systems are very difficult and expensive to build.

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

Advantages of time sharing operating system:

● It reduces CPU idle time and thus makes it more productive.


● Each process gets the chance to use the CPU.
● It allowed different applications run simultaneously.

Disadvantages of time sharing operating system:

● It requires a special operating system as it consumes more resources.


● Switching between tasks may hang up the system as it serves lots of users and runs
lots of applications at the same time, so it requires hardware with high
specifications.
● It is less reliable.

4. Distributed Operating System:

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.

The availability of powerful microprocessor and advanced communication technology has


made it possible to design, develop, and use the distributed operating system. Besides
this, it is an extension of a network operating system that supports a high level of
communication and integration of machines on the network.

Advantages of distributed operating system:

● 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.

Disadvantages of distributed operating system:

● Security issue may arise due to sharing of resources


● Few messages may be lost in the system
● Higher bandwidth is required in case of handling a large amount of data
● Overloading issue may arise
● The performance may be low
● The languages which are used to set up a distributed system are not well defined
yet
● They are very costly, so they are not easily available.

5. Real-Time Operating System:

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.

There are two types of real-time operating systems.

● Hard Real-Time Systems:

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

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.

Advantages of real-time operating system:

● 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.

Disadvantages of real-time operating system:

● A fewer number of tasks can run simultaneously to avoid errors.


● It is not easy for a designer to write complex and difficult algorithms or proficient
programs required to get the desired output.
● Specific drivers and interrupt signals are required to respond to interrupts quickly.
● It may be very expensive due to the involvement of the resources required to work.

Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging


systems, industrial control systems, weapon systems, robots, air traffic control systems,
etc.

6. Mobile Operating System:

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.

Key Feature-s of a Mobile Operating System:

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

Types of Mobile Operating System

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 ove­r hardware and software limits customization options, unlike
Android’s ope-n platform.

3. Tizen is a Linux-based mobile- OS developed by Samsung. It was cre-ated with Intel


and the Tize-n Association. Tizen powers various Samsung products.

4. Huawei develope-d HarmonyOS (Hongmeng OS in China): work across diverse


de-vices like smartphones, we-arables, laptops, smart home gadgets. By offe-ring a
unified ecosystem, Huawe-i aims to navigate US government re-strictions on its business.

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

1.4 History and Development of Linux:

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.

Nowadays, Linux is the fastest-growing OS. It is used from phones to supercomputers by


almost all major hardware devices

Why Use Linux

Linux is completely different from other operating systems in many ways.

● It is an open source OS which gives a great advantage to the programmers as they


can design their own custom operating systems.
● It gives you a lot of option of programs having some different features so you can
choose according to your need.
● Global development communities look at different ways to enhance its security,
hence it is highly secured and robust so you don't need an anti virus to scan it
regularly. Companies like Google, Amazon and Facebook use linux in order to
protect their servers as it is highly reliable and stable.
● Above all you don't have to pay for software and server licensing to install Linux,
its absolutely free and you can install it on as many computers as you want.
● Its completely trouble free operating system and don't have an issue with viruses,
malware and slowing down your computer.
Linux Operating System BCA III

Structure Of Linux Operating System

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.

System Utility Programs:-


Linux Operating System BCA III

It is responsible for doing specialized level and individual activities.

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.5 Features of Linux

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:

Linux OS can be defined as a multiprogramming system. It means more than one


application can be executed at the same time.

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.

8. Graphical User Interface (X Window system):

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.

10. File System:

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.

1.6 Concept of shell:

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.

Working on a command-line shell is a complicated for many beginners due to it is hard


to remember several commands. Command-line shell is very dominant and it permits
users for storing commands in a file and run them together. In this way, a repetitive action
could be automated easily. Usually, these files are known as Shell scripts in macOS/Linux
systems and batch files in Windows.

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.

1. The Bourne Shell

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.

For the Bourne shell the:

Command full-path name is /bin/sh and /sbin/sh,

Non-root user default prompt is $,

Root user default prompt is #.

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

For the Bourne-Again shell the:

Command full-path name is /bin/bash,

Default prompt for a non-root user is bash-g.gg$

(g.ggindicates the shell version number like bash-3.50$),

Root user default prompt is bash-g.gg#.

3. The C Shell:

The C Shell is denoted by csh.


Linux Operating System BCA III

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:

Command full-path name is /bin/csh,

Non-root user default prompt is hostname %,

Root user default prompt is hostname #.

4. The Korn Shell:

The Korn Shell is denoted by ksh.

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 $.

For the Korn shell the:

Command full-path name is /bin/ksh,

Non-root user default prompt is $,

Root user default prompt is #.

In ksh, a Metacharacter is one of the following characters:

● ;
● &
● (
● )
● <
● >
● 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

Complete path- Prompt for root Prompt for non root


Shell
name user user

/bin/sh and
Bourne shell (sh) # $
/sbin/sh

GNU Bourne-Again bash-


/bin/bash bash-VersionNumber$
shell (bash) VersionNumber#

C shell (csh) /bin/csh # %

Korn shell (ksh) /bin/ksh # $

Z Shell (zsh) /bin/zsh <hostname># <hostname>%

1.6 Concept of Kernel:

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.

What the kernel does?

The kernel has 4 jobs:

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

What is Kernel in Operating System?

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

To perform various actions, processes require access to peripheral devices such as a


mouse, keyboard, etc., that are connected to the computer. A kernel is responsible for
controlling these devices using device drivers. Here, a device driver is a computer
program that helps or enables the OS to communicate with any hardware device.

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.

4. Accessing Computer Resources

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.

As it uses the same memory space, the size of the


kernel increases, increasing the overall size of the
OS.

The execution of processes is also faster than


other kernel types as it does not use separate user
and kernel space.

Examples of Monolithic Kernels are Unix,


Linux, Open VMS, XTS-400, etc.

2. Microkernel

A microkernel is also referred to as μK, and it


is different from a traditional kernel or
Monolithic Kernel. In this, user services and
kernel services are implemented into two
different address spaces: user space and kernel
space.

Since it uses different spaces for both the


services, so, the size of the microkernel is decreased, and which also reduces the size of
the OS.

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.

Examples of Microkernel are L4, AmigaOS, Minix, K42, etc


Linux Operating System BCA III

3. Hybrid Kernel

Hybrid kernels are also known as modular


kernels, and it is the combination of both
Monolithic and Microkernels. It takes
advantage of the speed of monolithic kernels
and the modularity of microkernels.

A hybrid kernel can be understood as the


extended version of a microkernel with
additional properties of a monolithic kernel.
These kernels are widely used in commercial OS, such as different versions of MS
Windows.

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.

Examples of Nano kernel are EROS etc.

You might also like