Starting from:

$30

UCS1411-Lab 4 Implementation of CPU Scheduling Policies: Priority Solved

Develop a menu driven C program to implement the CPU Scheduling Algorithms 

Priority (Non-Preemptive and Preemptive) and Round Robin

Sample Learning Outcome:

1.     Learn about the CPU Scheduling algorithms – Priority and RR.

2.     Implement the sorting algorithms necessary for scheduling and analyzing the performance using waiting time, turn around time and response time.

3.     Learn to draw the Gantt Chart Best Practices:

1.  Algorithm design

2.  Naming convention – for file names, variables

3.  Comment usage at proper places

4.  Prompt messages during reading input and displaying output

5.  Error handling mechanisms for failures in system calls

6.  Incremental program development

7.  Modularity

8.  All possible test cases in output

 

Algorithm: 

1.  Read the following 

a.  Number of processes 

b.  Process IDs 

c.  Arrival time for each process 

d.  Burst Time for each process 

2.  Design a menu with Priority and Round Robin options 

3.  Upon selection of menu option apply the corresponding algorithm. 

4.  Compute the Turnaround Time, Average waiting Time for each of the algorithm. 

5.  Tabularize the results. 

6.  Display the Gantt Chart.

Sample Input & Output:

CPU SCHEDULING ALGORITHMS 
1.  ROUND ROBIN 

2.  PRIORITY

3.  EXIT 

Enter your option: 1 

ROUND ROBIN CPU SCHEDULER 

Number of Processes: 5 

Process ID:  P1 

Arrival Time: 0 

Burst Time:  4  









Process ID:  P5 

Arrival Time: 6 

Burst Time:  3 

Output: 

 



         Process ID   Arrival Time  Burst Time   Turnaround Time Waiting Time  Response time



              P1                     0                     4                     ***                   ***                ***

               ***                    ***                   ***                 ***                  ***                ***

            ***                   

***        



                                                                         Average          ***       ***                ***



 

Want to Continue ( Y/N): Y 

CPU SCHEDULING ALGORITHMS 
1.  ROUND ROBIN 

2.  PRIORITY 

3.  EXIT 

Enter your option: 2

 PRIORITY CPU SCHEDULER 

a.  Non preemptive PRIORITY 

b.  Pre emptive PRIORITY 

Enter your option: a 

Number of Processes: 5   

Process ID:  P1 

Arrival Time: 0 

Burst Time:  4  









Process ID:  P5 

Arrival Time: 6 

Burst Time:  3 

Output: 

 

Process ID  Arrival Time   Burst Time  Turnaround Time Waiting Time Response Time



                               ***    ***                 ***                    ***                  ***                  ***

                              ***       ***               ***                     ***                 ***                  ***

                        *** 

***        

                                                                        Average              *** ***                    ***

More products