Answered step by step
Verified Expert Solution
Question
1 Approved Answer
General Instructions: - For this assignment, you must use C language syntax. Your code must compile using make without errors. You will be provided with
General Instructions: - For this assignment, you must use C language syntax. Your code must compile using make without errors. You will be provided with a Makefile and instructions on using it. - Test your program thoroughly with the GCC compiler in a Linux environment. - If your code does not compile, then you will score zero. Therefore, ensure you have removed all syntax errors from your code. Write a C program to find the average waiting time and turn-around time for the pre-defined set of tasks. The program will read a predefined set of tasks from file "sample_in_schedule.txt" and will schedule the tasks based on the Round Robin (RR) scheduling algorithm (non preemptive). The columns in "sample_in_schedule.txt" present the thread id, its arrival time, and its burst time, respectively, with the following example format: Thus, thread T2 has arrived at 0 milliseconds and a CPU burst of 3 milliseconds, and so forth. There are several different ways of developing this program (students are encouraged to explore). You can use array's to hold the information and compute the results. But the easiest approach may be to create a data structure using a struct that may appear as follows: struct threadinfof int p_id; int arr_time; int burst_time; int waiting_time; int turn_around_time; }; Once the arrival time and burst times of threads have been read from the file, the turn-around time and the threads' waiting time are calculated using the following formula. - Turn-around_time = thread_completion_time - thread_arrival_time - Waiting_time = Turn-around_time - Thread_burst_time The average waiting time for all threads is determined by summing all the threads' respective waiting times and dividing the sum by the total number of threads. Similarly, the average turn-around time is calculated summing the respective turn-around time of all the threads and divided the sum by the total number of threads. The expected output for this question is: Note: When submitting source code file for this question, name it like: - fcfs.c sample_in_schedule how_to_run_a03 \$ indicates a command line prompt. Do not copy it when running the following material. To rename makefile.mk to makefile, run: \$mv Makefile.a3 Makefile Place makefile is in the same folder where your all .c files (named as mentioned in the assignment description) are and to compile run: $ make sample_in_sudoku.txt is in the same folder): $ make runq1 For question 2, (make sure that your sample_in_schedule.txt is in the same folder) run: $ make runq2 To clean out the directory, you can use: \$make clean reference on make files
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started