investigate the pre-emptive Round Robin scheduling algorithm by implementing the algorithm and simulating it by developing a test harness according to the following requirements:

1.Each process is represented by the following simplified PCB (process control block):

  • Process identifierpid_t of values 1 .. any positive integer value.
  • Burst time1 .. MAX_BURST (ms). Default MAX_BURST = 300.
  • Arrival time0 .. MAX_AT. Default MAX_AT = 80.
  • Start timeNonnegative integer value. As a CPU-bound process can be pre-empted and restart multiple times until its job is completed, this attribute is multivalued.
  • Service timeDuration the process ran in the run queue until it was pre-empted. Multivalued for the reason above.
  • Finish timeMultivalued for the same reason.
  • PreemptionA collection of time ticks when the process was preempted. Multivalued.
  • Turnaround timeSingle value.
  • Total waiting timeSingle value.

Notice that at any point in time, (Burst time sum of service time) will be the remaining time the process needs to be scheduled in the run queue.

The PCB must be implemented as a structure called "pcb".

2.Multivalued attributes must be stored in a linked list structure. You are welcome to implement your own singly linked list, or use the circular doubly-linked list implemented in the Linux kernel for EXTRA 5 POINTS.

3.The user specifies MAX_BURST and MAX_AT as command-line arguments, e.g.,

$ rr -b 300 -a 80

where rr is your program. If the user does not provide these options as command-line arguments, your program read them from an external text file called "pcb.conf". Its content can be as simple as:

MAX_BURST = 300
MAX_AT = 80

where spaces around the equal sign should be insignificant.

4.The Process identifier, Burst time and Arrival time of each PCB is initialized from an external data file of the following format:

# PID BURST_TIME ARRIVAL_TIME
1 20 2
2 8 0
. . .

If the user does not provide a data file name, each PCB is initialized randomly. (Use srand(time(NULL)) to generate random values. You need to further limit the range of the randomly generated values.) In this case, the user should provide the number of processes as a command-line argument, e.g.

$ rr -p 20

If the user does not specify quantum, your program reads the default value from "pcb.conf".

5.Your program will generate an array which is large enough to store NUM_PROC PCB structures or the processes specified in the external data file.

6.The user specifies the time quantum as a command-line argument, e.g.,

$ rr -q 5

If the user does not specify quantum, your program reads the default value from "pcb.conf".

7.Implement your program in ANSI C. Ensure that your program is error-free and warning-free. A solution with compilation errors will get 10% of the full points at best.

8.Your program should implement a UNIX-like "--help" option as found in most UNIX commands, e.g.,

$ rr --help Usage: rr [options] Options: -a Maximum arrival time -b Maximum burst time . . .

Your program will be tested and credited using these help options only.

9.The program then runs and displays the quantum, a complete scheduling details including every attribute value of each PCB, average waiting time and average turn-around time.

10.The user must be able to specify whether the scheduling details are displayed in the pid order or in the order of execution. HINT: You may want to keep the execution order in a linked list.

$ rr -i
or
$ rr -e

Test your program extensively using different test cases. Submit source files, makefile, and test output files.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.