Operating Systems - BSCS Notes

Operating Systems — Complete BSCS Notes

History and Goals of Operating Systems

Definition: An Operating System (OS) is system software that acts as an interface between the user and computer hardware.
Evolution: Batch Systems → Multiprogramming → Time-sharing Systems → Modern Operating Systems.
Goals: Efficient resource management, user convenience, and system reliability.
Example: Windows, Linux, macOS, Android.

Process and CPU Management

Process: A program in execution is called a process.
Process States: New, Ready, Running, Waiting, Terminated.
CPU Scheduling: The method used to decide which process gets CPU time.
Types: FCFS, SJF, Round Robin.
Example: Running a browser and music player at the same time.

Multithreading

Thread: The smallest unit of execution within a process.
Types: User-level threads and Kernel-level threads.
Example: Multiple tabs in a browser running simultaneously.

Synchronization and Concurrency

Problem: Multiple processes accessing shared data may cause inconsistency.
Solution: Mutex, Semaphores, Monitors.
Example: Two users updating the same bank account.

Deadlocks

Definition: A situation where processes are waiting indefinitely for resources held by each other.
Conditions: Mutual Exclusion, Hold and Wait, No Preemption, Circular Wait.
Handling: Deadlock Prevention, Avoidance, Detection and Recovery.

Memory Management

Virtual Memory: Uses disk space as an extension of RAM.
Paging: Dividing memory into fixed-size pages.
External Fragmentation: Wasted space in memory.
Demand Paging: Pages are loaded only when required.

Secondary Storage

Definition: Permanent storage devices used to store data.
Examples: Hard Disk, SSD.
Disk Scheduling: FCFS, SSTF, SCAN algorithms.

File Systems and I/O Systems

File System: Organizes and manages files on storage devices.
Types: FAT, NTFS, EXT.
I/O System: Manages input/output devices.

Security and Protection

Protection: Prevents unauthorized access to system resources.
Modes: User Mode and Kernel Mode.
Example: Login authentication system.

Distributed Operating Systems

Definition: A system where multiple computers work together as one system.
Example: Cloud computing systems.
Advantages: Resource sharing, scalability, reliability.