OS Unit-I
OS Unit-I
(SE21233)
Teaching Scheme
Lectures : 02 Hrs./week
Credits : 03
Examination Scheme
Continuous Internal Evaluation(CIE):20
Skills & Competency Exam(SCE):20
End-Sem (Paper):40
PR/OR/TW : 20
Operating Systems
Unit-1
Syllabus
Introduction, operating system operations, process
management, memory management, storage management,
protection and security, distributed systems. OPERATING
SYSTEMS STRUCTURES: Operating system services and
systems calls, system programs, operating system structure,
operating systems generations.
Reference Books
1. Silberschatz A & Galvin , Operating system concepts, JOHN WILEY & SONS. INC
Collection of
System programs
System program
System program
Controls
System program
System program
Operating Computer
System System
What does an operating system
do?
• The operating system includes programs that controls computer
systems:
1. Task Management
Task management involves creating, managing, and terminating processes and
threads.
2. Task Scheduling
Task scheduling involves determining which process or thread runs at a given
time. This is typically handled by the operating system's scheduler.
Error Handling:
Errors are inevitable, but a robust OS should handle them gracefully to
minimize disruption.
Error Detection:
Error Reporting:
Graceful Termination:
User Notification:
Operating Systems: tasks
Operating
Systems
Operating
System
2. It acts as a resource manager for programs and users
Application
Resources programs
3. Allow the program to communicate with one another
Process-1
Process-2
IPC
Kernel
Operating System Objectives
OS
Objectives
OS
1. Start
7. Terminate
1. Start Memory management
P1.exe
Operating System module does memory allocation for the program and
data
2. prompt user for input 10
Output device
elements management
Enter elements to be
sorted
-
I/P device
3. Input 10 numbers from keyboard
management
OS controls the keyboard to manage
Enter elements to be sorted
1 2 3 4 5 6 7 8 9 10 input for the application
CPU
4. Sort elements in ascending
order
management
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
Operating System assigns processor to the program and processor executes each
instructions.
5. Print sorted elements on printer Device
management
P1.exe
6. write output into a File
file management
P1.exe
Output.txt
Operating Systems
Architecture
OS kernel designs
1. Monolithic Kernel.
2. Microkernel.
20
What is Kernel
The kernel is the core component of an operating system. It acts as a bridge
between the hardware and the software applications running on a computer.
Think of it as the brain of the computer, managing all the essential functions that
keep your system running smoothly.
23
Monolithic Kernel
24
What is Monolithic Kernel ?
OS Kernel
Components
Memory Device
Manager Drivers
Scheduler File
System
25
Monolithic Kernel
User Mode
Services
26
Monolithic Structure of Operating System
The kernel can access all the resources present in the system. In
monolithic systems, each component of the operating system is
contained within the kernel. Operating systems that use monolithic
architecture were first time used in the 1970s.
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.
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.
• Linux
• MS-Windows XP
• Free BSD
31
Microkernel
32
Microkernel in Operating Systems
A microkernel is a type of operating system kernel that is designed to
provide only the most basic services required for an operating system to
function, such as memory management and process scheduling.
User programs
Shell Utilities (browsers, games, word
processing)
API
Memory Processor
User File system
management Scheduling
mode
Kernel
Microkernel
mode
To design a
5. Coding microkernel, more code Less
to
code when compared
microkernel
is required.
Hardware: Relied on bulky and power-hungry vacuum tubes for processing and
magnetic drums for storage.
Functionality: Batch processing was the dominant mode. Users submitted jobs
on punch cards, and the computer executed them sequentially, one after another.
No direct user interaction was possible during program execution.
Second Generation (1955-1965): Transistors and Batch
Systems
Hardware: The invention of transistors replaced vacuum tubes, making
computers smaller, faster, and more reliable.
Transistors in a computer
Third Generation (1965-1980): Integrated Circuits and
Multiprogramming
Integrated circuits
Fourth Generation (1980-Present): Personal Computers
Hardware: The invention of the microprocessor led to the development of
personal computers (PCs).
Personal computer
These generations represent a significant advancement in operating systems,
making computers more powerful, efficient, and user-friendly.
Functional classes of
OS
1. Single-user systems
2. Batch processing
3. Multiprogramming
4. Multitasking systems
5. Time-sharing systems
6. Real-time systems
7. Network Operating Systems
8. Distributed systems
1. Single-user single tasking systems
Single-user operating system (OS): This is a type of operating system
designed for use by one person at a time. There are two main categories:
Single-user single-tasking OS: This type only allows one user to complete
one task at a time.
Examples : Early operating systems like MS-DOS are examples.
Examples : Modern operating systems like Windows and macOS fall into this
category.
Resident OS
Memory
Program-1
CPU scheduling (Single-user single tasking systems) :
• No need for CPU scheduling because only one process at a time and it gets
the processor.
Resident OS
Memory
Program-1
2. Batch processing systems
Computer System
A computer operator formed a batch by arranging a few user jobs in a
sequence and inserting special marker cards to indicate the start and end
of the batch.
Computer System
Batch Processing: working
1. Operator initiates processing of a batch.
2. Batching OS kernel selects first jobs and assigns for
execution.
3. Automatically all jobs processed one by one sequentially.
4. Continue till last job.
Computer System
Thus the operator had to intervene only at the start and end of a
batch.
Turnaround Time
Turnaround time is the total time it takes for a process to
complete its execution from the moment it enters the system
until it finishes. It encompasses both the time the process spends
actively using the CPU and the time it spends waiting in the ready
queue or for I/O operations.
I/O wait time: The time a process spends waiting for I/O
operations to complete.
System load: The number of processes competing for CPU and I/O
resources affects overall performance.
Batch processing system: Turnaround
time
Multiprogramming
Multiprogramming is a fundamental concept in operating systems that allows
multiple programs to be executed concurrently on a single processor system. This
is achieved by rapidly switching the CPU between different programs.
How It Works
Multiple Programs in Memory: Several programs reside in the main memory
simultaneously.
Time-Sharing: The operating system allocates CPU time to each program in turn.
I/O Overlap: While one program is waiting for I/O, the CPU can execute another
program, improving efficiency.
Benefits of Multiprogramming
Increased CPU Utilization: By keeping the CPU busy with different programs, idle
time is minimized.
Enhanced Resource Sharing: Multiple programs can share system resources like
memory and peripherals.
Challenges
Memory Management: Efficiently allocating and managing memory for multiple
programs is crucial.
Scheduling: Deciding which program to run and for how long requires careful
scheduling algorithms.
I/O Management: Handles input and output operations efficiently, allowing tasks
to wait for I/O without halting the system.
Types of Multitasking:
• Preemptive multitasking: The operating system decides when to switch
between tasks, regardless of their current state.
• Cooperative multitasking: Tasks voluntarily yield control of the CPU to allow
other tasks to run.
Advantages of Multitasking:
Improved productivity: Users can work on multiple tasks simultaneously.
Efficient resource utilization: The CPU is kept busy by switching between tasks.
Better user experience: Provides a smooth and responsive system.
Challenges:
Performance: Maintaining responsiveness for all tasks can be challenging.
Memory management: Efficiently allocating memory to multiple processes is
crucial.
Scheduling: Determining which task to run next can be complex.
31
Examples of Multitasking Operating Systems:
Windows: Widely used in personal computers, offering both single-user and
multi-user multitasking.
macOS: Primarily used on Apple computers, known for its user-friendly interface
and efficient multitasking.
32
Single user multitasking systems
• Single-user multitasking systems include most modern PCs that support
windowing.
• In such systems it is common that one user is interacting with the system
but that the user may have several tasks started simultaneously.
A single user multitasking system allows a single user to perform
multiple tasks simultaneously on a computer. This is achieved by the
operating system rapidly switching between different tasks, giving
the user the illusion that they are happening at the same time.
How it works:
Time-sharing: The operating system divides the CPU's time into
small time slices, allocating these slices to different tasks.
32
Examples:
User-1
User-2
User-3
User-4
A multiple interactive users multitasking system, often referred to as a multi-
user operating system, allows multiple users to simultaneously access and utilize
a single computer system. This is achieved through a process known as time-
sharing, where the operating system rapidly switches between different users'
tasks, giving each user the illusion of exclusive access to the system.
File System: A robust file system manages file storage and access, allowing
multiple users to share files and maintain their own data.
32
User Interface: Provides a way for users to interact with the system, typically
through a graphical user interface (GUI) or command-line interface (CLI).
Unix: The foundation for many modern operating systems, offering powerful
features for multitasking and multi-user environments.
macOS Server: Designed for Apple environments, offering integration with other
Apple devices and services.
32
Advantages of Multi-User Systems:
User-1
User-2
User-3
User-4
Time-sharing is a crucial concept in operating systems (OS) that allows multiple
users to share a single computer system concurrently. It's a technique where the
CPU's time is divided into small intervals or time slices, and these slices are
allocated to different processes.
Key Components
CPU Scheduling: The OS determines which process will run next and for how
long using scheduling algorithms like FCFS, SJF, Priority, Round Robin, etc.
Memory Management: Efficiently allocates memory to different processes,
preventing conflicts.
Input/Output (I/O) Handling: Manages I/O operations for multiple processes,
ensuring smooth execution.
Advantages of Time-Sharing
Improved resource utilization: Maximizes CPU usage by keeping it busy with
different tasks.
Enhanced responsiveness: Provides quick response times for interactive users.
Cost-effective: Allows multiple users to share a single system, reducing hardware
costs.
Facilitates collaboration: Enables multiple users to work on a shared project
simultaneously.
Key Characteristics
Time-bounded: Tasks have specific deadlines that must be met.
Predictable: System behavior must be highly predictable.
Responsive: The system must respond to events within specified time constraints.
Reliable: System failures can have catastrophic consequences.
fopen;
Compiler fread;
fclose;