Question: Write a C language program to implement aCPU priority scheduler. Description We are given with the n number of processes i.e. P1, P2, P3,.......,Pn with

Write a C language program to implement aCPU priority scheduler.

Description

We are given with the n number of processes i.e. P1, P2, P3,.......,Pn with their corresponding burst times and priorities associated with each process . The task is to find the average waiting time ,average turnaround time and the sequence of process execution using priority CPU scheduling algorithm.

In priority scheduling algorithm each process has a priorityassociated with it and as each process hits the queue, it is stored in based onits priority so that process with higher priority are dealt with first.In this case, the priority follows: 0>1>2>3>4, which means that 0 has a higher priority than 1, 2, 3 and 4.

Your program must read a list of tasks from the following tableand schedule them based priority scheduling algorithm. Each line in the task file describes a single task. Each processhas a name(ex. P1,P2 etc), a priority, and a CPU bursttime. Priority is represented by an integer number;CPU burst is also represented by an integer number, which indicates the CPU time required to finish the task.

Process Priority Burst Time
P1 2 6
P2 4 12
P3 0 3
P4 1 10

You must implement a linked list to hold the tasks in the memory after reading from the tableand to facilitate the scheduling from an in-memory list. You must write a scheduler program that will take the name of the task file as an argument, read the tasks from the table, add each task to the scheduler list. (linked list), and finally schedule the tasks using priority scheduling programs. Also, it will display the waiting time as well as the turnaround time as well.Your code will also calculate the average waiting time and the average turnaround time.

Your code will have the following sample output:

Write a C language program to implement aCPU priority scheduler. Description We

What is Waiting Time and Turnaround Time? Turnaround Time is the time interval between the submission of a process and its completion. Turnaround Time = completion of a process submission of a process Waiting Time is the difference between turnaround time and burst time Waiting Time = turnaround time burst time

Process P[3] P[4] P[1] P[2] Burst Time 3 10 6 12 Waiting Time 0 3 13 19 Turnaround Time 3 13 19 31 Average Waiting Time=8 Average Turnaround Time=16

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!