Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simulates an operating system scheduler and to compare each scheduler performance in a report. You can use Java or C++ but please do not use

Simulates an operating system scheduler and to compare each scheduler performance in a report.

You can use Java or C++ but please do not use package names or namespaces. Do not use 3rd-party libraries.

The program implements the following CPU scheduling algorithms:

First-Come-First-Serve (FCFS)

Shortest-Job-First (SJF)

Round-Robin with time quantum = 20

Round-Robin with time quantum = 40

Lottery with time quantum = 40

Your program will read the processes, their burst times and their priority from test data file. The process files are located on Blackboard with this document. The input file will be in the following format :

pid

burst_time

priority

Where the first line is id of the process, the second is the burst time that the process requires, the third line will be the priority of the process. The priority is only to be used in the lottery scheduler.

**Note: the scheduler takes 3 units of CPU time to switch a process (context-switching cost). You will need to add this to the runtimes that you track. Assume that, if the same process continues to run after a context switch, there will still be a context-switching cost.

Note: You can make the following assumptions:

Processes arrive in the order in which are read from the file.

All processes are in the queue at CPU time = 0

Requirements output data:

Output the details of each schedulers execution of each test file to a csv formatted file. You need to show The following columns: CpuTime, PID, StartingBurstTime, EndingBurstTime, CompletionTime The completion time should be zero unless the process has completed (EndingBustTime = 0). Name each output file: scheduler_name-testfile_name.csv Requirements for each scheduler:

When all of the processes of a particular file complete, calculate and output the average turnaround times (completion times) of all processes for each scheduling algorithm.

Your output must be as a CSV file.

testdata1:

1 624 2 2 488 15 3 231 16 4 337 7 5 222 3 6 130 17 7 317 11 8 439 8 9 942 10

testdata2:

1 596 16 2 222 5 3 123 3 4 209 3 5 609 8 6 814 11 7 204 5 8 308 10 9 333 1

testdata3:

1

585

5

2

972

17

3

992

5

4

633

13

5

827

10

6

306

7

7

422

16

8

615

18

9

695

2

10

702

5

11

942

15

12

969

7

13

955

5

14

764

10

15

589

11

16

103

5

17

364

19

18

346

6

19

271

9

testdata4:

1

931

12

2

991

18

3

683

4 4

4 04

4

5

929

2

6

760

6

7

772

2

8 210

13

9

845

7

10

573

14

11

225

17

12

874

7

13

382

4

14

524

2

15

198

19

16

867

14

17

897

1

18

30

4

19

94

1

20

423

17

21

336

16

22

799

16

23

596

12

24

680

13

25

71 1 7

26

754

3

27

392

13

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

More Books

Students also viewed these Databases questions