Unit 1 OS
Unit 1 OS
V Sem
Subject Code: IT-501
Subject: Operating System
Unit 1
Introduction to Operating Systems
References:
1. Silberschatz ,”Operating system”, Willey Publication
2. Tanenbaum “ Modern Operating System” PHI Learning.
3. Dhamdhere, ”System Programming and Operating System”, TMH.
4. Stuart,” Operating System Principles, Design &Applications”,
Cengage Learning
5. Operating System: Principle and Design by Pabitra Pal Choudhury,
PHI Learning
Most Important topics: -
Operating System: -
a) Introduction with Example
b) Architecture and structure
c) Types in detail
d) Services
e) Protection
f) Evaluation
g) Design and Implementation
System calls and System Boots
Spooling and Buffering
What is Operating System?
• An operating system provides the environment within which programs are executed.
• The operating system keeps several jobs in memory simultaneously.
• In a multiprogrammed system, the operating system simply switches to, and executes another job.
• When that job needs to wait, the CPU switches to another job, and so on.
• Operating System is a Resource Manager.
• It is a Control Program.
• An Operating System (OS) is an interface between a computer user and hardware.
• An operating system is software that performs all the basic tasks like file management, memory
management, process management, input and output, and controlling peripheral devices such as
disk drives and printers.
• Some popular Operating Systems include Linux, Windows, etc.
Operating System Structure or Architecture
1. Simple Structure
2. Monolithic Structure
3. Layered Structure
4. Micro-Kernel Structure
5. Modules Structure
6. Hybrid Structure
Simple Structure
• Do not have well-defined structure
• These are small, simple, and limited systems.
• Example-MS-DOS operating system has four layers- ROM BIOS device drivers,
MS-DOS device drivers, application programs, and system programs.
Advantages-
Each level can be defined independently and, when necessary, can interact with
one another.
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.
Disadvantages-
When a user program fails, the operating system as whole crashes.
Layers are interconnected, and in communication with one another, there is no
abstraction or data hiding.
The operating system's operations are accessible to layers, which can result in
data tampering and system failure.
Monolithic Structure
The Monolithic operating System in which the kernel acts as a manager by
managing all things like file management, management, device management, and
memory management, operational processes of the Operating System.
The kernel(Kernel is a central component of an operating system that manages
operations of computer and hardware) is the heart of a computer operating
system (OS). Kernel delivers basic services to all other elements of the System. It
serves as the primary interface between the Operating System and the hardware
Advantages -
•Layering is unnecessary and the kernel alone is responsible for managing all
operations, it is easy to design and execute.
Disadvantages-
The monolithic kernel's services are interconnected in one address space and
have an impact on one another, so if any of them malfunctions, the entire system
does as well.
It is not adaptable. Therefore, launching a new service is difficult.
Layered Structure
The operating system is divided into a number of layers (levels), each built on
top of lower layers. The bottom. layer (layer 0), is the hardware; the highest
(layer N) is the user interface.
The operations (routines) can be invoked by higher-level layers. The layer itself
can invoke operations on lower-level layers.
Advantages-
Layered approach provides modularity. With modularity, layers are selected such
that each layer uses functions (operations) and services of only lower-level
layers.
Debugging is easier as lower layers are debugged, and then upper layers are
checked.
Disadvantages-
It takes careful planning to construct the layers since higher layers only utilize
the functions of lower layers.
Micro-Kernel Structure
• Kernel using microkernel approach (smaller kernels) remove all non
essential components from the kernel and implements them as a
system user and level programs
Advantages:-
• Each micro kernel is made immediately and is isolated from other
microkernels. so this makes the system more secure and reliable.
• If any micro kernels fails then the remaining operating system remains
untouched and works fine.
Disadvantages:-
• Increase the inter-module communication reduces the system
performance /system overhead system.
• System is a complex to be constructed
Modules Structure
• The Kernel has only a set of core components and other services are added as
dynamically loadable modules to the kernel either during runtime or boot
time.
• A layer can communicate with others with the help of a kernel.
• This type of design is common in modern implementations of UNIX, such as
Solaris, Linux, and Mac OS X, as well as Windows.
Advantages −
• Efficient
• Easy to maintain
• Easy to debug and update
Disadvantages −
• It may lose stability
• Less security
Hybrid Structure
In practice, very few operating systems adopt a single, strictly defined
structure. Instead, they combine different structures, resulting in hybrid
systems that address performance, security, and usability issues. For
example, both Linux and Solaris are monolithic, because having the
operating system in a single address space provides very efficient
performance.
Examples of hybrid systems: the Apple Mac OS X operating system and
mobile operating systems—iOS and Android.
Types Of Operating System
• Batch Operating System
• Multi-Programming System
• Multi-Processing System
• Multi-Tasking Operating System
• Time-Sharing Operating System
• Distributed Operating System
• Network Operating System
• Real-Time Operating System
Batch Operating System
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 groups them
into batches. It is the
responsibility of the operator
to sort jobs with similar needs.
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 sometimes costly.
• The other jobs will have to wait for an unknown time if any job fails.
• It is very hard to debug the system in case of an error.
Example:-Payroll Systems(a software application businesses used to
manage and automate the process of paying employees), Bank
Statements, etc.
Multi-Programming 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 execution of other
processes. Therefore, multiprogramming
improves the efficiency of the system.
Advantages:-
• Throughout the system, it increased as the CPU always had one
program to execute.
• Response time can also be reduced.
Disadvantages:-
• There is not any facility for user interaction of system resources with
the system
Multi-Processing System
In Multiprocessing, Parallel
computing is achieved.
There is more than one
processor in the system
which can execute more
than one process
simultaneously. This will
increase the system's
throughput(the amount of
work completed in a unit of
time).
Advantages:-
• It increases the throughput of the system.
• As it has several processors if one processor fails, we can proceed with
another.
Disadvantages:-
• Due to the multiple CPU, it can be more complex and somehow
difficult to understand.
Types Of Multi-Processing System
• Symmetrical multiprocessing operating system
• Asymmetric multiprocessing operating system
Symmetrical multiprocessing operating
system
• The symmetric multiprocessing operating system is also known as a
"shared everything" system because the processors share memory and
the Input output bus or data path.
• Each processor executes the same copy of the operating system, takes
its own decisions, and cooperates with other processes to smooth the
entire functioning of the system.
• Any new job submitted by a user can be assigned to any processor that
is least burdened. It also results in a system in which all processors are
equally burdened at any time.
Advantages:-
• Failure of a few processors does not bring the entire
system.
Disadvantages:-
• It is very difficult to balance the workload among
processors rationally.
Asymmetric multiprocessing operating
system
• In an asymmetric multiprocessing system, there is a master-slave
relationship between the processors.
• In the figure, the asymmetric processing system shows that CPU n1
acts as a supervisor whose function controls other following
processors.
• In this type of system, each processor is assigned a specific task, and
there is a designated master processor that controls the activities of
other processors.
Advantages:-
• In this type of system execution of Input and Output operation or an
application program may be faster in some situations because many
processors may be available for a single job.
Disadvantages:-
• In this type of multiprocessing operating system the processors are
unequally burdened. One processor may be having a long job queue,
while another one may be sitting idle.
• In this system, if the process handling a specific work fails, the entire
system will go down.
Multi-Tasking Operating System
The multitasking operating
system is a logical extension
of a multiprogramming
system that
enables multiple programs
simultaneously. It allows a
user to perform more than
one computer task at the same
time.
Advantages:-
• This operating system is more suited to supporting multiple users
simultaneously.
• The multitasking operating systems have well-defined memory
management.
Disadvantages:-
• The multiple processors are busier at the same time to complete any
task in a multitasking environment, so the CPU generates more heat.
Types of Multi-Tasking Operating System
• Pre-emptive Multi-Tasking Operating System:- The operating system
allows stopping the execution of the currently running process and
allocating the CPU to some other process.
Disadvantages:-
• Data transmission rates are very high in comparison to other methods.
• Security and integrity of user programs loaded in memory and data
need to be maintained as many users access the system at the same
time.
Distributed Operating System
•With resource sharing facility, a user at
one site may be able to use the resources
available at another.
•Speedup the exchange of data with one
another via electronic mail.
•If one site fails in a distributed system,
the remaining sites can potentially
continue operating.
•Better service to the customers.
•Reduction of the load on the host
computer.
•Reduction of delays in data processing.
Network Operating System
A Network Operating System runs
on a server and provides the server
the capability to manage data, users,
groups, security, applications, and
other networking functions.
Disadvantages:-
• High cost of buying and running a server.
• Dependency on a central location for most operations.
• Regular maintenance and updates are required.
Real-Time Operating System
In Real-Time Systems, each job
carries a certain deadline within which
the job is supposed to be completed,
otherwise, the huge loss will be there,
or even if the result is produced, it will
be completely useless.
The Application of a Real-Time
system exists in the case of military
applications, if you want to drop a
missile, then the missile is supposed to
be dropped with a certain precision.
Advantages
• Easy to layout, develop and execute real-time applications under the
real-time operating system.
• In a Real-time operating system, the maximum utilization of devices
and systems.
Disadvantages:-
• Real-time operating systems are very costly to develop.
• Real-time operating systems are very complex and can consume
critical CPU cycles.
Services
1. User interface
2. Program execution
3. I/O operations
4. File-system manipulation
5. Communications
6. Error detection
7. Resource allocation
8. Accounting
9. Protection and security
1. User interface:-
• Almost all operating systems have a user interface (UI) in several
forms.
• One is a command-line interface (CLI), which uses text commands
and a method for entering them.
• Another is a batch interface, in which commands and directives to
control those commands are entered into files, and those files are
executed.
• Most commonly, a graphical user interface (GUI) is used. Here, the
interface is a window system with a pointing device to direct I/O,
choose from menus, and make selections and a keyboard to enter text.
2. 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).
3. 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
4. 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.
5. Communications:-
• 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
6. Error detection:-
• 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.
7. Resource allocation:-
• When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them.
• 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.
8. Accounting:-
• 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.
9. Protection and security:-
• Protection involves ensuring that all access to system resources is
controlled. Security of the system from outsiders is also important.
• Such security starts with requiring each user to authenticate himself or
herself to the system, usually by means of a password, to gain access
to system resources.
Protection
• Computer systems contain many objects that must be protected from misuse.
• Objects may be hardware (such as memory, CPU time, and I/O devices) or software
(such as files, programs, etc.).
• The access matrix is a general model of protection that provides a mechanism for
protection without imposing a particular protection policy on the system or its users.
• UNIX is representative, providing read, write, and execution protection separately
for each file's owner, group, and general public.
• MULTICS(Multics, also known as Multiplexed Information and Computing Service,
was a time-sharing operating system developed by MIT, General Electric, and Bell
Labs, first released in 1964.) uses a ring structure in addition to file access.
• Mach are capability systems that extend protection to user-defined software objects.
• Language-based protection, For example, a single Java JVM can run several threads,
each in a different protection class.
Security
1. Authorization: After authentication, authorization determines what actions a user or process is
allowed to perform. It ensures that users only have access to the resources they are entitled to
access.
2. Encryption: Encryption transforms data into a format that can only be read by authorized entities.
It ensures data confidentiality, even if intercepted during transmission.
3. Firewalls: Firewalls monitor network traffic and enforce rules to control incoming and outgoing
communication. They protect against unauthorized access and potential cyberattacks.
4. Intrusion Detection and Prevention Systems (IDPS): IDPS monitor system activity for signs of
potential security breaches or unauthorized activities. They can raise alarms or take automated
actions to mitigate attacks.
5. Antivirus and Antimalware: These software tools detect, prevent, and remove malicious
software to ensure system integrity and protect against malware-based attacks.
6. Security Updates and Patches: Regularly updating the operating system and applications with
security patches helps fix known vulnerabilities and weaknesses, reducing the risk of exploitation
7. Authentication: The process of verifying the identity of users, devices, or processes attempting to
access the system. This can involve passwords, biometric methods, or multi-factor authentication
Evaluation
• The evaluation process involves comparing different operating systems based on these
criteria and aligning them with the specific needs and goals of the organization or user.
• Performance:
Throughput: Measure how many tasks the system can handle simultaneously.
Response Time.
Resource Utilization.
• Security.
• User Interface.
• Resource Management.
• Licensing and Cost.
• Maintenance and Updates.
• Future Growth and Development.
Design and Implementation
• The first problem in designing a system is to define goals and specifications.
• The requirements can, however, be divided into two basic groups: user goals and system goals.
• Once an operating system is designed, it must be implemented.
• Earlier they were written in assembly language, but now higher-level languages are used.
• Advantages of Higher-Level Language
There are multiple advantages to implementing an operating system using a higher-level language
such as the code being written faster; it is compact and easier to debug and understand. Also, the
operating system can be easily moved from one hardware to another if it is written in a high-level
language
• Disadvantages of Higher-Level Language
Using high-level language for implementing an operating system leads to a loss in speed and
increase in storage requirements. However, in modern systems, only a small amount of code is
needed for high performance, such as the CPU scheduler and memory manager. Also, the bottleneck
routines in the system can be replaced by assembly language equivalents if required.
System calls and System Boots
•System Call
When a program in user mode requires access to RAM or a hardware resource, it must
ask the kernel to provide access to that resource. This is done via something called a system
call.
When a program makes a system call, the mode is switched from user mode to kernel
mode. This is called a
context switch.
Then the kernel provides the resource which the program requested. After that, another
context switching happens which results in change of mode from kernel mode back to user
mode.
Generally, system calls are made by the user level programs in the following situations:
Creating, opening, closing and deleting files in the file system.
Creating and managing new processes.
Creating a connection in the network, sending and receiving packets.
Requesting access to a hardware device, like a mouse or a printer.
•System Boot
Booting the system is done by loading the kernel into main memory and
starting its execution.
The CPU is given a reset event, and the instruction register is loaded with
a predefined memory location, where execution starts.
o The initial bootstrap program is found in the BIOS read-only memory.
o This program can run diagnostics, initialize all components of the system,
loads and starts the Operating System loader. (Called bootstrapping)
o The loader program loads and starts the operating system.
o When the Operating system starts, it sets up needed data structures in
memory, sets several registers in the CPU, and then creates and starts the
first user-level program. From this point, the operating system only runs
in response to interrupts.
Spooling and Buffering
• Spooling refers to Simultaneous Peripheral Operation Online.
• In spooling more than one I/O operation can be performed
simultaneously such as at the time when the CPU is Executing some
process then more than one I/O operation can also be done at the same
time.
• Spooling refers to putting data of various I/O Jobs in a buffer. This
buffer is a special area in memory or hard disk that is accessible to I/O
devices.
• Advantage of spooling
• Since there is no interaction of I/O devices with the CPU, the CPU
need not wait for the IO operation to take place. The IO operation
takes a large amount of time.
• The CPU is kept busy most of the time and hence it is not in the idle
state which is good to have a situation.
• More than one IO devices can work simultaneously.
• The Spooling operation uses a disk as a very large buffer.
Features Spooling Buffering
Definition A spooling is a type of buffer that holds the Buffering is the act of temporarily storing
jobs for a system until the system is ready data in a buffer. The buffer is a part of the
to accept the jobs. main memory used to temporarily store or
hold data sent between two devices.
Resources Requirement Spooling needs less resource management It needs greater resource management
than buffering because various resources because the same resource handles the
control the process for different jobs. process of the same divided job.
Size It considers the disk as a large spool or Buffer is a limited area in the main
buffer. memory.
Usage It helps in the exchange of data between It helps in adapting to speed differences
devices with various data access rates. between producers and consumers of data
streams.
Thank You!