Operating Systems - Short Notes
Unit I: Operating Systems Overview
Definition of OS:
An Operating System (OS) is system software that manages hardware, software resources, and provides services for
computer programs.
Evaluation of OS:
Evolution from batch systems -> multiprogramming -> time-sharing -> distributed and real-time systems.
Components of OS:
1. Process management 2. Memory management 3. File system 4. Device management 5. Security & protection 6. I/O
system management
Services of OS:
- Program execution - I/O operations - File system manipulation - Communication - Error detection - Resource allocation
Structure of OS:
- Monolithic - Layered - Microkernel - Modular - Hybrid
Architecture of OS:
Defines how OS components interact with hardware. Includes user mode, kernel mode, and system calls.
Types of OS:
Batch, Time-sharing, Distributed, Real-time, Multiprogramming, Network OS
Batch Systems:
Jobs are collected and processed in batches with no user interaction.
Multiprogramming:
Multiple jobs in memory, CPU switches among them to improve utilization.
Operating Systems - Short Notes
Time Sharing:
Multiple users use system simultaneously using time-sliced CPU.
Parallel Systems:
Multiple processors executing in parallel.
Distributed Systems:
Multiple computers working together over a network.
Real-Time Systems:
Designed to meet timing constraints for real-time applications.
Unit I: Operating System Structures
OS Services:
User interface, Program execution, I/O operations, File-system services, Communication, Resource allocation,
Protection
System Calls:
Interface between user programs and OS (e.g., open, read, write)
System Programs:
Utilities like compilers, file managers, status info
OS Structure:
Simple, Layered, Microkernel, Modules, Hybrid
OS Generations:
1st Gen: No OS, 2nd: Batch systems, 3rd: Multiprogramming, 4th: Time-sharing, 5th: Networked/distributed systems
Operating Systems - Short Notes
Unit II: Process Management
Process Definition:
A program in execution.
Process States:
New, Ready, Running, Waiting, Terminated
State Transitions:
Switching due to events like I/O or interrupts.
Process Scheduling:
Decides which ready process gets CPU.
PCB (Process Control Block):
Holds PID, state, CPU registers, memory limits etc.
Threads:
Lightweight subprocesses sharing code, data, files.
Multithreading:
Multiple threads in a process improve efficiency.
Benefits of Threads:
Responsiveness, Resource sharing, Economy, Utilization
Types of Threads:
User-level and Kernel-level threads
Process Scheduling
Operating Systems - Short Notes
Definition:
Select process from ready queue for execution.
Objectives:
Max CPU utilization, Max throughput, Min turnaround, wait and response time
Algorithms:
- FCFS: Non-preemptive
- SJF: Non-preemptive and preemptive
- RR: Preemptive with time quantum
Performance Evaluation:
Metrics: CPU Utilization, Throughput, Turnaround, Waiting Time, Response Time
Unit III: Process Synchronization
IPC (Inter-Process Communication):
Mechanism for process interaction
Race Conditions:
Output depends on execution order when accessing shared data
Critical Section Problem:
Only one process at a time in critical section
Mutual Exclusion:
Ensures one process in critical section
Semaphores:
Operating Systems - Short Notes
wait() and signal() control access to critical section
Monitors:
High-level construct with mutual exclusion and condition variables
Deadlocks
System Model:
Processes request/release resources
Deadlock Characterization:
1. Mutual exclusion 2. Hold and wait 3. No preemption 4. Circular wait
Prevention:
Eliminate any one of the four conditions
Avoidance:
Avoid unsafe states (e.g., Banker's Algorithm)
Detection:
Use resource allocation graph
Recovery:
Terminate or preempt processes to resolve deadlock
Unit IV: Memory Management
Logical vs Physical Address:
Logical from CPU, Physical is actual memory location
Operating Systems - Short Notes
Swapping:
Move processes between memory and disk
Memory Allocation:
- MFT: Fixed size blocks
- MVT: Variable size blocks
Fragmentation:
- Internal: Wasted space inside allocated memory
- External: Scattered free memory
Compaction:
Combine free spaces to reduce fragmentation
Paging:
Divide memory into pages and frames; avoids fragmentation
Segmentation:
Divide memory into logical segments (code, data, stack)