CS 134

Key Points: Scheduling Algorithms

First Come, First Served (FCFS)

  1. Definition: Processes are executed in the order they arrive
  2. Characteristics:
    • Simple to implement
    • Non-preemptive
    • Can lead to long average wait times, especially if long processes arrive first

Shortest Job First (SJF)

  1. Definition: Process with the shortest execution time is selected to run next
  2. Characteristics:
    • Optimal for minimizing average wait time
    • Requires knowing or estimating job lengths in advance
    • Can lead to starvation of longer processes

Round Robin (RR)

  1. Definition: Each process is given a fixed time quantum to execute before being preempted
  2. Characteristics:
    • Preemptive
    • Fair allocation of CPU time
    • Good response time but processes take longer to complete
    • Performance depends on choice of quantum
    • Introduces context switch overhead

Scheduling Metrics

  1. Response Time: Time from when a process arrives until it first gets CPU time
  2. Turnaround Time: Time from when a process arrives until it completes
  3. Wait Time: Total time a process spends waiting in the ready queue

Context Switches

  1. Definition: The process of saving the state of a running process and loading the state of another
  2. Impact: Introduces overhead, affecting overall system performance

Remember

  • Each scheduling algorithm has its own strengths and weaknesses
  • There's no "one size fits all" solution in scheduling; the best algorithm depends on the specific use case
    • Understanding trade-offs between metrics (response time, turnaround time, wait time) is crucial
  • Context switches are an important consideration in preemptive scheduling
  • Be prepared to draw charts showing how processes are scheduled under different algorithms—it's a classic exam question!

(When logged in, completion status appears here.)