CPU Scheduling Algorithm Simulator

Enter processes with arrival, burst and priority, choose an algorithm and get a Gantt chart, every time per process with the subtraction shown and a side-by-side comparison.

브라우저에서 실행됩니다. 파일은 기기 밖으로 나가지 않습니다. 확인하는 방법 보기

…

사용 방법

  1. 1
    Enter processes

    Type each process's name, arrival time, burst time and priority, or press Random set.

  2. 2
    Choose an algorithm

    Pick FCFS, SJF, SRTF, priority or round robin and set the quantum for round robin.

  3. 3
    Read the Gantt chart

    Follow the coloured bars and the time marks below them.

  4. 4
    Check the times

    Read completion, turnaround, waiting and response times with the working.

  5. 5
    Compare algorithms

    Open Compare algorithms to see all six on the same processes.

  6. 6
    Practise and save

    Answer generated questions in Practice, save workloads, export CSV or print.

이 도구 소개

CPU scheduling decides which ready process runs next on the processor, and it is a standard topic in every operating systems course and many university exams. Questions give a table of processes with arrival times, burst times and sometimes priorities, and ask for a Gantt chart and the average waiting and turnaround times under a given algorithm. The arithmetic is simple, but one wrong decision early in the chart spoils everything after it. This simulator handles six algorithms: first come first served, shortest job first, shortest remaining time first, non-preemptive and preemptive priority, and round robin with any time quantum. It draws the Gantt chart, shows completion, turnaround, waiting and response times with the subtraction written out, and compares all algorithms on the same workload.

The measures

- **Completion time (C)**: when the process finishes. - **Turnaround time** = completion − arrival: the total time in the system. - **Waiting time** = turnaround − burst: the time spent ready but not running. - **Response time** = first run − arrival: how long until the process first gets the CPU.

The simulator also reports CPU utilisation (idle gaps appear in grey on the chart) and the number of context switches.

The algorithms

- **FCFS** runs processes in order of arrival. Simple, but short jobs can wait behind a long one (the convoy effect). - **SJF** picks the shortest burst when the CPU becomes free and runs it to completion. It minimises average waiting time among non-preemptive schedules. - **SRTF** is the preemptive version: when a new process arrives with less remaining time than the running one, it takes over. It minimises average waiting time overall. - **Priority** scheduling runs the process with the best priority, here the lowest number. The preemptive version lets a higher-priority arrival interrupt. Low-priority processes can starve; real systems use ageing. - **Round robin** gives each process at most one time quantum, then sends it to the back of the queue. New arrivals during a quantum join the queue before the preempted process, the convention used in most textbooks.

Ties are broken by arrival time and then by the order in the table, and the simulator states this so you can match your course's convention.

Comparing algorithms

The compare tab runs every algorithm on the same processes and lists average waiting, turnaround and response times, with the best waiting time in bold and a Gantt chart for each. It is a quick way to see the trade-offs: SRTF wins on waiting time, round robin on response time, FCFS on simplicity.

Worked example

Processes P1 (arrives 0, burst 8), P2 (1, 4), P3 (2, 9) and P4 (3, 5) under SRTF. P1 starts at 0; at time 1 P2 arrives with 4 units, less than P1's remaining 7, so P2 runs to 5. Then P4 (5 units) runs to 10, P1 resumes to 17 and P3 runs to 26. Waiting times: P1 = 17 − 0 − 8 = 9, P2 = 0, P3 = 15, P4 = 2. Average waiting time = 26 ÷ 4 = 6.5.

Limits

The simulator models one CPU, no I/O bursts and zero context-switch time, which is the textbook setting. Real operating systems use multilevel feedback queues, multiple cores and time-varying priorities. Tie-breaking rules vary between textbooks, so check your course's convention if an answer differs by one step.

풀이 예시

SRTF on P1(0,8) P2(1,4) P3(2,9) P4(3,5): waiting 9, 0, 15, 2 → average 6.5.

한눈에 보기

자주 묻는 질문

What is the difference between SJF and SRTF?

SJF is non-preemptive: once a job starts it finishes. SRTF is preemptive: a newly arrived shorter job interrupts the running one.

Which algorithm gives the lowest average waiting time?

SRTF, for a known set of burst times. It is used as a benchmark because real systems cannot know burst times in advance.

How does round robin handle new arrivals?

A process that arrives during a time slice joins the ready queue before the process whose slice just ended, as in most textbooks.

Is a lower priority number better?

Yes, here priority 1 is the highest. Some books use the opposite convention; swap the numbers if yours does.

What happens when no process is ready?

The CPU is idle; the gap appears in grey on the Gantt chart and lowers the utilisation figure.

Can I save my exercises?

Yes. Save sets of processes by name, export the results as CSV or print the table and Gantt order.

완전 무료요금 없음, 가입 없음
파일은 비공개로 유지됩니다모든 작업이 브라우저 안에서 이루어집니다
내 언어로 쉽게여러 언어로 제공