Operating System
OS Part-1
OS Part-2
- File Concepts and Access methods
- Free Space Management and Allocation methods
- Directory Systems and Protection
- File Organization, Sharing and Implementation issues
- Disk and Drum Scheduling
- I/O Devices Organisation & I/O Buffering
- I/O Hardware, Kernel I/O subsystem and Transforming I/O Requests to Hardware Operations
- Device Drivers and Path Management
- Device Driver Sub Modules and Procedure
- Device Scheduler and Handler
- Interrupt Service Routine (ISR)
- File System in Linux and Windows
OS Part-3
- Process and Process Control Block(PCB)
- Process Scheduling( Preemptive and Non Preemptive)
- Scheduling Algorithms
- Algorithm Evaluation
- Multiple Processor Scheduling
- Real Time Scheduling
- Operations on Processes
- Threads
- Inter-Process Communication
- Precedence Graphs
- Critical Section Problem
- Semaphores
- Classical Problems of Synchronization
- DeadLock
- Deadlock Prevention and Avoidance
- Deadlock Detection and Recovery
- Process Management in Linux
OS Part-4
- Memory Hierarchy in OS
- Concepts of Memory Management
- MFT and MVT
- Logical and Physical Address Space
- Swapping
- Contiguous and Non Contiguous Memory Allocation
- Paging
- Segmentation
- Paging Combined with Segmentation
- Structure and Implementation of Page Table
- Virtual Memory in OS
- Cache Memory Organization
- Demand Paging
- Page Replacement Algorithms
- Allocation of Frames and Thrashing
- Demand Segmentation
OS Part-5
- Distributed Operating System: Introduction and Types
- Distributed OS: Design Issues
- Distributed OS: File System
- Distributed OS: Remote File Access
- Remote Procedure Call(RPC)
- Remote Method Invocation(RMI)
- Distributed Shared Memory
- Parallel Processing and Concurrent Programming
- Security and Threats Protection in Distributed OS
- Security Design Principles and Authentication in Distributed OS
- Sensor Network and Parallel OS
Process Scheduling in OS – Preemptive & Non-Preemptive Scheduling
1. Process Scheduling Kya Hota Hai?
Process Scheduling ek technique hai jisme OS decide karta hai ki kaunsa process CPU pe chalega aur kitni der tak.
Kyunki CPU time limited hota hai, OS ensure karta hai ki sabhi processes efficiently execute ho sakein.
Scheduling Criteria (Performance Parameters)
Ek achha scheduling algorithm in factors ko optimize karta hai:
CPU Utilization – CPU hamesha busy rahe.
Throughput – Kitne processes ek second me complete ho rahe hain.
Turnaround Time – Process submit hone se lekar complete hone tak ka total time.
Waiting Time – Process CPU milne ka kitna wait karta hai.
Response Time – Process request bhejne ke baad pehli baar response milne me kitna time lagta hai.
2. Process Scheduling ke Types
Process Scheduling CPU allocation aur interruption ke basis pe do types me divide hota hai:
(A) Preemptive Scheduling
Isme ek process ko CPU se hata kar dusre process ko diya ja sakta hai.
Process execution ke beech me bhi interrupt ho sakta hai.
Multitasking aur real-time systems me use hota hai.
Example of Preemptive Scheduling:
Suppose teen processes P1, P2, P3 hain.
P1 start hota hai, par thodi der baad P2 higher priority ka aata hai.
CPU P1 se le kar P2 ko de diya jata hai (Preemption hoti hai).
Diagram for Preemptive Scheduling:
Time →0 2 4 6 8 10
|P1| → |P2| → |P1| → |P3|
P1 shuru hota hai (0 sec par)
P2 higher priority ka aaya (2 sec par) aur P1 ko preempt kar diya
P1 dobara execute hota hai P2 ke khatam hone ke baad
P3 execute hota hai last me
Common Preemptive Scheduling Algorithms:
Round Robin (RR) – Har process ko ek fixed time (time quantum) milta hai.
Shortest Remaining Time First (SRTF) – Sabse kam remaining time wale process ko CPU milta hai.
Priority Preemptive Scheduling – Higher-priority process lower-priority wale ko preempt kar deta hai.
(B) Non-Preemptive Scheduling
Ek baar process ko CPU mil gaya to jab tak wo complete na ho jaye, usko nahi hataya jata.
CPU process ke complete hone tak uske paas hi rehta hai.
Batch processing systems me use hota hai.
Example of Non-Preemptive Scheduling:
Suppose teen processes P1, P2, P3 hain.
P1 start hota hai aur jab tak complete na ho, CPU usi ke paas rahta hai.
Uske baad hi P2 execute hoga, phir P3.
Diagram for Non-Preemptive Scheduling:
Time → 0 5 10 15
| P1 | → | P2 | → | P3 |
P1 execute hota hai (0 se 5 sec tak)
P2 execute hota hai (5 se 10 sec tak)
P3 execute hota hai (10 se 15 sec tak)
Common Non-Preemptive Scheduling Algorithms:
First Come First Serve (FCFS) – Jo process pehle aata hai, usko CPU pehle milta hai.
Shortest Job First (SJF) – Jiska execution time sabse kam hota hai, wo pehle execute hota hai.
Priority Scheduling (Non-Preemptive) – Higher-priority process execute hota hai, lekin ek baar start hone ke baad usko interrupt nahi kiya jata.
3. Preemptive vs Non-Preemptive Scheduling ka Difference
Feature | Preemptive Scheduling | Non-Preemptive Scheduling |
---|---|---|
Process Interruption | Haan, process ko beech me interrupt kiya ja sakta hai | Nahi, ek baar start ho gaya to complete hone tak chalega |
Response Time | Fast, kyunki priority wale processes ko jaldi CPU milta hai | Slow, kyunki process wait karta hai |
CPU Utilization | High, kyunki CPU idle nahi rehta | Low, kyunki kabhi-kabhi CPU idle ho sakta hai |
Overhead | Jyada, kyunki frequent context switching hota hai | Kam, kyunki koi context switching nahi hoti |
Example Algorithms | Round Robin, SRTF, Priority (Preemptive) | FCFS, SJF, Priority (Non-Preemptive) |
4. Summary (Short Notes)
Process scheduling CPU execution ko manage karta hai.
Preemptive scheduling me process interrupt ho sakta hai (e.g., Round Robin, SRTF).
Non-preemptive scheduling me process complete hone tak chalega (e.g., FCFS, SJF).
Preemptive scheduling multitasking aur real-time systems me use hota hai, jabki non-preemptive simple aur low-overhead hota hai.