DEV Community

Abhishek Gupta
Abhishek Gupta

Posted on

OPERATING SYSTEM โ€” DETAILED EXAM NOTES (UNIT-WISE, CIITM Dhanbad)

๐ŸŸฆ 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

  1. Process Management
  • Creates, schedules, and terminates processes.
  1. Memory Management
  • Allocates memory to programs.
  • Performs deallocation when program ends.
  1. File Management
  • Creates, deletes, and organizes files.
  1. Device Management
  • Controls hardware devices (printers, disks, keyboard).
  1. Security & Protection
  • Prevents unauthorized access.
  1. Error Detection
  • Detects and handles system errors.
  1. Resource Allocation
  • Manages CPU, memory, disk, I/O.
  1. 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:

  1. Process Control โ€“ create, terminate process
  2. File Management โ€“ open, read, write files
  3. Device Management โ€“ request or release device
  4. Information Maintenance โ€“ get system info
  5. 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

  1. New โ€“ process created
  2. Ready โ€“ waiting for CPU
  3. Running โ€“ executing
  4. Waiting โ€“ waiting for I/O
  5. 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
Enter fullscreen mode Exit fullscreen mode

โญ 3. Classical Problems of Synchronization

  1. Producerโ€“Consumer Problem
  2. Readersโ€“Writers Problem
  3. Dining Philosophers Problem
  4. Sleeping Barber Problem

โญ 4. Deadlock

Occurs when a set of processes are waiting for each other forever.

Deadlock Conditions (Necessary & Sufficient):

  1. Mutual exclusion
  2. Hold & wait
  3. No preemption
  4. 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

  1. Explain functions of operating system.
  2. Describe different types of operating systems.
  3. What are system calls? Explain types.
  4. Explain OS services.

โญ UNIT โ€“ II

  1. Explain process states and PCB with diagram.
  2. Explain scheduling algorithms.
  3. What are threads? Explain their advantages.

โญ UNIT โ€“ III

  1. What is critical section? Explain its requirements.
  2. Explain semaphores with examples.
  3. Explain deadlock detection, prevention & avoidance.

โญ UNIT โ€“ IV

  1. Explain paging & segmentation.
  2. Explain page replacement algorithms.
  3. What is demand paging? Explain page faults.

โญ UNIT โ€“ V

  1. Explain disk scheduling algorithms.
  2. Explain directory structures.
  3. Explain file protection techniques.

Top comments (0)