Welcome to MyCPUHeats
A professional, interactive environment designed to help you understand core OS scheduling algorithms including FCFS, SJF, SRTF, Priority, and Round Robin.
Animated Visualizations
Watch the algorithms construct execution timelines dynamically using interactive Gantt charts.
Metrics & Analysis
Automatically calculates Average Waiting Time, Turnaround Time, and CPU Utilization instantly.
Pros & Cons Evaluation
Learn the exact advantages and disadvantages of each paradigm to know when to use them.
Learning Resource
In-depth explanations, numerical examples, and real-life analogies.
1. First-Come-First-Serve (FCFS)
Non-PreemptiveThe simplest scheduling algorithm. Processes are dispatched strictly according to their arrival time on the ready queue. Once the CPU is allocated to a process, it keeps the CPU until it finishes execution.
Numerical Example
P1: Arrival=0, Burst=10
P2: Arrival=1, Burst=2
• P1 runs from 0 to 10.
• P2 waits for 9ms, runs from 10 to 12.
Real Life Application
A printer queue or a movie theater ticket counter. The person who gets in line first is served completely before the next person is even acknowledged.
Advantages
- Extremely simple to understand and implement (uses a basic FIFO queue).
- No complex scheduling overhead or frequent context switching.
- Fairness in terms of arrival time (no starvation eventually).
Disadvantages
- The Convoy Effect: Short processes get stuck waiting behind massive processes, skyrocketing the average wait time.
- Not suitable for time-sharing or interactive systems.
2. Shortest Job First (SJF)
Non-PreemptiveWhen the CPU is available, it is assigned to the process that has the smallest burst time. If two processes have the same burst time, FCFS is used to break the tie.
Numerical Example
P1: Arrival=0, Burst=8
P2: Arrival=1, Burst=4
P3: Arrival=2, Burst=2
• P1 starts at 0 (only one available). Finishes at 8.
• At t=8, both P2 and P3 are waiting. P3 (burst 2) runs next, then P2 runs.
Real Life Application
The "10 Items or Less" express lane at a grocery store. It ensures people with very quick transactions aren't held up by a massive grocery cart.
Advantages
- Mathematically proven to provide the minimum average waiting time for a given set of processes.
- Provides high throughput by clearing short jobs quickly.
Disadvantages
- Starvation: A continuous stream of short jobs will prevent long jobs from ever executing.
- Practically impossible to accurately predict the exact CPU burst time of a process before it runs.
3. Shortest Remaining Time First (SRTF)
PreemptiveThe preemptive counterpart to SJF. If a new process arrives with a shorter burst time than the remaining time of the currently executing process, the CPU is preempted (paused) and given to the new process.
Numerical Example
P1: Arrival=0, Burst=8
P2: Arrival=1, Burst=4
• t=0: P1 starts running.
• t=1: P2 arrives. P1 has 7ms remaining. P2 needs 4ms.
• Since 4 < 7, P1 is preempted. P2 takes CPU.
Real Life Application
Hospital ER Triage. A doctor treating a minor cut (P1) will immediately suspend treatment if a critical trauma patient (P2) arrives requiring faster, life-saving intervention.
Advantages
- Superior response time for new, short interactive processes compared to basic SJF.
- Highly optimal for time-sharing environments handling many small tasks.
Disadvantages
- High overhead due to frequent context switching (saving/loading states).
- Like SJF, it heavily suffers from the starvation of longer processes.
4. Priority Scheduling
Non-PreemptiveA priority integer is assigned to each process. The CPU is allocated to the process with the highest priority. (In this simulator, a lower numerical value indicates a higher priority).
Numerical Example
P1: Arrival=0, Burst=5, Priority=3
P2: Arrival=0, Burst=3, Priority=1
• Both arrive at t=0. P2 has higher priority (1).
• P2 executes entirely before P1 is allowed to start.
Real Life Application
Emergency Vehicles in Traffic. Standard cars (low priority) waiting at a red light are overridden when an ambulance with sirens (high priority) arrives and passes through.
Advantages
- Allows for fine-grained control over which processes are deemed critical.
- Ideal for Real-Time Operating Systems (RTOS) where deadlines must be met.
Disadvantages
- Starvation: Low-priority processes can be blocked indefinitely if high-priority tasks keep arriving. (Requires a solution like "Aging").
5. Round Robin (RR)
PreemptiveDesigned for time-sharing systems. A small unit of time (time quantum) is defined. The CPU scheduler gives the CPU to each process in the queue for a maximum of one quantum. If a process doesn't finish, it gets put at the back of the line.
Numerical Example (Q=2)
P1: Burst=5
P2: Burst=3
• P1 runs for 2ms. Swaps to P2.
• P2 runs for 2ms. Swaps to P1.
• P1 runs for 2ms. Swaps to P2.
• P2 runs 1ms (done). P1 runs 1ms (done).
Real Life Application
A Customer Support Agent. The agent replies to Customer A, switches tabs to reply to Customer B, then switches back to A. Creates the illusion of simultaneous processing.
Advantages
- Fair allocation of CPU time across all processes.
- Excellent response time for interactive and time-sharing environments.
- Zero starvation; every process is guaranteed a time slice eventually.
Disadvantages
- If Quantum is too large, it degrades into FCFS.
- If Quantum is too small, it causes massive overhead due to excessive context switching.
- Generally higher average turnaround time compared to SJF.
Live Simulator
Configure parameters and build your process queue.
Configuration
Process Data
| Process | Arrival | Burst | Priority |
|---|