Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Urgent!! Need answers in less than 24 hours Purpose: The main goal of this assignment is to gain hands-on experience with the CPU scheduling algorithms

Urgent!! Need answers in less than 24 hours

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.

image text in transcribed

This is the output, please code in C

Sample Output: Test case \#1: p1 024 p2 23 p3 634 Number of Processes: 3, Quantum: 4 Process Scheduling Started: CPU Time 0: [pl Arrived] pl [1/24] CPU Time 1: pl [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: pl [5/24] CPU Time 8: pl [6/24] CPU Time 9: pl [7/24] CPU Time 10: pl [8/24] CPU Time 11:p3 [1/3] CPU Time 12: p3 [2/3] Process p3 completed with Turn Around Time: 8 , Waiting Time: 5 CPU Time 14: p1 [9/24] CPU Time 15: pl [10/24] CPU Time 16: pl [11/24] CPU Time 17: p1 [12/24] CPU Time 18: p1 [13/24] CPU Time 19: pl [14/24] CPU Time 20: p1 [15/24] CPU Time 21: p1 [16/24] CPU Time 22: pl [17/24] CPU Time 23: pl [18/24] CPU Time 24: pl [19/24] CPU Time 25: pl [20/24] CPU Time 26: pl [21/24] CPU Time 27: p1 [22/24] Sample Output: Test case \#1: p1 024 p2 23 p3 634 Number of Processes: 3, Quantum: 4 Process Scheduling Started: CPU Time 0: [pl Arrived] pl [1/24] CPU Time 1: pl [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: pl [5/24] CPU Time 8: pl [6/24] CPU Time 9: pl [7/24] CPU Time 10: pl [8/24] CPU Time 11:p3 [1/3] CPU Time 12: p3 [2/3] Process p3 completed with Turn Around Time: 8 , Waiting Time: 5 CPU Time 14: p1 [9/24] CPU Time 15: pl [10/24] CPU Time 16: pl [11/24] CPU Time 17: p1 [12/24] CPU Time 18: p1 [13/24] CPU Time 19: pl [14/24] CPU Time 20: p1 [15/24] CPU Time 21: p1 [16/24] CPU Time 22: pl [17/24] CPU Time 23: pl [18/24] CPU Time 24: pl [19/24] CPU Time 25: pl [20/24] CPU Time 26: pl [21/24] CPU Time 27: p1 [22/24]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Internal Auditors For Stock Brokers

Authors: National Institute Of Securities Markets (NISM)

1st Edition

9350717581, 978-9350717585

More Books

Students also viewed these Accounting questions