write a program called sched which simulates first come first served fcfs and preemp 5343932

In this project, you will write a program called sched, which simulates First Come First Served (FCFS) and

Preemptive Priority (PP) CPU scheduling algorithms. The program will be invoked as follows:

./sched [limit]

• is the name of a text file including the information about the processes to be scheduled and

it will have the following format:

– is a positive integer number representing the process id of the process

– is a non-negative integer number given in milliseconds representing the arrival

time of the process

– is a positive integer number indicating the amount of CPU-time that the process


– is a non-negative integer number indicating the priority of the process. Lower number

indicates a higher priority.

For example, the following can be a sample input file:

1 0 4 70

2 4 19 120

3 9 5 100

4 14 3 0

5 16 2 3

6 23 2 20

Each line of the input file represents a different process, starts without any space, ends with a newline, and

there is a single space (‘ ‘) in between each field in a line. Note that the example input file provided above is

just for illustration purposes. Your program will be tested using input files containing much larger number of

processes. Here is more information about the content of the input file:

– All three fields are guaranteed to appear in the input file.

– Processes are sorted by their arrival times in increasing order.

– Processes have unique arrival times.

– Arrival time of the first process is guaranteed to be 0.


"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now