Unit 1 OS
Unit 1 OS
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.
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.
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.
Mode bit The mode bit of kernel-mode While; the mode bit of user-mode is
value is 0. 1.
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
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
There are various situations where you must require system calls in the operating system.
Following of the situations are as follows:
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.
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.
There are various examples of Windows and Unix system calls. These are as listed below
in the table:
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()
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
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.