The goal of this assignment is to compare the performance of CPU Scheduling algorithms for a given set of processes and a given value of quantum. Basically, you are to write a program to draw Gantt charts and calculate the waiting time and turnaround times for a set of processes under the following CPU scheduling algorithms:

  • First-Come-First-Serve (FCFS)
  • Round Robin with a specific quantum value.

Data Input:

Before starting to execute, your program asks the user to enter the following:

  • Time quantum to be used in the RR algorithm.
  • The name of the input data file. The input file is a text file with the following format.
P1 5
P2 3
P3 4
P4 3
P5 6

The input file is interpreted as follows:

  • First column is the process ID.
  • Second column is the CPU burst length.
  • For simplicity, assume that all processes arrived together at time 0.
  • For FCFS, jobs are processed in the same order as they are written in the input file.
  • Assume that all processes consist of only one CPU burst.

Expected output:

The output of your program should include two parts, Gantt charts and Output Statistics, explained as follows. Instead of displaying the output on the screen, the output of your program should be stored in a text file for easy checking of output correctness.

Gantt Charts:

The first part of the output should be two vertical Gantt charts, one for FCFS and the other for RR with the given quantum. Each Gantt chart is represented in two columns as follows. The first column is the time point and the second column is the process ID for the process that was running on CPU at this time point.

Gantt Chart for FCFS:
Time Process Id
0 P1
1 P1
2 P1
3 P1
4 P1
5 P2
6 P2
7 P2
Gantt Char for RR (quantum = 2)
Time Process Id
0 P1
1 P1
2 P2
3 P2
4 P3
5 P3
6 P4
7 P4
8 P5
9 P5

Output statistics:

In this part you required to display the waiting time and the turnaround time for all processes in the work load. Waiting time is defined as the time that the process spent in the ready queue. However, the turnaround time is the overall time spent by the process in the system (i.e., finish time – arrival time).

Waiting Times
ID FCFS RR
P1 0 14
P2 5 10
P3 8 11
P4 12 13
P5 15 15

Turnaround Times
ID FCFS RR
P1 5 19
P2 8 13
P3 12 15
P4 15 16
P5 21 21

Programming Language:

You can use either Java or C/C++ as a programming language to implement your algorithms. Just make sure that you turn in detailed instructions on how to compile and run your code.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.