Skip to main content
This section provides comprehensive documentation for all CPU scheduling algorithms implemented in the simulator. Each algorithm has different characteristics that make it suitable for specific use cases.

Available Algorithms

The simulator implements five core CPU scheduling algorithms:
  • FIFO (First In First Out) - Simple queue-based scheduling
  • SJF (Shortest Job First) - Optimizes for shortest execution time
  • Round Robin - Time-sliced fair scheduling with quantum
  • Priority Scheduling - Priority-based non-preemptive scheduling
  • MLFQ (Multi-Level Feedback Queue) - Advanced multi-queue scheduling

Algorithm Comparison

AlgorithmTypePreemptiveParametersBest For
FIFOQueue-basedNoArrival time, CPU timeSimple batch processing
SJFShortest firstNoArrival time, CPU timeMinimizing average waiting time
Round RobinTime-slicedYesArrival time, CPU time, QuantumTime-sharing systems
PriorityPriority-basedNoArrival time, CPU time, PriorityCritical task handling
MLFQMulti-queueYesArrival time, CPU time, Quantum arrayComplex interactive systems

Key Metrics

All algorithms calculate the following performance metrics:
  • Start Time - When the process first begins execution
  • Finish Time - When the process completes
  • Waiting Time - Total time spent waiting in ready queue
  • Turnaround Time - Total time from arrival to completion
  • Total Time - Overall completion time for all processes
Waiting Time = Start Time - Arrival TimeTurnaround Time = Finish Time - Arrival Time

Choosing an Algorithm

Use FIFO when:

  • Processes arrive in a predictable order
  • Simplicity is more important than optimization
  • Running batch jobs without time constraints

Use SJF when:

  • Process execution times are known in advance
  • Minimizing average waiting time is critical
  • Running non-interactive batch processes

Use Round Robin when:

  • Fair CPU time distribution is required
  • Running interactive or time-sharing systems
  • All processes should make progress regularly

Use Priority Scheduling when:

  • Some processes are more critical than others
  • You need control over execution order
  • Real-time constraints exist for certain tasks

Use MLFQ when:

  • Handling mixed workloads (interactive + batch)
  • Want automatic priority adjustment
  • Need sophisticated scheduling behavior
Non-preemptive algorithms (FIFO, SJF, Priority) can cause long waiting times if a long process executes while shorter processes wait.

Next Steps

Explore each algorithm in detail:

Build docs developers (and LLMs) love