Introduction
Operating System lies in the category of system
software. It basically manages all the resources of
the computer. An operating system acts as an
interface between the software and different parts
of the computer or the computer hardware. The
operating system is designed in such a way that it
can manage the overall resources and operations
of the computer.
An Operating System can be defined as an interface
between user and hardware. It is responsible for the
execution of all the processes, Resource
Allocation, CPU management, File Management and many
other tasks.
The purpose of an operating system is to provide an
environment in which a user can execute programs in
convenient and efficient manner.
Structure of a Computer System
Objectives of Operating System
The main objective of operating systems is
to make computers and other devices
easier for us to use. The OS can deliver
greater convenience, productivity, and ease
of use by providing a user interface that
allows us to interact with our hardware and
software.
The objectives of the operating system, are mentioned below:-
•Convenient to use: One of the objectives is to make the computer
system more convenient to use in an efficient manner.
•User Friendly: To make the computer system more interactive
with a more convenient interface for the users.
•Easy Access: To provide easy access to users for using resources
by acting as an intermediary between the hardware and its users.
•Management of Resources: For managing the resources of a
computer in a better and faster way.
•Controls and Monitoring: By keeping track of who is using
which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
•Fair Sharing of Resources: Providing efficient and fair sharing
of resources between the users and programs.
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.
•Job Accounting: It keeps track of time and resources used by various
jobs or users.
•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.
•Backup and Recovery: The operating system provides mechanisms
for backing up data and recovering it in case of system failures, errors,
or disasters.
•Virtualization: The operating system provides virtualization capabilities that allow
multiple operating systems or applications to run on a single physical machine. This
can enable efficient use of resources and flexibility in managing workloads.
•Performance Monitoring: The operating system provides tools for monitoring and
optimizing system performance, including identifying bottlenecks, optimizing resource
usage, and analyzing system logs and metrics.
•Time-Sharing: The operating system enables multiple users to share a computer
system and its resources simultaneously by providing time-sharing mechanisms that
allocate resources fairly and efficiently.
•System Calls: The operating system provides a set of system calls that enable
applications to interact with the operating system and access its resources. System
calls provide a standardized interface between applications and the operating system,
enabling portability and compatibility across different hardware and software
platforms.
•Error-detecting Aids: These contain methods that include the production of dumps,
traces, error messages, and other debugging and error-detecting methods.
Examples of Operating Systems
•Windows (GUI-based, PC)
•GNU/Linux (Personal, Workstations, ISP, File,
and print server, Three-tier client/Server)
•macOS (Macintosh), used for Apple’s personal
computers and workstations (MacBook, iMac).
•Android (Google’s Operating System for
smartphones/tablets/smartwatches)
•iOS (Apple’s OS for iPhone, iPad, and iPod
Touch)
Evolution of OS
Evolution of an OS from simple Batch
processing to today’s OS-
– Batch Operating System
– Multiprogramming Operating System
– Time Sharing
– Real-Time Systems
– Distributed Operating System
OS Class Period Prime Concern Key Concept
Batch Processing 1960s CPU idle time Automated transition
between jobs
Multiprograming 1960s Resource utilization Program priorities,
preemption
Time Sharing 1970s Good response time Time slice, round-
robin scheduling
Real Time 1980s Meeting time Real time
scheduling
constraints
Distributed 1990s Resource sharing Distributed control
transparency
Types of Operating Systems (OS)
Batch Operating System
In this technique, similar types of jobs were batched together and
executed in time. In Batch operating system, access is given to
more than one person; they submit their respective jobs to the
system for the execution.
The system put all of the jobs in a queue on the basis of first come
first serve and then executes the jobs one by one. The users collect
their respective output when all the jobs get executed.
Advantages of Batch Operating System
•Processors of the batch systems know how
long the job would be when it is in the
queue.
•Multiple users can share the batch systems.
•It is easy to manage large work repeatedly
in batch systems.
Disadvantages of Batch OS
• Batch processing suffers from starvation. jobs will
never be executed, or they will have to wait for a
very long time.
• Batch Processing is not suitable for jobs that are
dependent on the user's input. If a job requires the
input of two numbers from the console, then it will
never get it in the batch processing scenario since
the user is not present at the time of execution.
• Batch systems are hard to debug.
Multiprogramming Operating System
Multiprogramming is an extension to batch
processing where the CPU is always kept busy.
Each process needs two types of system time:
CPU time and IO time.
In a multiprogramming environment, when a
process does its I/O, The CPU can start the
execution of other processes. Therefore,
multiprogramming improves the efficiency of the
system.
More than one program is present in the main memory
and any one of them can be kept in execution. This is
basically used for better execution of resources.
• Multiprogramming is a technique to execute number
of programs simultaneously by a single processor.
• In Multiprogramming, number of processes reside in
main memory at a time.
• The OS picks and begins to executes one of the jobs
in the main memory.
• If any I/O wait happened in a process, then CPU
switches from that job to another job. Hence CPU in
not idle at any time.
Advantages of Multi-Programming Operating
System
•Multi Programming increases the Throughput of the
System.
•It helps in reducing the response time.
Disadvantages of Multi-Programming Operating
System
•There is not any facility for user interaction of system
resources with the system.
Time-Sharing Operating Systems
• Time sharing, or multitasking, is a logical
extension of multiprogramming.
• Multiple jobs are executed by switching the
CPU between them.
• In this, the CPU time is shared by different
processes, so it is called as “Time sharing
Systems”.
• Time slice is defined by the OS, for sharing
CPU time between processes.
• Each task is given some time to execute so that all
the tasks work smoothly.
• Each user gets the time of the 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.
Advantages of Time-Sharing OS
•Each task gets an equal opportunity.
•Fewer chances of duplication of software.
•CPU idle time can be reduced.
•Resource Sharing: Time-sharing systems allow multiple
users to share hardware resources such as the CPU, memory,
and peripherals, reducing the cost of hardware and increasing
efficiency.
•Improved Productivity: Time-sharing allows users to work
concurrently, thereby reducing the waiting time for their turn
to use the computer. This increased productivity translates to
more work getting done in less time.
•Improved User Experience: Time-sharing provides an
interactive environment that allows users to communicate with
the computer in real time, providing a better user experience
than batch processing.
Disadvantages of Time-Sharing OS
•Reliability problem.
•One must have to take care of the security and integrity of user
programs and data.
•Data communication problem.
•High Overhead: Time-sharing systems have a higher overhead than
other operating systems due to the need for scheduling, context
switching, and other overheads that come with supporting multiple
users.
•Complexity: Time-sharing systems are complex and require
advanced software to manage multiple users simultaneously. This
complexity increases the chance of bugs and errors.
•Security Risks: With multiple users sharing resources, the risk of
security breaches increases. Time-sharing systems require careful
management of user access, authentication, and authorization to
ensure the security of data and software.
Real-Time Operating System
A real time operating system is the type of system which
uses maximum time and resources to output exact and on
the time result. There is no difference between the results
when same problem run on different occasion on same
machine. There is no late or early execution on that
operating system and is done on fixed time as suggested.
RTOS is used for automatic system for example the robots
machines that are manufacturing cars. Also RTOS are used
in aircrafts i.e. during launch of aircraft on space and
landing of aircraft. Also the other tasks and operation done
by aircraft on space is controlled by the RTOS.
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.
Types of RTOS:-
1. Soft RTOS is a type of system which is less strict to time and
accuracy.
2. Hard RTOS is another type which show exact execution time
and exact output and results on required time.
3. Firm RTOS: Missing a dead line might result in an
unacceptable quality reduction but may not lead to failure of the
complete system
Advantages of RTOS
•Maximum Consumption: Maximum utilization of devices and
systems, thus more output from all the resources.
•Task Shifting: The time assigned for shifting tasks in these systems
is very less. For example, in older systems, it takes about 10
microseconds in shifting from one task to another, and in the latest
systems, it takes 3 microseconds.
•Focus on Application: Focus on running applications and less
importance on applications that are in the queue.
•Real-time operating system in the embedded system: Since the size
of programs is small, RTOS can also be used in 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 of RTOS
•Limited Tasks: Very few tasks run at the same time and
their concentration is very less on a 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 signal to respond earliest to
interrupts.
•Thread Priority: It is not good to set thread priority as
these systems are very less prone to switching tasks.
Distributed Operating System
• A distributed computer system is a collection of
autonomous computer systems capable of
communication and cooperation via their H/w and S/w
interconnection.
• The distributed operating system provides a illusion to
its users that it has a single uniprocessor system,
although it is actually consisted of multiprocessors.
• Distributed OS provide the means for system-wide
sharing of resources such as computational capacity,
files and I/O devices.
Advantages of Distributed Operating System
•Failure of one will not affect the other network
communication, as all systems are independent of each
other.
•Since resources are being shared, computation is highly
fast and durable.
•Load on host computer reduces.
•These systems are easily scalable as many systems can
be easily added to the network.
•Delay in data processing reduces.
Disadvantages of Distributed Operating System
•Failure of the main network will stop the entire
communication.
•Software: difficult to develop software for distributed
systems
•Network: saturation, lossy transmissions
• Security: easy access also applies to secrete data
•These types of systems are not readily available as they
are very expensive. Not only that the underlying
software is highly complex and not understood well yet.
Multiprocessor OS
Multiprocessor Operating System refers to the use
of two or more central processing units (CPU)
within a single computer system. These multiple
CPUs are in a close communication sharing the
computer bus, memory and other peripheral devices.
These systems are referred as tightly coupled
systems. These types of systems are used when very
high speed is required to process a large volume of
data. These systems are generally used in
environment like satellite control, weather
forecasting etc.
Multiprocessing system is based on the symmetric
multiprocessing model, in which each processor runs an
identical copy of operating system and these copies
communicate with each other. In this system processor is
assigned a specific task. A master processor controls the
system. This scheme defines a master-slave relationship.
These systems can save money in compare to single
processor systems because the processors can share
peripherals, power supplies and other devices. The main
advantage of multiprocessor system is to get more work
done in a shorter period of time. Moreover, multiprocessor
systems prove more reliable in the situations of failure of
one processor. In this situation, the system with
multiprocessor will not halt the system; it will only slow it
Advantages of Multi-Processing Operating
System
•It increases the throughput of the system.
•As it has several processors, so, if one processor
fails, we can proceed with another processor.
Disadvantages of Multi-Processing Operating
System
•Due to the multiple CPU, it can be more complex
and somehow difficult to understand.
Difference between Multiprocessing and Multiprogramming:
Multiprocessing Multiprogramming
• The availability of more than one • The concurrent application of more
processor per system, that can than one program in the main
execute several set of instructions in memory is known as
parallel is known as multiprocessing. multiprogramming.
• The number of CPU is more than
• The number of CPUs is one.
one.
• It takes less time for job processing. • It takes more time to process the jobs.
• In this, more than one process can be • In this, one process can be executed
executed at a time. at a time.
• It is tightly couped .sychronization is
• No sychronization is there
there in multiprocessing.
• The number of users is can be one or
• The number of users is one at a time.
more than one.
• Throughput is maximum. • Throughput is less.
• Its efficiency is maximum.
• Its efficiency is Less.
Network Operating System
An Operating system, which includes software and associated
protocols to communicate with other computers via a network
conveniently and cost-effectively, is called Network Operating
System.
Advantages of Network Operating System
•In this type of operating system, network traffic reduces
due to the division between clients and the server.
•This type of system is less expensive to set up and
maintain.
Disadvantages of Network Operating System
•In this type of operating system, the failure of any node
in a system affects the whole system.
•Security and performance are important issues. So
trained network administrators are required for network
administration.
Operating System structure
The structure of OS consists of 4 layers:
1. Hardware:- Hardware consists of CPU, Main
memory, I/O Devices, etc,
2. Software (Operating System):- Software
includes process management routines, memory
management routines, I/O control routines, file
management routines.
3. System programs:- This layer consists of
compilers, Assemblers, linker etc.
4. Application programs:- This is dependent on
users need. Ex. Railway reservation system, Bank
Services Provided by OS
An OS provides an environment for the execution
of programs. It provides certain services to
programs and to the users of these programs.
• Program Execution
• I/O Operations
• File-System Manipulation
• Communications
• Error Detection
Program Execution
• The OS 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.
I/O Operations
• When a program is running it may require I/O. This I/O may
involve a file or an I/O device. A user usually cannot control I/O
devices directly. Therefore the OS system must provide a means to
do I/O.
File – System Manipulation
• Programs need to read and write files, programs also need to create
and delete files by name.
Communications
• Sometimes one process needs to exchange information with
another process. Such communication can occur in two major
ways. The first takes place between processes that are executing
on the same computer. The second takes place between process
that are executing on different system that are tied together by a
computer network.
Error Detection
• The OS constantly needs to be aware of possible errors. Errors
may be in the CPU and memory hardware, in I/O devices and in
the user program. For each type of error, the OS should take the
appropriate action to ensure correct and consistent computing.
System Program and System calls
System Calls provide the Interface
between a process and the Operating
System. In other words they are
programing interface to the services
provided by OS.
• These calls are generally available as
Assembly language instruction.
System call is the programmatic way in which a
computer program requests a service from the
kernel of the operating system it is executed on.
This may include hardware-related services (for
example, accessing a hard disk drive), creation
and execution of new processes, and
communication with integral kernel services
such as process scheduling. Modern operating
system execute thousands of system calls per
second.
System call implementation
Programming languages provides a system call
interface that serves as the link to system calls
made available by OS. System call interface
intercepts function calls in the API and invokes
the necessary system call within the OS. System
call interface maintains a table indexed according
to the numbers associated with each system call.
The system call interface invokes intended
system calls in OS kernel and return the status of
system call and return values.
Categories of System Calls
System calls can be grouped into five major categories
as follows:-
• Process control
• File management.
• Device management
• Information Maintenance and
• Communication.
Process control
Some system calls under process control
are:
• abort
• Load, execute
• Create process, terminate process
• Get process attribute, Set process attribute
• Wait for time
• Allocate and free memory
File management
Some system calls under file management
are:
• Create file, delete file
• Open , close
• Read, write.
• Get file attributes, set file attributes
Device management
Some system calls under device management
are:
• Request Device, release device
• Read, write.
• Get device attributes and set device
attributes
• Logically attach or detach devices
Information Maintenance
Some system calls under information maintenance
are:
• Get time or date, Set time or date
• Logically attach or detach devices
• Information maintenance
• Get system data, Set Systems data
• Get process, file or device attributes
• Set process, file or device attributes
Communication
• Create, delete communication
connection.
• Send, receive messages
• Transfer status information
• Attach or detach remote devices.
System Programs
System programs provide basic functioning
to users so that they do not need to write
their own environment for program
development (editors, compilers) and
program execution (shells). In some sense,
they are bundles of useful system calls