Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Programming Assignment Please note that variations of this problem have been posted online before. None of them are correct. That is why I’m getting help here. 1. Write a C/C++ program that c

Programming Assignment

Please note that variations of this problem have been posted online before. None of them are correct. That is why I’m getting help here.

1.  Write a C/C++ program that creates a table consisting of 2,000 randomly generated 3- tuple entries where each entry consists of processID, arrivalTime, and burstTime. The processID should be a “unique” 4-digit positive integer (e.g., 3862, 8871, 9239, etc.). The arrivalTime should be an integer randomly picked from a range of values between 1 and 1,250. Note that the arrival times of two processes can be the same. The burstTime is an integer randomly picked from a range of values between 1 and 750. Your program should print out the table. An example output of your program would look something like this:

processID    arrivalTime   burstTime

8391             1                        83

2283             4                        20

1024             3                        30

2.  Based on the code for Problem 1, write a C/C++ program that simulates execution of the first come first served (FCFS) algorithm and calculates the average waiting time. If the arrival times are the same use the unique processID to break the tie by scheduling a process with a smaller ID first. Run this program 2,000 times. Note that each time you run this program, a new table should be generated, and thus, the average waiting time would be different. An example output would look like this:

Average waiting time for FIFO

12.2

13.3

15.2

3.  Based the code for Problems 1 and 2, write a C/C++ program that simulates execution of the preemptive shortest job first (SJF) algorithm. If the arrival times are the same use the unique processID to break the tie by scheduling a process with a smaller ID first. If the

burst time is the same, use the FCFS algorithm to break the tie. Run this program 2,000 times. Note that each time you run this program, a new table should be generated, and thus, the average waiting time would be different. An example output would look like this:

Average waiting time for Preemptive SFJ 

11.1

9.3

8.2

4.  In this problem, you will compare the performance of the two algorithms in terms of the average waiting time. Therefore, your program should calculate the average waiting times for both algorithms. For each table generated in Problem 1, run both algorithms and compute the average waiting time for each algorithm. Repeat this 1,000 times. An example output would look like this.

FIFO     SJF

10.1     9.1

19.1     12.3

20.4     15.2

...

5. Write a report that analyzes and compares the performance of the two algorithms. In your analysis, include a graph that visually represents the performance difference. For example,

WILL ATTACH GRAPH

Also write a paragraph that analyzes the performance difference. For example, “the mean average waiting time of the preemptive SFJ was … and the standard deviation was … The preemptive SJF performs better than FCFS by X% in terms of the average waiting time. The reason is that …”

Files to submit:

A SEPARATE .C FILE FOR EACH QUESTION

A SEPARATE .DOCX FILE FOR Q5

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question