Operating Systems
Table of Contents
- Operating System Overview
- Process Management
- Process Scheduling
- Threads
- Inter-Process Communication
- Process Synchronization
- Deadlock
- Memory Management
- Virtual Memory
- Disk Scheduling
- File Systems
- I/O Systems
- Linux/Windows OS Basics
Operating System Overview
An operating system is system software that manages computer hardware, software resources, and provides common services for computer programs.
OS Functions
- Process Management: Creation, scheduling, termination of processes
- Memory Management: Allocation and deallocation of memory
- File System Management: Creating, deleting, accessing files
- I/O System Management: Managing input/output devices
- Security and Access Control: User authentication, file permissions
- Network Management: Managing network connections
- User Interface: CLI, GUI, shell
Types of Operating Systems
| Type | Description | Example |
|---|---|---|
| Batch OS | Jobs grouped and executed without user interaction | Early payroll systems |
| Time-Sharing/Multitasking | Multiple users share CPU time | UNIX, Linux |
| Real-Time OS (RTOS) | Guaranteed response within strict time limits | VxWorks, QNX |
| Distributed OS | Multiple computers work as single system | Amoeba, LOCUS |
| Network OS | Server-based, manages network resources | Novell NetWare |
| Mobile OS | Designed for mobile devices | Android, iOS |
Real-Time OS Types
- Hard RTOS: Missing deadline = system failure (e.g., airbag systems)
- Soft RTOS: Missing deadline degrades performance but acceptable (e.g., video streaming)
Kernel Types
| Type | Description | Pros | Cons |
|---|---|---|---|
| Monolithic | All OS services in kernel space | Fast (no context switching) | Large, less reliable |
| Microkernel | Minimal services in kernel; rest in user space | Modular, reliable | Slower (message passing) |
| Hybrid | Combination of both | Balanced | Complex |
| Exokernel | Minimal abstractions; apps manage hardware directly | Maximum performance | Complex for developers |
Examples: Linux = Monolithic, Windows NT = Hybrid, QNX = Microkernel
Process Management
Program vs Process
- Program: Passive entity (code stored on disk)
- Process: Active entity (program in execution) — has code, data, stack, heap, PCB
Process States
| State | Description |
|---|---|
| New | Process is being created |
| Ready | Process is waiting to be assigned to CPU |
| Running | Instructions are being executed |
| Waiting/Blocked | Process is waiting for an event (I/O completion) |
| Terminated | Process has finished execution |
State Transitions
New → Ready (admitted)
Ready → Running (scheduler dispatch)
Running → Ready (interrupt / time slice expired)
Running → Waiting (I/O request / event wait)
Waiting → Ready (I/O completion / event occurred)
Running → Terminated (exit)
Process Control Block (PCB)
Each process has a PCB containing:
- Process State: Current state (ready, running, waiting, etc.)
- Process ID (PID): Unique identifier
- Program Counter: Address of next instruction to execute
- CPU Registers: All processor registers (accumulator, index, stack pointer)
- CPU Scheduling Info: Priority, scheduling queue pointers
- Memory Management Info: Page tables, segment tables, limits
- I/O Status Info: List of open files, allocated devices
- Accounting Info: CPU time used, time limits, account numbers
Context Switching
When CPU switches from one process to another:
1. Save state of old process into its PCB
2. Load state of new process from its PCB
3. Update memory management data structures
Context switch time is pure overhead — CPU does no useful work during the switch.
Process Scheduling
Scheduling Criteria
| Metric | Definition |
|---|---|
| CPU Utilization | Keep CPU as busy as possible (ideally 100%) |
| Throughput | Number of processes completed per unit time |
| Turnaround Time | Total time from submission to completion |
| Waiting Time | Time spent in ready queue |
| Response Time | Time from submission to first response |
CPU and I/O Bursts
Process execution alternates between CPU bursts (computation) and I/O bursts (waiting for input/output). CPU burst duration determines scheduling behavior.
Scheduling Algorithms
First Come First Served (FCFS)
- Type: Non-preemptive
- Mechanism: Processes served in order of arrival
- Advantage: Simple, fair
- Disadvantage: Convoy effect — short processes wait behind long ones
- Example:
| Process | Burst Time | Arrival |
|---------|-----------|---------|
| P1 | 24 | 0 |
| P2 | 3 | 0 |
| P3 | 3 | 0 |
Gantt: | P1 (0-24) | P2 (24-27) | P3 (27-30) |
- Turnaround: P1=24, P2=27, P3=30 → Avg = 27
- Waiting: P1=0, P2=24, P3=27 → Avg = 17
Shortest Job First (SJF)
- Type: Non-preemptive (can be preemptive → SRTF)
- Mechanism: Process with smallest burst time runs first
- Advantage: Minimizes average waiting time (provably optimal)
- Disadvantage: Starvation of long processes; requires knowledge of burst times
- Burst time prediction: Exponential averaging: τₙ₊₁ = α×tₙ + (1-α)×τₙ
- α typically = 0.5; tₙ = actual nth burst; τₙ = predicted nth burst
Shortest Remaining Time First (SRTF)
- Preemptive version of SJF
- Mechanism: If new process arrives with shorter burst than remaining time, preempt current process
- Better than non-preemptive SJF but more context switches
Round Robin (RR)
- Type: Preemptive
- Mechanism: Each process gets a time quantum (q) in cyclic order
- If burst ≤ q: process completes
- If burst > q: process interrupted after q, moved to back of ready queue
- q too large → becomes FCFS
- q too small → excessive context switches (overhead)
- Rule of thumb: q should be such that 80% of CPU bursts are shorter than q
- Fair: No starvation; good response time
- Average waiting time: Can be high (especially with many processes)
Priority Scheduling
- Type: Can be preemptive or non-preemptive
- Mechanism: Each process assigned priority; highest priority runs first
- Problem: Starvation — low priority processes may never execute
- Solution: Aging — gradually increase priority of waiting processes
- Priority types:
- Static: Fixed at process creation
- Dynamic: Can change during execution
Multilevel Queue Scheduling
- Concept: Ready queue divided into separate queues by process type:
- Foreground (interactive): Round Robin (higher priority)
- Background (batch): FCFS (lower priority)
- Each queue has its own scheduling algorithm
- Fixed priority between queues
Multilevel Feedback Queue
- Most flexible algorithm — used in most OS
- Mechanism: Processes can move between queues based on behavior
- Parameters:
- Number of queues
- Scheduling algorithm for each queue
- Method to promote/demote processes
- Which queue a process enters initially
- Example:
- Q0 (highest) RR q=8ms → if not finished, demote to Q1
- Q1 RR q=16ms → if not finished, demote to Q2
- Q2 FCFS (lowest)
- Guarantees: Interactive processes get priority; CPU-bound processes eventually get scheduled
Scheduling Algorithm Comparison
| Algorithm | Type | Avg Wait Time | Starvation | Best For |
|---|---|---|---|---|
| FCFS | Non-preemptive | Can be high | No | Batch systems |
| SJF | Non-preemptive | Minimum | Yes | Known burst times |
| SRTF | Preemptive | Very low | Yes | Mixed workloads |
| RR | Preemptive | Moderate | No | Time-sharing |
| Priority | Both | Varies | Yes | Real-time systems |
| MLQ | Both | Varies | Possible | Mixed process types |
| MLFQ | Both | Flexible | Rarely | General-purpose |
Threads
A thread is a lightweight process — the basic unit of CPU utilization.
Process vs Thread
| Feature | Process | Thread |
|---|---|---|
| Memory | Separate address space | Shares address space with process |
| Communication | IPC required (pipes, message queues) | Direct memory access |
| Creation | Slow (separate resources) | Fast (shares resources) |
| Switching | Heavy context switch | Lightweight |
| Isolation | Independent | Not isolated (one thread crash affects all) |
| PCB | One per process | One TCB (Thread Control Block) per thread |
Thread Types
| Type | Description | Advantage | Disadvantage |
|---|---|---|---|
| User Threads | Managed by user-level library (no kernel support) | Fast switching, no kernel mode | One blocking call blocks all threads |
| Kernel Threads | Managed by OS kernel | True parallelism, blocking handled per thread | Slower (kernel mode transitions) |
| Hybrid | User threads mapped to kernel threads | Best of both | Complex |
Threading Models
| Model | Description |
|---|---|
| Many-to-One | Many user threads → 1 kernel thread (e.g., early GNU Portable Threads) |
| One-to-One | Each user thread → 1 kernel thread (e.g., Linux, Windows — most common) |
| Many-to-Many | Many user threads → many kernel threads (e.g., Solaris, Windows Fibers) |
Thread Pools
- Pre-created threads waiting for tasks
- Advantages: Faster task assignment, limits thread count
Inter-Process Communication
Shared Memory
- Concept: Processes share a region of memory
- Fastest IPC (no system calls after setup)
- Problem: Must handle synchronization
- Example: POSIX shared memory, mmap
Message Passing
- Concept: Processes communicate by sending/receiving messages
- Two Operations:
- send(message): Send a message to another process
- receive(message): Receive a message from another process
- Communication Link: Direct (named) or indirect (mailbox/port)
Other IPC Mechanisms
| Mechanism | Type | Description |
|---|---|---|
| Pipes | Message passing | Unidirectional; between parent-child (unnamed pipe) or any process (named pipe/FIFO) |
| Message Queues | Message passing | Structured messages in queue; supports priorities |
| Sockets | Message passing | Network communication; can be used locally (Unix domain sockets) |
| Shared Memory | Shared memory | Fastest; requires synchronization |
| Signals | Event notification | Asynchronous notification (e.g., SIGKILL, SIGINT) |
| Semaphores | Synchronization | Integer variable for signaling between processes |
Process Synchronization
Critical Section Problem
A critical section is a code segment that accesses shared variables. Only one process should execute it at a time.
Requirements for Solution:
1. Mutual Exclusion: Only one process in critical section
2. Progress: If no process is in CS, selection of next cannot be postponed
3. Bounded Waiting: Limit on how many times other processes can enter CS after a request
Solutions
Mutex (Mutual Exclusion Lock)
- Simple binary lock: acquire() and release()
- Process must wait (busy waiting/spinlock) if lock is held
- Advantage: Simple
- Disadvantage: Wastes CPU (busy waiting)
Semaphores
- Integer variable S accessed only through:
- wait(S) (P/proberen): while S ≤ 0 do no-op; S--
- signal(S) (V/verhogen): S++
Types:
| Type | Description |
|------|-------------|
| Binary Semaphore (Mutex) | Values: 0 or 1; used for mutual exclusion |
| Counting Semaphore | Values: 0 to n; used for resource counting |
Semaphore with No Busy Waiting:
- Each semaphore has a waiting queue
- wait(): if S < 0, block process and add to queue; else S--
- signal(): if queue not empty, wake a process; else S++
Monitors
- High-level synchronization construct (abstract data type)
- Encapsulates shared data and operations
- Only one process can be active in a monitor at a time
- Uses condition variables:
- wait(): Process waits on condition
- signal(): Wake up a waiting process
- Advantages: Safer than semaphores (no coding errors like missing signal)
Classical Synchronization Problems
Producer-Consumer Problem
- Producer adds items to buffer; consumer removes items
- Need: mutual exclusion + buffer full/empty synchronization
- Solution with semaphores:
- mutex = 1 (mutual exclusion)
- empty = n (count of empty slots)
- full = 0 (count of filled slots)
Producer: wait(empty); wait(mutex); add_item(); signal(mutex); signal(full) Consumer: wait(full); wait(mutex); remove_item(); signal(mutex); signal(empty)
Reader-Writers Problem
- Multiple readers can read simultaneously; writer needs exclusive access
- Reader preference (readers may starve writers):
- mutex = 1 (protects readcount)
- rw_mutex = 1 (mutual exclusion for writers)
- readcount = 0
```
Reader: wait(mutex); readcount++; if(readcount==1) wait(rw_mutex); signal(mutex);
READ; wait(mutex); readcount--; if(readcount==0) signal(rw_mutex); signal(mutex);
Writer: wait(rw_mutex); WRITE; signal(rw_mutex);
```
Dining Philosophers Problem
- 5 philosophers, 5 chopsticks; need 2 chopsticks to eat
- Solutions to deadlock:
- Allow max 4 philosophers at table
- Pick up both chopsticks atomically
- Asymmetric solution (odd pick left first, even pick right first)
Deadlock
Necessary Conditions (ALL must hold simultaneously)
- Mutual Exclusion: At least one resource held in non-sharable mode
- Hold and Wait: Process holds at least one resource and waits for others
- No Preemption: Resources cannot be forcibly taken
- Circular Wait: Set of processes {P₁, P₂, ..., Pₙ} where P₁ waits for P₂, P₂ waits for P₃, ..., Pₙ waits for P₁
Resource Allocation Graph
- Nodes: Processes (circles) and Resources (rectangles)
- Edges:
- Request edge: Process → Resource (process requests resource)
- Assignment edge: Resource → Process (resource assigned to process)
- Cycle in graph = Deadlock (if all resources have single instance)
- Cycle ≠ Deadlock if resources have multiple instances
Deadlock Handling Strategies
Deadlock Prevention (Break one of 4 conditions)
| Condition | Prevention |
|---|---|
| Mutual Exclusion | Make resources sharable (not always possible) |
| Hold and Wait | Request all resources at once, or release all before requesting new |
| No Preemption | If request denied, release all held resources |
| Circular Wait | Impose ordering on resource types; request in increasing order |
Deadlock Avoidance
- Requires maximum claim information in advance
- Safe State: There exists a sequence where all processes can complete
- Unsafe State: May lead to deadlock (not guaranteed)
Banker's Algorithm:
- Data Structures:
- Available[m]: Available resources of each type
- Max[n][m]: Maximum demand of each process
- Allocation[n][m]: Currently allocated resources
- Need[n][m] = Max - Allocation
- Safety Algorithm:
- Work = Available; Finish[i] = false
- Find process where Finish[i] = false AND Need[i] ≤ Work
- Work = Work + Allocation[i]; Finish[i] = true
-
Repeat; if all Finish[i] = true → Safe State
-
Resource Request Algorithm:
- Request[i] ≤ Need[i]? If not, error
- Request[i] ≤ Available? If not, wait
- Pretend to allocate: Available -= Request; Allocation += Request; Need -= Request
- Check safety → if safe, grant; else, deny and restore
Deadlock Detection
- Wait-for Graph: For single-instance resources
- Remove resource nodes from resource allocation graph
- Cycle detection using DFS
- Detection Algorithm: Similar to Banker's but check for cycles in current state
- Detection Frequency: Periodically or when CPU utilization drops
Deadlock Recovery
| Method | Description |
|---|---|
| Process Termination | Abort all deadlocked processes, or one at a time |
| Resource Preemption | Take resources from deadlocked processes; roll back |
| Victim Selection | Choose process with minimum cost (least work, lowest priority) |
Memory Management
Memory Allocation Strategies
| Strategy | Description | Problem |
|---|---|---|
| First Fit | Allocate first hole big enough | Fast, may fragment |
| Best Fit | Allocate smallest sufficient hole | Lowers fragmentation but many tiny holes |
| Worst Fit | Allocate largest hole | Leaves larger fragments |
Fragmentation
- External Fragmentation: Total free memory sufficient but not contiguous
- Solution: Compaction (move processes), paging, segmentation
- Internal Fragmentation: Allocated block slightly larger than requested
- Solution: Smaller allocation units
Paging
- Concept: Physical memory divided into frames, logical memory into pages (same size)
- Page Table: Maps page numbers → frame numbers
- Address Translation:
- Logical address = (page number, offset)
- Physical address = (frame number, offset)
- Frame number from page table; offset stays same
- Page Size: Typically 4 KB; power of 2
- Advantages: No external fragmentation, supports virtual memory
- Disadvantages: Internal fragmentation (last page), page table overhead
Multi-Level Paging:
- Page table itself is paginated (too large to store contiguously)
- Two-Level: Outer page table → inner page table → frame
- Reduces memory needed for page table storage
Inverted Page Table:
- One entry per physical frame (instead of per page)
- Reduces page table size but increases lookup time
Segmentation
- Concept: Memory divided by logical segments (code, data, stack, heap)
- Segment Table: Base address and limit for each segment
- Logical Address: (segment number, offset)
- Advantages: Logical organization, supports sharing and protection
- Disadvantages: External fragmentation (variable-sized segments)
Segmentation with Paging
- Combines both: Segments divided into pages
- Advantages: No external fragmentation per segment + logical organization
- Used in: Intel 80x86 architecture
Virtual Memory
Virtual memory allows execution of processes that are not completely in memory (separates logical from physical memory).
Demand Paging
- Concept: Pages loaded into memory only when needed (lazy loading)
- Valid/Invalid Bit: In page table; valid = in memory, invalid = on disk
- Page Fault: Accessed page not in memory → trap to OS → load from disk
- Effective Access Time:
- EAT = (1-p) × memory_access + p × page_fault_time
- Typical: memory = 100ns, page fault = 10ms, p = 0.001
- EAT = 0.999 × 100 + 0.001 × 10,000,000 = 10,099.9ns ≈ 10μs (100x slower!)
Page Replacement Algorithms
FIFO (First In First Out)
- Replace the page that has been in memory longest
- Simple but performs poorly
- Belady's Anomaly: Increasing frames can increase page faults!
Optimal (OPT/Bélády's)
- Replace page that will not be used for longest time
- Best possible page fault rate
- Impossible to implement (requires future knowledge) — used as benchmark
LRU (Least Recently Used)
- Replace page that has not been used for longest time
- Approximation of optimal — no Belady's anomaly
- Implementation:
- Counters: Each page table entry has timestamp; update on every access
- Stack: Maintain stack of page numbers; move accessed page to top
- Problem: Hardware support needed for exact LRU (expensive)
LRU Approximation Algorithms
| Algorithm | Description |
|---|---|
| Reference Bit | Each page has bit; set when referenced; periodically cleared |
| Second Chance (Clock) | FIFO with reference bit; skip pages with bit=1 (give second chance) |
| Enhanced Second Chance | Combines reference bit + dirty bit; prefer replacing not-referenced, clean pages |
| NFU (Not Frequently Used) | Software counter incremented; replace lowest counter |
Page Replacement Comparison
| Algorithm | Page Faults | Implementation |
|---|---|---|
| FIFO | High | Simple queue |
| Optimal | Minimum | Theoretical only |
| LRU | Near-optimal | Counters or stack |
| LRU Approx | Good | Reference bits |
Thrashing
- Concept: Process spends more time paging than executing
- Cause: Too many processes competing for too little memory
- Detection: CPU utilization low + high paging activity
- Solution:
- Degree of Multiprogramming: Reduce number of active processes
- Working Set Model: Keep pages that have been recently used in memory
- Page Fault Frequency (PFF): Monitor page fault rate; adjust memory allocation
Working Set: Set of pages referenced in last Δ time units. OS ensures working set is in memory before process runs.
Disk Scheduling
Disk Access Time
Access Time = Seek Time + Rotational Latency + Transfer Time
- Seek Time: Time to move read/write head to correct track
- Rotational Latency: Time for desired sector to rotate under head (half rotation on average)
- Transfer Time: Time to read/write data (depends on rotational speed and data density)
Disk Scheduling Algorithms
FCFS (First Come First Served)
- Mechanism: Service requests in order of arrival
- Advantage: Fair, no starvation
- Disadvantage: High seek time (head moves back and forth)
SSTF (Shortest Seek Time First)
- Mechanism: Service nearest request first
- Advantage: Better than FCFS; minimizes seek time
- Disadvantage: Starvation — far requests may never be served
- Similar to: SJF for processes
SCAN (Elevator Algorithm)
- Mechanism: Head moves in one direction servicing requests, then reverses
- Advantage: No starvation; more uniform wait time
- Disadvantage: Requests at middle get better service; long wait at extremes
C-SCAN (Circular SCAN)
- Mechanism: Head moves in one direction servicing requests; returns to start without servicing (like a circular list)
- Advantage: More uniform service than SCAN
- Disadvantage: Wasted trip back to start
LOOK
- Mechanism: Like SCAN but reverses at last request in direction (not at disk end)
- Advantage: Better than SCAN (less unnecessary movement)
C-LOOK
- Mechanism: Like C-SCAN but goes to nearest request on return (not full disk end)
Disk Algorithm Comparison
| Algorithm | Starvation | Fairness | Seek Time |
|---|---|---|---|
| FCFS | No | Very fair | High |
| SSTF | Yes | Unfair | Low |
| SCAN | No | Fair | Medium |
| C-SCAN | No | Very uniform | Medium |
| LOOK | No | Fair | Low-Medium |
| C-LOOK | No | Very uniform | Low-Medium |
File Systems
File Concepts
- File: Named collection of related information
- File Attributes: Name, type, size, location, protection, timestamps
- File Operations: Create, open, read, write, delete, truncate, seek
File Access Methods
| Method | Description | Use Case |
|---|---|---|
| Sequential | Read/write in order | Text files, logs |
| Direct (Random) | Access any block directly | Database files |
| Indexed | Use index block to find records | Indexed files |
Directory Structures
| Type | Description | Advantage | Disadvantage |
|---|---|---|---|
| Single Level | One directory for all files | Simple | Naming conflicts, no grouping |
| Two Level | Separate directory per user | Some isolation | Still limited organization |
| Tree | Hierarchical (folders/subfolders) | Natural organization | Path-based access |
| Acyclic Graph | Shared subdirectories (no cycles) | Sharing | Complex (dangling pointers) |
| General Graph | Full graph with cycles | Maximum sharing | Complex; garbage collection needed |
Disk Allocation Methods
| Method | Description | Advantage | Disadvantage |
|---|---|---|---|
| Contiguous | File occupies consecutive blocks | Fast sequential access | External fragmentation |
| Linked | Each block has pointer to next | No external frag | No random access; pointer overhead |
| Indexed | Index block contains pointers to all blocks | Random access | Index block overhead |
Free Space Management
| Method | Description |
|---|---|
| Bitmap/Bit Vector | Bit per block (0=free, 1=used); simple but large |
| Linked List | Free blocks linked together |
| Grouping | First free block addresses next group of free blocks |
| Counting | List of (start, length) pairs for contiguous free blocks |
File System Types
| File System | OS | Key Features |
|---|---|---|
| FAT32 | DOS/Windows | Simple; no permissions; max 4GB file |
| NTFS | Windows | Journaling, permissions, encryption, compression |
| ext4 | Linux | Journaling, extents, large files, backward compatible |
| XFS | Linux | High performance, large files, journaling |
| ZFS | Solaris/Linux | Copy-on-write, snapshots, data integrity |
| APFS | macOS | Snapshots, cloning, encryption |
I/O Systems
I/O Hardware
- Port: Connection point for device (e.g., USB port, serial port)
- Bus: Shared communication pathway (e.g., PCI bus)
- Controller: Electronics that operates port/bus/device
- Device Driver: Software module that interacts with device controller
I/O Techniques
Programmed I/O (Polling)
- CPU repeatedly checks device status (busy waiting)
- Inefficient — CPU wasted in polling loop
Interrupt-Driven I/O
- Device interrupts CPU when ready or done
- CPU can do other work while waiting
- Most common approach
DMA (Direct Memory Access)
- DMA controller transfers data directly between device and memory
- CPU only interrupted at start and end of transfer
- Used for: Disk I/O, network, graphics (high-speed data transfer)
- Cycle Stealing: DMA temporarily "steals" bus cycles from CPU
I/O Layer Stack
User Application
↓
User-space I/O library
↓
Kernel I/O subsystem (logical file system, VFS)
↓
Device driver
↓
Device controller (hardware)
↓
I/O Device
Linux/Windows OS Basics
Linux Basics
| Concept | Description |
|---|---|
| Everything is a file | Devices, processes, sockets all treated as files |
| Process Management | fork() creates child process; exec() loads new program |
| File Permisions | Read (4), Write (2), Execute (1) for owner/group/others: chmod 755 file |
| Superuser (root) | UID = 0; highest privileges |
| Init System | systemd (modern) or init (traditional); first process (PID 1) |
| Kernel Modules | Loadable at runtime (insmod, rmmod, modprobe) |
| Shell | Command interpreter (bash, zsh, sh) |
| File System Hierarchy | / (root), /home, /etc, /var, /tmp, /usr, /bin, /sbin |
Key Linux Commands
# Process management
ps aux # List all processes
top # Real-time process monitor
kill -9 PID # Force kill process
nice -n 10 cmd # Run with priority
# File operations
chmod 755 file # Change permissions
chown user:grp # Change ownership
ls -la # List with details
# Disk management
df -h # Disk free space
du -sh dir # Directory size
mount /dev/sdX # Mount filesystem
# Network
ifconfig # Network interfaces
netstat -tuln # Open ports
iptables # Firewall rules
Windows OS Basics
| Concept | Description |
|---|---|
| Registry | Central hierarchical database for system/application settings |
| NTFS | Default file system; supports ACLs, encryption, compression |
| Services | Background processes (managed via Services.msc) |
| Task Manager | Process and performance monitoring |
| Active Directory | Directory service for domain management |
| Windows Kernel | Hybrid kernel (NT kernel) |
| DLL (Dynamic Link Library) | Shared library; code reuse across applications |
Linux vs Windows Comparison
| Feature | Linux | Windows |
|---|---|---|
| Kernel | Monolithic | Hybrid (NT) |
| File System | ext4, XFS, Btrfs | NTFS, ReFS |
| Open Source | Yes | No |
| CLI | Primary (shell) | Secondary (PowerShell, CMD) |
| Permissions | rwx (owner/group/others) | ACL-based |
| Process Creation | fork() + exec() | CreateProcess() |
| Dominant Use | Servers, embedded, cloud | Desktop, enterprise |
Key Formulas Summary
| Concept | Formula |
|---|---|
| CPU Utilization | (CPU busy time / Total time) × 100 |
| Throughput | Processes completed / Time |
| Turnaround Time | Completion Time - Arrival Time |
| Waiting Time | Turnaround Time - Burst Time |
| Response Time | First Response - Arrival Time |
| EAT (Virtual Memory) | (1-p) × ma + p × page_fault_time |
| Disk Access Time | Seek + Rotational Latency + Transfer |
| Exponential Averaging | τₙ₊₁ = α×tₙ + (1-α)×τₙ |
| Page Fault Rate | Page faults / Memory references |
| Banker's Safety | Need[i] ≤ Work for some unfinished process |
Exam Tips
- Process Scheduling: Practice numerical problems on FCFS, SJF, RR — most frequently tested
- Gantt Charts: Draw them for scheduling problems to avoid errors
- Banker's Algorithm: Practice safety check and resource request — guaranteed question
- Page Replacement: Know FIFO, LRU, Optimal — practice with reference strings
- Deadlock: All 4 conditions, prevention, avoidance, detection — comprehensive topic
- Disk Scheduling: SCAN vs C-SCAN vs LOOK — know the differences
- Synchronization: Semaphore solutions for producer-consumer, reader-writer
- Virtual Memory: Demand paging, thrashing, working set concept
- Memory Management: Paging vs segmentation — advantages and disadvantages
- Belady's Anomaly: Only in FIFO — important exam fact
- Context Switching: Understand what happens during a context switch
- Threads: User vs kernel threads; threading models
Practice Questions
11 MCQs for Operating Systems with detailed explanations.
Q1. Which of the following best describes Context switch time?
- A. pure overhead — CPU does no useful work during the switch.
- B. held
- C. a code segment that accesses shared variables. Only one process should execute it at a time.
- D. in CS, selection of next cannot be postponed
✅ Correct Answer: Option A
Explanation:
The correct answer is Option A — pure overhead — CPU does no useful work during the switch..
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q2. Regarding the following concept: 'Security and Access Control:...', which statement is correct?
- A. This approach has been deprecated in all modern implementations
- B. Security and Access Control:
- C. This is defined exclusively at the physical layer of system design
- D. This concept applies only to analog systems and not digital ones
✅ Correct Answer: Option B
Explanation:
The correct answer is Option B — Security and Access Control:.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q3. Regarding the following concept: 'User Interface:...', which statement is correct?
- A. This is defined exclusively at the physical layer of system design
- B. User Interface:
- C. This concept applies only to analog systems and not digital ones
- D. This approach has been deprecated in all modern implementations
✅ Correct Answer: Option B
Explanation:
The correct answer is Option B — User Interface:.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q4. Regarding the following concept: 'Process Management:...', which statement is correct?
- A. This approach has been deprecated in all modern implementations
- B. Process Management:
- C. This concept applies only to analog systems and not digital ones
- D. This is defined exclusively at the physical layer of system design
✅ Correct Answer: Option B
Explanation:
The correct answer is Option B — Process Management:.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q5. Regarding the following concept: 'I/O System Management:...', which statement is correct?
- A. This approach has been deprecated in all modern implementations
- B. This concept applies only to analog systems and not digital ones
- C. I/O System Management:
- D. This is defined exclusively at the physical layer of system design
✅ Correct Answer: Option C
Explanation:
The correct answer is Option C — I/O System Management:.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q6. Regarding the following concept: 'File System Management:...', which statement is correct?
- A. This is defined exclusively at the physical layer of system design
- B. This approach has been deprecated in all modern implementations
- C. This concept applies only to analog systems and not digital ones
- D. File System Management:
✅ Correct Answer: Option D
Explanation:
The correct answer is Option D — File System Management:.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q7. Regarding the following concept: '| Multiple users share CPU time | UNIX, Linux |
|...', which statement is correct?
- A. | Multiple users share CPU time | UNIX, Linux |
| - B. This is defined exclusively at the physical layer of system design
- C. This concept applies only to analog systems and not digital ones
- D. This approach has been deprecated in all modern implementations
✅ Correct Answer: Option A
Explanation:
The correct answer is Option A — | Multiple users share CPU time | UNIX, Linux |
|.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q8. Which of the following best describes critical section?
- A. pure overhead — CPU does no useful work during the switch.
- B. held
- C. a code segment that accesses shared variables. Only one process should execute it at a time.
- D. in CS, selection of next cannot be postponed
✅ Correct Answer: Option C
Explanation:
The correct answer is Option C — a code segment that accesses shared variables. Only one process should execute it at a time..
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q9. Which of the following best describes 2. Progress: If no process?
- A. pure overhead — CPU does no useful work during the switch.
- B. in CS, selection of next cannot be postponed
- C. a code segment that accesses shared variables. Only one process should execute it at a time.
- D. held
✅ Correct Answer: Option B
Explanation:
The correct answer is Option B — in CS, selection of next cannot be postponed.
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q10. Which of the following best describes - Page table itself?
- A. pure overhead — CPU does no useful work during the switch.
- B. paginated (too large to store contiguously)
- C. a code segment that accesses shared variables. Only one process should execute it at a time.
- D. held
✅ Correct Answer: Option B
Explanation:
The correct answer is Option B — paginated (too large to store contiguously).
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option C — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
Q11. Which of the following best describes operating system?
- A. held
- B. pure overhead — CPU does no useful work during the switch.
- C. system software that manages computer hardware, software resources, and provides common services for computer programs.
- D. a code segment that accesses shared variables. Only one process should execute it at a time.
✅ Correct Answer: Option C
Explanation:
The correct answer is Option C — system software that manages computer hardware, software resources, and provides common services for computer programs..
This concept is covered under Operating Systems in the CBDT Assistant Director Systems syllabus. The answer is established through standard definitions and widely accepted principles in the field.
Why other options are incorrect:
- Option A — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option B — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.
- Option D — This option is factually incorrect or describes a concept from a different domain, making it an invalid choice for this question.