->An operating system is a program which manages all the computer hard wares.
->The operating system has two objectives such as:
->Firstly, an operating system controls the computer’s hardware.
->The second objective is to provide an interactive interface to the user and
interpret commands so that it can communicate with the hardware.
->A process is a program in execution
Types of Operating Systems
Batch OS – Executes jobs in batches without user interaction.
Multiprogramming OS – Allows multiple programs to reside in memory for better CPU
utilization.
Multitasking OS – Supports concurrent execution of multiple tasks (processes).
Time-sharing OS – Each task gets CPU for a small time slice (quantum).
Distributed OS – Manages a group of separate computers and makes them appear as a
single system.
Real-Time OS (RTOS) – Provides immediate response; used in embedded systems.
Types of schedulers: Long ,Medium and Short
CPU Scheduling Algorithm:
1. First Come, First Served Scheduling (FCFS) Algorithm - convey affect is the draw
back of FCFS, if a process with lowest arrival time and high burst time occurs then
the process with lowest burst time will have high weighting time.
2.Shortest Job First Scheduling (SJF) Algorithm -In Preemptive mode it is called
SRTF(shortest remaining time first).
3.Priority Scheduling Algorithm - Ageing is the draw back, if a lowest priority
process occurs with lowest burst time it must weight all the time until the turn
comes.
4.Round Robin Scheduling Algorithm - context switching will be used more.
🔸 Context Switching
Saving the state of a process and loading the state of another.
Overhead due to frequent switches.
🔸 Process States
New → Ready → Running → Waiting → Terminated
Ready: Waiting for CPU
Running: Currently executing
Waiting: Waiting for I/O
🔸 Thread vs Process
Process: Independent execution unit with separate memory.
Thread: Lightweight process; shares memory with other threads of the same process.
🔸 Types of Threads
User-Level Threads (ULT)
Kernel-Level Threads (KLT)
Classical Problem on Synchronization:
-> Bounded Buffer Problem(procedure and consumer problem).
-> Reader Writer Problem.
-> Dining Philosopher Problem.
Deadlock : A situation where n process are in blocked state because each process is
holding a resource and waiting for another resource held by another process which
only release the resource if it a resource which is held by other.
A deadlock occurs when processes wait indefinitely for resources that are locked
by each other, and none of them can move forward until another process releases a
resource — which never happens.
Deadlock Characteristics:
-> Mutual exclusion
-> Hold and wait
-> No Preemption
-> Circular wait
Deadlock Detection :
-> Single Instance of each Resource type - wait for graph is used.
-> Several Instances of a Resource type - Available, allocation and request.
Recovery from Deadlock :
->Process Termination
->Resource Preemption
o Logical address – address generated by the CPU; also referred to as virtual
address.
o Physical address – address seen by the memory unit.
Partition Algorithm:
o First-fit: Allocate the first hole that is big enough.
o Best-fit: Allocate the smallest hole that is big enough; must search entire
list, unless
ordered by size.
o Worst-fit: Allocate the largest hole; must also search entire list.
Fragmentation
• External Fragmentation – total memory space exists to satisfy a request, but it
is not
contiguous.
• Internal Fragmentation – allocated memory may be slightly larger than requested
memory; this
size difference is memory internal to a partition, but not being used.
Memory Management Techniques:
->Paging – Logical memory divided into pages, physical into frames.
->Segmentation – Divides memory into variable-size segments like code, data, stack.
🔸 Virtual Memory
->Allows execution of processes not completely in memory.
->Uses demand paging.
Page Replacement Algorithm :
-> Optimal algorithm.
-> FIFO algorithm.
-> LFU algorithm (page-based) & LFU algorithm (frame-based).
• Thrashing is when a process is busy swapping pages in and out.
🔸 File Systems
File attributes: name, type, size, permissions
File operations: create, delete, read, write, open, close
Directory structures: single-level, two-level, tree, acyclic graph
🔸 Security & Protection
Authentication – verifying identity (e.g., passwords, biometrics)
Authorization – access control policies
Access matrix – describes rights of each process to resources
🔸 I/O Management
Polling vs Interrupt-driven I/O
DMA (Direct Memory Access) for fast data transfer
🔸 Booting Process
Bootstrap loader loads OS kernel into memory.
🔸 Disk Scheduling Algorithms
FCFS (First-Come, First-Served) – Services disk I/O requests in the order they
arrive; simple but not always efficient.
SSTF (Shortest Seek Time First) – Selects the request closest to the current head
position; reduces seek time but may cause starvation.
SCAN – The disk arm moves in one direction, servicing requests until it hits the
end, then reverses direction (like an elevator).
LOOK – Similar to SCAN, but the head only goes as far as the last request in each
direction before reversing.
C-SCAN (Circular SCAN) – The head moves in one direction servicing requests, then
jumps back to the beginning and continues in the same direction.