B.Tech / B.E — Core CS

Operating Systems — Process Management Notes

📖 Operating Systems· ⌨️ Typed notes · 🌐 English

Complete Core CS notes for B.Tech / B.E. Covers all important topics with formulas, examples and PYQ solutions.

🏫 eGuru24 Team
⬇️0 downloads
❤️0 likes
👁️10 views
📅23 Jul 2026
Preview

Operating Systems — Process Management



What is a Process?


A program in execution. When you run a .exe file, OS creates a process.

Process States


``
New → Ready → Running → Waiting → Terminated
↑ ↓
Preempted
`

| State | Description |

|-------|-------------|

| New | Process being created |

| Ready | Waiting for CPU |

| Running | Currently executing |

| Waiting | Waiting for I/O |

| Terminated | Finished execution |


Process Control Block (PCB)


Data structure OS maintains for each process:
• Process ID (PID)

• Process State

• Program Counter

• CPU Registers

• Memory Information

• I/O Status

• Priority


CPU Scheduling Algorithms



FCFS (First Come First Serve)


• Non-preemptive

• Simple, easy to implement

Problem: Convoy effect — short processes stuck behind long ones


SJF (Shortest Job First)


• Select process with shortest burst time

Preemptive version: SRTF (Shortest Remaining Time First)

• Optimal for average waiting time

Problem: Need to know burst time in advance


Round Robin (RR)


• Each process gets time quantum (e.g., 2ms)

• Preemptive — clock interrupt after quantum

Best for time-sharing systems

• Performance depends on quantum size


Priority Scheduling


• Each process has priority number

• CPU given to highest priority process

Problem: Starvation of low-priority processes

Solution: Aging — increase priority over time


Gantt Chart (Exam Important!)


Example: Processes P1(bt=4), P2(bt=3), P3(bt=2), P4(bt=5) — FCFS

`
| P1 | P2 | P3 | P4 |

0 4 7 9 14
`

Waiting Times: P1=0, P2=4, P3=7, P4=9
Average Waiting Time = (0+4+7+9)/4 = 5ms

Deadlock


Necessary conditions (all 4 must hold):
1. Mutual Exclusion

2. Hold and Wait

3. No Preemption

4. Circular Wait


Prevention: Remove any one condition
Detection: Resource allocation graph, Banker's algorithm

Memory Formula


Turnaround Time = Completion Time - Arrival Time
Waiting Time = Turnaround Time - Burst Time`

PYQ


Q: Compare SJF and Round Robin. Which is better and why?
Q: Calculate average waiting time using RR with quantum=2 for given processes.