Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ (Overview) Right a program that implements the round robin scheduling algorithm. You should have 2 classes, the Process Class and the RR_Scheduler Class

In C++

(Overview)

Right a program that implements the round robin scheduling algorithm. You should have 2 classes, the Process Class and the RR_Scheduler Class with each class having a header file. The main method should take 3 arguments, input file, block_duration(decimal integer), and time_slice(decimal integer) and check to see if the correct number of arguments is provided. It should then read in the input file and create a list of processes calling on the Process class for this and passing that to an object of type RR_Scheduler. It should then call the run method of RR_Scheduler to run the simulation.

Program Breakdown

Process (Class) w/ header file

  • Constructor has 4 arguments: name of process, arrival time, runtime, cpu burst(amount of time before the process blocks)
  • All member variables should be private
  • Add additional member variables and functions if needed

RR_Scheduler (Class) w/ header file

  • Constructor has 3 arguments: list of processes(created by the Process class), block_duration, time_slice
  • One public member function called, run, should have no parameters and have a void return type and return all output to console

Main Method

  • Check to see if correct number of commands is given
  • Read input file and create a list of processes using the Process class
  • Create object of type RR_Scheduler
  • Call RR_Schedulers, run, method

Output Format

  • First line should be block_duration and then time_slice with a space between
  • Then one line for each interval that system has process running or system is idle
  • That line should contain: current simulation time, process name or [IDLE], length of interval, and a status code for why interval ended: B for blocked, Q for time_slice ended, T for terminated, or I for idle interval
  • After all processes terminate output to a single line: simulation time last process terminated and string [END]
  • For each process print on a line: processs name, and the processs turnaround time
  • Finally print average turnaround time on a line itself, with the average having 2 digits to the right of the decimal

Sample input file

P1 0 100 25

P2 100 150 30

P3 200 25 5

Sample output to console w/ block_duration of 20 and time_slice of 20

30 20

0 P1 25 B

25 [IDLE] 30 I

55 P1 25 B

80 [IDLE] 20 I

100 P2 20 Q

120 P1 20 Q

140 P2 10 B

150 P1 5 B

155 [IDLE] 25 I

180 P2 20 Q

200 P1 20 Q

220 P3 5 B

225 P2 10 B

235 P1 5 T

240 [IDLE] 15 I

255 P3 5 B

260 [IDLE] 5 I

265 P2 30 B

295 P3 5 B

300 [IDLE] 25 I

325 P2 20 Q

345 P3 5 B

350 P2 10 B

360 [IDLE] 20 I

3 380 P3 5 T

385 [IDLE] 5 I

390 P2 30 T

420 [END]

P1 240

P3 185

P2 320

248.333

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

Students also viewed these Databases questions

Question

What is the purpose of scorecard cascading?

Answered: 1 week ago