Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Round Robin Process Scheduling It takes 20 time quanta to set-up/create a task p

ID: 651825 • Letter: R

Question

Round Robin Process Scheduling

It takes 20 time quanta to set-up/create a task process.

It takes 20 time quanta to tear-down/end a task process.

It takes 500 time quanta to read in from disk a text file.

It takes 15 time quanta to context switch.

It the scheduler takes 30 time quanta at the beginning of each cycle for its own use. In addition, the scheduler also incurs aentry context switch, the same as any other process.

A high priority user task process is given 90 time quanta of ALU time.

A standard user task priority process is given 60 time quanta of ALU time.

When a user task process finishes, it issues a kernel call requesting a tear-down/end process, then it yields its' remaining time quanta and is immediately followed thecontext switch for the teardown process.

Assume reporters and time quanta counters and their related output report(s) are free, they consume no time quanta.

Contents for the user task process data file (format as you wish):

User Task A requires 1250 time quanta and has a standard priority

User Task B requires 970 time quanta and has a high priority

User Task C requires 75 time quanta and has a standard priority

User Task D requires 2000 time quanta and has a high priority16

You are to do the following:

Create a data file

Create code for your model scheduler

Execute: Have your RR scheduler read the data in and process it

Start up: The quanta counter/timer is started, the file is read, the first context switch hit is taken, the RR scheduler is loaded/started, the second context switch hit is taken and the first cycle begins.

When all cycles have been completed have your program reporter output the starting time, waiting and finishing time of each task process.

When all cycles have been completed have your program reporter output: What was the total efficiency of the system (show the details of the calculation)?: Ratio of useful work process quanta / The total elapsed time quanta.

Write a summary (2 page max) summary including: The name of each file and its' purpose, the results, brief summary of your approach (which language used, major assumptions, etc.), brief statement about which part of the scheduler was the hardest for you to write and why

Create an appendix with relevant screen captures

Explanation / Answer

//displays total waiting time and average waiting time of process

#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
void main()
{
char process[10][5];
int processt[10],endt[10],waitt[10],timer=3,count,rt,i,j,totwt=0,t,n=5,found=0,m;
float avgwt;
clrscr();
for(i=0;i<n;i++)
{
printf("enter the process name : ");
scanf("%s",&process[i]);
printf("enter the processing time : ");
scanf("%d",&processt[i]);
}
m=n;
waitt[0]=0;
i=0;
do
{
if(processt[i]>timer)
{
rt=processt[i]-timer;
strcpy(process[n],process[i]);
processt[n]=rt;
endt[i]=timer;
n++;
}
else
{
endt[i]=processt[i];
}
i++;
waitt[i]=waitt[i-1]+endt[i-1];
}while(i<n);

count=0;
for(i=0;i<m;i++)
{
for(j=i+1;j<=n;j++)
{
if(strcmp(process[i],process[j])==0)
{
count++;
found=j;
}
}
if(found!=0)
{
waitt[i]=waitt[found]-(count*timer);
count=0;
found=0;
}
}
for(i=0;i<m;i++)
{
totwt+=waitt[i];
}
avgwt=(float)totwt/m;
for(i=0;i<m;i++)
{
printf(" %s %d %d",p[i],pt[i],waitt[i]);
}
printf(" total waiting time %d ",totwt);
printf("total average waiting time %f",avgwt);
}