1. Basic Concepts
Process Scheduling
 The OS manages processes using a scheduler to allocate CPU time efficiently.
 Scheduling occurs at different levels:
1. Long-term scheduling: Decides which processes enter the system.
2. Short-term scheduling: Determines which process gets CPU next.
3. Medium-term scheduling: Swaps processes in and out of memory.
Process States
1. New → Process is created.
2. Ready → Waiting for CPU.
3. Running → Executing on CPU.
4. Waiting → Blocked for I/O or resource.
5. Terminated → Finished execution.
CPU Scheduler
 Chooses from the ready queue and assigns a process to the CPU.
 Uses scheduling algorithms to decide which process to run.
2. Scheduling Criteria
Used to evaluate scheduling algorithms:
1. CPU Utilization → Keep CPU as busy as possible (goal: 40-90%).
2. Throughput → Number of processes completed per unit time.
3. Turnaround Time → Time from process submission to completion.
4. Waiting Time → Time spent in the ready queue.
5. Response Time → Time from request submission to first response.
6. Fairness → Equal distribution of CPU time among processes.
Goal: Minimize turnaround, waiting, and response times while maximizing CPU utilization and
throughput.
3. Scheduling Algorithms
1. First-Come, First-Served (FCFS)
 Non-preemptive, simple queue-based.
 Pros: Fair, easy to implement.
 Cons: Long wait time for short processes (convoy effect).
2. Shortest Job Next (SJN) / Shortest Job First (SJF)
 Picks the process with the shortest burst time.
 Non-preemptive or preemptive (SRTF - Shortest Remaining Time First).
 Pros: Optimal for minimizing waiting time.
 Cons: Hard to predict burst time, starvation for longer jobs.
3. Round Robin (RR)
 Preemptive, each process gets a fixed time quantum.
 Pros: Fair for time-sharing, responsive.
 Cons: High context-switching overhead.
4. Priority Scheduling
 Assigns a priority to each process.
 Non-preemptive or preemptive.
 Pros: Prioritizes important tasks.
 Cons: Starvation (solved by aging).
5. Multilevel Queue Scheduling
 Separates processes into queues (e.g., system, user, background).
 Each queue has its own scheduling algorithm.
 Pros: Good for different user needs.
 Cons: Complex implementation.
6. Multilevel Feedback Queue Scheduling
 Dynamic priority adjustment (processes can move between queues).
 Pros: Adaptive, prevents starvation.
 Cons: More complex than fixed-priority queues.
4. Algorithm Evaluation
1. Deterministic Modeling
 Uses predefined workloads to compare performance.
 Example: Compare FCFS vs. SJF for known processes.
2. Queueing Models
 Uses mathematical models to predict scheduling behavior.
 Based on arrival rates, service time, etc.
3. Simulations
 Generates random workloads and measures algorithm performance.
4. Implementation & Testing
 Real-world deployment to analyze performance under actual conditions.

Process Scheduling in Operating System.docx

  • 1.
    1. Basic Concepts ProcessScheduling  The OS manages processes using a scheduler to allocate CPU time efficiently.  Scheduling occurs at different levels: 1. Long-term scheduling: Decides which processes enter the system. 2. Short-term scheduling: Determines which process gets CPU next. 3. Medium-term scheduling: Swaps processes in and out of memory. Process States 1. New → Process is created. 2. Ready → Waiting for CPU. 3. Running → Executing on CPU. 4. Waiting → Blocked for I/O or resource. 5. Terminated → Finished execution. CPU Scheduler  Chooses from the ready queue and assigns a process to the CPU.  Uses scheduling algorithms to decide which process to run. 2. Scheduling Criteria Used to evaluate scheduling algorithms: 1. CPU Utilization → Keep CPU as busy as possible (goal: 40-90%). 2. Throughput → Number of processes completed per unit time. 3. Turnaround Time → Time from process submission to completion. 4. Waiting Time → Time spent in the ready queue.
  • 2.
    5. Response Time→ Time from request submission to first response. 6. Fairness → Equal distribution of CPU time among processes. Goal: Minimize turnaround, waiting, and response times while maximizing CPU utilization and throughput. 3. Scheduling Algorithms 1. First-Come, First-Served (FCFS)  Non-preemptive, simple queue-based.  Pros: Fair, easy to implement.  Cons: Long wait time for short processes (convoy effect). 2. Shortest Job Next (SJN) / Shortest Job First (SJF)  Picks the process with the shortest burst time.  Non-preemptive or preemptive (SRTF - Shortest Remaining Time First).  Pros: Optimal for minimizing waiting time.  Cons: Hard to predict burst time, starvation for longer jobs. 3. Round Robin (RR)  Preemptive, each process gets a fixed time quantum.  Pros: Fair for time-sharing, responsive.  Cons: High context-switching overhead. 4. Priority Scheduling  Assigns a priority to each process.  Non-preemptive or preemptive.  Pros: Prioritizes important tasks.
  • 3.
     Cons: Starvation(solved by aging). 5. Multilevel Queue Scheduling  Separates processes into queues (e.g., system, user, background).  Each queue has its own scheduling algorithm.  Pros: Good for different user needs.  Cons: Complex implementation. 6. Multilevel Feedback Queue Scheduling  Dynamic priority adjustment (processes can move between queues).  Pros: Adaptive, prevents starvation.  Cons: More complex than fixed-priority queues. 4. Algorithm Evaluation 1. Deterministic Modeling  Uses predefined workloads to compare performance.  Example: Compare FCFS vs. SJF for known processes. 2. Queueing Models  Uses mathematical models to predict scheduling behavior.  Based on arrival rates, service time, etc. 3. Simulations  Generates random workloads and measures algorithm performance. 4. Implementation & Testing
  • 4.
     Real-world deploymentto analyze performance under actual conditions.