0% found this document useful (0 votes)
10 views174 pages

Final OS Unit-I

The document outlines the curriculum for the Operating Systems course at MIT School of Computing, detailing course objectives and outcomes, as well as the topics covered in various units. Key areas include process management, synchronization, memory management, storage management, and advanced operating systems concepts. It also lists recommended textbooks and reference materials for further study.

Uploaded by

Nandini Gupta
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)
10 views174 pages

Final OS Unit-I

The document outlines the curriculum for the Operating Systems course at MIT School of Computing, detailing course objectives and outcomes, as well as the topics covered in various units. Key areas include process management, synchronization, memory management, storage management, and advanced operating systems concepts. It also lists recommended textbooks and reference materials for further study.

Uploaded by

Nandini Gupta
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

MIT School of Computing

Department of Computer Science & Engineering

Second Year Engineering

23CSE2010-OPERATING SYSTEM

Class - [Link](SEM-IV)

Unit - I

INTRODUCTION
AY 2024-2025 SEM-II

1
MIT School of Computing
Department of Computer Science & Engineering

Course Objectives

➢ To introduce students to the fundamental concepts of operating


systems.
➢ To familiarize students with process and thread management.
PLD
➢ To equip students with knowledge of process synchronization,
deadlock resolution.
➢ To provide comprehensive understanding of the fundamental
concepts of memory &storage management.
➢ To enable understanding of advance operating system concepts.

2
MIT School of Computing
Department of Computer Science & Engineering

Course Outcomes
On completion of the course, learner will be able to–

➢ Understand the basic concepts and structures of an Operating system.

➢ Explore & understand the role of Process & Thread.

➢ PLD synchronization, and deadlock-


Analyze and apply process scheduling,
handling techniques.

➢ Implement memory management algorithms and evaluate their performance


and explain storage management techniques.

➢ Explore advanced topics like distributed systems and virtualization with real-
world examples.

3
MIT School of Computing
Department of Computer Science & Engineering

Unit-I Introduction to OS
➢ Evolution of Operating System
➢ OS Definition
➢ Operating System Overview – Objectives and Functions
➢ PLD (Batch OS, Multi-programming
Types of operating systems
OS, Time-sharing OS, Real-time OS)
➢ OS Structure(Monolithic, Microkernel, Layered, Client-Server)
➢ OS services (system calls, interrupt handling)
➢ System Programs, Kernel and user space
➢ OS Generation and System Boot

4
MIT School of Computing
Department of Computer Science & Engineering

Unit-I Introduction to OS

➢ Process Management: Process definition, the process concept –


system programmer’s view of processes – operating system’s views
of processes, States, Process Control Block (PCB), Process
PLDexec, process hierarchy, exit, wait),
Creation and Termination (fork,
Context switching, Types of schedulers (long-term, short-term,
medium-term), Scheduling algorithms- Preemptive vs. Non-
Preemptive Scheduling (FCFS, SJF, RR, Priority Scheduling)

➢ Case study: CPU scheduling algorithms

5
MIT School of Computing
Department of Computer Science & Engineering

Unit-II Process synchronization and Deadlocks


➢ Process Synchronization: Cooperating processes and Race Conditions,
the critical-section problem, Peterson’s solution, Semaphores, Classic
problems of synchronization (Producer-Consumer Problem, Dining-
Philosophers Problem, Readers and Writers Problem, Sleeping Barber
PLD
Problem), Inter process Communication: Overview of IPC, Examples of IPC
Systems, Communication in Client Server Systems.

➢ Deadlock: System Model, Deadlock characterization, Deadlock and


Starvation, Methods for Handling Deadlocks, Resource Allocation Graphs,
Deadlock Prevention, Deadlock Avoidance, Deadlock Detection, Recovery
From Deadlock.

➢ Case study: Bankers Algorithm


6
MIT School of Computing
Department of Computer Science & Engineering

Unit-III Memory Management

➢ Memory Management: Logical vs. physical address space,


Contiguous Memory Allocation, Allocation Methods,
Fragmentation, Compaction, Cache Memory, Paging, Demand
PLD
paging, Segmentation, Virtual memory in modern OS, Page
Replacement Algorithms(FIFO, LRU, Second Chance,
OPT),Thrashing and techniques to avoid it.

➢ Case study: Page replacement algorithms

7
MIT School of Computing
Department of Computer Science & Engineering

Unit-IV Storage Management

➢ Storage Management: File-System Interface, File Concept, Access


Methods, Directory Structure, File-System Mounting, File Sharing,
Protection, File-System Implementation, File-System Structure, File-
PLD
System Implementation, Directory Implementation, Allocation
Methods, Free-Space Management, Efficiency and Performance,
Recovery, Mass-Storage Structure, Disk Structure, Disk Scheduling,
Swap-Space Management

➢ Case study: Disk scheduling algorithms

8
MIT School of Computing
Department of Computer Science & Engineering

Unit-V Advance Operating System


➢ Distributed Operating Systems: System Architectures, RTOS &
Scheduling (Rate-monotonic scheduling, Earliest Deadline First),
Virtualization and Operating-System Components
PLD

➢ Linux System — Design Principles, Process Management, Scheduling

➢ Mobile OS — Android

9
MIT School of Computing
Department of Computer Science & Engineering

Text Books:

1. Silberschatz ,Galvin and Gagne , Operating systems Principles – 8th edition or


Later(Wiley Asia Student Edition)

2. Deitel H.M., “An Introduction to Operating Systems”, Addison Wesley Publishers


Company, Latest Edition
PLD
3. Milenkovic M., “Operating Systems : Concepts and Design”, McGraw Hill
International Edition Computer Science series ; Latest Edition

4. Tanenbaum A. S., Modern Operating Systems”, Prentice Hall of India Pvt.


Ltd.,Latest Edition

5. Operating Systems – a modern perspective - Gary Nutt , Addison Wesley, Latest


Edition

10
MIT School of Computing
Department of Computer Science & Engineering

Reference Books:

1. A S Tanenbaum, Distributed Operating Systems, Pearson Education Asia, 2001

2. M Singhal and NG Shivaratri , Advanced Concepts in Operating Systems, Tata


McGraw Hill Inc, 2001
PLD

11
MIT School of Computing
Department of Computer Science & Engineering

Unit-I
PLD
Introduction
to
Operating System

12
MIT School of Computing
Department of Computer Science & Engineering

Unit-I Introduction to OS
➢ Evolution of Operating System
➢ OS Definition
➢ Operating System Overview – Objectives and Functions,
➢ PLD (Batch OS, Multi-programming
Types of operating systems
OS, Time-sharing OS, Real-time OS)
➢ OS Structure(Monolithic, Microkernel, Layered, Client-Server)
➢ OS services (system calls, interrupt handling)
➢ System Programs, Kernel and user space
➢ OS Generation and System Boot

13
MIT School of Computing
Department of Computer Science & Engineering

Unit-I Introduction to OS

➢ Process Management: Process definition, the process concept –


system programmer’s view of processes – operating system’s views
of processes, States, Process Control Block (PCB), Process
PLDexec, process hierarchy, exit, wait),
Creation and Termination (fork,
Context switching, Types of schedulers (long-term, short-term,
medium-term), Scheduling algorithms- Preemptive vs. Non-
Preemptive Scheduling (FCFS, SJF, RR, Priority Scheduling)

➢ Case study: CPU scheduling algorithms

14
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


First Generation Computers (1940-1950)
➢ The first computers used vacuum tubes(a sealed glass tube
containing a near-vacuum which allows the free passage of
electric current.) for circuitry and magnetic drums for memory.
➢ They were often huge and taking up entire room.
PLD
➢ First generation computers relied on machine language. There
were nothing such as OS.
➢ Was using Serial Processing.
➢ They were very expensive to operate and in addition to using a
great deal of electricity, generated a lot of heat, which was
often the cause of malfunctions(defect or breakdown).
➢ The UNIVAC(Universal Automatic Computer)
and ENIAC(Electronic Numerical Integrator and
Computer) computers are examples of first-generation
computing devices.
15
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


Advantages :

➢ It was only electronic device

➢ No OS was present
PLD

Disadvantages :

➢ Too bulky i.e large in size

➢ Vacuum tubes burn frequently

➢ They were producing heat

➢ Maintenance problems
16
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


Second Generation Computers (1950-1960)
➢ Transistors (A transistor is a semiconductor that amplifies or switches
electronic signals) replaced vacuum tubes
➢ Used Batch System / Created base for multitasking.
➢ Batch Processing: Jobs were PLD
submitted in batches, and an operator
loaded them into the computer sequentially.
➢ High-level programming languages were also being developed at this
time, such as early versions of COBOL and FORTRAN.
➢ Job Control Language (JCL): Introduced to manage jobs.
➢ No Interactive Processing: Programs were executed without user
interaction.
➢ Examples: IBM 701, IBM 7090. 17
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


Advantages :

➢ Size reduced considerably

➢ Faster than previous generation


PLD

Disadvantages :

➢ They over heated quickly

➢ Maintenance problems

18
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System

Third Generation Computers (1960-1979)


➢ Multiprogramming: Multiple programs could run simultaneously,
improving CPU utilization.
PLD
➢ Time-Sharing: Allowed multiple users to share computing resources
interactively.
➢ Introduction of System Software: Operating systems like UNIX and
OS/360 emerged.
➢ Features: File systems, device drivers, and memory management.

19
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


Fourth Generation Computers (1980-
1990)
➢ Graphical User Interfaces (GUI): Made
systems more user-friendly (e.g.,
PLD
Windows and macOS).
➢ Distributed Systems: Introduced to
connect multiple computers for resource
sharing.
➢ Networking Capabilities: Supported
protocols for communication over LAN
➢ Examples: MS-DOS, Windows 1.0, 2.0
20
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System


Fifth Generation Computers (2000-Present)

Mobile and Embedded Systems: Operating systems optimized for


mobile devices and IoT (e.g., Android, iOS).
PLD
➢ Virtualization and Cloud Computing: Virtual machines and cloud-
based services became widespread.
➢ Security and Scalability: Focus on data security and scalable
architectures.
➢ Examples: Linux, Windows 10, Android, iOS.

21
MIT School of Computing
Department of Computer Science & Engineering

Evolution of Operating System

PLD

22
MIT School of Computing
Department of Computer Science & Engineering

System and Programming Concepts


System:
➢ System is the collection of various components.

➢ Ex: College is a system, because it consist of various components


like various departments, classroom,
PLD faculties and students.

Programming:
➢ Art of designing and implementing the programs/any specific task.

➢ In a college system, what is program?


A LECTURE can be a program, because it has input and output.
Input: The information that teacher is delivering.
Output: The knowledge student has been received.
23
MIT School of Computing
Department of Computer Science & Engineering

Operating System (OS)


➢ Computer System = Hardware + Software

➢ Hardware: only understand machine code i.e 0 and 1.

➢ Software: Application Software + System Software(OS)


PLD
➢ An Operating System is a system Software that acts as an
interface between a user and the computer hardware.

➢ Operating system is a collection or set of programs, which


manages all the resources of the computer system.

➢ It basically manages all the resources of the computer.

➢ Example: Unix, Window, Linux, Ms-Dos, Mac, etc


24
MIT School of Computing
Department of Computer Science & Engineering

Operating System (OS)


➢ An Operating System (OS) is an interface between a
computer user and computer hardware.

➢ An operating system is a software which performs all the


PLD
basic tasks like file management, memory management,
process management, handling input and output, and
controlling peripheral devices such as disk drives and
printers.

25
MIT School of Computing
Department of Computer Science & Engineering

Overview of Operating Systems

PLD

26
MIT School of Computing
Department of Computer Science & Engineering

Software and its types


➢ Software: Collection of many programs
➢ Software is a set of instructions or commands that tells a
user how to do and what to do.
➢ Two types of software PLD
System Software: These program assist general user
application program.
Ex: Operating System, Assembler.
Application Software: These are the software developed for
the specific tasks.
Ex: Adobe Reader, Media Player.
27
MIT School of Computing
Department of Computer Science & Engineering

Software and its types

PLD

28
MIT School of Computing
Department of Computer Science & Engineering

Application Software and System Software

PLD

Application software is created to help users to perform


specific tasks directly. System software acts as a
mediator between hardware and user applications.
29
MIT School of Computing
Department of Computer Science & Engineering

Application Software
➢ The term “application software” refers to software that
performs specific functions for a user.
➢ It runs on the platform which is provided by system
software.
PLD
➢ It’s a specific purpose software.
➢ Application Software is the type of software that runs as
per user request.
➢ Microsoft Word and Excel, as well as popular web
browsers like Firefox and Google Chrome, are examples
of application software.

30
MIT School of Computing
Department of Computer Science & Engineering

Functions of Application Software


➢ Information and data management
➢ Management of documents (document exchange systems)
➢ Development of visuals and video
➢ Emails, text messaging, audio, and video conferencing
PLD
➢ Management of accounting, finance, and payroll
➢ Management of resources (ERP and CRM systems)
➢ Management of a project
➢ Management of business processes
➢ Software for education (LMS and e-learning systems)
➢ Software for healthcare applications

31
MIT School of Computing
Department of Computer Science & Engineering

Features of Application Software


➢ Application software is written in a high-level
language.
➢ Application software requires more storage space than
system software. PLD

➢ Only a single task is performed by each application


software.
➢ Application Software is easy to build in comparison to
system software.

32
MIT School of Computing
Department of Computer Science & Engineering

Types of Application Software


1. General Purpose Software: This Application Software is used
to perform tasks that are used for a variety of tasks, just not limited
to a specific task only. For Example, MS Word, MS Excel, etc.
PLD
2. Customized Software: It is used to perform tasks that are
designed for specific organizations. For Example, Railway
Reservation System, Airline Reservation System, etc.

3. Utility Software: It is used to support the architecture of the


Computer. It is designed for optimizing and maintaining the system
and also taking care of its requirements. Example : CCleaner
33
MIT School of Computing
Department of Computer Science & Engineering

System Software
➢ System Software is the type of software that is the
interface between application software and the system.
➢ Low-level languages are used to write the system
software. PLD

➢ System Software maintains the system resources and


gives the path for application software to run.
➢ An important thing is that without system software, the
system can not run.
➢ It is general-purpose software.

34
MIT School of Computing
Department of Computer Science & Engineering

Components of System Software


➢ Text Editors
➢ Loaders
➢ Assembler PLD

➢ Macro Processor
➢ Compiler
➢ Debugger

35
MIT School of Computing
Department of Computer Science & Engineering

Text Editors
➢ Editor is a computer program that allows a user to
create and revise a document.
Ex: Notepad, MS word, etc.
PLD
➢ It is a program in which the primary elements being
edited are character strings.
➢ A text editor is a type of program used for editing plain
text files.
➢ With the help of text editor you can write your own
program(ex- C program or java program)

36
MIT School of Computing
Department of Computer Science & Engineering

Loaders
➢ A loader is a software component in an operating system that loads
executable programs or software modules into memory for
execution by the CPU. It initiates the execution.
PLD

37
MIT School of Computing
Department of Computer Science & Engineering

Loaders
➢ Functions of Loaders are:
Allocation: It allocates space for programs in main memory.
Linking: If we have different modules in our program, then
loader links object modules with
PLD each other.
Relocation: Adjusting all address dependent location.
Loading: Physically loading the machine instructions and
data into main memory.

38
MIT School of Computing
Department of Computer Science & Engineering

Assembler
➢ Assembler is a translator which translates assembly
language program into machine language.

PLD

An assembler's purpose in an operating system is to


translate assembly language code into machine code,
which allows the computer to directly communicate
with its hardware.
39
MIT School of Computing
Department of Computer Science & Engineering

Macro Processor
➢ Macro allows a sequence of source language code to be
defined once and then referred many times.
➢ A macro processor takes a source with macro definition
and macro calls and replaces
PLD each macro call with its
body.
➢ A macro processor is a program that helps programmers
write code more efficiently by simplifying tasks and
reducing code duplication. It does this by allowing
programmers to define macros, which are groups of
commonly used instructions, expressions, or code blocks
that can be invoked by name.
40
MIT School of Computing
Department of Computer Science & Engineering

Compiler
➢ Programmers use compilers to translate high-level
programming languages into machine code that
computers can understand and execute.
➢ PLD role in the development
Compilers play a critical
process because they help to catch syntax and
semantic errors before we run the code, which saves
time and prevents crashes.
➢ Compilers also optimize the code for efficient
execution and produce faster, more compact
programs.
41
MIT School of Computing
Department of Computer Science & Engineering

Compiler
➢ It is a translator which converts the high level
language into low level language.
➢ Benefits of writing a program in a high level language:
PLD
Increases productivity: It is very easy to write a
program in a high level language.
Machine independence: A program written in a high
level language is machine independent.

42
MIT School of Computing
Department of Computer Science & Engineering

Debugger
➢ It helps programmer for testing and debugging
programs.
➢ A debugger is a software tool that can help the
software development process by identifying coding
errors at various stagesPLDof the operating system or
application development. Some debuggers will
analyze a test run to see what lines of code were not
executed.
➢ It provides some facilities:
Setting breakpoint
Displaying values of variables
43
MIT School of Computing
Department of Computer Science & Engineering

Functions of System Software


➢ Memory Management
➢ Processor Management
➢ File Management PLD

➢ Security
➢ Error-detecting Aids
➢ Scheduling

44
MIT School of Computing
Department of Computer Science & Engineering

Features of System Software


➢ System software is written in a low-level language.
➢ The size of the system Software is smaller.
➢ PLD to understand.
System software is complex
➢ System software is present near hardware
components.

45
MIT School of Computing
Department of Computer Science & Engineering

Types of System Software


1. Operating System: It has the responsibility of
managing all the resources such as CPU, Printer, Hard
Disk, etc. Examples of Operating
PLD
Systems are Linux,
Apple, macOS, Microsoft Windows, etc.

2. Language Processor: System Software converts


Human-Readable Language into a Machine Language
and it is done by Language Processor. It converts
programs into instructions that are easily readable by
Machines.
46
MIT School of Computing
Department of Computer Science & Engineering

Types of System Software


3. Device Driver: A Device Driver is a program or
software that helps to perform its functions by
controlling the device. YouPLD
first have to install a driver
for running the program..

47
MIT School of Computing
Department of Computer Science & Engineering

Difference between System Software and Application Software

System Software Application Software

System Software maintains the system resources Application software is built for specific tasks.
and gives the path for application software to run.

PLD While high-level languages are used to write the


Low-level languages are used to write the system
software. application software.
It is general-purpose software. It’s a specific purpose software.

Without system software, the system stops and While Without application software system
can’t run. always runs.
System software runs when the system is turned While application software runs as per the user’s
on and stops when the system is turned off. request.

Example: System software is an operating Example: Application software is Photoshop,


system, etc. VLC player, etc.

48
MIT School of Computing
Department of Computer Science & Engineering

Difference between System Software and Application Software


System Software Application Software

System Software programming is more complex Application software programming is simpler in


than application software. comparison to system software.

The Software that is designed to control, A set of computer programs installed in the user’s
integrate and manage the individual hardware PLD system and designed to perform a specific task is
components and application software is known known as application software.
as system software.
A system software operates the system in the Application software runs in the front end
background until the shutdown of the computer. according to the user’s request.
The system software has no interaction with Application software connects an intermediary
users. It serves as an interface between between the user and the computer.
hardware and the end user.
System software runs independently. Application software is dependent on system
software because they need a set platform for its
functioning.

49
MIT School of Computing
Department of Computer Science & Engineering

OS Services
➢ 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.

PLD
➢ 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.

50
MIT School of Computing
Department of Computer Science & Engineering

OS Services
➢ 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.

PLD
➢ 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.

51
MIT School of Computing
Department of Computer Science & Engineering

OS Services
➢ 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.
PLD
➢ 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.

52
MIT School of Computing
Department of Computer Science & Engineering

OS Services
➢ Backup and Recovery: The operating system provides mechanisms for
backing up data and recovering it in case of system failures, errors, or
disasters.

PLD
➢ 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.

53
MIT School of Computing
Department of Computer Science & Engineering

Goals/Objectives of OS
➢ Convenience (user friendly)
➢ Efficiency PLD
➢ Portability
➢ Reliability
➢ Scalability
➢ Robustness

54
MIT School of Computing
Department of Computer Science & Engineering

Objectives of Operating Systems


➢ 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 PLD


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.
55
MIT School of Computing
Department of Computer Science & Engineering

Types of Operating Systems


➢ Classification based on functionalities an operating system
provides:

PLD
1. Batch Operating System
2. Time-sharing Operating System
3. Distributed Operating System
4. Network Operating System
5. Real-time Operating System
6. Multiprocessing Operating System
7. Embedded Operating Systems

56
MIT School of Computing
Department of Computer Science & Engineering

Types of Operating Systems


Batch Operating System Sequencing

Time-sharing Operating System Multitasking

Distributed Operating System Coordination

Network Operating System Connectivity

Real-time Operating System Timeliness

Multiprocessing Operating System Parallelism

Embedded Operating Systems Specialization


MIT School of Computing
Department of Computer Science & Engineering

Batch Operating System


➢ Batch Operating System is
designed to manage and execute
a large number of jobs efficiently
by processing them in groups.

➢ There is an operator which takes


PLD similar jobs having the same
requirements and groups them into
batches.

➢ It is the responsibility of the


operator to sort jobs with similar
needs.

Examples of Batch Operating Systems: ➢ Users submit jobs to the system,


Payroll Systems, Bank Statements, etc which are then executed one after
the other.
58
MIT School of Computing
Department of Computer Science & Engineering

Batch Operating System


➢ A batch operating system
processes tasks in groups rather
than interacting directly with the
computer.

PLD ➢ Batch Operating System group’s


jobs that perform similar type of
functions. These groups are called
as batch.

➢ It organizes similar tasks into


batches for efficient processing
and quicker response times.
Examples of Batch Operating Systems: ➢ This system is well-suited for
Payroll Systems, Bank Statements, etc lengthy and repetitive tasks.
59
MIT School of Computing
Department of Computer Science & Engineering

Batch Operating System


➢ 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.

PLD ➢ In the Batch operating system,


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

➢ The system puts all of the jobs in


a queue on the basis of first come,
first serve and then executes the
Examples of Batch Operating Systems: jobs one by one. The users collect
Payroll Systems, Bank Statements, etc their respective output when all
the jobs get executed.
60
MIT School of Computing
Department of Computer Science & Engineering

Batch Operating System


➢ Advantages of Batch Operating System
▪ Multiple users can share the batch systems.
▪ The idle time for the batch system is very less.
▪ It is easy to manage large work repeatedly
PLD in batch systems.
➢ Disadvantages of Batch Operating System
▪ CPU is not used efficiently. When the current process is doing IO, CPU
is free and could be utilized by other processes waiting.
▪ The other jobs will have to wait for an unknown time if any job fails.
▪ In batch operating system, average response time increases as all
processes are processed one by one.
61
MIT School of Computing
Department of Computer Science & Engineering

Time-sharing Operating System


➢ The operating system which can run multiple processes on a
single processor is called a multiprogramming operating system.
There are different programs that want to get executed. So these
programs are kept in the ready queue and are assigned to the CPU
one by one.
➢ The aim of this is optimal resource utilization and more CPU
utilization. PLD

Multi-programming OS 62
MIT School of Computing
Department of Computer Science & Engineering

Time-sharing Operating System


➢ Multi-tasking operating systems are designed to enable multiple
applications to run simultaneously. Multi-tasking operating systems
allow multiple users to work on the same document or application
simultaneously.

➢ For example, a user running antivirus software, searching the internet,


PLD
and playing a song simultaneously. Then the user is using a
multitasking OS.

Multi-Tasking OS 63
MIT School of Computing
Department of Computer Science & Engineering

Time-sharing Operating System


➢ The task can be from a single user or different users also.
➢ The time that each task gets to execute is called quantum. After this
time interval is over OS switches over to the next task.
➢ Examples of Time-Sharing OS UNIX, Linux, IBM VM/CMS, Windows
NT server, Windows 2000 server

PLD

Time-sharing Operating System


64
MIT School of Computing
Department of Computer Science & Engineering

Time-sharing Operating System


➢ Advantages
▪ Each task gets an equal opportunity.
▪ CPU idle time can be reduced.
▪ Resource Sharing between multiple users.
PLD
▪ Time-sharing allows users to work concurrently. Its reduce waiting time.

➢ Disadvantages
▪ It has difficulty with consistency.
▪ A security and integrity problem with user programs and data.
▪ High Overhead because need for scheduling, context switching.

65
MIT School of Computing
Department of Computer Science & Engineering

Distributed Operating System


➢ Need of Distributed operating system

PLD

Characteristics of Centralized Systems


➢ Single Point of Control
➢ Scalability Issues
➢ Single Point of Failure
➢ No Fault Tolerance
➢ No Coordination and Communication
➢ No Resource Sharing
➢ Performance degrade with increased load 66
MIT School of Computing
Department of Computer Science & Engineering

Distributed Operating System


➢ A distributed operating system is an operating system that is designed
to operate on a network of computers. Distributed systems are usually
used to distribute software applications and data.
➢ Distributed systems are also used to manage the resources of
PLD
multiple computers. Users could be at different sites.
➢ Multiple computers are connected via a single communication channel.
Every system has its own processor and memory. Resources like disk,
computer, CPU, network interface, nodes, etc., are shared among
different computers at different locations. It increases data availability in
the entire system.

67
MIT School of Computing
Department of Computer Science & Engineering

Distributed Operating System


➢ A distributed operating system is the software over a collection of
independent, networked, communicating and physically separate
computational nodes.

PLD

68
MIT School of Computing
Department of Computer Science & Engineering

Distributed Operating System


➢ A collection of autonomous computer systems that are physically
separated but are connected by a centralized computer network that is
equipped with distributed system software.
➢ The autonomous computers will PLD
communicate among each system by
sharing resources and files and performing the tasks assigned to them.
➢ Distributed Operating Systems are of two types: Client-Server
Systems and Peer-to-Peer Systems.
➢ Examples of distributed operating systems: Solaris, Micros, DYNIX,
Ubuntu, Linux

69
MIT School of Computing
Department of Computer Science & Engineering

Distributed Operating System


➢ Advantages
▪ Fault Tolerance: Failure of one system will not affect the other network
communication, as all systems are independent of each other.
▪ Load Balancing : Load on host computer reduces. (Evenly Distributed)
PLD
▪ Computation Speedup: Since resources are being shared, computation is
highly fast and durable.
➢ Disadvantages
▪ Failure of the main network will stop the entire communication.
▪ To establish distributed systems, the language is used not well-defined yet.
▪ These types of systems are not readily available as they are very
expensive.
70
MIT School of Computing
Department of Computer Science & Engineering

Network Operating System


➢ An operating system that connects multiple computers and devices on a
local area network to allow sharing of files and resources by connection
and communication over a network.
➢ It used to boost the performance of multiple CPUs within a single compute
PLD
system. Multiple CPUs are linked together so that a job can be divided and
executed more quickly.
➢ When a job is completed, the results from all CPUs are compiled to
provide the final output.
➢ Examples of Network Operating Systems UNIX, Linux, Microsoft Windows
Server 2008, Microsoft Windows Server 2003, Novell NetWare, Banyan's
VINES, Artisoft's LANtastic, Mac OS X, and BSD. 71
MIT School of Computing
Department of Computer Science & Engineering

Difference between Distributed and Network OS

Distributed Operating System Network Operating System

.Its main objective is to manage hardware Its primary objective is to give local services to
resources. remote users
Distributed OS is less scalable. The process to Network OS is highly scalable. A new machine
add new hardware is complex. PLD can be added very easily.
It has very high fault tolerance. Less fault tolerance as compared to distributed
OS.
Distributed OS-based nodes have the same copy Network OS-based systems have their own
of the operating system. copy of operating systems.

N-tier Client-server Architecture 2-tier Client-server Architecture

It is difficult to implement a Distributed OS. Network OS-based systems are easy to build
and maintain.

72
MIT School of Computing
Department of Computer Science & Engineering

Real-time Operating System


➢ A real-time operating system (RTOS) is a system that processes data
and executes tasks within strict time constraints.
➢ RTOSs are used in many industries, including automotive, aerospace,
medical, and industrial automation.
PLD
➢ The working of a real time operating system is based on the principle
of deterministic behavior, which guarantees that tasks are executed
within their deadlines.
➢ An real time OS typically employs a preemptive priority-based
scheduling algorithm, which means that tasks with higher priorities
are executed before tasks with lower priorities.

73
MIT School of Computing
Department of Computer Science & Engineering

Real-time Operating System


➢ Types of Real Time Operating Systems
1. Hard real time OS:
➢ It guarantees that all tasks will be completed within a certain
deadline, without exception. These systems are designed to provide
PLD
deterministic behavior, ensuring that critical tasks are completed on
time, every time.
➢ Hard real-time systems are commonly used in applications where
missed deadlines can have serious consequences, such as in
aerospace and defense, medical devices, and certain types of industrial
automation.

74
MIT School of Computing
Department of Computer Science & Engineering

Real-time Operating System


➢ Types of Real Time Operating Systems
2. Soft real time OS:
➢ It does not guarantee that all tasks will be completed within a
certain deadline. Instead, it provides the best-effort service, attempting
PLD
to complete tasks as quickly as possible, but without making any
guarantees about response time or deadline completion.
➢ Soft real-time systems are commonly used in applications where
occasionally missed deadlines are tolerable, but overall system
performance is important. Some examples of soft real-time applications
include multimedia streaming, interactive gaming, and certain types of
data processing. 75
MIT School of Computing
Department of Computer Science & Engineering

Multiprocessing Operating System

PLD

Single processor system


➢ Throughput is less.
➢ More cost because require separate resources.
➢ No Fault tolerant.
➢ Performance degrade with increased load.
76
MIT School of Computing
Department of Computer Science & Engineering

Multiprocessing Operating System

➢ It used to boost the performance of multiple CPUs within a single


computer system.
➢ Multiple CPUs are linked together so that a job can be divided and
PLD
executed more quickly.
➢ When a job is completed, the results from all CPUs are compiled to
provide the final output.

77
MIT School of Computing
Department of Computer Science & Engineering

Embedded Operating System


➢ Embedded Operating Systems is a specialized operating system (OS)
designed to perform a specific task for a device that is not a computer.
➢ The main job of an embedded OS is to run the code that allows the device
to do its job.
PLD
➢ It makes the device's hardware accessible to software that is running on
top of the OS.
➢ It typically consists of a microcontroller or microprocessor, memory,
input/output interfaces.
➢ These systems are programmed to carry out specific tasks and are often
found in everyday devices such as appliances, automobiles, medical
devices, and industrial machines. 78
MIT School of Computing
Department of Computer Science & Engineering

Operating-System Structure

The operating system structure refers to the way in which


the various components of an operating system are
PLD
organized and interconnected.

1. Simple structure

2. Monolithic structure

3. Layered structure

4. Microkernel structure
79
MIT School of Computing
Department of Computer Science & Engineering

1. Simple OS Structure
➢ Used very beginning and old
Structure
➢ Not having well designed
structure
PLD
➢ Example: MS-DOS
➢ Interface & levels of functionality
are not separated.

80
MIT School of Computing
Department of Computer Science & Engineering

Simple Operating System Structure

➢ Advantages
▪ Simple to develop
▪ Better application performance
PLD

➢ Disadvantages
▪ Less Secure
▪ If user application fails all OS fails.
▪ Not well design and structured.

81
MIT School of Computing
Department of Computer Science & Engineering

Monolithic Operating System Structure


➢ Everything packed in one
level hence called
monolithic structure.
➢ The kernel acts as a
manager by managing all
things of the Operating PLD
System.
➢ Kernels can directly access
all the resources of the
operating System
➢ The monolithic kernel
functions as a virtual
machine by working on
top of the Operating
System and controlling all
hardware components. 82
MIT School of Computing
Department of Computer Science & Engineering

Monolithic Operating System Structure


➢ This operating system works in the kernel space in the
monolithic system.

➢ The monolithic kernel is quite fast as the services such


PLD
as memory management, file management, process
scheduling etc.

➢A set of primitives or system calls implement all


operating system services such as process
management, concurrency, and memory management.

➢ Example Linux, BSDs, Solaris, DOS, OpenV 83


MIT School of Computing
Department of Computer Science & Engineering

Monolithic Operating System Structure

➢ Advantages
▪ Faster execution due to direct access to all the services.
▪ Simple and easy to implement structure.
▪ Fewer lines of codes need to bePLD
written for a monolithic kernel.

➢ Disadvantages
▪ If one component fails, the entire system crashes
▪ Debugging is complex and difficult
▪ It’s difficult to add new functionalities

84
MIT School of Computing
Department of Computer Science & Engineering

Layered Operating System Structure

➢ OS is divided into layers


or levels. i.e layer 0,
HW…layer N … user
interface.
➢ Broken down PLD
functionality into
separate layer.
➢ Easy to implements and
design.
➢ Ex- Windows NT OS

85
MIT School of Computing
Department of Computer Science & Engineering

Layered Operating System Structure

➢ key characteristics of a layered operating system structure:

▪ Each layer is responsible for a specific set of tasks.


This makes it easier to understand, develop, and maintain
PLD
the operating system.
▪ Layers are typically arranged in a hierarchy. This
means that each layer can only use the services provided
by the layers below it.
▪ Layers are independent of each other. This means that
a change to one layer should not affect the other layers.

86
MIT School of Computing
Department of Computer Science & Engineering

Layered Operating System Structure


➢ Advantages
▪ Easy debugging
▪ Easy update
▪ No direct access to hardware
PLD
▪ Well design and define structure

➢ Disadvantages
▪ Complex and careful implementation
▪ Communication(between adjacent layer)
▪ It’s difficult to add new functionalities

87
MIT School of Computing
Department of Computer Science & Engineering

Microkernel Operating System Structure


➢ In microkernel, user
services and kernel
services are kept in
separate address space.
➢ OS is complex to design. PLD
➢ Microkernel are smaller in
size.
➢ Easier to add new
functionalities.
➢ Failure of one component
does not effect the working
of micro kernel.
➢ Example : Mac OS X. 88
MIT School of Computing
Department of Computer Science & Engineering

Microkernel Operating System Structure


➢ In monolithic kernel all
functionalities packed into
kernel make structure big.
➢ Micro->Small structure
➢ Two separate mode PLD
➢ User mode :essential
function.
➢ Kernel mode : Non-essential
function.(Core functionalities)
➢ Main function:- provide
communication between
client and services.(Massage
passing) 89
MIT School of Computing
Department of Computer Science & Engineering

Microkernel Operating System Structure


➢ Advantages
▪ It allows the operating system to be portable between platforms.
▪ Micro-Kernels are smaller, they can be successfully tested.
▪ Failure of one component does not effect the working of micro kernel.
PLD
▪ It is simple to maintain.
▪ Easier to add new functionalities.
➢ Disadvantages
▪ Complex to design->Modular Structure
▪ If Kernel fails then then all system collapse
▪ Microkernel system is costly.
▪ Low performance ->Massage passing 90
MIT School of Computing
Department of Computer Science & Engineering

Operating-System Operations
• PROCESS MANAGEMENT
• MEMORY MANAGEMENT
• SYSTEM MANAGEMENT
• PROTECTION AND SECURITY
PLD

91
MIT School of Computing
Department of Computer Science & Engineering

PROCESS MANAGEMENT
Process Management refers to aligning
processes with an organization's strategic
goals, designing and implementing
process architectures, establishing
process measurement systems that align
with organizational goals, and educating
PLD
and organizing managers so that they will
manage processes effectively.

SUMMARY

92
MIT School of Computing
Department of Computer Science & Engineering

Memory Management
Memory :
Memory is a device that is used to store data or programs on a
PLD in an electronic digital
temporary or permanent basis for use
computer.

Memory management is the process of controlling and coordinating a


computer's main memory. It ensures that blocks of memory space are
properly managed and allocated so the operating system (OS),
applications and other running processes have the memory they need to
carry out their operations.

93
MIT School of Computing
Department of Computer Science & Engineering

PLD

94
MIT School of Computing
Department of Computer Science & Engineering

Storage Management is defined as


Storage Management : it refers to the management of the
data storage equipment’s that are
used to store the user/computer
generated data. Hence it is a tool or
set of processes used by an
administrator to keep your data and
storage equipment’s safe.
PLD

95
MIT School of Computing
Department of Computer Science & Engineering

Storage Management : Storage management key attributes: Storage


management has some key attribute which is
generally used to manage the storage capacity
of the system. These are given below:

1. Performance
2. Reliability
3. Recoverability
4. Capacity

PLD

96
MIT School of Computing
Department of Computer Science & Engineering

PROTECTION AND SECURITY


WHAT YOU EXPECT FROM YOUR OS AS USER ??

PLD

97
MIT School of Computing
Department of Computer Science & Engineering

PROTECTION AND SECURITY


•Protection is a method used in operating systems that manages threats
within the system to maintain the proper functioning of the system.

•Security is a method used in operating systems that handles the threats from
outside of the system to maintain the proper functioning of the system.
PLD

98
MIT School of Computing
Department of Computer Science & Engineering

OS SECURITY ISSUES

PLD

99
MIT School of Computing
Department of Computer Science & Engineering

System call
➢ 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. PLD
➢ 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.

100
MIT School of Computing
Department of Computer Science & Engineering

System call
➢ System Calls in programs can ask the operating system (OS)
for services through a system call. Putting it more simply, it’s a
means via which a program can communicate with the
underlying system, for example, by gaining access to hardware
PLD
resources or by using privileged commands.

➢ A program can request a service from the OS by executing a


specified instruction, which sets off a transition to kernel mode
and initiates a system call. After handling the request and
carrying out the required actions, the OS sends the outcome
back to the program.

101
MIT School of Computing
Department of Computer Science & Engineering

Types of System Calls

1. Process Control
[Link] Management
3. Device Management
[Link] Maintenance PLD
[Link]

102
MIT School of Computing
Department of Computer Science & Engineering

Types of System Calls


1. 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.
PLD
2. 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.

3. 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.
103
MIT School of Computing
Department of Computer Science & Engineering

Types of System Calls

4. 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, setPLD
time or date, get time or date, set
system data, etc.

5. 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.

104
MIT School of Computing
Department of Computer Science & Engineering

Program and Process

➢ Program is a set of instructions written to perform a task, stored


in memory.
➢ A process is the active execution of a program, using system
resources like CPU and [Link]

➢ In other words, a program is static, a process is dynamic,


representing the program in action.

105
MIT School of Computing
Department of Computer Science & Engineering

Program
➢ Program is a set of instructions written to perform a task, stored
in memory.
➢ When we execute a program that was just compiled, the
Operating System will generatePLD a process to execute the
program.
➢ Execution of the program starts via mouse clicks, command line
entry of its name, etc.
➢ A program is a passive entity as it resides in the secondary
memory, such as the contents of a file stored on disk.
➢ One program can have several processes.

106
MIT School of Computing
Department of Computer Science & Engineering

Process

➢ A process is the active execution of a program, using system


resources like CPU and memory.
➢ The term process (Job) refers to program code that has been
PLD so that it can be executed by
loaded into a computer’s memory
the central processing unit (CPU).
➢ A process can be described as an instance of a program running
on a computer or as an entity that can be assigned to and
executed on a processor.
➢ A program becomes a process when loaded into memory and
thus is an active entity.

107
MIT School of Computing
Department of Computer Science & Engineering

Difference between Program and Process


Program Process
The program contains a set of instructions The process is an instance of an executing
designed to complete a specific task. program.

The process is an active entity as it is created


A program is a passive entity as it resides in the
during execution and loaded into the main
secondary memory.
PLD memory.

The process exists for a limited period as it


Program exists at a single place and continues to
gets terminated after the completion of the
exist until it is deleted.
task.

A program is a static entity. The process is a dynamic entity.

The program does not have any resource The process has a high resource requirement,
requirement, it only requires memory space for it needs resources like CPU, memory address,
storing the instructions. and I/O during its lifetime.
Process has its control block called Process
The program does not have any control block.
Control Block.

108
MIT School of Computing
Department of Computer Science & Engineering

Difference between Program and Process


Program Process
In addition to program data, a process also
The program has two logical components:
requires additional information required for the
code and data.
management and execution.
Many processes may execute a single program.
The program does not change itself.
PLD
Their program code may be the same but program
data may be different. these are never the same.

The process is a sequence of instruction


Program contains instructions .
execution.

109
MIT School of Computing
Department of Computer Science & Engineering

System Program
➢ A system program in an operating system (OS) is a software program that helps
manage and control a computer's hardware and resources.
➢ System programs are used to run the OS and other programs on a computer.

PLD

110
MIT School of Computing
Department of Computer Science & Engineering

System 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
PLD
system calls.
➢ The system call establishes a connection between the
user software and the operating system's services. The
system program also offers a proper environment for the
development and execution of a program.
➢ For example, a modern operating system includes
system programs such as an assembler, compiler,
editor, loader, etc. These programs enable
programmers to create and run new programs. 111
MIT School of Computing
Department of Computer Science & Engineering

System Programs
➢ What do system programs do?
➢ Manage files: Create, modify, delete, copy, rename, print,
and dump files and directories
➢ Provide a user interface: Allow
PLD
users to interact with the
operating system, such as through a command line
interface (CLI)
➢ Program the OS: Provide software that is used to
program the operating system
➢ Provide a platform for application software: Provide a
convenient environment for application programs to run
on.

112
MIT School of Computing
Department of Computer Science & Engineering

Interrupt
➢ Interrupts are signals or events that divert the attention
of the central processing unit (CPU) from its current task
to handle a specific event.
➢ These events can range PLD from hardware-related issues,
such as a key press or mouse movement, to software-
generated signals like system calls or program errors.
➢ Interrupts allow the operating system to promptly
respond to these events, ensuring a more dynamic and
efficient system.

113
MIT School of Computing
Department of Computer Science & Engineering

Interrupt
➢ Interrupts have two types: Hardware interrupt and
Software interrupt.
➢ The hardware interrupt occurs by the interrupt request
signal from peripheral circuits. On the other hand, the
software interrupt occursPLDby executing a dedicated
instruction.
➢ The hardware interrupt has an external interrupt and
an internal interrupt.
➢ The external interrupt occurs when a specified signal is
input to the dedicated external interrupt terminal.
➢ The internal interrupt occurs by an interrupt request
signal from a peripheral circuit built into the
microcontroller. 114
MIT School of Computing
Department of Computer Science & Engineering

User space
➢ The area of memory where user applications run.
➢ Includes utilities, programming languages, graphical
tools, and applications.
➢ User space applications can't
PLD directly access the system's
hardware resources.
➢ User space applications must use system calls to request
access to the system's hardware resources.

115
MIT School of Computing
Department of Computer Science & Engineering

Kernel space

➢ The area of memory where the operating system's kernel


runs.
➢ Includes the kernel, kernel extensions, and most device
PLD
drivers.
➢ The kernel has unrestricted access to the system's
hardware resources.
➢ The kernel is responsible for managing the system's
resources, such as the CPU, memory, and storage.

116
MIT School of Computing
Department of Computer Science & Engineering

Operating System Generations

PLD

117
MIT School of Computing
Department of Computer Science & Engineering

Operating System Generations


➢ 1940s-1950s: Early Beginnings
➢ Computers operated without operating systems (OS).
➢ Programs were manually loaded and run, one at a
time.
➢ The first operating system
PLD was introduced in 1956. It
was a batch processing system GM-NAA I/O (1956)
that automated job handling.

➢ 1960s: Multiprogramming and Timesharing


➢ Introduction of multiprogramming to utilize CPU
efficiently.
➢ Timesharing systems, like CTSS (1961) and Multics
(1969), allowed multiple users to interact with a single
system. 118
MIT School of Computing
Department of Computer Science & Engineering

Operating System Generations


➢ 1970s: Unix and Personal Computers
➢ Unix (1971) revolutionized OS design with simplicity,
portability, and multitasking.
➢ Personal computers emerged, leading to simpler OSs
like CP/M (1974) and PC-DOS
PLD (1981).

➢ 1980s: GUI and Networking


➢ Graphical User Interfaces (GUIs) gained popularity with
systems like Apple Macintosh (1984) and Microsoft
Windows (1985).
➢ Networking features, like TCP/IP in Unix, became
essential.

119
MIT School of Computing
Department of Computer Science & Engineering

Operating System Generations


➢ 1990s: Linux and Advanced GUIs
Linux (1991) introduced open-source development.
Windows and Mac OS refined GUIs and gained
widespread adoption.
PLD
➢ 2000s-Present: Mobility and Cloud
Mobile OSs like iOS (2007) and Android (2008) dominate.
Cloud-based and virtualization technologies reshape
computing, with OSs like Windows Server and Linux
driving
innovation.

120
MIT School of Computing
Department of Computer Science & Engineering

System Boot

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.
PLD

Rebooting: Restarting a computer also is called rebooting.

121
MIT School of Computing
Department of Computer Science & Engineering

Sequencing of Booting
➢ Booting is a start-up sequence that starts the
operating system of a computer when it is turned on.
➢ A boot sequence is the initial set of operations that the
computer performs whenPLDit is switched on.
➢ Every computer has a boot sequence.

122
MIT School of Computing
Department of Computer Science & Engineering

Sequencing of Booting
➢ Boot Loader:
➢ The program that starts the chain reaction that ends with
the entire operating system being loaded is the boot
loader or bootstrap loader. The boot loader's only job is to
load other software for thePLDoperating system to start.

➢ Boot Devices: The boot device is the device from


which the operating system is loaded. A modern PC
BIOS (Basic Input/Output System) supports booting from
various devices. These include the local hard disk drive,
optical drive, floppy drive, a network interface card, and a
USB device. The BIOS will allow the user to configure
a boot order. 123
MIT School of Computing
Department of Computer Science & Engineering

Sequencing of Booting
➢ Boot Sequence: There is a standard boot sequence that
all personal computers use.

PLD

124
MIT School of Computing
Department of Computer Science & Engineering

Booting Process in Operating System


When our computer is switched on, it can be started by
hardware such as a button press, or by software command,
a computer's central processing unit (CPU) has no software
in its main memory, there is some process(boot) which must
load software into main memoryPLD before it can be executed.

125
MIT School of Computing
Department of Computer Science & Engineering

Dual Booting
➢ When two operating systems are installed on the
computer system, then it is called dual booting.
➢ Multiple operating systems can be installed on such a
system. But to know which operating system is to boot, a
PLD multiple file systems and
boot loader that understands
multiple operating systems can occupy the boot space.
➢ Once loaded, it can boot one of the operating systems
available on the disk. The disk can have multiple
partitions, each containing a different type of operating
system. When a computer system turns on, a boot
manager program displays a menu, allowing the user to
choose the operating system to use.
126
MIT School of Computing
Department of Computer Science & Engineering

Process Management
➢ Process Management: Process definition, the process
concept – system programmer’s view of processes –
operating system’s views of processes, States, Process
PLD
Control Block (PCB), Process Creation and Termination (fork,
exec, process hierarchy, exit, wait), Context switching, Types
of schedulers (long-term, short-term, medium-term),
Scheduling algorithms- Preemptive vs. Non-Preemptive
Scheduling (FCFS, SJF, RR, Priority Scheduling)

127
MIT School of Computing
Department of Computer Science & Engineering

Process
➢ Program under execution
➢ An instance of a program
➢ Schedulable/Dispatch unit (CPU)
➢ Unit of execution (CPU) PLD

128
MIT School of Computing
Department of Computer Science & Engineering

Process as a Data structure


➢ Definition (Same as last slide)
➢ Representation/Implementation
➢ Operations PLD
➢ Attributes

129
MIT School of Computing
Department of Computer Science & Engineering

Process
➢ A process is basically a program in execution or instance
of the program execution.
➢ The execution of a process must progress in a sequential
PLD
fashion.
➢ Process is not as same as program code but a lot more
than it.
➢ A process is an 'active' entity as opposed to program
which is considered to be a 'passive' entity.
130
MIT School of Computing
Department of Computer Science & Engineering

Process
➢ A "process" in computing refers to an active instance of a program
that is currently being executed by the system, encompassing not
just the program code itself but also its current state including
memory allocation, CPU registers,
PLD and other relevant data; from a
system programmer's perspective, a process is essentially a
collection of data structures that represent the program's
execution context, while an operating system views a process as an
entity it manages, tracking its state (like running, waiting,
terminated) and allocating system resources to it as needed.

131
MIT School of Computing
Department of Computer Science & Engineering

Process : System Programmer's View


➢ Focuses on the data structures and mechanisms needed to
implement a process within the program code, including
things like the program counter, stack, heap, and data
PLD
segments.
➢ Primarily concerned with how to manage the execution flow
and data within the program's address space.
➢ May involve writing code to handle function calls, memory
allocation, and interfacing with the operating system's
process management APIs.
132
MIT School of Computing
Department of Computer Science & Engineering

Process : System Programmer's View


➢ Example: When a programmer writes a function in a
program, they would define the stack frame
PLD
structure to store local variables and return
addresses, which is a key aspect of managing the
process execution context.

133
MIT School of Computing
Department of Computer Science & Engineering

Process : Operating System's View


➢ Sees a process as an abstract entity that needs to be
scheduled, managed, and given access to system
resources like CPU time, memory,
PLD and I/O devices.
➢ Tracks the state of a process (new, ready, running,
waiting, terminated) and manages transitions between
these states based on system events.
➢ Responsible for creating, suspending, resuming, and
terminating processes as needed.
134
MIT School of Computing
Department of Computer Science & Engineering

Process : Operating System's View


➢ Example: When a user launches a program, the OS
creates a new process entry in its internal data
PLD
structures, allocates memory space for the program,
and then schedules the process to run on the CPU
when it becomes available.

135
MIT School of Computing
Department of Computer Science & Engineering

Process memory representation


Process memory is divided into four sections for
efficient working :
➢ The Text section is made up of the compiled program
code, read it from nonvolatile storage when the program is
PLD
launched.
➢ The Data section is made up the global and static
variables, allocated and initialized prior to executing the
main.
➢ The Heap is used for the dynamic memory allocation,
and is managed via calls to new, delete, malloc, free, etc.
➢ The Stack is used for local variables. Space on the stack
is reserved for local variables when they are declared.

136
MIT School of Computing
Department of Computer Science & Engineering

Process operations
➢ Create (space allocation)
➢ Schedule/run
➢ Wait/Block
PLD
➢ Suspend/Resume
➢ Terminate (space
deallocation)

137
MIT School of Computing
Department of Computer Science & Engineering

Process Creation and Termination


➢ Process creation is achieved
through the fork() system
call.
➢ The newly created processPLD is
called the child process and
the process that initiated it
(or the process when
execution is started) is called
the parent process.
➢ After the fork() system call,
now we have two processes -
parent and child processes. 138
MIT School of Computing
Department of Computer Science & Engineering

Process Attributes in Process Control Block (PCB)


➢ The architecture of a PCB is completely
dependent on Operating System and
may contain different information in
different operating systems.
➢PLD
A Process Control Block(PCB) is a data
structure maintained by the
Operating System for every process.
➢ The PCB is identified by an integer
process ID (PID).
➢ A PCB keeps all the information needed
to keep track of a process.

139
MIT School of Computing
Department of Computer Science & Engineering

Process Attributes in Process Control Block (PCB)


1. Process ID: Unique identification for each of
the process in the operating system.
2. Process State: The current state of the
process i.e., whether it is ready, running, waiting,
PLD
or whatever.
3. Pointer: A pointer to parent process.
4. Priority: Priorities of processes.
5. Program Counter is a pointer to the address
of the next instruction to be executed for this
process.
6. CPU registers: Various CPU registers where
process need to be stored for execution for
running state. 140
MIT School of Computing
Department of Computer Science & Engineering

Process Attributes in Process Control Block (PCB)


7. IO status information: This includes a list of I/O
devices allocated to the process.
8. Accounting information: This includes the
amount of CPU used for process execution, time
PLDexecution ID etc.
limits,
9. CPU Scheduling Information: Process priority
and other scheduling information which is required
to schedule the process.
9. Memory management information: This
includes the information of page table, memory
limits, Segment table depending on memory used
by the operating system.
141
MIT School of Computing
Department of Computer Science & Engineering

More about PCBs


➢ OS maintains 1 PCB for each process.
➢ Contents of a PCB are also called collectively as context of a
process.
OS
PLD PCB3…PCBn
PCB1, PCB2,
Process 1 (Stack, heap, code, data sections)
Process 2 (Stack, heap, code, data sections)
Process 3 (Stack, heap, code, data sections)
.
.

Process n (Stack, heap, code, data sections)

142
MIT School of Computing
Department of Computer Science & Engineering

Context Switching in OS
➢ CPU uses registers to store current process
execution state.
➢ When stopped in between, have to save these
values in PCB to resumePLD
from that point onwards.
➢ Context switching is the process of switching
between tasks or contexts. Basically, the state of
the currently executing process is saved before
moving to the new process. Saving state means
copying all live registers to PCB(Process Control
Block).

143
MIT School of Computing
Department of Computer Science & Engineering

Example Context Switching

PLD

144
MIT School of Computing
Department of Computer Science & Engineering

Non-preemptive process states

PLD

No Multitasking

145
MIT School of Computing
Department of Computer Science & Engineering

Preemptive Process States

PLD

Done Multitasking

146
MIT School of Computing
Department of Computer Science & Engineering

Process States
➢ New: All installed processes are here (SSD, HDD)
➢ Ready: Processes among the installed processes
that are wanting to runPLD
on CPU (in MM)
➢ Running: Running on CPU (MM)
➢ Blocked: Waiting for any I/O or event (MM)
➢ Terminated: All completed processes are in this
state (goes out from the MM)

147
MIT School of Computing
Department of Computer Science & Engineering

Process States
➢ When a new process is formed, OS makes the PCB
➢ In non preemptive process, no factor can force a
running process to come PLDout of CPU. Termination or
going to waiting is only its wish.
➢ PCB will be there in running, ready and waiting
state. In these three states, process will be in MM
only.

148
MIT School of Computing
Department of Computer Science & Engineering

CPU scheduling
➢ Make a selection of ready processes to run on CPU.
➢ Needed for better performance.
➢ Metric for performancePLDmay vary.
➢ Multiple policies according to metric.

149
MIT School of Computing
Department of Computer Science & Engineering

Scheduling Queue
➢ Job queue: To keep all processes in new state.
➢ Ready queue: To keep all processes in ready state.
➢ Device queue: To keep the processes in blocked
PLD
state.

150
MIT School of Computing
Department of Computer Science & Engineering

Scheduling Objectives
➢ Maximize throughput.
➢ Maximize number of users receiving acceptable
response times.
➢ Be predictable. PLD

➢ Balance resource use.


➢ Enforce Priorities.
➢ Give preference to processes holding key resources.

151
MIT School of Computing
Department of Computer Science & Engineering

CPU scheduling need


➢ Make a selection of ready processes to run on CPU.
➢ Needed for better performance
➢ Metric for performancePLDmay vary
➢ Multiple policies according to metric

152
MIT School of Computing
Department of Computer Science & Engineering

Types of scheduler
➢ Long term scheduler: new to ready
➢ Short term scheduler: ready to running
➢ Mid term scheduler: swapping
PLD is done by this.
Swapping leads to suspension. (Use Secondary
memory to stored process)

153
MIT School of Computing
Department of Computer Science & Engineering

Sr. Long-term Scheduler Short-term Scheduler Medium -term Scheduler


No.
1 It is job Scheduler. It is CPU scheduler. It is process swapping scheduler.

2 Speed is lesser than Speed is fastest than other Speed is between both short and
short term scheduler two schedulers a long term scheduler

3 Transition of process Transition of process state No process state transition


state from new to ready from ready to executing
state state
4 It selects process from PLD processes
It selects those It can reintroduce the process into
pool and loads them which are ready to execute memory and execution cannot be
into memory for continued
execution
5 Supplies a mix of jobs, Selects a new process to Process are swapped in and out
such as I/O bound and allocate CPU frequently for balanced process mix
CPU bound
6 It is almost absent or It is almost absent or It is almost absent or minimal in
minimal in time sharing minimal in time sharing time sharing system
system system
7 Process state is (new Process state is ( ready to Swapping state
to ready) running)

154
MIT School of Computing
Department of Computer Science & Engineering

CPU Scheduling
➢ Types: Preemptive and non preemptive
➢ Assumption initially: No process has I/O requirement
➢ Some terminologies:
➢ Arrival Time(AT): Process arrival time(admitted by LTS)
➢ Burst/Service time(BT): burst PLDtime is the time, required the CPU to
execute that job, it is in milli seconds.
➢ Completion time (CT): Time when process completes execution.
➢ Turn around time (TAT): Time from arrival until completion
(TAT=CT-AT)
➢ Waiting time (WT): Waiting for CPU in ready queue (WT=TAT-BT)
➢ Response time: Time from arrival to the first response on CPU
➢ Scheduling length: max(CT)-min(AT)
➢ Throughput: No of processes executed per unit time
155
MIT School of Computing
Department of Computer Science & Engineering

Scheduling Criteria
➢ CPU Utilization
➢ Throughput
➢ Turnaround time
➢ Waiting Time PLD
➢ Response Time

156
MIT School of Computing
Department of Computer Science & Engineering

CPU SCHEDULING ALGORITHMS:


➢ FCFS (First come first serve) – Non
preemptive
➢ SJF (Shortest Job first)
PLD

➢ Priority Scheduling
➢ Round Robin

157
MIT School of Computing
Department of Computer Science & Engineering

FCFS (First Come First Serve)


➢ The process that request the CPU first is holds the CPU first.
➢ If a process request the CPU then it is loaded into the ready
queue. PLD

➢ Mode: Non preemptive


➢ Tie breaker: Smallest ID first of the processes at tie (P1 and P2,
P1 will execute first)

158
MIT School of Computing
Department of Computer Science & Engineering

FCFS Example no. 1


Process Id Arrival time Burst time

P1 3 4

P2 5 3
PLD
P3 0 2

P4 5 1

P5 4 3

Calculate the average waiting time and average turn around time.

159
MIT School of Computing
Department of Computer Science & Engineering

FCFS Example no. 1


Gantt Chart-

PLD

Here, black box represents the idle time of CPU.


➢ Turn Around time = Exit time – Arrival time
➢ Waiting time = Turn Around time – Burst time
160
MIT School of Computing
Department of Computer Science & Engineering

FCFS Example no. 1


Process Id Exit time Turn Around time Waiting time

P1 7 7–3=4 4–4=0
P2 13 13 – 5 = 8 8–3=5
P3 2 2 – PLD
0=2 2–2=0
P4 14 14 – 5 = 9 9–1=8

P5 10 10 – 4 = 6 6–3=3

Average Turn Around time = (4 + 8 + 2 + 9 + 6) / 5 = 29 / 5 =


5.8 unit
Average waiting time = (0 + 5 + 0 + 8 + 3) / 5 = 16 / 5 = 3.2
unit
161
MIT School of Computing
Department of Computer Science & Engineering

Pros and Cons


➢ Advantages
➢ Very easy to implement
➢ Very easy to understand
➢ No complex logic PLD
➢ No starvation

➢ Disadvantages
➢ No option of preemption
➢ Convoy effect

162
MIT School of Computing
Department of Computer Science & Engineering

Convoy effect
➢ Only FCFS suffers
➢ If a slow process (large service time) is scheduled first, then it makes
entire system slow

PLD

163
MIT School of Computing
Department of Computer Science & Engineering

SJF
➢ Criteria: min BT first
➢ Mode: Non preemptive
➢ Tie breaker: FCFS

PLD

164
MIT School of Computing
Department of Computer Science & Engineering

Example

PLD

165
MIT School of Computing
Department of Computer Science & Engineering

PLD

166
MIT School of Computing
Department of Computer Science & Engineering

More about SJF


• Advantages:
• Min waiting time among non preemptive scheduling
• Better throughput in continuous execution
• No convoy effect
PLD

• Disadvantages
• No practical implementation because burst time cannot be known in
advance
• No option of preemption
• Longer processes may suffer from starvation
• No fairness

167
MIT School of Computing
Department of Computer Science & Engineering

Priority Scheduling

PLD

168
MIT School of Computing
Department of Computer Science & Engineering

[Link] Around Time = Completion Time - Arrival Time


[Link] Time = Turn Around Time - Burst Time

PLD

169
MIT School of Computing
Department of Computer Science & Engineering

Avg Waiting Time = (0+11+2+7+12+2+18)/7 = 52/7 units

Preemptive Priority Scheduling

PLD

170
MIT School of Computing
Department of Computer Science & Engineering

PLD

171
MIT School of Computing
Department of Computer Science & Engineering

Round Robin Scheduling


➢ Criteria: Arrival time + (Q)Quantum time/timeslice
➢ Mode: Preemptive
➢ Quantum time/time slice: Max amount of time for which a
process runs on CPU beforePLD
preemption

172
MIT School of Computing
Department of Computer Science & Engineering

PLD

173
MIT School of Computing
Department of Computer Science & Engineering

PLD

174

You might also like