Question: Q1. Write a program in C++ to implement the Priority based Scheduling algorithm (Non-preemptive). Assuming arrival time for all processes is zero, the program
Q1. Write a program in C++ to implement the Priority based Scheduling algorithm (Non-preemptive). Assuming arrival time for all processes is zero, the program should ask the user to input the following (ignore the explanation in brackets). 1. Number of processes (not more than 10 processes) 2. The CPU time required by each process (CPU Burst Time) 3. The priority of each process (the integer values between 1 and 10, inclusive). The lower the value, the higher the priority. In case of equal priorities (conflict resolution), always give preference to the lowest indexed process. The program should then calculate the following: 1. Waiting time for each process 2. Average waiting time 3. Turnaround time for each process 4. Average turnaround time Note: 1. You are NOT allowed to use any readymade library constructs (linked lists, queues, etc.) or C++ Standard Template Library (STL) functions. Marks shall be deducted for violation. 2. Your program output format must match the sample input/output given on the next page. Sample input/output: Enter Total Number of Process:4 Enter Burst Time and Priority P[1] Burst Time: 14 Priority: 5 P[2] Burst Time:22 Priority:1 P[3] Burst Time: 17 Priority:3 P[4] Burst Time:5 Priority:2 Process P[2] P[4] P[3] P[1] Burst Time 22 5 17 14 Average Waiting Time=23 Average Turnaround Time=37 Waiting Time 0 22 27 44 Turnaround Time 22 27 44 58
Step by Step Solution
There are 3 Steps involved in it
Below is an example of a simple C program implementing the Priority based Scheduling algorithm Nonpreemptive based on your requirements include using ... View full answer
Get step-by-step solutions from verified subject matter experts
