My contribution

CPU Scheduling Algorithm Animation

Specification

There should be 3 separate pop-up GUI views (ie. Animation View, Input View, and Statistics View) somewhere on your monitor although they might be on top of each other, giving the illusion of only one view. Feel free to adjust the size of these boxes to see them comfortably; the initial size may be too small to show all functionality.

Animation View

The title of the currently/previously running CPU algorithm is displayed across the top panel. The bottom panel traces the clock time and the status of the algorithm. The main panel performs the animation by establishing a time line as the top horizontal axis and the process names as the vertical-left axis, and dynamically plots the bar graph. The entire Animation view is uneditable since user input is not needed. Caution: the animated view is not refreshed.

Statistics View

This is an editable display of final statistics after the selected algorithm has finished.

Input View

There are three text areas to supply input about the arrival time, service time, and the process name. As illustrated by the preset sample input, all input entities are to be isolated within each line. The process names could be strings of variable length. Arrival time and service time are to be integers. Caution: if there are idle time between arrival and service times, the horizontal time axis shown in the animation view will not be adequate.

Across the bottom panel of the Input View are the available operation control buttons including "clear", "run", "pause", "resume", and "quit".

To the left of these operation buttons is the pull-down menu of CPU Scheduling algorithms available (described below) for animation.

First Come First Serve(FCFS)

This non-preemptive scheduling algorithm follows the first-in, first-out (FIFO) policy. As each process becomes ready, it joins the ready queue. When the current running process finishes execution, the oldest process in the ready queue is selected to run next.

source

Round Robin

This scheduling policy (aka time-slicing) gives each process a slice of time before being preempted. As each process becomes ready, it joins the ready queue. A clock interrupt is generated at periodic intervals. When the interrupt occurs, the currently running process is preempted, and the oldest process in the ready queue is selected to run next. The time interval between each interrupt may vary.

source1
source2

Shortest Process Next

This non-preemptive scheduling algorithm favors processes with the shortest expected process time. As each process becomes ready, it joins the ready queue. When the current running process finishes execution, the process in the ready queue with the shortest expected processing time (aka service time) is selected to run next.

source

Shortest Remaining Time

This preemptive scheduling algorithm favors processes with the shortest remaining expected process time. As each process becomes ready, it joins the ready queue. This triggers an interrupt which preempts the current running process back into the ready queue. The process in the ready queue with the shortest remaining service time is selected to run next.

source

Highest Response Ratio

This non-preemptive scheduling algorithm favors processes with shorter expected service time. Nevertheless, aging processes without service will eventually get past competing shorter jobs. As each process becomes ready, it joins the ready queue. When the current process finishes execution, the process in the ready queue with the maximum response ratio is selected to run next. Response ratio = (time spent waiting for CPU + expected service time)/expected service time

source

Feedback

This preemptive scheduling algorithm favors shorter jobs by penalizing processes that have been running longer. It achieves this by using a multilevel priority queues. When a process becomes reay, it joins the first level ready queue. After each subsequent execution interval, it is relegated to the next lower-priority queue until it joins the bottom-most level queue. At each interrupt, the process in the highest priority queue is selected to run next; the processes in the lowest priority queue are scheduled using round robin algorithm. The time interval between interrupts may vary, and the levels of ready queues may also vary.

source

System Support

Views

input view
anime view
stats view

Class heirarchy

Driver
scheduling algorithm
process
augmented process
GUI listener
GUI packet

Go to applet

Quan T. Tran
Algorithm Animation project
Multimedia (CS 8302)
UT Dallas
Spring, 1998