CSC3300 - Lab04
CSC3300 - Lab04
1 2023/2024
LAB 4
OBJECTIVE:
The main objective of this lab is to help student to understand the scheduling algorithms
used in operating system, by implementing and running the algorithm using computer
program.
DURATION:
2 weeks / 6 hours
RUBRIC:
LEVEL 1 LEVEL 2 LEVEL 3 LEVEL 4 LEVEL 5
CRITERIA
Very Poor Poor Good Very Good Excellent
The ability to Unable to Able to perform Able to perform Able to perform Able to perform
perform perform programming programming programming programming
programming programming task with task with some task with task with
task task with very limited success success (≥ 60%, considerable outstanding
limited success (≥ 40%,< 60%). < 80%). success (≥ 80%, success (100%).
(< 40%). < 100%).
1
CSC3300 Sem. 1 2023/2024
INSTRUCTIONS:
You are given a scheduling problem in Table 1 below, which involved 5 processes with
the given arrival time and burst time:
Table 1
Process Arrival Time Burst Time
Process A 0 6
Process B 2 4
Process C 5 1
Process D 6 3
Process E 9 5
Implement a Java program to calculate the waiting time and turnaround time for each
process involved using First-Come-First-Serve (FCFS) algorithm, and fill up the Table
2. Then calculate the average waiting time produced by FCFS scheduling algorithm.
2
CSC3300 Sem. 1 2023/2024
Implement a Java program to calculate the waiting time and turnaround time involving
N processes using Round-Robin scheduling algorithm. The user should be allowed to
enter the following information:
• N, or the total of processes involved (N should be between 4 to 10 inclusive)
• Burst time for each process
• The quantum time to be used by the RR algorithm.
Arrival time is not needed as it is assumed all processes arrived at the same time (t=0).
Using the information provided, calculate
• Waiting times for all the processes
• Turnaround times for all the processes
• The average waiting time produced by the RR algorithm for the given
situation/problem.
Complete Table 3 and Table 4 below with the input and result of the program.
3
CSC3300 Sem. 1 2023/2024
N: 4
Burst time: 7 4 1 4
Q: 3
Process Exec. slices (t) Waiting Turnaround
A 0, 10, 15 9 16
B 3, 13 10 14
C 6 6 7
D 7, 14 11 15
You may use the algorithm listed in Figure 2 below as reference. (There might be other
possible solution.)
Screen-capture the output after you run/execute the programs from Question 1 and
Question 2 and submit with your source code.
4
CSC3300 Sem. 1 2023/2024
You may improve further the programs from this lab assignment by varying the problems,
attributes and output as follows:
• add priority value for each of the processes involved and perform scheduling based
on priority
• create a simulation program which able to generate processes (generate random
arrival times and burst times to represent a process) and perform several repetitions
of scheduling, then calculate the related statistics (avg waiting time, average
turnaround time, etc).
You may also implement other general scheduling algorithms such as Shortest-Job-First
algorithm (non-preemptive and preemptive), scheduling with multiple queues and aging,
etc. which are not covered in this assignment.