Unit1 OS
Unit1 OS
Noida
Operating Systems
ACSE0403A
Unit: 1
Operating System
SWETA PANDEY
Assistant Professor
B Tech 4th Sem Deptt. of CSE
CO1: Understand the fundamentals of an operating systems, functions and their structure
and functions.
CO2: Implement concept of process management policies, CPU Scheduling and thread
management.
CO3: Understand and implement the requirement of process synchronization and apply
deadlock handling algorithms.
CO4: Evaluate the memory management and its allocation policies.
CO5: Understand and analyze the I/O management and File systems
ACSE0403A .1 3 3 2 2 1 2 - 2 3 2 2 3
ACSE0403A .2 3 3 3 2 2 3 2 2 3 - 1 3
ACSE0403A .3 3 3 2 2 2 2 2 2 2 3 1 3
ACSE0403A .4 3 2 2 3 1 2 2 - 2 - 2 3
ACSE0403A .5 3 1 2 2 2 2 - - 2 2 2 3
ACSE0403A .1 2 1 2 2
ACSE0403A .2 2 2 1 2
ACSE0403A .3 2 3 3 2
ACSE0403A .4 2 2 1 2
ACSE0403A .5 2 2 2 2
• PEO1:Apply sound knowledge in the field of information technology to fulfill the needs of IT
industry.
• PEO2:Design innovative and interdisciplinary systems through latest digital technologies.
• PEO3:Inculcate professional – social ethics, team work and leadership for serving the
society.
• PEO4:Inculcate lifelong learning in the field of computing for successful career in
organizations and R&D sectors.
• https://www.youtube.com/playlist?list=PLmXKhU9FNesSFvj6gASuWmQd23Ul5omtD
Topic Objective
Students will be able to
Introduction of Operating System Understand the basics of Operating System,its features
characteristics and functions
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.
Application Software:
Application Software is the type of software which runs as per user request. It runs on the platform which is
provide by system software.
A computer software which is developed to perform a specific function is known as an application software.
Application software are also called end-user software because they are designed to use by users of the
computer.
Example: word processing, playing multimedia files, database applications, spreadsheets, accounting, graphic
designing, etc.
The most common examples of application software are: MS-Word, Excel, PowerPoint, browsers, video editors,
etc.
2/15/2024 SWETA PANDEY OS Unit Number:1 22
Introduction of Operating System
Hardware:
Hardware is a set of physical parts of computers which actually executes the
instruction.
A hardware cannot do any task with a software instructing it.
Hardware categories: Input Devices, Output Devices, Storage Devices, Internal
components of CPU and motherboard.
Hardware understands only machine language (or binary language).
• 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.
Memory Management − Keeps track of the primary memory, i.e. what part of it is in use by whom, what part is not in
use, etc. and allocates the memory when a process or program requests it.
Processor Management − Allocates the processor (CPU) to a process and deallocates the processor when it is no longer
required.
Device Management − Keeps track of all the devices. This is also called I/O controller that decides which process gets the
device, when, and for how much time.
File Management − Allocates and de-allocates the resources and decides who gets the resources.
Security − Prevents unauthorized access to programs and data by means of passwords and other similar techniques.
Job Accounting − Keeps track of time and resources used by various jobs and/or users.
Memory Management:
• It is the management of the main or primary memory. Whatever program is executed, it has to be
present in the main memory. Main memory is a quick storage area that may be accessed directly by
the CPU. When the program execution is completed, the memory region is released and can be used
by other programs. Therefore, there can be more than one program present at a time. Hence, it is
required to manage the memory.
The operating system:
• Allocates and de allocates the memory.
• Keeps a record of which part of primary memory is used by whom and how much.
• Distributes the memory while multiprocessing.
• In multiprogramming, the operating system selects which processes acquire memory when and how
much memory they get.
Processor Management:
• Every software that runs on a computer, whether in the background or in the frontend, is a process.
Processor management is an execution unit in which a program operates. The operating system
determines the status of the processor and processes, selects a job and its processor, allocates the
processor to the process, and de-allocates the processor after the process is completed.
• When more than one process runs on the system, the OS decides how and when a process will use the
CPU. Hence, the name is also CPU Scheduling.
The OS:
• Allocates and de allocates processor to the processes.
• Keeps record of CPU status.
Certain algorithms used for CPU scheduling are as follows:
• First Come First Serve (FCFS)
• Shortest Job First (SJF)
• Round-Robin Scheduling
• Priority-based scheduling etc.
Input Device
• An input device is a computer hardware which handles input receiving from outside the system. The main
function of the input device is to enter data or give commands by the user into the system.
• For example, the input devices are keyboards, mouse, joysticks, scanners, touchpad and many more.
Output devices
• Output devices are computer hardware devices which handle output activities. The function of the output
device is to display the results of data processing, as soft copy, hard copy, voice, or video.
• For example, the output devices are monitors, printers, speakers, projectors and so on.
I/O Ports
I / O Ports are called connectors which are under the
control of the processor helpful in handling input and
output activities.
This port is used to connect any device that comes from
outside the computer, like a printer, scanner, mouse, or
USB. In a computer system this port is present on the
back of the CPU while on the laptop the ports are located
on the right and left side.
CPU
• The Central Processing unit is computer hardware called the brain of the computer system. Because, the
performance of a computer is determined by the technology and quality of the CPU used.
Generally, there are three types of components in the CPU, which are given below −
Control unit
Register
Given below in the figure are the access times and capacities of the memory:
Parts of Computer
The computer structure in general, divided into five main parts, which are as follows −
Input devices
Output devices
I / O Ports
CPU and
Memory
• Computer-System Operation
• I/O Structure
• Storage Structure
• Storage Hierarchy
• Hardware Protection
• General System Architecture
• A modern computer system consists of a CPU, memory, system bus and a number of
device controllers.
• I/O devices and the CPU can execute concurrently.
• Each device controller is in charge of a particular device type.
• A device controller for each device contains local buffer storage and special purpose
registers.
• A bootstrap program is required to initialize the computer system.
• CPU moves data from /to main memory and to/from local buffers.
• I/O is from the device to local buffer of controller.
• Device controller informs CPU that it has finished its operation by causing an
interrupt.
• Registers
• Cache Memory
• Main Memory
• Electronic Disk
• Magnetic Disk
• Optical Disk
• Hard Disk
• Magnetic Tape
• I/O Protection
• Memory Protection
• CPU Protection
I/O Protection :
a) All I/O instructions are defined as privileged instructions so users cannot issue I/O
instructions from user mode.
b) To do I/O , a user program executes a system call to request that the OS perform
I/O on its behalf and returns the control to the users after completion of I/O
operation.
Memory Protection:
Two registers are used to determine the range of legal addresses a program may access:
1. Base register: holds the smallest legal physical memory address.
2. Limit register: contains the size of the range
• CPU Protection :
A user program may:
a) be stuck in an infinite loop
b) fail to call system services
c) fail to return control to the OS.
Timer: Interrupts computer after specified period to ensure operating system maintains control.
Timer is also commonly used to implement time sharing mechanism.
Timer can be used to compute the current time.
Multitasking
•A program that is loaded into memory and is executing is commonly
referred to as a process.
•When a process executes, it typically executes for only a very short
time before it either finishes or needs to perform I/O.
•Since interactive I/O typically runs at slower speeds, it may take a long
time to complete. During this time, a CPU can be utilized by another
process.
•The operating system allows the users to share the computer
simultaneously. Since each action or command in a time-shared system
tends to be short, only a little CPU time is needed for each user.
•As the system switches CPU rapidly from one user/program to the
next, each user is given the impression that he/she has his/her own
CPU, whereas actually one CPU is being shared among many users.
Time-Sharing Systems
• The CPU is multiplexed among several jobs that are kept in memory
and on disk (the CPU is allocated to a job only if the job is in memory).
• A job is swapped in and out of memory to the disk.
• On-line communication between the user and the system is provided;
when the operating system finishes the execution of one command, it
seeks the next “control statement” not from a card reader, but rather
from the user’s keyboard.
• On-line system must be available for users to access data and code.
Multithreaded System
• A thread is a flow of execution through the process code, with its own program
counter that keeps track of which instruction to execute next, system registers which
hold its current working variables, and a stack which contains the execution history.
• A thread shares with its peer threads few information like code segment,
data segment and open files. When one thread alters a code segment,
memory item, all other threads see that.
• A thread is also called a lightweight process. Threads provide a way to
improve application performance through parallelism. Threads represent
a software approach to improving performance of operating system by
reducing the overhead, thread is equivalent to a classical process.
Multithreaded System
Multithreaded System
• Most modern applications are multithreaded.
• Threads run within application.
• Multiple tasks within the application can be implemented by separate
threads
• Update display.
• Fetch data.
• Spell checking.
• Answer a network request.
• Process creation is heavy-weight while thread creation is light-weight.
• Can simplify code, increase efficiency.
• Kernels are generally multithreaded.
A multiprocessing operating system is defined as a type of operating system that makes use of more
than one CPU to improve performance.
Multiple processors work parallelly in multi-processing operating systems to perform the given task.
All the available processors are connected to peripheral devices, computer buses, physical memory,
and clocks.
The main aim of the multi-processing operating system is to increase the to increase the speed of
execution of the system.
For example: UNIX, LINUX, and Solaris are the most widely used multi-processing operating system.
USER PROGRAM
SYSTEM CALL
KERNAL (OS)
HARDWARE
First, the user application program sets up the arguments for the system call.
After the arguments are all set up, the program executes the "system call" instruction.
This instruction causes an exception: an event that causes the processor to jump to a new
address and start executing the code there.
The instructions at the new address save your user program's state, figure out what system call
you want, call the function in the kernel that implements that system call, restores your user
program state, and returns control back to the user program.
user mode
mode bit=1
kernel mode
mode bit=0
• Whenever we press the power button of our computer system, all the devices get the
power and they are initialized.
• Our main memory which is responsible for holding the instructions will be initially
empty as RAM is volatile memory.
• So, there will be a small set of instructions present in the non-volatile memory called
ROM.
• These instructions will be passed to the CPU and the execution of instructions takes
place which will check all the hardware connected with the system.
• If there are any problems with the hardware, we will get the alert by beep sounds or
even on-screen messages.
• After the testing of the hardware is completed, the booting process continues and
loads the operating system.
2/15/2024 SWETA PANDEY OS Unit Number:1 93
System Boot(CO1)
Cold Booting/ Hard Booting: Cold booting is the process when our computer system moves from the shutdown state
to the start by pressing the power button. The system reads the BIOS from ROM and will eventually load the
Operating System.
Warm Booting/ Soft Booting: Warm booting is the process in which the computer gets restarted due to reasons like
setting the configuration for newly installed software or hardware. Warm booting is called as rebooting.
When our system gets hung and we restart the device, we are doing the Warm booting.
Interrupts are generally called signals which are generated by the software or
hardware when a particular event or process requires immediate attention. So,
the signal informs the processor about a high priority and urgent information
demand causing an interruption in the current working process.
Whenever an interruption occurs the processor finishes the current instruction
execution and starts the execution of the interrupt known as interrupt
handling. Moreover, for every interrupt handling to occur there is an Interrupt
service routine (ISR) or interrupt handler.
The operating system preserves the state of the CPU by storing registers and
the program counter.
Interrupt Handler is a process that runs when an interrupt is generated by hardware or software. The interrupt
handler is also known as the Interrupt Service Routine (ISR). ISR handles the request and sends it to the CPU.
When the ISR is complete, the process gets resumed.
Before working on the interrupt, the state of the current program which was in execution is saved. After saving
the state of the current process, the control is then given to a program to handle the interrupt. We have several
types of interrupt handlers. There is usually an interrupt handler associated with an interrupt.
• One thing to note here is that the state of the current program which was in execution is saved
along with its corresponding register states. After saving the state of the current process, the
control is then given to a program to handle the interrupt, and every program is known as
Interrupt Handler.
What is a kernel?
It is the central component of an OS that handles system resources. It also acts as a bridge between the
computer's application and hardware. It is one of the initial programs that is loaded when the computer boots
up. When an OS is loaded, the kernel is the first component that loads into memory and rests there until the OS
is shut down. It is in charge of various activities, including task management, disk management, and memory
management.
A monolithic kernel is a large single piece of code, composed of several logically different program pieces.
It is one single large program where all the functional components of the operating system have access to all
the data and routines. (All those components reside in the kernel space.) Such a program, with the passage of
time, grows more and more complex, and becomes difficult to maintain.
To avoid these problems, modern monolithic kernels are structured in strictly functional units. One unit
cannot directly access data and routines belonging to other units. The units follow strict communication
protocols to avail services from one another.
This is though purely a programming paradigm, and whatever be the internal structure, every part of the
operating system runs in the kernel mode on behalf of the running process.
Advantage:
• The execution of the monolithic kernel is quite fast as the services such as memory management, file
management, process scheduling, etc., are implemented under the same address space.
• A process runs completely in single address space in the monolithic kernel.
Disadvantage:
• If any service fails in the monolithic kernel, it leads to the failure of the entire system.
• The entire operating system needs to be modified by the user to add any new service.
The microkernel is one of the kernel's classifications. Being a kernel, it handles all system
resources. On the other hand, the user and kernel services in a microkernel are implemented
in distinct address spaces.
User services are kept in user address space, while kernel services are kept in kernel address
space. It aids to reduce the kernel and OS's size.
The minimum functionalities needed in the microkernel are as follows:
In the microkernel, processor scheduling algorithms are also required. Process and thread
schedulers are included.
Address spaces and other memory management mechanisms should be incorporated in the
microkernel.
Memory protection features are also included.
Inter-process communication (IPC) is used to manage servers that execute their own address
spaces.
Advantage :
• Microkernels are secure
• Microkernels are modular, and the various modules may be swapped, reloaded, and
• modified without affecting the kernel.
• Microkernel architecture is compact and isolated, so it may perform better.
• The system expansion is more accessible, so it may be introduced to the system application without disrupting
the kernel.
• When compared to monolithic systems, microkernels have fewer system crashes. Furthermore, due to the
modular structure of microkernels, any crashes that do occur are simply handled.
Drawback
• In a microkernel system, providing services are more costly than in a traditional monolithic system.e microkernel
interface helps in enforcing a more modular system structure.
3 Size Microkernel are smaller in size. Monolithic kernel is larger than microkernel.
Failure of one component does not effect the working of micro Failure of one component in a monolithic kernel leads to the failure
6 Failure
kernel. of the entire system.
To implement IPC messaging queues are used by the Signals and Sockets are utilized to implement IPC in monolithic
9 Communication
communication microkernels. kernels.
11 Maintain It is simple to maintain. Extra time and resources are needed for maintenance.
Message passing and Context Message forwarding and context switching are required by the Message passing and context switching are not required while the
12
switching microkernel. kernel is working.
The kernel only offers IPC and low-level device management
13 Services The Kernel contains all of the operating system’s services.
services.
14 Example Example :Mac OS X. Example :Microsoft Windows 95.
Process Management
Main Memory Management
Secondary-Storage Management
I/O System Management
File Management
Protection System
Networking
Memory is a large array of words or bytes, each with its own address. It is a repository
of quickly accessible data shared by the CPU and I/O devices.
Main memory is a volatile storage device. It loses its contents in the case of system
failure.
The operating system is responsible for the following activities in connections with
memory management:
• Keep track of which parts of memory are currently being used and by whom.
• Decide which processes to load when memory space becomes available.
• Allocate and deallocate memory space as needed.
Since main memory (primary storage) is volatile and too small to accommodate all data and
programs permanently, the computer system must provide secondary storage to back up
main memory.
Most modern computer systems use disks as the principle on-line storage medium, for both
programs and data.
The operating system is responsible for the following activities in connection with disk
management:
• Free space management
• Storage allocation
• Disk scheduling
User
Interface
UNIX Kernel
• https://www.youtube.com/playlist?list=PLBlnK6fEyqRiVhbXDGLXDk_OQAeuVcp2O
• https://nptel.ac.in/courses/106108101
• https://www.youtube.com/playlist?list=PLBlnK6fEyqRiVhbXDGLXDk_OQAeuVcp2O
• https://nptel.ac.in/courses/106108101
• https://www.youtube.com/playlist?list=PLBlnK6fEyqRiVhbXDGLXDk_OQAeuVcp2O
• https://nptel.ac.in/courses/106108101