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

Unit-1 OS KCS-401

operating system
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)
23 views

Unit-1 OS KCS-401

operating system
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/ 62

Operating Systems

(KCS-401)

Introduction to Operating Systems


(UNIT-1)
Course Instructor:
Mr Deepak Vishwakarma
(Assistant Professor, IT Department, KIET, Ghaziabad)
Operating Systems Syllabus (Unit-1)

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Introduction to Operating Systems
 An operating system is a program that manages a computer’s
hardware.
 It also provides a basis for application programs and acts as an
intermediary between the computer user and the computer
hardware.
 Some operating systems are designed to be convenient (like mobile
OS), others to be efficient (like mainframe OS), and others to be
some combination of the two (like PCs).

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
The components of a computer system

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
OS from two viewpoints (User view & System view)
 User View
 The user’s view of the computer varies according to the interface
being used.
 Some operating system (like in PCs) is designed mostly for ease of
use, with some attention paid to performance and none paid to
resource utilization.
 In other cases, a user sits at a terminal connected to a mainframe
or a minicomputer. operating system in such cases is designed to
maximize resource utilization— to assure that all available CPU
time, memory, and I/O are used efficiently and that no individual
user takes more than her fair share.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
OS from two viewpoints (User view & System view) (Cont.)
 User View
 In still other cases, users sit at workstations connected to networks
of other workstations and servers.
 These users have dedicated resources at their disposal, but they
also share resources such as networking and servers.
 Some computers have little or no user view. For example,
embedded computers in home devices and automobiles may have
numeric keypads and may turn indicator lights on or off to show
status

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
OS from two viewpoints (User view & System view) (Cont.)
 System View
 From the computer’s point of view, the operating system is the
program most intimately involved with the hardware. In this
context, we can view an operating system as a resource allocator.
 A computer system has many resources that may be required to
solve a problem: CPU time, memory space, file-storage space, I/O
devices, and so on. The operating system acts as the manager of
these resources.
 Another view, as a control program, of an operating system
emphasizes the need to control the various I/O devices and user
programs.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Classification of Operating Systems
 Batch Systems
 Interactive Systems
 Batch Interactive
 Time sharing
 Real Time System
 Multiprocessor Systems
 Multiuser Systems
 Multiprocess Systems
 Multithreaded Systems

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Batch Systems
 Batch Processing was introduced to avoid CPU time wastage.
 The primary function of the batch processing system is to
service the jobs in a batch one after another without requiring the
operator intervention.
 This type of operating system does not interact with the computer
directly.
 There is an operator which takes similar jobs having the same
requirement and group them into batches.
 It is the responsibility of the operator to sort jobs with similar
needs.
 Example: IBM OS/360, IBM MVS, IBM z/OS, and Unix/Linux-based
batch systems like CentOS, Ubuntu. OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Interactive Systems:
 An interactive operating system is a type of operating system
that allows users to interact directly with the computer system.
 In an interactive operating system, the user can input commands
and receive feedback immediately.
 This type of operating system is designed for tasks that require
frequent user input or interaction, such as real-time systems,
gaming systems, and personal computers.
 Example: MicrosoftWindows, macOS, Linux, Android, iOS.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Batch Interactive Systems
 Batch Interactive Systems that combine features of both batch and interactive operating
systems.
 These systems allow users to interact with the system during job processing while still running
jobs in batch mode.
 In a batch interactive system, users submit jobs in batches, and the system processes them in
the background while allowing the user to interact with the system through a terminal or
other input/output devices.
 The system can interrupt the job processing to respond to user input and resume processing
when the user's input is complete.
 The key difference between batch interactive systems and pure batch systems is that batch
interactive systems provide some degree of interactivity while still processing jobs in batch
mode, while pure batch systems do not provide any user interaction during job processing.
 UNIX provides a command-line interface that allows users to submit batch jobs and also
provides a shell that enables them to interact with the system during job processing.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Advantages & Disadvantages of Batch Operating System
Advantages
 Multiple users can share the batch systems
 The idle time for the batch system is very less
 It is easy to manage large work repeatedly in batch systems
Disadvantages
 It is very difficult to guess or know the time required for any job to
complete.
 Batch systems are hard to debug
 The other jobs will have to wait for an unknown time if any job
fails
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multiprogramming Operating System
 Multiprogramming OS is an ability of an operating system that
executes more than one program using a single processor machine.
 More than one task or program or jobs are present inside the main
memory at one point of time.
 The OS could pick and start the execution of one of the jobs in
memory.
 Whenever the jobs does not need CPU that means the job is working
with I/O at that time the CPU is idle. At that time the OS switches
to another job in memory and CPU executes a portion of it till the
job issues a request for I/O and so on.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multiprogramming Operating System

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multiprogramming Operating System
 An appropriate measure of performance of a
Multiprogramming Operating System is throughput, which
is the ratio of the number of programs processed and the total time
taken to process them
 To optimize the throughput The kernel keeps a mix of CPU-bound
and I/O-bound programs in memory.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Time-Sharing (Multitasking ) Operating Systems
 Each task is given some time to execute so that all the tasks work
smoothly.
 Each user gets the time of CPU as they use a single system.
 These systems are also known as Multitasking Systems.
 The task can be from a single user or different users also.
 The time that each task gets to execute is called quantum.
 After this time interval is over OS switches over to the next task.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Time-Sharing (Multitasking ) Operating Systems
Advantages:
 Each task gets an equal opportunity
 CPU idle time can be reduced
 Better Resource Sharing
 Improved Productivity: Time-sharing allows users to work
concurrently
 Improved User Experience: Time-sharing provides an interactive
environment that allows users to communicate with the computer in
real-time

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Time-Sharing (Multitasking ) Operating Systems
Disadvantages: (Due to multiple users)
 Reliability problem
 One must have to take care of the integrity of user programs and data
 Data communication problem
 High Overhead
 Complexity
 Security Risks

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Real Time Operating System (RTOS)
 Real-time operating systems (RTOS) are used in environments
where a large number of events, mostly external to the computer
system, must be accepted and processed in a short time or within
certain deadlines.
 The processing in this type of system must occur within the specified
constraints. Otherwise, This will lead to system failure.
 Examples of the real-time operating systems: Airline traffic control
systems, Command Control Systems, Heart Pacemaker, Robot etc.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Real Time Operating System : Types
 Soft Real-Time System
 A soft real-time system is one in which performance is degraded but
not destroyed by failure to meet response-time constraints.
 If several tasks miss deadline, then the performance of the system is
said to have degraded.
 An example of a soft real-time task is web browsing. Normally,
after an URL (Uniform Resource Locater) is clicked, the
corresponding web page is fetched and displayed within a couple of
seconds on the average. However, when it takes several minutes to
display a requested page, we still do not consider the system to have
failed, but merely express that the performance of the system has
degraded. OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Real Time Operating System : Types
 Hard Real-Time operating system
 A hard real-time system is one in which failure to meet even a single
deadline may lead to complete or catastrophic system failure.
 The task deadlines are in the order of micro or milliseconds.
 Many hard real-time systems are safety critical
 Examples: Industrial Control Applications, Robots, Satellite
Launching Application.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Real Time Operating System : Types
 Firm Real-Time operating system
 A firm real-time system is one in which a few missed deadlines
will not lead to total failure, but missing more than a few may
lead to complete or catastrophic system failure.
 Every firm real-time task is associated with some predefined deadline
before which it is required to produce its results.
 Examples: A video conferencing application, Satellite-based
surveillance applications

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multiprocessor operating systems
 Multiprocessor system means, there are more than one processor
which work parallel to perform the required operations.
 It allows the multiple processors, and they are connected with
physical memory, computer buses, clocks, and peripheral devices.
 The main objective of using a multiprocessor operating system is to
increase the execution speed of the system and consume high
computing power.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multiprocessor operating systems: Types
 The different fields of multiprocessor operating systems used are as
follows −
 Asymmetric Multiprocessor − Every processor is given seeded
tasks in this operating system, and the master processor has the
power for running the entire system. In the course, it uses the
master-slave relationship.
 Symmetric Multiprocessor − In this system, every processor
owns a similar copy of the OS, and they can make communication in
between one another. All processors are connected with peering
relationship nature, meaning it won’t be using master & slave
relation.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multithreaded systems
 Multitasking is of two types: Processor based and thread based.
 Processor based multitasking is totally managed by the OS.
 However multitasking through multithreading can be controlled by
the programmer to some extent.
 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.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multithreaded systems
 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.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multi-User Operating System
 A multi-user operating system is an operating system that permits
several users to access a single system running to a single operating
system.
 Users will usually sit at terminals or computers connected to the
system via a network and other system machines like printers.
 A multi-user operating system varies from a connected single-user
operating system in that each user accesses the same operating
system from different machines.
 The main goal of developing a multi-user operating system is to use it
for time-sharing and batch processing on mainframe systems.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Multi-User Operating System: Types
 Distributed System
Collection of multiple components distributed over multiple
computers that interact, coordinate, and seem like a single coherent
system to the end-user.
 Time-Sliced Systems
Each user's job gets a specific amount of CPU time
 Multiprocessor System
If one of the processors in this system fails, the other processor is
responsible for completing its assigned task.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Network Operating System
 An OS, which includes software to communicate with other
computers via a network is called Network Operating System.
 This allows resources such as files, application programs and printers
to be shared between computers. Such OS are specialized to
provide the networking services.
 NOS examples are : BSD (Berkeley System Distribution) UNIX,
Windows NT etc.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Distributed Operating System (DOS)
 Distributed System is a collection of autonomous computer systems
that are physically separated but are connected by a centralized
computer network that is equipped with distributed system software.
 The autonomous computers will communicate among each system
by sharing resources and files and performing the tasks assigned to
them.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Functions of Operating System
 Operating system functions exists for ensuring the
efficient operation of the system itself.
 Resource allocation. When there are multiple users or multiple
jobs running at the same time, resources must be allocated to each of
them. The operating system manages many different types of
resources. For instance, in determining how best to use the CPU,
operating systems have CPU-scheduling routines that take into
account the speed of the CPU, the jobs that must be executed, the
number of registers available, and other factors. There may also be
routines to allocate printers, USB storage drives, and other
peripheral devices.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Functions of Operating System
 Security –
The operating system uses password protection to protect user data
and similar other techniques. it also prevents unauthorized access to
programs and user data.
 Control over system performance –
Monitors overall system health to help improve performance.
records the response time between service requests and system
response to having a complete view of the system health. This can
help improve performance by providing important information
needed to troubleshoot problems.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Functions of Operating System
 Job accounting –
Operating system Keeps track of time and resources used by various
tasks and users, this information can be used to track resource usage
for a particular user or group of users.
 Error detecting aids –
The operating system constantly monitors the system to detect
errors and avoid the malfunctioning of a computer system.
 Coordination between other software and users –
Operating systems also coordinate and assign interpreters,
compilers, assemblers, and other software to the various users of the
computer systems. OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating System Services
 Operating system services provides functions that are helpful to
the user.
 User interface:
 One is a command-line interface (CLI), which uses text commands and a
method for entering them (say, a keyboard for typing in commands in a specific
format with specific options).
 Another is a batch interface, in which commands and directives to control
those commands are entered into files, and those files are executed.
 Graphical user interface (GUI) is a window system with a pointing device to
direct I/O, choose from menus, and make selections and a keyboard to enter
text.
 Some systems provide two or all three of these variations.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating System Services (cont.)
 Program execution. The system must be able to load a program into
memory and to run that program. The program must be able to end its
execution, either normally or abnormally (indicating error).
 I/O operations. A running program may require I/O, which may involve
a file or an I/O device. For efficiency and protection, users usually cannot
control I/O devices directly. Therefore, the operating system must provide
a means to do I/O.
 File-system manipulation. programs need to read and write files and
directories. They also need to create and delete them by name, search for a
given file, and list file information.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating System Services (cont.)
 Communications. There are many circumstances in which one process
needs to exchange information with another process. Such communication
may occur between processes that are executing on the same computer or
between processes that are executing on different computer systems tied
together by a computer network.
 Communications may be implemented via shared memory, in which
two or more processes read and write to a shared section of memory, or
message passing, in which packets of information in predefined formats
are moved between processes by the operating system.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating System Services (cont.)
 Error detection. The operating system needs to be detecting and
correcting errors constantly. Errors may occur in the CPU and memory
hardware (such as a memory error or a power failure), in I/O devices
(such as a parity error on disk, a connection failure on a network, or lack
of paper in the printer), and in the user program (such as an arithmetic
overflow, an attempt to access an illegal memory location, or a too-great
use of CPU time).
 For each type of error, the operating system should take the appropriate
action to ensure correct and consistent computing.
 Sometimes, it has no choice but to halt the system. At other times, it might
terminate an error-causing process or return an error code to a process for
the process to detect and possibly correct.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
System Calls
 System calls provide an interface to the services made available by an
operating system.
 These calls are generally available as routines written in C and C++,
although certain low-level tasks (for example, tasks where hardware must
be accessed directly) may have to be written using assembly-language
instructions.
 An example to illustrate how system calls are used: writing a
simple program to read data from one file and copy them to another file.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
System Calls
 In an interactive system, this approach will require a sequence of system
calls, first to write a prompting message on the screen and then to read
from the keyboard the characters that define the two files.
 On mouse based and icon-based systems, a menu of file names is usually
displayed in a window. The user can then use the mouse to select the source
name, and a window can be opened for the destination name to be
specified.
 This sequence requires many I/O system calls.
 Even simple programs may make heavy use of the operating system.
Frequently, systems execute thousands of system calls per second.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
System Calls (Cont.)
 An example to illustrate how system calls are used: writing a
simple program to read data from one file and copy them to another file.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
System Calls (Cont.)
 The developers don’t prefer directly writing System calls, instead they use
API.
 Typically, application developers design programs according to an
application programming interface (API). The API specifies a set of
functions that are available to an application programmer, including the
parameters that are passed to each function and the return values the
programmer can expect.
 Furthermore, actual system calls can often be more detailed and difficult to
work with than the API available to an application programmer.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of System Calls
 System calls can be grouped roughly into six major categories: process
control, file manipulation, device manipulation, information
maintenance, communications, and protection.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of System Calls

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of System Calls

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
systemcall interface
 For most programming languages, the run-time support system (a set of
functions built into libraries included with a compiler) provides a
systemcall interface that serves as the link to system calls made
available by the operating system.
 The system-call interface intercepts function calls in the API and invokes
the necessary system calls within the operating system.
 Typically, a number is associated with each system call, and the system-call
interface maintains a table indexed according to these numbers.
 The system call interface then invokes the intended system call in the
operating-system kernel and returns the status of the system call and any
return values.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
systemcall interface (cont.)
 The caller need know nothing about how the system call is implemented or
what it does during execution. Rather, the caller need only obey the API
and understand what the operating system will do as a result of the
execution of that system call.
 Thus, most of the details of the operating-system interface are hidden from
the programmer by the API and are managed by the run time support
library.
 The relationship between an API, the system-call interface, and the
operating system is shown in Figure (next slide)…

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
systemcall interface (cont.)

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating-System Operations
 Since the operating system and the users share the
hardware and software resources of the computer system,
we need to make sure that an error in a user program
could cause problems only for the one program running.
 Without protection against different sorts of errors, either
the computer must execute only one process at a time or
all output must be suspect.
 Solution is ‘Dual Mode Operation’.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Dual-Mode Operation
 At the very least, we need two separate modes of operation:
user mode and kernel mode (also called supervisor mode,
system mode, or privileged mode).
 A bit, called the mode bit, is added to the hardware of the
computer to indicate the current mode: kernel (0) or user
(1).
 With the mode bit, we can distinguish between a task that is
executed on behalf of the operating system and one that is
executed on behalf of the user.
 The OS switches between user mode and kernel mode to
fulfill the requests. OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Dual-Mode Operation

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Need of Dual-Mode Operation
 The dual mode of operation provides us with the means
for protecting the operating system from errant users—
and errant users from one another.
 The hardware allows privileged instructions to be
executed only in kernel mode.
 If an attempt is made to execute a privileged instruction
in user mode, the hardware does not execute the
instruction but rather treats it as illegal and traps it to the
operating system.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Kernel of an Operating System
 Kernel is central component of an operating system that manages
operations of computer and hardware.
 Kernel acts as a bridge between applications and data processing
performed at hardware level using inter-process communication
and system calls.
 The kernel also provides a set of system calls, which are used by
programs to request services from the operating system.
 For example, when a program needs to read data from a file, it can
make a system call to the kernel to perform the file input/output
operation on its behalf.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Operating-System Structure: Simple Structure
 Many operating systems started as
small, simple, and limited systems
and then grew beyond their
original scope.
 It was written to provide the most
functionality in the least space, so it
was not carefully divided into
modules.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of Kernel: Monolithic Kernel
 A monolithic kernel is an operating system architecture where the
entire operating system is a single large program, or kernel, that
runs in privileged mode.
 This kernel contains all the necessary functions and services to
manage system resources, such as memory management, process
management, device drivers, and file systems.
 All the system services and device drivers run in the same address
space as the kernel, which makes the system more efficient in
terms of speed and resource utilization.
 However, this also means that a single bug or error in the kernel
can bring down the entire system.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of Kernel: Monolithic Kernel

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Layered Approach
 With proper hardware support,
operating systems can be broken
into pieces that are smaller and
more appropriate than those
allowed by the original MS-DOS
and UNIX systems.
 Layered approach, in which
the operating system is broken
into a number of layers (levels).
The bottom layer (layer 0) is the
hardware; the highest (layer N) is
the user interface.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
More on Layered Approach
 An operating-system layer is an implementation of an abstract object made up of
data and the operations that can manipulate those data.
 A typical operating-system layer—say, layer M—consists of data structures and a
set of routines that can be invoked by higher-level layers. Layer M, in turn, can
invoke operations on lower-level layers.
 Advantages: simplicity of construction and debugging
 Disadvantages: The major difficulty with the layered approach involves
appropriately defining the various layers.
 Because a layer can use only lower-level layers, careful planning is necessary. For
example, the device driver for the backing store (disk space used by virtual-
memory algorithms) must be at a lower level than the memory-management
routines, because memory management requires the ability to use the backing
store.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of Kernel: Micro Kernel
 This method structures the operating system by removing all nonessential
components from the kernel and implementing them as system and user-
level programs.
 Most of the system services and device drivers run in user space, outside the
kernel's address space, which makes the system more modular and easier to
maintain.
 The main function of the microkernel is to provide communication between
the client program and the various services that are also running in user
space.
 Communication is provided through message passing.
 This also provides better isolation between different system components and
makes the system more robust and secure. However, the microkernel
architecture is usually slower and less efficient than a monolithic kernel due
to the overhead of inter-process communication. OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Micro Kernel Architecture

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Types of Kernel: Reentrant Kernel
 A reentrant kernel is a type of operating system kernel that
allows multiple programs or threads to execute concurrently
within the kernel space without interfering with each other.
 In other words, a reentrant kernel can be entered by multiple
processes or threads simultaneously without causing any
conflicts or crashes.
 The term "reentrant" comes from the fact that the kernel code
can be re-entered by multiple processes or threads without
causing any problems.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Example of Reentrant Kernel
 One example of a reentrant kernel is the Linux kernel.
 The Linux kernel allows multiple processes or threads to
execute concurrently within the kernel space without
interfering with each other.
 This is achieved through the use of locks, semaphores, and other
synchronization mechanisms that ensure that shared resources
are accessed in a safe and coordinated manner.

OPERATING SYSTEMS (KCS-401)


(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)
Example of Non-Reentrant Kernel
 An example of a non-reentrant kernel is the original UNIX kernel,
which was a monolithic kernel. In the original UNIX kernel, all
system services and drivers ran in the same address space, and
there was no support for concurrent execution of system calls.
 When a process made a system call in the original UNIX kernel, it
would temporarily halt the execution of all other processes while
it ran the system call.
 Later versions of UNIX, such as System V and BSD, added support
for reentrant system calls, which allowed multiple processes to
make system calls concurrently without interfering with each
other.
OPERATING SYSTEMS (KCS-401)
(Mr Deepak Vishwakarma, Assistant Professor, IT, KIET)

You might also like