Priority
Never
#include<stdio.h> struct priority_scheduling { char process; int bt,wt,tat,priority; }; int main() { int no_of_process; int total =0; struct priority_scheduling temp_process; int ASCII_number = 65; int position; float average_waiting_time; float average_turnaround_time; printf("Enter the number of processes:"); scanf("%d",&no_of_process); struct priority_scheduling process[no_of_process]; printf("Please enter the bt and priority of each process\n"); for(int i=0;i<no_of_process;i++) { process[i].process = (char) ASCII_number; printf("Enter the details of the process %c \n",process[i].process); printf("enter the bt :"); scanf("%d",&process[i].bt); printf("enter the priority :"); scanf("%d",&process[i].priority); ASCII_number; } for(int i=0;i<no_of_process;i++) { position = i; for(int j=i+1;j<no_of_process;j++) { if(process[j].priority > process[position].priority) { position = j; } } temp_process = process[i]; process[i] = process[position]; process[position] = temp_process; } process[0].wt = 0; for(int i=0;i<no_of_process;i++) { process[i].wt = 0; for(int j=0;j<i;j++) { process[i].wt += process[j].bt; } total += process[i].wt; } average_waiting_time = (float) total / (float) no_of_process; total =0; printf("\n process name \t BT \t WT \t TAT \n"); for(int i=0;i<no_of_process;i++) { process[i].tat = process[i].bt = process[i].wt; total = process[i].tat; printf("\t %c \t %d \t %d \t %d \n",process[i].process,process[i].bt,process[i].wt,process[i].tat); } average_turnaround_time = (float)total/ (float) no_of_process; printf("Average WT %f\n",average_waiting_time); printf("Average TAT : %f",average_turnaround_time ); return 0; }
Raw Text
-
Adult Telegram Channels
23 min ago
-
SMA BERHIJAB CANTIK T
26 min ago
-
sewagwq3eyhg2
29 min ago
-
zxsv
2 hours ago
-
Untitled
3 hours ago
-
Untitled
4 hours ago
-
15 CXPX VIDS THE BEST OF THE BEST + MAY 4 COLLECTION
5 hours ago
-
fsdgggg
5 hours ago
-
đ đ♥ď¸CP VIDEO SLEEPING LITTLE GIRL♥ď¸đâ¨
5 hours ago
-
PEDOMOM Special 7gb
6 hours ago