Sale!

CS 3305A: Operating Systems Assignment 4

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

Purpose:
The main goal of this assignment is to gain hands-on experience with the CPU scheduling
algorithms using C language in Linux environment.
Performance Evaluation of CPU Scheduling Algorithms
You will develop CPU Scheduling Algorithms using the C programming language in Linux. A
sample input file is provided with the assignment, which must be used to develop the Round Robin
(RR) CPU Scheduling Algorithm.
Format of the Input File:
You must use the same input file name (i.e., rr_input.txt) in your code. The input file contains
several test cases for this assignment. Every line of the input file represents one individual test case.
For example, if there are four lines inside the input file, it means your program must execute four
different test cases. Every input line consists of several processes and their corresponding
information, such as process name, arrival time (art_1), burst time (brt_1), and quantum time
(q_time), and the following format is used:
Input format: process_1 art_1 brt_1 process_2 art_2 brt_2 process_n art_n brt_n q_time
Input example: p1 0 23 p2 1 3 p3 2 3 4
In the example input given above, there are three processes such as p1, p2, and p3. The arrival and
burst time of process p1 is 0 and 23, process p2 is 1 and 3, and process p3 is 2 and 3. The quantum
time is 4. The individual entries in the input line are separated by space.
What you need to do:
You must supply given rr_input.txt file to your program. At first, parse the input file line-wise,
meaning every line in the input file is a test case. For every test case in the input file, apply Round
Robin Scheduling and output the process schedule details. The output of your program for the
sample test cases in the given input file must follow the format of the sample output given below.
You must consider two decimal points for printing the fractional number; marks will be deducted
otherwise.
Sample Content in rr_input.txt :
p1 0 24 p2 2 3 p3 6 3 4
p1 1 10 p2 2 5 p3 2 8 p4 6 9 2
Sample Output:
Test case #1: p1 0 24 p2 2 3 p3 6 3 4
Number of Processes: 3, Quantum: 4
Process Scheduling Started:
2
CPU Time 0: [p1 Arrived] p1 [1/24]
CPU Time 1: p1 [2/24]
CPU Time 2: [p2 Arrived] p1 [3/24]
CPU Time 3: p1 [4/24]
CPU Time 4: p2 [1/3]
CPU Time 5: p2 [2/3]
CPU Time 6: [p3 Arrived] p2 [3/3]
Process p2 completed with Turn Around Time: 5, Waiting Time: 2
CPU Time 7: p1 [5/24]
CPU Time 8: p1 [6/24]
CPU Time 9: p1 [7/24]
CPU Time 10: p1 [8/24]
CPU Time 11: p3 [1/3]
CPU Time 12: p3 [2/3]
CPU Time 13: p3 [3/3]
Process p3 completed with Turn Around Time: 8, Waiting Time: 5
CPU Time 14: p1 [9/24]
CPU Time 15: p1 [10/24]
CPU Time 16: p1 [11/24]
CPU Time 17: p1 [12/24]
CPU Time 18: p1 [13/24]
CPU Time 19: p1 [14/24]
CPU Time 20: p1 [15/24]
CPU Time 21: p1 [16/24]
CPU Time 22: p1 [17/24]
CPU Time 23: p1 [18/24]
CPU Time 24: p1 [19/24]
CPU Time 25: p1 [20/24]
CPU Time 26: p1 [21/24]
CPU Time 27: p1 [22/24]
CPU Time 28: p1 [23/24]
CPU Time 29: p1 [24/24]
Process p1 completed with Turn Around Time: 30, Waiting Time: 6
Process scheduling completed with Avg Turn Around Time: 14.33, Avg Waiting Time:4.33
Test case #2: p1 1 10 p2 2 5 p3 2 8 p4 6 9 2
Number of Processes: 4, Quantum: 2
Process Scheduling Started:
CPU Time 0: None
CPU Time 1: [p1 Arrived] p1 [1/10]
CPU Time 2: [p2 Arrived] [p3 Arrived] p1 [2/10]
CPU Time 3: p2 [1/5]
CPU Time 4: p2 [2/5]
CPU Time 5: p3 [1/8]
CPU Time 6: [p4 Arrived] p3 [2/8]
CPU Time 7: p1 [3/10]
CPU Time 8: p1 [4/10]
CPU Time 9: p2 [3/5]
3
CPU Time 10: p2 [4/5]
CPU Time 11: p4 [1/9]
CPU Time 12: p4 [2/9]
CPU Time 13: p3 [3/8]
CPU Time 14: p3 [4/8]
CPU Time 15: p1 [5/10]
CPU Time 16: p1 [6/10]
CPU Time 17: p2 [5/5]
Process p2 completed with Turn Around Time: 16, Waiting Time: 11
CPU Time 18: p4 [3/9]
CPU Time 19: p4 [4/9]
CPU Time 20: p3 [5/8]
CPU Time 21: p3 [6/8]
CPU Time 22: p1 [7/10]
CPU Time 23: p1 [8/10]
CPU Time 24: p4 [5/9]
CPU Time 25: p4 [6/9]
CPU Time 26: p3 [7/8]
CPU Time 27: p3 [8/8]
Process p3 completed with Turn Around Time: 26, Waiting Time: 18
CPU Time 28: p1 [9/10]
CPU Time 29: p1 [10/10]
Process p1 completed with Turn Around Time: 29, Waiting Time: 19
CPU Time 30: p4 [7/9]
CPU Time 31: p4 [8/9]
CPU Time 32: p4 [9/9]
Process p4 completed with Turn Around Time: 27, Waiting Time: 18
Process scheduling completed with Avg Turn Around Time: 24.50, Avg Waiting Time:16.50
Mark Distribution
This section describes a tentative allocation of points assigned for the desired features.
A. Supplying rr_input.txt to the program: 5 points
B. Parsing the input file correctly: 10 points
C. Printing the number of process and quantum for every test case: 5 points
D. Detecting process arrival correctly: 15 points
E. Detecting process completion correctly: 15 points
F. Calculating Turn Around Time and Waiting Time for every process: 15 points
G. Maintaining Round Robin sequence and quantum: 25 points
H. Calculating Avg Turn Around Time and Avg Waiting Time for every test case: 10 points
Computing Platform for Assignments
You are responsible for ensuring that your program compiles and runs without error on the
computing platform mentioned below. Marks will be deducted if your program fails to compile
or runs into errors on the specified computing platform (see below).
4
• Students have virtual access to the MC 244 lab, which contains 30 Fedora 28 systems. Linux
machines available to you are linux01.gaul.csd.uwo.ca through linux30.gaul.csd.uwo.ca.
• It is your responsibility to ensure that your code compiles and runs on the above systems. You
can SSH into MC 244 machines (please see the Assignment 1 file transfer tutorial).
• If you are off-campus, you have to SSH to compute.gaul.csd.uwo.ca first (this server is also
known as sylvia.gaul.csd.uwo.ca, in honor of Dr. Sylvia Osborn), and then to one of the MC
244 systems (linux01.gaul.csd.uwo.ca through linux30.gaul.csd.uwo.ca) (please see the
Assignment 1 file transfer tutorial).
• https://wiki.sci.uwo.ca/sts/computer-science/gaul
Assignment Submission
You need to submit only one C file. The name of your submitted C file must be “assignment4.c”.
Marks will be deducted if your submitted C file name is different. You must submit your
assignment through OWL. Be sure to test your code on one of MC 244 systems (see “Computing
Platform for Assignments” section above). Marks will be deducted if your program fails to
compile or runs into errors on the computing platform mentioned above.
Assignment 4 FAQ will be made available on OWL as needed. Also, consult TAs and the Instructor
for any questions you may have regarding this assignment.