Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is to simulate a few CPU scheduling policies discussed in the class. You will write a C/C++ program to implement a simulator with

image text in transcribedimage text in transcribed

This program is to simulate a few CPU scheduling policies discussed in the class. You will write a C/C++ program to implement a simulator with different scheduling algorithms. The simulator selects a task to run from ready queue based on the scheduling algorithm. Since the project intends to simulate a CPU scheduler, so it does not require any actual process creation or execution. When a task is scheduled, the simulator will simply print out what task is selected to run at a time. It outputs the way similar to Gantt chart style. The selected scheduling algorithms to implement in this program are 1) First Come First Serve (FCFS), 2) Round Robin (RR), and 3) Shortest Remaining Time First (SRTF) The task information will be read from an input file. The format is: pid arrival time burst time All of fields are integer type where pid is a unique numeric process ID arrival time is the time when the task arrives in the unit of milliseconds burst time the is the CPU time requested by a task, in the unit of mseconds The time unit for arrival time, burst time and interval is millisecond Command-line Usage and Examples Usage: proj2 input file [FCFS IRRISRTFl [time quantum] where input file is the file name with task information. FCFS, RR, and SRTF are names of scheduling algorithms. The time quantum only applies to RR. FCFS needed only for RR. (See following table for more examples) is nonpreemptive, while RR and SRTF are all preemptive. The last argument is Examples Description proj2 input.1 FCFSFCFS scheduling with the data file "nput" Simulate RR scheduling with time quantum 2 milli proj2 input.1 RR2 millisecond) with the data file "input. 1" Simulate SRTF scheduling with the data file "input.1" proj2 input.1 SRTF Requirements The program requires to simulate FCFS, RR, and SRTF scheduling for given tasks and to compute the average waiting time, response time, turnaround time and overall CPU usage Implement scheduling algorithm for FCFS, RR, and SRTF. The program should schedule tasks and print progress of task every unit time (millisecond) as shown in sample outputs Print statistical information. As soon as all tasks are completed, the program should compute and print average waiting time, average response time, average turnaround time and overall CPU usage Recommended Methodology 1. Implement one scheduling algorithm at each step 2. You can use circular linked list as a 3. You can use a data structure similar to PCB for each task, though it will be much simpler queue structure

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

Step: 3

blur-text-image

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions