Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

CPU scheduling & memory simulator

Compare CPU scheduling methods on a Gantt chart, step through FIFO, LRU, optimal and clock page replacement, and try first, best and worst fit.

Each process (times in the same units you typed)
ProcessArrivesBurstPriorityFinishesTurnaroundWaitingResponse

How to use

  1. CPU scheduling: type one process per line: a short name, when it arrives, how long it needs the CPU (burst) and, for priority methods, its priority (a smaller number is more important). Pick a method and press Run to see the Gantt chart and the times for each process.
  2. Page replacement: type the order in which pages are used and how many frames fit in memory. The table shows the frames after each request; F marks a page fault.
  3. Memory allocation: type the free blocks and the requests. Each request takes a piece of a block; the rest stays as a smaller hole.
  4. Switch methods to compare them on the same numbers.

Keyboard and touch

TabMove between boxes, lists and buttons
Enter in a one-line boxRun the simulation

Tips

  • Shortest job first gives the lowest average waiting time when all jobs are known, but long jobs can wait for ever ("starvation").
  • Round robin gives everyone a quick first turn (good response time). A tiny time slice means many switches; a huge one turns it into first come, first served.
  • Optimal page replacement needs to know the future, so real systems cannot use it; it is the yardstick for the others.
  • Belady's anomaly: with FIFO, giving a program more memory can make it fault more. LRU and optimal never do this.
  • Best fit leaves tiny holes that are hard to use; worst fit keeps holes big. Try both on the same requests.

About this simulator

These are the classic textbook models used in operating-systems courses. Ties go to the process that arrived first, then to the one listed first. Pre-emptive methods check at every arrival and keep the running process when there is a tie. In round robin, a process that arrives as a time slice ends joins the queue before the process whose slice just ended. Context switches take no time. Response time is the wait before a process first runs.

Page replacement fills empty frames first. LRU throws out the page unused for the longest time, optimal the page needed furthest in the future, and clock gives recently used pages a second chance. Memory allocation splits a block and leaves the rest as a hole; holes are not merged or moved. Real operating systems add many details, but the trade-offs are the same.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product