Operating_System_Notes
Operating_System_Notes
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.
An operating system is a well-organized collection of programs that manages the computer hardware. It is
a type of system software that is responsible for the smooth functioning of the computer 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
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 will 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 never get it in the batch processing scenario since the user
is not present at the time of execution.
Multiprogramming is an extension to batch processing where the CPU is always kept busy. Each process
needs two types of system time: CPU time and IO time.
In a multiprogramming environment, when a process does its I/O, The CPU can start the execution of
other processes. Therefore, multiprogramming improves the efficiency of the system.
Advantages 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
efficiently, 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.
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.
o The multiple processors are busier at the same time to complete any task in a multitasking
environment, so the CPU generates more heat.
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.
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.
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.
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:
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.
Advertisement
A time-sharing operating system allows many users to be served simultaneously, so sophisticated CPU
scheduling schemes and Input/output management are required.
o The time-sharing operating system provides effective utilization and sharing of resources.
o This system reduces CPU idle and response time.
The Distributed Operating system is not 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 much more complex,
large, and sophisticated than Network operating systems because they also have to take care of varying
networking protocols.
FUNCTIONS OF OS
The operating system provides various functionalities, which are discussed below:
One of the most important functions of the operating system is controlling the system's health. For this
purpose, it monitors and observes the delay time between a service being requested and the requested
service being served. This delay time is reduced as much as possible to improve the overall performance
of the system.
Memory Management
In a computer system, we have primary memory, which is also called main memory, and it is made by the
sequence of bytes. Each byte in the main memory has a unique address which helps it to check if it is
occupied or not. For executing each program in its computer system, it should be in the main memory.
Operating systems can easily check which bytes of main memory are empty and which are not. So it
allocates the main memory for the program execution, and when the program is completed or terminated,
then it deallocates the memory. Operating systems also keep a record that which byte of memory is
assigned to which program.
Device Management
The operating system manages the communication between the computer system and the peripheral
devices connected to the I/O port of the system. Peripheral devices use their respective drivers to
communicate with the system. The operating system determines which program or process is accessed
by which connection and device. It also makes sure when a program is executed or terminated, it will stop
the communication between the device and the computer system.
There is other software in the system which is coordinated by the operating system so that users can
access them efficiently, like assemblers, compilers, etc.
Advertisement
Process Management
The process is a program under the execution. The operating system manages all the processes so that
each process gets the CPU for a specific time to execute itself, and there will be less waiting time for each
process. This management is also called process scheduling.
o First Come First Serve (FCFS) Algorithm: In this algorithm, which comes first is served first by
the CPU until it is completed. It is a non-preemptive algorithm which means it cannot be
terminated without completing it.
o Shortest Job First (SJF) Algorithm: The process which has the shortest burst time (execution
time) that will be served first by the CPU.
o Longest Job First (LJF) Algorithm: This algorithm is based on the phenomenon that the
process that has the longest execution time will be served first by the processor.
o Round Robin Algorithm: In this algorithm, there is a specific time quanta assigned for each
process. If the process is not executed in time quanta, it is sent to the waiting queue for its next
turn.
o Priority Scheduling Algorithm: Processes are given the priority based on different criteria and
scheduled according to the highest priority. Criteria can be burst time or arrival time etc.
Resource Allocation
The operating system manages all the resources of the computer system. It ensures the use of all the
resources by managing which resource is used by which process and for how much time.
All the data and information available on the machine are protected by the operating system. If any
external resource tries to attack the computer resource and steal the data, then the operating system
helps to prevent the attack.
Advertisement
Input/output devices like mouse, keyboards, printers etc., are external I/O devices, and there are different
natures of each device. The operating system appropriately manages the input and output operation of
these devices.
Job Priority:
Advertisement
The work of job priority is creation and promotion. It determines what action should be done first in a
computer system.
Advertisement
The operating systems make automatic changes to the task through specific control programs. These
programs are called Special Control Program.
The operating system prepares the list of tasks to be performed for the device of the computer system.
The operating system decides which device to use for which task. This action becomes complicated when
multiple tasks are to be performed simultaneously in a computer system. The scheduling programs of the
operating system determine the order in which tasks are completed. It performs these tasks based on the
priority of performing the tasks given by the user. It makes the tasks available based on the priority of the
device.
Security:
Computer security is a very important aspect of any operating system. The reliability of an operating
system is determined by how much better security it provides us. Modern operating systems use a firewall
for security. A firewall is a security system that monitors every activity happening in the computer and
blocks that activity in case of any threat.
Monitoring activities:
Advertisement
The operating system takes care of the activities of the computer system during various processes. This
aborts the program if there are errors. The operating system sends instant messages to the user for any
unexpected error in the input/output device. It also provides security to the system when the operating
system is used in systems operated by multiple users. So that illegal users cannot get data from the
system.
Job accounting:
It keeps track of time & resources used by various jobs and users.
Overview
An operating system is a design that enables user application programs to communicate with the
hardware of the machine. The operating system should be built with the utmost care because it is such a
complicated structure and should be simple to use and modify. Partially developing the operating system
is a simple approach to accomplish this. Each of these components needs to have distinct inputs,
outputs, and functionalities.
This article discusses many sorts of structures that implement operating systems, as listed below, as well
as how and why they work. It also defines the operating system structure.
o Simple Structure
o Monolithic Structure
o Layered Approach Structure
o Micro-Kernel Structure
o Exo-Kernel Structure
o Virtual Machines
We want a clear structure to let us apply an operating system to our particular needs because operating
systems have complex structures. It is easier to create an operating system in pieces, much as we break
down larger issues into smaller, more manageable subproblems. Every segment is also a part of the
operating system. Operating system structure can be thought of as the strategy for connecting and
incorporating various operating system components within the kernel. Operating systems are
implemented using many types of structures, as will be discussed below:
SIMPLE STRUCTURE
It is the most straightforward operating system structure, but it lacks definition and is only appropriate for
usage with tiny and restricted systems. Since the interfaces and degrees of functionality in this structure
are clearly defined, programs are able to access I/O routines, which may result in unauthorized access to
I/O procedures.
o There are four layers that make up the MS-DOS operating system, and each has its own set of
features.
o These layers include ROM BIOS device drivers, MS-DOS device drivers, application programs,
and system programs.
o The MS-DOS operating system benefits from layering because each level can be defined
independently and, when necessary, can interact with one another.
o If the system is built in layers, it will be simpler to design, manage, and update. Because of this,
simple structures can be used to build constrained systems that are less complex.
o When a user program fails, the operating system as whole crashes.
o Because MS-DOS systems have a low level of abstraction, programs and I/O procedures are
visible to end users, giving them the potential for unwanted access.
The following figure illustrates layering in simple structure:
Advantages of Simple Structure:
o Because there are only a few interfaces and levels, it is simple to develop.
o Because there are fewer layers between the hardware and the applications, it offers superior
performance.
Disadvantages of Simple Structure:
o The entire operating system breaks if just one user program malfunctions.
o Since the layers are interconnected, and in communication with one another, there is no
abstraction or data hiding.
o The operating system's operations are accessible to layers, which can result in data tampering
and system failure.
MONOLITHIC STRUCTURE
The monolithic operating system controls all aspects of the operating system's operation, including file
management, memory management, device management, and operational operations.
The core of an operating system for computers is called the kernel (OS). All other System components
are provided with fundamental services by the kernel. The operating system and the hardware use it as
their main interface. When an operating system is built into a single piece of hardware, such as a
keyboard or mouse, the kernel can directly access all of its resources.
The monolithic operating system is often referred to as the monolithic kernel. Multiple programming
techniques such as batch processing and time-sharing increase a processor's usability. Working on top of
the operating system and under complete command of all hardware, the monolithic kernel performs the
role of a virtual computer. This is an old operating system that was used in banks to carry out simple
tasks like batch processing and time-sharing, which allows numerous users at different terminals to
access the Operating System.
o Because layering is unnecessary and the kernel alone is responsible for managing all operations,
it is easy to design and execute.
o Due to the fact that functions like memory management, file management, process scheduling,
etc., are implemented in the same address area, the monolithic kernel runs rather quickly when
compared to other systems. Utilizing the same address speeds up and reduces the time required
for address allocation for new processes.
Disadvantages of Monolithic Structure:
o The monolithic kernel's services are interconnected in address space and have an impact on one
another, so if any of them malfunctions, the entire system does as well.
o It is not adaptable. Therefore, launching a new service is difficult.
LAYERED STRUCTURE
The OS is separated into layers or levels in this kind of arrangement. Layer 0 (the lowest layer) contains
the hardware, and layer 1 (the highest layer) contains the user interface (layer N). These layers are
organized hierarchically, with the top-level layers making use of the capabilities of the lower-level ones.
The functionalities of each layer are separated in this method, and abstraction is also an option. Because
layered structures are hierarchical, debugging is simpler, therefore all lower-level layers are debugged
before the upper layer is examined. As a result, the present layer alone has to be reviewed since all the
lower layers have already been examined.
MICRO-KERNEL STRUCTURE
The operating system is created using a micro-kernel framework that strips the kernel of any unnecessary
parts. Systems and user applications are used to implement these optional kernel components. So,
Micro-Kernels is the name given to these systems that have been developed.
Each Micro-Kernel is created separately and is kept apart from the others. As a result, the system is now
more trustworthy and secure. If one Micro-Kernel malfunctions, the remaining operating system is
unaffected and continues to function normally.
EXOKERNEL
An operating system called Exokernel was created at MIT with the goal of offering application-level
management of hardware resources. The exokernel architecture's goal is to enable application-specific
customization by separating resource management from protection. Exokernel size tends to be minimal
due to its limited operability.
Because the OS sits between the programs and the actual hardware, it will always have an effect on the
functionality, performance, and breadth of the apps that are developed on it. By rejecting the idea that an
operating system must offer abstractions upon which to base applications, the exokernel operating
system makes an effort to solve this issue. The goal is to give developers as few restriction on the use of
abstractions as possible while yet allowing them the freedom to do so when necessary. Because of the
way the exokernel architecture is designed, a single tiny kernel is responsible for moving all hardware
abstractions into unreliable libraries known as library operating systems. Exokernels differ from micro-
and monolithic kernels in that their primary objective is to prevent forced abstraction.
o A decline in consistency
o Exokernel interfaces have a complex architecture.
• No OS – (0s to 1940s)
• Batch Processing Systems -(1940s to 1950s)
• Multiprogramming Systems -(1950s to 1960s)
• Time-Sharing Systems -(1960s to 1970s)
• Introduction of GUI -(1970s to 1980s)
• Networked Systems – (1980s to 1990s)
• Mobile Operating Systems – (Late 1990s to Early 2000s)
• AI Integration – (2010s to ongoing)
o It allows only a few tasks that can run at the same time.
o It any error occurred in the operating system; the stored data can be destroyed.
o It is a very difficult task or works for the OS to provide entire security from the viruses because
any threat or virus can occur at any time in a system.
o An unknown user can easily use any system without the permission of the original user.
o The cost of operating system costs is very high.
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.
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.
SYSTEM BOOTING
Booting is the process of starting a computer. It can be initiated by hardware such as a button
press or by a software command. After it is switched on, a CPU has no software in its main
memory, so some processes must load software into memory before execution. This may be done
by hardware or firmware in the CPU or by a separate processor in the computer system.
Types of Booting
There are two types of booting in an operating system.
1. Cold Booting: When the computer starts for the first time or is in a shut-down state and switch
on the power button to start the system, this type of process to start the computer is called cold
booting. During cold booting, the system will read all the instructions from the ROM (BIOS) and
the Operating System will be automatically get loaded into the system. This booting takes more
time than Hot or Warm Booting.
2. Warm Booting: Warm or Hot Booting process is when computer systems come to no response
or hang state, and then the system is allowed to restart during on condition.. Most
commonly Ctrl+Alt+Del button is used to reboot the system. Else, in some systems, the external
reset button may be available to reboot the system.
Step 1: Once the computer system is turned on, BIOS (Basic Input /Output System) performs a series of
activities or functionality tests on programs stored in ROM, called on POST (Power-on Self Test) that
checks to see whether peripherals in the system are in perfect order or not.
Step 2: After the BIOS is done with pre-boot activities or functionality test, it read bootable sequence
from CMOS (Common Metal Oxide Semiconductor) and looks for master boot record in the first physical
sector of the bootable disk as per boot device sequence specified in CMOS. For example, if the boot
device sequence is:
o Floppy Disk
o Hard Disk
o CDROM
Step 3: After this, the master boot record will search first in a floppy disk drive. If not found, then the hard
disk drive will search for the master boot record. But if the master boot record is not even present on the
hard disk, then the CDROM drive will search. If the system cannot read the master boot record from any
of these sources, ROM displays "No Boot device found" and halted the system. On finding the master
boot record from a particular bootable disk drive, the operating system loader, also called Bootstrap
loader, is loaded from the boot sector of that bootable drive· into memory. A bootstrap loader is a special
program that is present in the boot sector of a bootable drive.
Step 4: The bootstrap loader first loads the IO.SYS file. After this, MSDOS.SYS file is loaded, which is
the core file of the DOS operating system.
Advertisement
Step 5: After this, MSDOS.SYS file searches to find Command Interpreter in CONFIG.SYS file, and when
it finds, it loads into memory. If no Command Interpreter is specified in the CONFIG.SYS file,
the COMMAND.COM file is loaded as the default Command Interpreter of the DOS operating system.
Step 6: The last file is to be loaded and executed is the AUTOEXEC.BAT file that contains a sequence of
DOS commands. After this, the prompt is displayed. We can see the drive letter of bootable drive
displayed on the computer system, which indicates that the operating system has been successfully on
the system from that drive.
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
Utility program
It manages, maintains and controls various computer resources. Utility programs are
comparatively technical and are targeted for the users with solid technical knowledge.
Few examples of utility programs are: antivirus software, backup software and disk tools.
Device drivers
It controls the particular device connected to a computer system. Device drivers basically
act as a translator between the operating system and device connected to the system.
These tools are required in an operation system to have some software to facilitate the
navigation through the computer system.
Protection and security requires that computer resources such as CPU, softwares, memory etc.
are protected. This extends to the operating system as well as the data in the system. This
can be done by ensuring integrity, confidentiality and availability in the operating system.
The system must be protect against unauthorized access, viruses, worms etc.
A threat is a program that is malicious in nature and leads to harmful effects for the system.
Some of the common threats that occur in a system are −
Virus
Viruses are generally small snippets of code embedded in a system. They are very
dangerous and can corrupt files, destroy data, crash systems etc. They can also spread
further by replicating themselves as required.
Trojan Horse
A trojan horse can secretly access the login details of a system. Then a malicious user can
use these to enter the system as a harmless being and wreak havoc.
Trap Door
A trap door is a security breach that may be present in a system without the knowledge of
the users. It can be exploited to harm the data or files in a system by malicious people.
Worm
A worm can destroy a system by using its resources to extreme levels. It can generate
multiple copies which claim all the resources and don't allow any other processes to access
them. A worm can shut down a whole network in this way.
Denial of Service
These type of attacks do not allow the legitimate users to access a system. It overwhelms
the system with requests so it is overwhelmed and cannot work properly for other user.
The different methods that may provide protect and security for different computer systems
are −
Authentication
This deals with identifying each user in the system and making sure they are who they
claim to be. The operating system makes sure that all the users are authenticated before
they access the system. The different ways to make sure that the users are authentic are:
• Username/ Password
Each user has a distinct username and password combination and they need to enter it correctly before they
can access the system.
• User Key/ User Card
The users need to punch a card into the card slot or use they individual key on a keypad to access the
system.
• User Attribute Identification
Different user attribute identifications that can be used are fingerprint, eye retina etc. These are unique for
each user and are compared with the existing samples in the database. The user can only access the system
if there is a match.
These passwords provide a lot of security for authentication purposes. A one time password
can be generated exclusively for a login every time a user wants to enter the system. It
cannot be used more than once. The various ways a one time password can be
implemented are −
• Random Numbers
The system can ask for numbers that correspond to alphabets that are pre arranged. This combination can
be changed each time a login is required.
• Secret Key
A hardware device can create a secret key related to the user id for login. This key can change each time.