0% found this document useful (0 votes)
13 views46 pages

Unit 1 OS

Uploaded by

Vedika Patil
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)
13 views46 pages

Unit 1 OS

Uploaded by

Vedika Patil
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/ 46

Unit -1

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.
Operating System is a fully integrated set of specialized programs that handle all the
operations of the computer. It 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, Mac
OS, etc.
An Operating System (OS) is a collection of software that manages computer hardware
resources and provides common services for computer programs. The operating system
is the most important type of system software in a computer system.
Why Use an Operating System?
The operating system helps in impro
improving
ving the computer software as well as hardware.
Without OS, it became very difficult for any application to be user
user-friendly.
friendly. Operating
System provides a user with an interface that makes any application attractive and user-
user
friendly. The operating System ccomes
omes with a large number of device drivers that makes
OS services reachable to the hardware environment. Each and every application present
in the system requires the Operating System. The operating system works as a
communication channel between system ha hardware
rdware and system software. The operating
system helps interact an application with the hardware part without knowing about the
actual hardware configuration. It is one of the most important parts of the system and
hence it is present in every device, whet
whether large or small device.

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.
Objectives of Operating Systems
Let us now see some of the objectives of the operating system, which 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.

Services of Operating System


1. Program execution
2. Input Output Operations
3. Communication between Process
4. File Management
5. Memory Management
6. Process Management
7. Secuirity and Privacy
8. Resource Management
9. User Interface
10. Networking
11. Error handling
12. Time Management
Program Execution
It is the Operating System that manages how a program is going to be executed. It loads
the program into the memory after which it is executed. The order in which they are
executed depends on the CPU Scheduling Algorithms. A few are FCFS, SJF, etc. When
the program is in execution, the Operating System also handles deadlock i.e. no two
processes come for execution at the same time. The Operating System is responsible for
the smooth execution of both user and system programs. The Operating System utilizes
various resources available for the efficient running of all types of functionalities.
Input Output Operations
Operating System manages the input-output operations and establishes communication
between the user and device drivers. Device drivers are software that is associated with
hardware that is being managed by the OS so that the sync between the devices works
properly. It also provides access to input-output devices to a program when needed.
Communication between Processes
The Operating system manages the communication between processes. Communication
between processes includes data transfer among them. If the processes are not on the
same computer but connected through a computer network, then also their
communication is managed by the Operating System itself.
File Management
The operating system helps in managing files also. If a program needs access to a file, it
is the operating system that grants access. These permissions include read-only, read-
write, etc. It also provides a platform for the user to create, and delete files. The
Operating System is responsible for making decisions regarding the storage of all types
of data or files, i.e, floppy disk/hard disk/pen drive, etc. The Operating System decides
how the data should be manipulated and stored.
Memory Management
Let’s understand memory management by OS in simple way. Imagine a cricket team
with limited number of player . The team manager (OS) decide whether the upcoming
player will be in playing 11 ,playing 15 or will not be included in team , based on his
performance . In the same way, OS first check whether the upcoming program fulfill all
requirement to get memory space or not ,if all things good, it checks how much
memory space will be sufficient for program and then load the program into memory at
certain location. And thus , it prevents program from using unnecessary memory.
Process Management
Let’s understand the process management in unique way. Imagine, our kitchen stove as
the (CPU) where all cooking(execution) is really happen and chef as the (OS) who uses
kitchen-stove(CPU) to cook different dishes(program). The chef(OS) has to cook
different dishes(programs) so he ensure that any particular dish(program) does not take
long time(unnecessary time) and all dishes(programs) gets a chance to
cooked(execution) .The chef(OS) basically scheduled time for all dishes(programs) to
run kitchen(all the system) smoothly and thus cooked(execute) all the different
dishes(programs) efficiently.
Security and Privacy
 Security : OS keep our computer safe from an un-authorized user by adding security
layer to it. Basically, Security is nothing but just a layer of protection which protect
computer from bad guys like viruses and hackers. OS provide us defenses like
firewalls and anti-virus software and ensure good safety of computer and personal
information.
 Privacy : OS give us facility to keep our essential information hidden like having a
lock on our door, where only you can enter and other are not allowed . Basically , it
respect our secrets and provide us facility to keep it safe.
Resource Management
System resources are shared between various processes. It is the Operating system that
manages resource sharing. It also manages the CPU time among processes using CPU
Scheduling Algorithms. It also helps in the memory management of the system. It also
controls input-output devices. The OS also ensures the proper use of all the resources
available by deciding which resource to be used by whom.
User Interface
User interface is essential and all operating systems provide it. Users either interface
with the operating system through the command-line interface or graphical user
interface or GUI. The command interpreter executes the next user-specified command.
A GUI offers the user a mouse-based window and menu system as an interface.
Networking
This service enables communication between devices on a network, such as connecting
to the internet, sending and receiving data packets, and managing network connections.
Error Handling
The Operating System also handles the error occurring in the CPU, in Input-Output
devices, etc. It also ensures that an error does not occur frequently and fixes the errors.
It also prevents the process from coming to a deadlock. It also looks for any type of
error or bugs that can occur while any task. The well-secured OS sometimes also acts as
a countermeasure for preventing any sort of breach of the Computer System from any
external source and probably handling them.
Time Management
Imagine traffic light as (OS), which indicates all the cars(programs) whether it should
be stop(red)=>(simple queue) , start(yellow)=>(ready queue),move(green)=>(under
execution) and this light (control) changes after a certain interval of time at each side of
the road(computer system) so that the cars(program) from all side of road move
smoothly without traffic.

Evolution of Operating Systems

Operating Systems have evolved in past years. It went through several changes before
getting its original form. These changes in the operating system are known as
the evolution of operating systems.OS improve itself with the invention of new
technology. Basically , OS added the feature of new technology and making itself more
powerful. Let us see the evolution of operating system year-wise in detail:
No OS – (0s to 1940s) –
As we know that before 1940s, there was no use of OS . Earlier, people are lacking OS
in their computer system so they had to manually type instructions for each tasks in
machine language(0-1 based language) . And at that time , it was very hard for users to
implement even a simple task. And it was very time consuming and also not user-
friendly . Because not everyone had that much level of understanding to understand the
maching language and it required a deep understanding.
Batch Processing Systems -(1940s to 1950s):
With the growth of time, batch processing system came into the market .Now Users had
facility to write their programs on punch cards and load it to the computer operator.
And then operator make different batches of similar types of jobs and then serve the
different batch(group of jobs) one by one to the CPU .CPU first executes jobs of one
batch and them jump to the jobs of other batch in a sequence manner.
Multiprogramming Systems -(1950s to 1960s) :
Multiprogramming was the first operating system where actual revolution began.It
provide user facility to load the multiple program into the memory and provide a
specific portion of memory to each program. When one program is waiting for any I/O
operations (which take much time) at that time the OS give permission to CPU to
switch from previous program to other program(which is first in ready queue) for
continuos execution of program with interrupt.
Time-Sharing Systems -(1960s to 1970s)
Time-sharing systems is extended version of multiprogramming system. Here one extra
feature was added to avoid the use of CPU for long time by any single program and
give access of CPU to every program after a certain interval of time. Basically OS
swithces from one program to another program after a certain interval of time so that
every program can get access of CPU and complete their work.
Introduction of GUI -(1970s to 1980s)
With the growth of time, Graphical User Interfaces (GUIs) came. First time OS became
more user-friendly and changed the way of people to interact with computer. GUI
provides computer system visual elements which made user’s interaction with computer
more comfortable and user-friendly. User can just click on visual elements rather than
typing commands. Here are some feature of GUI in Microsoft’s windows icons, menus
and windows.
Networked Systems – (1980s to 1990s)
At 1980s,the craze of computer networks at it’s peak .A special type of Operating
Systems needed to manage the network communication . The OS like Novell NetWare
and Windows NT were developed to manage network communication which provide
users facility to work in collaborative environment and made file sharing and remote
access very easy.
Mobile Operating Systems – (Late 1990s to Early 2000s)
Invention of smartphones create a big revolution in software industry, To handle the
operation of smartphones , a special type of operating systems were developed. Some of
them are : iOS and Android etc. These operating systems were optimized with the time
and became more powerful.
AI Integration – (2010s to ongoing)
With the growth of time, Artificial intelligence came into picture.Operating system
integrates features of AI technology like Siri, Google Assistant, and Alexa and became
more powerful and efficient in many way. These AI features with operating system
create a entire new feature like voice commands, predictive text, and personalized
recommendations.

Difference Between User Mode and Kernel Mode


User Mode: When a Program is booted up on an Operating system let’s say windows,
then it launches the program in user mode. And when a user-mode program requests to
run, a process and virtual address space (address space for that process) is created for it
by windows. User-mode programs are less privileged than user-mode applications and
are not allowed to access the system resources directly. For instance, if an application
under user-mode wants to access system resources, it will have to first go through the
Operating system kernel by using syscalls.
Kernel Mode: The kernel is the core program on which all the other operating system
components rely, it is used to access the hardware components and schedule which
processes should run on a computer system and when, and it also manages the
application software and hardware interaction. Hence it is the most privileged program,
unlike other programs it can directly interact with the hardware. When programs
running under user mode need hardware access for example webcam, then first it has to
go through the kernel by using a syscall, and to carry out these requests the CPU
switches from user mode to kernel mode at the time of execution. After finally
completing the execution of the process the CPU again switches back to the user mode.

Criteria Kernel Mode User Mode

Access to In kernel mode, the program In user mode, the application


Criteria Kernel Mode User Mode

Resources has direct and unrestricted program do not have direct access to
access to system resources. system resources. In order to access
the resources, a system call must be
made.

In Kernel mode, the whole


In user mode, a single process fails
operating system might go
if an interrupt occurs.
Interruptions down if an interrupt occurs

Kernel mode is also known as User mode is also known as the


the master mode, privileged unprivileged mode, restricted mode,
Modes mode, or system mode. or slave mode.

In kernel mode, all processes


In user mode, all processes get
Virtual share a single virtual address
separate virtual address space.
address space space.

In kernel mode, the


applications have more While in user mode the applications
Level of privileges as compared to user have fewer privileges.
privilege mode.

As kernel mode can access


While user mode needs to access
both the user programs as well
kernel programs as it cannot directly
as the kernel programs there
access them.
Restrictions are no restrictions.

Mode bit The mode bit of kernel-mode While; the mode bit of user-mode is
value is 0. 1.

Memory It is capable of referencing It can only make references to


References both memory areas. memory allocated for user mode.

A system crash in kernel mode In user mode, a system crash can be


is severe and makes things recovered by simply resuming the
System Crash more complicated. session.
Criteria Kernel Mode User Mode

Only essential functionality is User programs can access and


permitted to operate in this execute in this mode for a given
Access mode. system.

The user mode is a standard and


The kernel mode can refer to
typical viewing mode, which implies
any memory block in the
that information cannot be executed
system and can also direct the
on its own or reference any memory
CPU for the execution of an
block; it needs an Application
instruction, making it a very
Protocol Interface (API) to achieve
potent and significant mode.
Functionality these things.

Types of Operating Systems (OS)

Batch Operating System

In the 1970s, Batch processing was very popular. In this technique, similar types of jobs
were batched together and executed in time. People were used to having a single
computer which was called a mainframe.

In Batch operating system, access is given to more than one person; they submit their
respective jobs to the system for the execution.

The system put all of the jobs in a queue on the basis of first come first serve and then
executes the jobs one by one. The users collect their respective output when all the jobs
get executed.
The purpose of this operating system was mainly to transfer control from one job to
another as soon as the job was completed. It contained a small set of programs called the
resident monitor that always resided in one part of the main memory. The remaining part
is used for servicing jobs.
Advantages of Batch OS
o The use of a resident monitor improves computer efficiency as it eliminates CPU
time between two jobs.

Disadvantages of Batch OS

1. Starvation

Batch processing suffers from starvation.

For Example:
There are five jobs J1, J2, J3, J4, and J5, present in the batch. If the execution time of J1
is very high, then the other four jobs will never be executed, or they wiwill
ll have to wait for
a very long time. Hence the other processes get starved.

2. Not Interactive

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 neve
neverr get it in the batch
processing scenario since the user is not present at the time of execution.

Multiprogramming Operating System

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


busy. Each process needs two types of syst
system
em 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 of Multiprogramming OS
o Throughout the system, it increased as the CPU always had one program to
execute.
o Response time can also be reduced.

Disadvantages of Multiprogramming OS
o Multiprogramming systems provide an environment in which various systems
resources are used efficientl
efficiently,
y, but they do not provide any user interaction with the
computer system.

Multiprocessing Operating System

In Multiprocessing, Parallel computing is achieved. There are more than one processors
present in the system which can execute more than one process at the same time. This
will increase the throughput of the system.
In Multiprocessing, Parallel computing is achieved. More than one processor present in
the system can execute more than one process simultaneously, which will increase the
throughput of the system.

Advantages of Multiprocessing operating system:

o Increased reliability: Due to the multiprocessing system, processing tasks can be


distributed among several processors. This increases reliability as if one processor
fails, the task can be given to another processor for completion.
o Increased throughout: As several processors increase, more work can be done in
less.

Disadvantages of Multiprocessing operating System

o Multiprocessing operating system is more complex and sophisticated as it takes


care of multiple CPUs simultaneously.

Multitasking 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 att the same time.
Advantages of Multitasking operating system
o This operating system is more suited to supporting multiple users simultaneously.
o The multitasking operating systems have well-defined memory management.

Disadvantages of Multitasking operating system


o The multiple processors are busier at the same time to complete any task in a
multitasking environment, so the CPU generates more heat.

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


o In this type of operating system, network traffic reduces due to the division
between clients and the server.
o This type of system is less expensive to set up and maintain.

Disadvantages of Network Operating System


o In this type of operating system, the failure of any node in a system affects the
whole system.
o Security and performance are important issues. So trained network administrators
are required for network administration.

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 of Real-time operating system:
o Easy to layout, develop and execute real-time applications under the real-time
operating system.
o In a Real-time operating system, the maximum utilization of devices and systems.

Disadvantages of Real-time operating system:


o Real-time operating systems are very costly to develop.
o Real-time operating systems are very complex and can consume critical CPU
cycles.

Time-Sharing Operating System

In the Time Sharing operating system, computer resources are allocated in a time-
dependent fashion to several programs simultaneously. Thus it helps to provide a large
number of user's direct access to the main computer. It is a logical extension of
multiprogramming. In time-sharing, the CPU is switched among multiple programs given
by different users on a scheduled basis.
A time-sharing
sharing operating system allows many users to be served simultaneously, so
sophisticated CPU scheduling schemes and Input/output management are required.

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

Advantages of Time Sharing Operating System


o The time-sharing
sharing operating system provides effective utilization and sharing of
resources.
o This system reduces CPU idle and response time.

Disadvantages of Time Sharing Operating System


o Data transmission rates are very high in comparison to other methods.
o 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

The Distributed Operating system is nnot


ot installed on a single machine, it is divided into
parts, and these parts are loaded on different machines. A part of the distributed
Operating system is installed on each machine to make their communication possible.
Distributed Operating systems are mu
much
ch more complex, large, and sophisticated than
Network operating systems because they also have to take care of varying networking
protocols.

Advantages of Distributed Operating System


o The distributed operating system provides sharing of resources.
o This type of system is fault
fault-tolerant.

Disadvantages of Distributed Operating System


o Protocol overhead can dominate computation cost.

o Multiprocessing operating system is more complex and sophisticated as it takes


care of multiple CPUs simultaneously.
Multitasking 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 of Multitasking
ultitasking operating system
o This operating system is more suited to supporting multiple users simultaneously.
o The multitasking operating systems have well
well-defined
defined memory management.
Disadvantages of Multitasking operating system
o The multiple processors are busier at the same time to complete any task in a
multitasking environment, so the CPU generates more heat.

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
o In this type of operating system, network traffic reduces due to the division
between clients and the server.
o This type of system is less expensive to set up and maintain.

Disadvantages of Network Operating System


o In this type of operating system, the failure of any node in a system affects the
whole system.
o Security and performance are important issues. So trained network administrators
are required for network administration.

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 of Real-time operating system:


o Easy to layout, develop and execute real-time applications under the real-time
operating system.
o In a Real-time
time operating system, the maximum utilization of devices and systems.

Disadvantages of Real-time
time operating system:
o Real-time
time operating systems are very cos
costly to develop.
o Real-time
time operating systems are very complex and can consume critical CPU
cycles.

Time-Sharing
Sharing Operating System

In the Time Sharing operating system, computer resources are allocated in a time- time
dependent fashion to several programs simultaneously. Thus it helps to provide a large
number of user's direct access to the main computer. It is a logical extension of
multiprogramming. In time-sharing,
sharing, the CPU is switched among multiple programs given
by different users on a scheduled basis.

A time-sharing
sharing operating system allows many users to be served simultaneously, so
sophisticated CPU scheduling schemes and Input/output management are required.

Time-sharing
sharing operating systems are very difficult and expensive to build.
Advantages of Time Sharing Operating System
o The time-sharing
sharing operating system provides effective utilization and sharing of
resources.
o This system reduces CPU idle and response time.

Disadvantages of Time Sharing Operating System


o Data transmission rates are very high in com
comparison
parison to other methods.
o 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

The Distributed Operating system is not installed on a single m


machine,
achine, it is divided into
parts, and these parts are loaded on different machines. A part of the distributed
Operating system is installed on each machine to make their communication possible.
Distributed Operating systems are much more complex, large, an andd sophisticated than
Network operating systems because they also have to take care of varying networking
protocols.

Advantages of Distributed Operating System


o The distributed operating system provides sharing of resources.
o This type of system is fault
fault-tolerant.

Disadvantages of Distributed Operating System


o Protocol overhead can dominate computation cost.

o Multiprocessing operating system is more complex and sophisticated as it takes


care of multiple CPUs simultaneously.

Multitasking 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 of Multitasking operating system
o This operating system is more suited to supporting multiple users simultaneously.
o The multitasking operating systems have well-defined memory management.

Disadvantages of Multitasking operating system


o The multiple processors are busier at the same time to complete any task in a
multitasking environment, so the CPU generates more heat.

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


o In this type of operating system, network traffic reduces due to the division
between clients and the server.
o This type of system is less expensive to set up and maintain.

Disadvantages of Network Operating System


o In this type of operating system, the failure of any node in a system affects the
whole system.
o Security and performance are important issues. So trained network administrators
are required for network administration.

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 of Real-time operating system:
o Easy to layout, develop and execute real-time applications under the real-time
operating system.
o In a Real-time operating system, the maximum utilization of devices and systems.

Disadvantages of Real-time operating system:


o Real-time operating systems are very costly to develop.
o Real-time operating systems are very complex and can consume critical CPU
cycles.

Time-Sharing Operating System

In the Time Sharing operating system, computer resources are allocated in a time-
dependent fashion to several programs simultaneously. Thus it helps to provide a large
number of user's direct access to the main computer. It is a logical extension of
multiprogramming. In time-sharing, the CPU is switched among multiple programs given
by different users on a scheduled basis.
A time-sharing
sharing operating system allows many users to be served simultaneously, so
sophisticated CPU scheduling schemes and Input/output management are required.

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

Advantages of Time Sharing Operating System


o The time-sharing
sharing operating system provides effective utilization and sharing of
resources.
o This system reduces CPU idle and response time.

Disadvantages of Time Sharing Operating System


o Data transmission rates are very high in comparison to other methods.
o Security
rity 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

The Distributed Operating system is not installed on a single machine, it is divided into
parts,
ts, and these parts are loaded on different machines. A part of the distributed
Operating system is installed on each machine to make their communication possible.
Distributed Operating systems are much more complex, large, and sophisticated than
Network operating
perating systems because they also have to take care of varying networking
protocols.

Advantages of Distributed Operating System


o The distributed operating system provides sharing of resources.
o This type of system is fault
fault-tolerant.

Disadvantages of Distributed Operating System


o Protocol overhead can dominate computation cost.

System Programs in Operating System


System Programming can be defined as the act of building Systems Software using
System Programming Languages. According to Computer Hierarchy, one which comes
at last is Hardware. Then it is Operating System, System Programs, and finally
Application Programs. Program Development and Execution can be done conveniently
in System Programs. Some of the System Programs are simply user interfaces, others
are complex. It traditionally lies between the user interface and system calls.
In the context of an operating system, system programs are nothing but a special
software which give us facility to manage and control the computer’s hardware and
resources. As we have mentioned earlier these programs are more closely with the
operating system so it executes the operation fast and helpful
ful in performing essential
opeartion which can’t be handled by application software .

Note : The user can only view up-to-the System Programs he can’t see System Calls.
Here are the examples of System Programs :
1. File Management – A file is a collection of specific information stored in the
memory of a computer system. File management is defined as the process of
manipulating files in the computer system, its management includes the process of
creating, modifying and deleting files.
2. Command Line Interface(CLI’s)
face(CLI’s) : CLIs is the essential tool for user . It provide
user facility to write commands directly to the system for performing any operation .
It is a text-based way to interact with operating system. CLIs can perform many
tasks like file manipulation,system
n,system configuration and etc.
3. Device drivers :Device drivers work as a simple translator for OS and devices .
Basically it act as an intermediatry between the OS and devices and provide facility
to both OS and devices to understand each other’s language so that they can work
together efficiently without interrupt.
4. Status Information – Information like date, time amount of available memory, or
disk space is asked by some users. Others providing detailed performance, logging,
and debugging information which is more complex. All this information is formatted
and displayed on output devices or printed. Terminal or other output devices or files
or a window of GUI is used for showing the output of programs.
5. File Modification – For modifying the contents of files we use this. For Files stored
on disks or other storage devices, we used different types of editors. For searching
contents of files or perform transformations of files we use special commands.
6. Programming-Language
Language support – For common programming languages, we use
Compilers, Assemblers, Debuggers, and interpreters which are already provided to
users. It provides all support to users. We can run any programming language. All
languages of importance are already provided.
7. Program Loading and Execution – When the program is ready after Assembling
and compilation, it must be loaded into memory for execution. A loader is part of an
operating system that is responsible for loading programs and libraries. It is one of
the essential stages for starting a program. Loaders, relocatable loaders, linkage
editors, and Overlay loaders are provided by the system.
8. Communications 𠄺l connections among processes, users, and computer systems
are provided by programs. Users can send messages to another user on their screen,
User can send e-mail, browsing on web pages, remote login, the transformation of
files from one user to another.

System Calls in Operating System (OS)

A system call is a way for a user program to interface with the operating system. The
program requests several services, and the OS responds by invoking a series of system
calls to satisfy the request. A system call can be written in assembly language or a high-
level language like C or Pascal. System calls are predefined functions that the operating
system may directly invoke if a high-level language is used.

In this article, you will learn about the system calls in the operating system and discuss
their types and many other things.

What is a System Call?

A system call is a method for a computer program to request a service from the kernel of
the operating system on which it is running. A system call is a method of interacting with
the operating system via programs. A system call is a request from computer software to
an operating system's kernel.

The Application Program Interface (API) connects the operating system's functions to
user programs. It acts as a link between the operating system and a process, allowing
user-level programs to request operating system services. The kernel system can only be
accessed using system calls. System calls are required for any programs that use
resources.

How are system calls made?

When a computer software needs to access the operating system's kernel, it makes a
system call. The system call uses an API to expose the operating system's services to user
programs. It is the only method to access the kernel system. All programs or processes
that require resources for execution must use system calls, as they serve as an interface
between the operating system and user programs.
Below are some examples of how a system call varies from a user function.

1. A system call function may create and use kernel processes to execute the
asynchronous processing.
2. A system call has greater authority than a standard subroutine. A system call with
kernel-mode privilege executes in the kernel protection domain.
3. System calls are not permitted to use shared libraries or any symbols that are not
present in the kernel protection domain.
4. The code and data for system calls are stored in global kernel memory.

Why do you need system calls in Operating System?

There are various situations where you must require system calls in the operating system.
Following of the situations are as follows:

1. It is must require when a file system wants to create or delete a file.


2. Network connections require the system calls to sending and receiving data
packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a
system call.
5. System calls are used to create and manage new processes.

How System Calls Work

The Applications run in an area of memory known as user space. A system call connects
to the operating system's kernel, which executes in kernel space. When an application
creates a system call, it must first obtain permission from the kernel. It achieves this
using an interrupt request, which pauses the current process and transfers control to the
kernel.

If the request is permitted, the kernel performs the requested action, like creating or
deleting a file. As input, the application receives the kernel's output. The application
resumes the procedure after the input is received. When the operation is finished, the
kernel returns the results to the application and then moves data from kernel space to user
space in memory.
A simple system call may take few nanoseconds to provide the result, like retrieving the
system date and time. A more complicated system call, such as connecting to a network
device, may take a few seconds. Most operating systems launch a distinct kernel thread
for each system call to avoid bottlenecks. Modern operating systems are multi-threaded,
which means they can handle various system calls at the same time.

Types of System Calls

There are commonly five types of system calls. These are as follows:

1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication

Now, you will learn about all the different types of system calls one-by-one.

Process Control

Process control is the system call that is used to direct the processes. Some process
control examples include creating, load, abort, end, execute, process, terminate the
process, etc.
File Management

File management is a system call that is used to handle the files. Some file management
examples include creating files, delete files, open, close, read, write, etc.

Device Management

Device management is a system call that is used to deal with devices. Some examples of
device management include read, device, write, get device attributes, release device, etc.

Information Maintenance

Information maintenance is a system call that is used to maintain information. There are
some examples of information maintenance, including getting system data, set time or
date, get time or date, set system data, etc.

Communication

Communication is a system call that is used for communication. There are some
examples of communication, including create, delete communication connections, send,
receive messages, etc.

Examples of Windows and Unix system calls

There are various examples of Windows and Unix system calls. These are as listed below
in the table:

Process Windows Unix

Process Control CreateProcess() Fork()


ExitProcess() Exit()
WaitForSingleObject() Wait()

File Manipulation CreateFile() Open()


ReadFile() Read()
WriteFile() Write()
CloseHandle() Close()
Device Management SetConsoleMode() Ioctl()
ReadConsole() Read()
WriteConsole() Write()

Information Maintenance GetCurrentProcessID() Getpid()


SetTimer() Alarm()
Sleep() Sleep()

Communication CreatePipe() Pipe()


CreateFileMapping() Shmget()
MapViewOfFile() Mmap()

Protection SetFileSecurity() Chmod()


InitializeSecurityDescriptor() Umask()
SetSecurityDescriptorgroup() Chown()

Here, you will learn about some methods briefly:

open()

The open() system call allows you to access a file on a file system. It allocates resources
to the file and provides a handle that the process may refer to. Many processes can open a
file at once or by a single process only. It's all based on the file system and structure.

read()

It is used to obtain data from a file on the file system. It accepts three arguments in
general:

o A file descriptor.
o A buffer to store read data.
o The number of bytes to read from the file.

The file descriptor of the file to be read could be used to identify it and open it
using open() before reading.
wait()

In some systems, a process may have to wait for another process to complete its
execution before proceeding. When a parent process makes a child process, the parent
process execution is suspended until the child process is finished. The wait() system call
is used to suspend the parent process. Once the child process has completed its execution,
control is returned to the parent process.

write()

It is used to write data from a user buffer to a device like a file. This system call is one
way for a program to generate data. It takes three arguments in general:

o A file descriptor.
o A pointer to the buffer in which data is saved.
o The number of bytes to be written from the buffer.

fork()

Processes generate clones of themselves using the fork() system call. It is one of the most
common ways to create processes in operating systems. When a parent process spawns a
child process, execution of the parent process is interrupted until the child process
completes. Once the child process has completed its execution, control is returned to the
parent process.

close()

It is used to end file system access. When this system call is invoked, it signifies that the
program no longer requires the file, and the buffers are flushed, the file information is
altered, and the file resources are de-allocated as a result.

exec()

When an executable file replaces an earlier executable file in an already executing


process, this system function is invoked. As a new process is not built, the old process
identification stays, but the new process replaces data, stack, data, head, etc.

exit()

The exit() is a system call that is used to end program execution. This call indicates that
the thread execution is complete, which is especially useful in multi-threaded
environments. The operating system reclaims resources spent by the process following
the use of the exit() system function.

Head-to-head comparison between the System Call and System Program in Operating
System

Features System Call System Program

Definition It is a technique in which a It offers an environment for a


computer system program requests program to create and run.
a service from the OS kernel.

Request It fulfils the low-level requests of It fulfils the high-level request or


the user program. requirement of the user program.

Programming It is usually written in C and C++ It is commonly written in high-level


Languages programming languages. programming languages only.
Assemble-level language is used in
system calls where direct hardware
access is required.

User View It defines the interface between the It defines the user interface (UI) of
services and the user process the OS.
provided by the OS.

Action The user process requests an OS It transforms the user request into a
service using a system call. set of system calls needed to fulfil the
requirement.

Classification It may be categorized into file It may be categorized into file


manipulation, device management, program loading and
manipulation, communication, execution, programming-language
process control, information support, status information, file
maintenance, and protection. modification, and communication.

Operating System Design and Implementation


An operating system is a construct that allows the user application programs to interact
with the system hardware. Operating system by itself does not provide any function but
it provides an atmosphere in which different applications and programs can do useful
work.
There are many problems that can occur while designing and implementing an operating
system. These are covered in operating system design and implementation.
Operating System Design Goals
It is quite complicated to define all the goals and specifications of the operating system
while designing it.The design changes depending on the type of the operating system i.e
if it is batch system, time shared system, single user system, multi user system,
distributed system etc.
There are basically two types of goals while designing an operating system. These are −
User Goals
The operating system should be convenient, easy to use, reliable, safe and fast according
to the users. However, these specifications are not very useful as there is no set method
to achieve these goals.
System Goals
The operating system should be easy to design, implement and maintain. These are
specifications
ations required by those who create, maintain and operate the operating system.
But there is not specific method to achieve these goals as well.
Operating System Mechanisms and Policies
There is no specific way to design an operating system as it is a highly creative task.
However, there are general software principles that are applicable to all operating
systems.
A subtle difference between mechanism and policy is that mechanism shows how to do
something and policy shows what to do. Policies may change over time and this would
lead to changes in mechanism. So, it is better to have a general mechanism that would
require few changes even when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are
required in mechanism if policy changes. If a policy favours I/O intensive processes over
CPU intensive processes, then a policy change to preference of CPU intensive processes
will not change the mechanism.
Operating System Implementation
The operating system needs to be implemented after it is designed. Earlier they were
written in assembly language but now higher level languages are used. The first system
not written in assembly language was the Master Control Program (MCP) for Burroughs
Computers.
Advantages of Higher Level Language
There are multiple advantages to implementing an operating system using a higher level
language such as: the code is written more fast, it is compact and also 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.
The operating system is needed to design and implement because without proper design
and implementation any system cannot work properly, for every aspect or for any
development a proper design and implementation should be necessary so that it can work
in good manner and we can easily debug if any failures occur.
So, design and implementation is a necessary part of an operating system and this
technique can be used by every user who uses a computer.
There are different types of techniques to design and implement the operating system.
 Design goals
 Mechanism
 Implementation
Let us discuss each technique in detail.
Design goals
Let us understand the features of the design goals.
Concurrent Systems
Operating systems must handle multiple devices as well as multiple users concurrently.
It is a must for modern multiple core architectures. Due to these features the design of
the operating system is complex and very difficult to make.
Security and Privacy
Operating systems must provide security and privacy to a system. It is important to
prevent the malicious user from accessing your system and to prevent the stealing of the
user programs.
Resource Sharing
Operating system ensures that the resources of the system must be shared in a correct
fashion in between multiple user processes. It becomes more complex when multiple
users use the same device.
Changes in Hardware and Software
Operating systems must be flexible in order to accommodate any change to the hardware
and software of the system, It should not be obsolete. It is necessary as it is costly to
change the operating system again and again on any change to the software or hardware.
Portable Operating Systems
Operating system that is able to work with different hardware and systems is called a
portable operating system and it is a very important design goal.
Backward Compatibility
Any upgrade to the current operating system could not hinder it's compatibility with the
machine i.e. if the previous version of the operating system is compatible with the
system then the newer or upgraded version should also be compatible with the system
this is called backward compatibility.
Mechanism
In an operating system there is a particular mechanism to be followed and this
mechanism is responsible for the entire task performed by the operating system.
When a task is performed in the operating system then we follow a particular mechanism
for input, store, process, and output and by using this process we can define memory to
the different tasks performed by the computer.
An Operating system provides the services to users and programs. Like I/O operations,
program execution, file system manipulation, Resource allocation, Protection.
Program Execution
OS handles many activities from user programs to system programs like printer spooler,
name servers, file servers etc. Each of these activities is encapsulated as a process. A
process includes the complete execution context.
Operating System Activities
The operating system activities are as follows −
 Loads a program into memory
 Execute the program
 Handle's program's execution
 Provides a mechanism for process synchronization
 Provides a mechanism for process communication
 Provides a mechanism for deadlock handling
Implementation
Once the operating system is designed it must be implemented because it is a collection
of many programs written by many people over a long period of time.
Implementation is a process which is most important for the operating system.
An operating system needs to be implemented because when it is implemented then new
tasks can be performed and new application software can also install in your computer
and run your computer smoothly for that we need implementation of operating system.

You might also like