0% found this document useful (0 votes)
7 views33 pages

UNIT-1 Notes OS

An Operating System (OS) is a system software that manages computer resources and acts as an interface between hardware and software. It performs essential functions such as resource management, process management, memory management, security, and file management, while supporting various types of operating systems like batch processing, time-sharing, real-time, multiprocessor, multi-user, multiprogramming, and interactive systems. Each type of OS has its own advantages and disadvantages, catering to different user needs and computing environments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views33 pages

UNIT-1 Notes OS

An Operating System (OS) is a system software that manages computer resources and acts as an interface between hardware and software. It performs essential functions such as resource management, process management, memory management, security, and file management, while supporting various types of operating systems like batch processing, time-sharing, real-time, multiprocessor, multi-user, multiprogramming, and interactive systems. Each type of OS has its own advantages and disadvantages, catering to different user needs and computing environments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

UNIT -1

Operating System
An Operating System is a System software that manages all the resources of the
computing device.
• Acts as an interface between the software and different parts of the
computer or the computer hardware.
• Manages the overall resources and operations of the computer.
• Controls and monitors the execution of all other programs that reside in
the computer, which also includes application programs and other
system software of the computer.
• Examples of Operating Systems are Windows, Linux, macOS, Android,
iOS, etc.

Dig. Operating System

Need of an Operating System


• As a platform for Application programs: It provides a platform, on top of
which, other programs, called application programs can run.
• Managing Input-Output unit: It also allows the computer to manage its
own resources such as memory, monitor, keyboard, printer, etc.
Management of these resources is required for effective and fair
utilization.
• Multitasking: It manages memory and allows multiple programs to run in
their own space and even communicate with each other through shared
memory.
• Manages memory and Files: It manages the computer’s main memory
and second storage. Additionally, it allows and deallocates memory to all
tasks and applications.
• Provides Security: It helps to maintain the system and applications safe
through the authorization process. Thus, the OS provides security to the
system.

Functions of the Operating System


• Resource Management: The operating system manages and allocates
memory, CPU time, and other hardware resources among the various
programs and processes running on the computer.
• Process Management: The operating system is responsible for starting,
stopping, and managing processes and programs. It also controls the
scheduling of processes and allocates resources to them.
• Memory Management: The operating system manages the computer’s
primary memory and provides mechanisms for optimizing memory usage.
• Security: The operating system provides a secure environment for the
user, applications, and data by implementing security policies and
mechanisms such as access controls and encryption.
• File Management: The operating system is responsible for organizing and
managing the file system, including the creation, deletion, and
manipulation of files and directories.
• Device Management: The operating system manages input/output
devices such as printers, keyboards, mice, and displays. It provides the
necessary drivers and interfaces to enable communication between the
devices and the computer.
• Networking: The operating system provides networking capabilities such
as establishing and managing network connections, handling network
protocols, and sharing resources such as printers and files over a network.
• User Interface: The operating system provides a user interface that
enables users to interact with the computer system. This can be
a Graphical User Interface (GUI), a Command-Line Interface (CLI), or a
combination of both.

Types of Operating System

1. Batch Processing OS- The batch-processing operating system was


very popular in the 1970s. In batch operating system the jobs were
performed in batches. This means Jobs having similar requirements are
grouped and executed as a group to speed up processing. Users using
batch operating systems do not interact with the computer directly. Each
user prepares their job using an offline device for example a punch card
and submits it to the computer operator. Once the programmers have
left their programs with the operator, they sort the programs with similar
needs into batches.

Advantages of Batch Operating System


The benefits of batch-processing operating systems include:
• Resource Efficiency: These systems improve the use of computation
resources by processing jobs in groups and scheduling them during
stages of resource accessibility.
• High Throughput: Batch processing systems can handle and complete a
large number of tasks quickly, and high throughput.
• Error Reduction: Since these systems work without requiring user
interference, they minimize the risk of faults that can occur with manual
processing.
• Cost Efficiency: By producing well-organized use of resources and
reducing processing time and errors, batch processing systems can be a
cost-effective option.
• Scalability: These classifications can manage a huge number of tasks,
making them scalable and appropriate for large organizations with
significant data processing needs.
Disadvantages of Batch Operating System
There are many disadvantages to using batch operating systems, including:
• Limited functionality: A batch operating system can solve only simple
tasks not solve more complex tasks. this can make them difficult to use
for certain tasks, like managing files or software.
• Security issues: Batch operating systems are not more secure because
they are not typically used for day-to-day tasks, so they are not as secure
as more common operating systems. This can lead to security risks if the
system is used by people who should not have access to it.
• Interruptions: Batch systems can be interrupted frequently, which can
lead to missed deadlines or mistakes.
• Inefficiency: Batch systems are often slow and difficult to use, which can
lead to inefficiency in the workplace.
2. Time-Sharing OS- Time-sharing is a technique which enables many
people, located at various terminals, to use a particular computer system
at the same time. Time-sharing or multitasking is a logical extension of
multiprogramming. Processor's time which is shared among multiple
users simultaneously is termed as time-sharing. The main difference
between multiprogrammed Batch Systems and Time-Sharing Systems is
that in case of multiprogrammed batch systems, the objective is to
maximize processor use, whereas in Time-Sharing Systems, the objective
is to minimize response time.
Multiple jobs are executed by the CPU by switching between them, but
the switches occur so frequently. Thus, the user can receive an immediate
response. For example, in a transaction processing, the processor
executes each user program in a short burst or quantum of computation.
That is, if n users are present, then each user can get a time quantum.
When the user submits the command, the response time is in few seconds
at most. The operating system uses CPU scheduling and
multiprogramming to provide each user with a small portion of a time.
Computer systems that were designed primarily as batch systems have
been modified to time-sharing systems.

Advantages

1. Each task gets an equal opportunity.


2. Fewer chances of duplication of software.
3. CPU idle time can be reduced.

Disadvantages

1. Reliability problem.
2. One must have to take of the security and integrity of user programs and
data.
3. Data communication problem.

3.Real Time OS- 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.
1. Hard real-time systems- Hard real-time systems guarantee that
critical tasks complete on time. In hard real-time systems,
secondary storage is limited or missing and the data is stored in
ROM. In these systems, virtual memory is almost never found.

2. 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
The advantages of real-time operating systems are as follows:
• Maximum Consumption: Maximum utilization of devices and systems.
Thus more output from all the resources.
• Real-Time Operating System In Embedded System: Since the size of
programs is small, RTOS can also be embedded systems like in transport
and others.
• Error Free: These types of systems are error-free.
• Memory Allocation: Memory allocation is best managed in these types of
systems.

Disadvantages
The disadvantages of real-time operating systems are as follows:
• Limited Tasks: Very few tasks run simultaneously, and their concentration
is very less on few applications to avoid errors.
• Use Heavy System Resources: Sometimes the system resources are not so
good and they are expensive as well.
• Complex Algorithms : The algorithms are very complex and difficult for
the designer to write on.
• Device Driver And Interrupt Signals: It needs specific device drivers and
interrupts signals to respond earliest to interrupts.

4. Multi-processor OS- Most computer systems are single processor


systems i.e., they only have one processor. However, multiprocessor or
parallel systems are increasing in importance nowadays. These systems
have multiple processors working in parallel that share the computer
clock, memory, bus, peripheral devices etc.

Types of Multiprocessors

There are mainly two types of multiprocessors: symmetric and


asymmetric multiprocessors

Symmetric Multiprocessors
In these types of systems, each processor contains a similar copy of the
operating system and they all communicate with each other. All the
processors are in a peer-to-peer relationship i.e. no master - slave
relationship exists between them.
An example of the symmetric multiprocessing system is the Encore
version of Unix for the Multimax Computer.

Asymmetric Multiprocessors
In asymmetric systems, each processor is given a predefined task. There
is a master processor that gives instruction to all the other processors.
Asymmetric multiprocessor system contains a master slave relationship.
Asymmetric multiprocessor was the only type of multiprocessor
available before symmetric multiprocessors were created. Now also, this
is the cheaper option.

Advantages
1. More reliable Systems
In a multiprocessor system, even if one processor fails, the system will
not halt. This ability to continue working despite hardware failure is
known as graceful degradation. For example: If there are 5 processors in
a multiprocessor system and one of them fails, then also 4 processors
are still working. So the system only becomes slower and does not
ground to a halt.
2. Enhanced Throughput
If multiple processors are working in tandem, then the throughput of the
system increases i.e. number of processes getting executed per unit of
time increase. If there are N processors then the throughput increases by
an amount just under N.
3. More Economic Systems
Multiprocessor systems are cheaper than single processor systems in the
long run because they share the data storage, peripheral devices, power
supplies etc. If there are multiple processes that share data, it is better to
schedule them on multiprocessor systems with shared data than have
different computer systems with multiple copies of the data.

Disadvantages

1. Increased Expense
Even though multiprocessor systems are cheaper in the long run than
using multiple computer systems, still they are quite expensive. It is
much cheaper to buy a simple single processor system than a
multiprocessor system.
2. Complicated Operating System Required
There are multiple processors in a multiprocessor system that share
peripherals, memory etc. So, it is much more complicated to schedule
processes and impart resources to processes than in single processor
systems. Hence, a more complex and complicated operating system is
required in multiprocessor systems.
3. Large Main Memory Required
All the processors in the multiprocessor system share the memory. So a
much larger pool of memory is required as compared to single processor
systems.

5. Multi-user/Multi tasking OS- An operating system is software that acts as an


interface between the user and the computer hardware which does multiple
functions such as memory management; file management and processor
management. The operating system should have to meet the requirements of
all its users in a balanced way so that if any problem would arise with a user, it
does not affect any other user in the chain.
In a multiuser operating system, multiple numbers of users can access different
resources of a computer at the same time. The access is provided using a
network that consists of various personal computers attached to a mainframe
computer system. A multi-user operating system allows the permission of
multiple users for accessing a single machine at a time. The various personal
computers can send and receive information to the mainframe computer
system. Thus, the mainframe computer acts as the server and other personal
computers act as clients for that server.

Components of the multi-user operating system:


1. Memory: Consists of main memory (RAM). Main memory is determined
as an important part of the operating system because it specifies how
many programs may be executed simultaneously. The system can correct
data that is present in the main memory, therefore every program that is
executed must be copied from physical storage.
The types of physical storage:
• Hard disk: Hard disk can hold a huge amount of data and also
determines how many programs can be run at a single time.
• Floppy disk: It is more inexpensive, but it is potable
• Optical disks: They use a laser to read and write data. They can
hold large data and portable
• Tapes: They are expensive but they can hold a huge amount of
data.
2. Processor: The core of the computer is called the central processing unit
(CPU).
3. User interface: Create a simple environment for all users for using the
computer system. It is the point of communication between users and
hardware (or) software. The main frame is one of the systems which
works on the concepts of multi-user programming concept. It is widely
used in banks, to store bank account and transaction details. This
mainframe helps in various ways: security and scalability.
Advantages:
• It helps in the sharing of data and information among different users.
• It also helps in the sharing of hardware resources such as printers.
• It avoids disruption if any one computer fails it does not affect any other
computer present on that network.
• Users can share their work with other users.
• The multi-user operating system is very helpful in economic
improvement.
• Backing up data can be done in the multi-user operating system.
• The services of the multi-user operating systems are very stable and
systematic.
Disadvantages:
• It requires expensive hardware to set up a mainframe computer
• When multiple users log on or work on the same system it reduces the
overall performance of the system.
• Information is shared with the public so privacy becomes a concern here.

6.Multiprogramming OS- Multiprogramming means more than one program


can be active at the same time. Before the operating system concept, only one
program was to be loaded at a time and run. These systems were not efficient
as the CPU was not used efficiently. For example, in a single-tasking system, the
CPU is not used if the current program waits for some input/output to finish.
The idea of multiprogramming is to assign CPUs to other processes while the
current process might not be finished. This has the below advantages.
1) The user gets the feeling that he/she can run multiple applications on a
single CPU even if the CPU is running one process at a time.
2) CPU is utilized better
All modern operating systems like MS Windows, Linux, etc are
multiprogramming operating systems.

Advantages
• Need Single CPU for implementation.
• Context switch between process.
• Switching happens when current process undergoes waiting state.
• CPU idle time is reduced.
• High resource utilization.
• High Performance.
Disadvantages
• Prior knowledge of scheduling algorithms (An algorithm that decides
which next process will get hold of the CPU) is required.
• If it has a large number of jobs, then long-term jobs will have to require a
long wait.
• Memory management is needed in the operating system because all
types of tasks are stored in the main memory.
• Using multiprogramming up to a larger extent can cause a heat-up issue.

7. Interactive OS- An interactive operative system is an operating system


that allows the execution of interactive programs. All PC operating systems
are interactive operating systems only.
• An interactive operating system gives permission to the user to interact
directly with the computer. In an Interactive operating system, the user
enters some command into the system and the work of the system is to
execute it.
• Programs that allow users to enter some data or commands are known
as Interactive Operating Systems. Some commonly used examples of
Interactive operating systems include Word Processors and Spreadsheet
Applications.
• A non-interactive program can be defined as one that once started
continues without the need for human interaction. A compiler can be an
example of a non-interactive program.
Example of an Interactive Operating System:
Some examples of Interactive operating systems are as follows:
1. Unix Operating System
2. Disk Operating System
Advantages
1. Usability: An operating system is designed to perform something and the
interactiveness allows the user to manage the tasks more or less in real-
time.
2. Security: Simple security policy enhancement. In non-interactive
systems, the user virtually always knows what their programs will do
during their lifetime, thus allowing us to forecast and correct the bugs.
Disadvantages
1. Tough to design: Depending on the target device, interactivity might be
proved challenging to design because the user must be prepared for
every input. What about having many inputs? The state of a program can
alternate at any particular time, all the programs should be handled in
some way, and also it doesn’t always work out properly.

8. Multithreaded OS- Multithreading is a feature in operating systems that


allows a program to do several tasks at the same time. Think of it like having
multiple hands working together to complete different parts of a job faster.
Each “hand” is called a thread, and they help make programs run more
efficiently. Multithreading makes your computer work better by using its
resources more effectively, leading to quicker and smoother performance for
applications like web browsers, games, and many other programs you use
every day.
The concept of multi-threading needs a proper understanding of these two
terms – a process and a thread. A process is a program being executed. A
process can be further divided into independent units known as threads. A
thread is like a small light-weight process within a process. Or we can say a
collection of threads is what is known as a process.

Threading is used widely in almost every field. Most widely it is seen over the
internet nowadays where we are using transaction processing of every type like
recharges, online transfer, banking etc. Threading is a segment which divide the
code into small parts that are of very light weight and has less burden on CPU
memory so that it can be easily worked out and can achieve goal in desired
field. The concept of threading is designed due to the problem of fast and
regular changes in technology and less the work in different areas due to less
application.

Spooling
Spooling is an acronym for simultaneous peripheral operation online. Spooling
is the process of temporary storage of data for use and execution by a device,
program, or system. Data is sent to and stored in main memory or other
volatile storage until it is requested for execution by a program or computer.
Spooling makes use of the disc as a large buffer to send data to printers and
other devices. It can also be used as an input, but it is more commonly used as
an output. Its primary function is to prevent two users from printing on the
same page at the same time, resulting in their output being completely mixed
together. It prevents this because it uses the FIFO (First In First Out) strategy to
retrieve the stored jobs in the spool, and that creates a synchronization
preventing the output to be completely mixed together.
It also aids in the reduction of idle time, as well as overlapped I/O and CPU.
Simple forms of file management are frequently provided by batch systems.
The access to the file is sequential. Batch systems do not necessitate the
management of time-critical devices.

How Spooling Works in Operating Systems?


• Spooling requires the creation of a buffer known as SPOOL, which is used
to hold off jobs and data until the device in which the SPOOL is created is
ready to use and execute the job or operate on the data.
• When a faster device sends input to a slower device to perform an
operation, it acts as a SPOOL buffer by using any secondary memory
attached. This input is retained in the SPOOL until the slower device is
ready to use it. When the slower device is ready, the input in the SPOOL
is loaded into main memory for the operations that are required.
• A device can connect to multiple input devices, each of which may
require some data processing. As a result, all of these input devices may
store their data in secondary memory (SPOOL), which can then be
executed sequentially by the device. This prevents the CPU from
becoming idle at any time. As a result, Spooling is a combination of
buffering and queuing.
• After the CPU generates some output, this output is first saved in the
main memory. This output is transferred to the secondary memory from
the main memory, and from there, the output is sent to the respective
output devices.
Example
• Printing is the most obvious application of Spooling. The documents to
be printed are saved in the SPOOL and then added to the printing queue.
During this time, many processes can run and use the CPU without
waiting while the printer runs the printing process on each document
one by one.

Operating System Services


An Operating System provides services to both the users and to the programs.
• It provides programs an environment to execute.
• It provides users the services to execute the programs in a convenient
manner.
Following are a few common services provided by an operating system −
• Program execution
• I/O operations
• File System manipulation
• Communication
• Error Detection
• Resource Allocation
• Protection
1. Program execution
Operating systems handle many kinds of activities from user programs to
system programs like printer spooler, name servers, file server, etc. Each of
these activities is encapsulated as a process.
A process includes the complete execution context (code to execute, data to
manipulate, registers, OS resources in use). Following are the major activities of
an operating system with respect to program management −
• Loads a program into memory.
• Executes the program.
• Handles program's execution.
• Provides a mechanism for process synchronization.
• Provides a mechanism for process communication.
• Provides a mechanism for deadlock handling.
2. I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver
software. Drivers hide the peculiarities of specific hardware devices from the
users.
An Operating System manages the communication between user and device
drivers.
• I/O operation means read or write operation with any file or any specific
I/O device.
• Operating system provides the access to the required I/O device when
required.
3. File system manipulation
A file represents a collection of related information. Computers can store files
on the disk (secondary storage), for long-term storage purpose. Examples of
storage media include magnetic tape, magnetic disk and optical disk drives like
CD, DVD. Each of these media has its own properties like speed, capacity, data
transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and
usage. These directories may contain files and other directions. Following are
the major activities of an operating system with respect to file management −
• Program needs to read a file or write a file.
• The operating system gives the permission to the program for operation
on file.
• Permission varies from read-only, read-write, denied and so on.
• Operating System provides an interface to the user to create/delete files.
• Operating System provides an interface to the user to create/delete
directories.
• Operating System provides an interface to create the backup of file
system.
4. Communication
In case of distributed systems which are a collection of processors that do not
share memory, peripheral devices, or a clock, the operating system manages
communications between all the processes. Multiple processes communicate
with one another through communication lines in the network.
The OS handles routing and connection strategies, and the problems of
contention and security. Following are the major activities of an operating
system with respect to communication −
• Two processes often require data to be transferred between them
• Both the processes can be on one computer or on different computers,
but are connected through a computer network.
• Communication may be implemented by two methods, either by Shared
Memory or by Message Passing.
5. Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O
devices or in the memory hardware. Following are the major activities of an
operating system with respect to error handling −
• The OS constantly checks for possible errors.
• The OS takes an appropriate action to ensure correct and consistent
computing.
6. Resource Management
In case of multi-user or multi-tasking environment, resources such as main
memory, CPU cycles and files storage are to be allocated to each user or job.
Following are the major activities of an operating system with respect to
resource management −
• The OS manages all kinds of resources using schedulers.
• CPU scheduling algorithms are used for better utilization of CPU.
7. Protection
Considering a computer system having multiple users and concurrent execution
of multiple processes, the various processes must be protected from each
other's activities.
Protection refers to a mechanism or a way to control the access of programs,
processes, or users to the resources defined by a computer system. Following
are the major activities of an operating system with respect to protection −
• The OS ensures that all access to system resources is controlled.
• The OS ensures that external I/O devices are protected from invalid
access attempts.
• The OS provides authentication features for each user by means of
passwords.

Shell and Kernel


The operating system (OS) serves as the fundamental layer that bridges the gap
between computer hardware and the user. Two critical components of an
operating system are the kernel and the shell. Understanding the relationship
between these two components is fundamental to grasping how operating
systems function and how users interact with their computers.
What is a Shell?
The shell is a command-line interface that allows the user to enter commands to
interact with the operating system. It acts as an intermediary between the user
and the kernel, interpreting commands entered by the user and translating them
into instructions that the kernel can execute. The shell also provides various
features like command history, tab completion, and scripting capabilities to make
it easier for the user to work with the system.
Advantages
• Efficient Command Execution
• Scripting capability
Disadvantages
• Limited Visualization
• Steep Learning Curve
What is Kernel?
The kernel is the core component of the operating system that manages system
resources and provides services to other programs running on the system. It acts
as a bridge between the user and the resources of the system by accessing
various computer resources like the CPU, I/O devices and other resources. It is
responsible for tasks such as memory management, process scheduling,
and device drivers. The kernel operates at a lower level than the shell and
interacts directly with the hardware of the computer.
Advantages
• Efficient Resource Management
• Process Management
• Hardware Abstraction
Disadvantages
• Limited Flexibility
• Dependency on Hardware
Difference Between Shell and Kernel

Shell Kernel

Shell allows the users to Kernel controls all the tasks of the
communicate with the kernel. system.

It is the interface between kernel


It is the core of the operating system.
and user.

It’s a low-level program interfacing with


It is a command line interpreter
the hardware (CPU, RAM, disks) on top
(CLI).
of which applications are running.

Its types are – Bourne Shell, C shell, Its types are – Monolithic Kernel, Micro
Korn Shell, etc. kernel, Hybrid kernel, etc.

It carries out commands on a


group of files by specifying a It performs memory management.
pattern to match

Shell commands like ls, mkdir and


many more can be used to request
It performs process management.
to complete the specific operation
to the OS.

It is the outer layer of OS. It is the inner layer of OS.


Shell Kernel

Kernel directly interacts with the


It interacts with user and
hardware by accepting machine
interprets to machine
understandable language from the
understandable language.
shell.

Core component of the operating


Command-line interface that
system that manages system resources
allows user interaction

Provides services to other programs


Interprets and translates user
running on the system
commands

Operates at a lower level than the shell


Acts as an intermediary between
and interacts with hardware
the user and the kernel

Responsible for tasks such as memory


Provides various features like
management, process scheduling, and
command history, tab completion,
device drivers
and scripting capabilities

Executes commands and Enables user and applications to


programs interact with hardware resources
Operating System Structure
An operating system is a design that enables user application programs to
communicate with the hardware of the machine. The operating system
should be built with the utmost care because it is such a complicated
structure and should be simple to use and modify. Partially developing the
operating system is a simple approach to accomplish this. Each of these
components needs to have distinct inputs, outputs, and functionalities.

1. Simple Structure
2. Monolithic Structure
3. Layered Approach Structure
4. Micro-Kernel Structure
What is an operating System Structure?
Operating systems consist of many interacting parts, and the definition of
the structural relationships among these parts is called OS structure. Such
a structure ensures that it will be easy to develop, maintain, and customize
the OS for particular applications. The clear structure lets the OS be built
from manageable segments; each segment contributes to the overall
system functionality.
The OS structure provides an idea of how different components are
connected and integrated within the kernel, which is the central part of
the OS. The kernel carries out sensitive tasks such as memory
management, process scheduling, and interaction with hardware. A look
into different OS structures and their relative advantages and
disadvantages is presented next.
1. Simple Structure
It is the most straightforward operating system structure, but it lacks
definition and is only appropriate for usage with tiny and restricted
systems. Since the interfaces and degrees of functionality in this structure
are clearly defined, programs are able to access I/O routines, which may
result in unauthorized access to I/O procedures.
This organizational structure is used by the MS-DOS operating system:
o There are four layers that make up the MS-DOS operating system, and
each has its own set of features.
o These layers include ROM BIOS device drivers, MS-DOS device drivers,
application programs, and system programs.
o The MS-DOS operating system benefits from layering because each level
can be defined independently and, when necessary, can interact with one
another.
o If the system is built in layers, it will be simpler to design, manage, and
update. Because of this, simple structures can be used to build
constrained systems that are less complex.
o When a user program fails, the operating system as whole crashes.
o Because MS-DOS systems have a low level of abstraction, programs and
I/O procedures are visible to end users, giving them the potential for
unwanted access.
Advantages of Simple Structure:
o It is easy to develop as it contains only a few interfaces and levels.
o It executes faster because there are fewer layers between the hardware
and applications.
o Direct access to hardware provides faster operations.
o Minimal consumption of system resources as the structure is very simple.
o Light in weight hence suitable for small or even embedded systems.
Disadvantages of Simple Structure:
o As these components are not distinctly separated, making any change or
upgrade in the system is considerably harder to achieve.
o All things are connected, and therefore, debugging is quite hectic; finding
the error is very hard.
o Due to the lack of data abstraction, a security vulnerability is a strong
possibility.
o It does not scale well to larger, more complex systems. Adding new
features is particularly challenging in this architecture.
o One failure in one part might bring down the whole system.
2. MONOLITHIC STRUCTURE
The monolithic operating system controls all aspects of the operating
system's operation, including file management, memory management,
device management, and operational operations.
The core of an operating system for computers is called the kernel (OS).
All other System components are provided with fundamental services by
the kernel.
The operating system and the hardware use it as their main interface.
When an operating system is built into a single piece of hardware, such as
a keyboard or mouse, the kernel can directly access all of its resources.
The monolithic operating system is often referred to as the monolithic
kernel. Multiple programming techniques such as batch processing and
time-sharing increase a processor's usability. Working on top of the
operating system and under complete command of all hardware, the
monolithic kernel performs the role of a virtual computer.
This is an old operating system that was used in banks to carry out simple
tasks like batch processing and time-sharing, which allows numerous
users at different terminals to access the Operating System.
The following diagram represents the monolithic structure:

Advantages of Monolithic Structure:


o Because everything is packed into one big kernel, there is no need for
multi-layer complexities. Hence, the design and bringing into practice of
such a system is relatively easy.
o As long as all the components run in the same memory space, there is no
need to have inter-process communication or to perform context
switching between layers; thus, execution is faster.
o Direct access to hardware and little additional-abstraction overhead result
in high performance.
o Development can thus be easier as developers have to deal with one
codebase only, and no interactions among various layers or modules need
to be considered.
Disadvantages of Monolithic Structure:
o Fault in any single component has the potential to bring down the whole
system since there is no isolation between different parts.
o This can be a hard and unsafe task, as changes in one part of the system
may accidentally filter out into another part.
o Since the components are more interdependent, debugging is also more
complex and always requires heavy testing and testing-related activities.
o This is an issue where scaling up or adjusting to the latest trends in a
system involves significant changes in the kernel.
o Consequently, it will be cumbersome to update or upgrade the system
because it involves a large codebase in a monolithic form where changes
may have widespread effects.
3. LAYERED STRUCTURE
The OS is separated into layers or levels in this kind of arrangement. Layer
0 (the lowest layer) contains the hardware, and layer 1 (the highest layer)
contains the user interface (layer N).
• The model, in this respect, uses the functions' availability through the
layer below it. For example, memory management may have to rely on
process scheduling, while higher layers use it here with respect to user
interaction.
• This approach also introduces abstraction between layers, whereby the
system is also easier to manage and debug. In case any issue arises, testing
and debugging can be performed at lower layers before going onto higher
layers
The functionalities of each layer are separated in this method, and
abstraction is also an option. Because layered structures are hierarchical,
debugging is simpler, therefore all lower-level layers are debugged before
the upper layer is examined. As a result, the present layer alone has to be
reviewed since all the lower layers have already been examined.

Advantages of Layered Structure:


o Development, maintenance, and understanding are much easier, as every
layer is assigned a specific role.
o It can isolate problems in individual layers because testing and debugging
would be less demanding.
o Sensitive operations can be confined to specific layers; thus, unauthorized
access can be minimized to such layers because the concerns have been
clearly separated.
o Modifying or updating one layer will not affect other independent layers
directly; thus, upgrading or fixing could be done more easily.
o With layers, basic operations can be entrusted to lower layers, and hence,
the layers above need not be concerned with the minute details, thereby
reducing the complexity of the overall management.
Disadvantages of Layered Structure:
o The layered approach adds delays due to the fact that data and commands
must pass through several layers, thus slowing down the system in
general.
o Designing a properly working layered structure requires forethought and
iron discipline for proper interaction between different layers.
o Layers are generally dependent on lower layers; thus skipping layers and
directly accessing the lower-level functionalities becomes harder, hence
reducing flexibility in many systems.
o System performance optimization becomes challenging due to the extra
abstractions introduced by the layers, which harden the tuning of
individual parts of the system to make them run more effectively.
o Unless the lower-layer design is lousy or inefficient, the whole system will
suffer since the higher layer depends on them for functionality.
4 MICRO-KERNEL STRUCTURE
The operating system is created using a micro-kernel framework that
strips the kernel of any unnecessary parts. Systems and user applications
are used to implement these optional kernel components. So, Micro-
Kernels is the name given to these systems that have been developed.
The Micro-Kernel Structure minimizes the functions handled by the
kernel, delegating most services to user-level applications. The micro-
kernel itself only handles core functions, such as memory management,
process scheduling, and basic communication between processes.
o By stripping away unnecessary services from the kernel, the system
becomes more secure and reliable. If a service crashes, it doesn’t affect
the entire system.
o Micro-kernels are common in modern OS architectures like macOS and
QNX, as they allow for easier updates and better system resilience.
Advantages of Micro-Kernel Structure:
o The just necessary services running in the kernel ensure that user service
failures don't crash the whole system.
o It isolates the services from the kernel, thus minimizing the possibility of
compromising the system since every service operates independently of
the other.
o Smaller kernels are easier to operate and alter. Hence, updating and bug
fixes are less challenging.
o Services can be added or removed without affecting the kernel. So, this
gives more flexibility while designing the system.
o Due to the small size of the micro-kernel, it can be ported on different
hardware platforms with minimal modification.
Disadvantages of Micro-Kernel Structure:
o The inter-process communication between kernel and user services
introduces additional overhead and hence is slower as compared to the
monolithic approach.
o In a micro-kernel, the separation of services must be done very carefully,
which may complicate the initial development process.
o Context switches are more frequent between user space and kernel space
in this approach; hence, performance would be slower in highly loaded
conditions.
o Due to the complexity and possibly extra performance trade-offs, few
operating systems have been built using the micro-kernel architecture.
o Modular requires more planning and testing in detail; hence, the
development cycle may be longer.

5 REENTRANT KERNELS- In kernel mode, a reentrant kernel allows processes


(or, more precisely, their corresponding kernel threads) to give up the CPU.
They have no effect on other processes entering kernel mode. Multiple
processor systems may be scheduled together in the case of single-processor
systems.
Example:
A disc read is an example of this. When a user program requests a disc read, the
scheduler will delegate the CPU to another process (kernel thread) until the disc
controller issues an interrupt indicating that the data is accessible and our thread
can be resumed. This process can still access I/O, such as user input, which
requires kernel functions. The system remains responsive, and the amount of
CPU time wasted as a result of IO delays is reduced. The original function
(whatever requested data) would be blocked in a non-reentrant kernel until the
disc read was completed.
If a computer program or routine can be safely called again before its previous
invocation has been completed, it is said to be reentrant (i.e it can be safely
executed concurrently). A computer program or routine that is reentrant:
• There cannot be any non-constant data that is static (or global).
• The address must not be returned to static (or global) non-constant data.
• It must only work with the data provided by the caller.
• Locks should not be used to protect singleton resources, a variable that is
only referenced once
• It must not change its own code (unless executing in its own unique thread
storage).
• Non-reentrant computer programs or routines must not be called.

You might also like