π¦ UNIT β I : OS Basics, Types, Services, Structure, System Calls
β 1. Operating System β Definition
An Operating System (OS) is system software that manages computer hardware, executes programs, and provides a user-friendly environment for running applications.
It acts as an intermediary between user and hardware.
β 2. Functions of Operating System
- Process Management
- Creates, schedules, and terminates processes.
- Memory Management
- Allocates memory to programs.
- Performs deallocation when program ends.
- File Management
- Creates, deletes, and organizes files.
- Device Management
- Controls hardware devices (printers, disks, keyboard).
- Security & Protection
- Prevents unauthorized access.
- Error Detection
- Detects and handles system errors.
- Resource Allocation
- Manages CPU, memory, disk, I/O.
- User Interface
- Command-line (CLI)
- Graphical (GUI)
β 3. Types of Operating Systems
β 1. Batch Operating System
- Jobs grouped into batches.
- No user interaction during execution.
- Example: Banking batch jobs.
β 2. Multiprogramming Operating System
- Multiple programs kept in memory at same time.
- CPU switches between them.
- Increases CPU utilization.
β 3. Time Sharing Operating System
- CPU time divided into time slices.
- Many users use computer simultaneously.
- Example: UNIX, Linux.
β 4. Single-User Operating System
- Only one user at a time.
- Simple, low-security.
- Example: Windows 98.
β 5. Multiuser Operating System
- Multiple users logged in at same time.
- Strong protection.
- Example: Linux, Unix server.
β 4. Components of an Operating System
- Process Manager β handles processes
- Memory Manager β allocates memory
- File Manager β manages files/folders
- I/O Manager β controls devices
- Security Manager β permissions & protection
- Kernel β core of the OS
- Shell β command interpreter
β 5. Operating System Services
- Program execution
- File system access
- Device access
- Communication
- Error handling
- Resource allocation
- I/O operations
- Authentication & security
β 6. System Calls
System calls allow user-level programs to interact with OS.
Types of System Calls:
- Process Control β create, terminate process
- File Management β open, read, write files
- Device Management β request or release device
- Information Maintenance β get system info
- Communication β send/receive messages
β 7. System Programs
Useful programs included with OS:
- Text editors
- Compilers & Assemblers
- File management tools
- Command interpreters (shell)
- Utilities (backup, compression)
β 8. System Structure
1. Monolithic Structure
- Entire OS is one large program.
2. Layered Structure
- OS divided into multiple layers.
3. Microkernel
- Minimal kernel; rest runs in user mode.
4. Modules
- OS built in modular form.
5. Virtual Machines
- Hardware is virtualized.
π¦ UNIT β II : Processes, Scheduling, Threads
β 1. Process Concept
A process is a program in execution.
It includes:
- Program counter
- Stack
- Data section
- CPU registers
β 2. Process States
- New β process created
- Ready β waiting for CPU
- Running β executing
- Waiting β waiting for I/O
- Terminated β finished execution
β 3. Process Control Block (PCB)
A data structure used by OS to store information about a process.
Contains:
- Process ID
- CPU registers
- Process state
- Program counter
- Scheduling info
- Memory allocation info
β 4. Process Scheduling
Decides which process runs next.
β 5. Scheduling Criteria
- CPU utilization
- Throughput
- Turnaround time
- Waiting time
- Response time
β 6. Scheduling Algorithms
β 1. FCFS (First Come First Serve)
- Simple
- Non-preemptive
- Process served in arrival order
β 2. SJF (Shortest Job First)
- Selects shortest process first
- Preemptive version β SRTF
β 3. Priority Scheduling
- Highest priority runs first
- Can cause starvation
β 4. Round Robin
- Time-sharing
- Each process gets fixed time quantum
β 5. Multilevel Queue Scheduling
- Different queues for different process types
β 7. Multiple Processor Scheduling
- Used in multicore CPUs
- Load balancing between processors
-
Two types:
- Asymmetric multiprocessing
- Symmetric multiprocessing (SMP)
β 8. Real-Time Scheduling
- Hard real-time β deadlines must be met
- Soft real-time β occasional misses allowed
β 9. Threads
A thread is a lightweight process.
Types:
- User-level threads
- Kernel-level threads
Advantages:
- Faster context switching
- Efficient resource usage
- Useful in web servers, games, browsers
π¦ UNIT β III : Critical Section, Synchronization, Deadlocks
β 1. Critical Section Problem
Section of code where shared resources are accessed.
Requirements
- Mutual Exclusion β only one process
- Progress β no unnecessary waiting
- Bounded Waiting β limit on wait time
β 2. Semaphores
Used for synchronization.
Types
- Binary semaphore
- Counting semaphore
Operations
wait(S); // decrements S
signal(S); // increments S
β 3. Classical Problems of Synchronization
- ProducerβConsumer Problem
- ReadersβWriters Problem
- Dining Philosophers Problem
- Sleeping Barber Problem
β 4. Deadlock
Occurs when a set of processes are waiting for each other forever.
Deadlock Conditions (Necessary & Sufficient):
- Mutual exclusion
- Hold & wait
- No preemption
- Circular wait
β 5. Methods for Handling Deadlock
β 1. Deadlock Prevention
Break one of the 4 conditions.
β 2. Deadlock Avoidance
- Use extra information
- Bankerβs algorithm
β 3. Deadlock Detection
- Resource allocation graph
- Periodic checking
β 4. Deadlock Recovery
- Kill process
- Rollback process
- Resource preemption
π¦ UNIT β IV : Memory Management, Paging, Segmentation, Virtual Memory
β 1. Logical vs Physical Address
- Logical address β generated by CPU
- Physical address β actual location in RAM
- MMU translates logical β physical
β 2. Contiguous Allocation
Two methods:
β Fixed Partitioning
- Memory divided into fixed-sized blocks
- Internal fragmentation
β Variable Partitioning
- Dynamic partitions
- External fragmentation
β 3. Swapping
Entire process swapped between RAM and disk.
β 4. Paging
- Memory divided into pages and frames
- Removes external fragmentation
β 5. Segmentation
Memory divided into variable-sized segments:
- Code
- Data
- Stack
More user-friendly than paging.
β 6. Virtual Memory
Allows running programs larger than actual physical memory.
Techniques:
- Demand paging
- Page replacement
β 7. Demand Paging
Loads page into memory only when needed.
Page Fault:
Occurs when page is not in memory.
β 8. Page Replacement Algorithms
β FIFO
Replace oldest page.
β LRU (Least Recently Used)
Replace page not used for longest time.
β Optimal
Replace page that will not be used in future.
π¦ UNIT β V : Disk Scheduling, File Systems, Directories, Protection
β 1. Disk Scheduling Algorithms
β FCFS
Serve in arrival order.
β SSTF
Serve request closest to current head position.
β SCAN
Arm moves like elevator.
β C-SCAN
Circular version of SCAN.
β LOOK / C-LOOK
SCAN/C-SCAN with smart stopping.
β 2. Disk Management
Includes:
- Partitioning
- Formatting
- Boot block
- Bad block management
β 3. Swap Space Management
Used to store swapped-out pages.
Located on fast disk space.
β 4. Disk Reliability
Techniques:
- Mirroring
- RAID
- Backups
β 5. Stable Storage
Data stored safely using redundant devices.
β 6. File Concepts
A file is a named collection of related information.
Attributes:
- Name
- Type
- Size
- Location
- Permissions
- Owner
β 7. Directory Structure
- Single-level
- Two-level
- Tree-structured
- Acyclic graph
- General graph
β 8. File Protection
- Access control lists
- Read/Write/Execute permissions
- Password protection
- Encryption
π IMPORTANT EXAM QUESTIONS (DETAILED)
β UNIT β I
- Explain functions of operating system.
- Describe different types of operating systems.
- What are system calls? Explain types.
- Explain OS services.
β UNIT β II
- Explain process states and PCB with diagram.
- Explain scheduling algorithms.
- What are threads? Explain their advantages.
β UNIT β III
- What is critical section? Explain its requirements.
- Explain semaphores with examples.
- Explain deadlock detection, prevention & avoidance.
β UNIT β IV
- Explain paging & segmentation.
- Explain page replacement algorithms.
- What is demand paging? Explain page faults.
β UNIT β V
- Explain disk scheduling algorithms.
- Explain directory structures.
- Explain file protection techniques.
Top comments (0)