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
-
Untitled
3 min ago
-
Untitled
19 min ago
-
awsgfqe3t32t
48 min ago
-
✅✅ Spy cam, incest, banned videos ✅✅
1 hour ago
-
asdfnm adsdfgdasfdf
2 hours ago
-
sdddsdssddsdsf
3 hours ago
-
sdfgasdf sadfsadf
3 hours ago
-
asdnb nadsdfdasd
3 hours ago
-
Untitled
3 hours ago
-
BUY SUPER HIGH QUALITY COUNTERFEIT MONEY ,CLONE CREDIT CARDS ONLINE GBP, DOLLAR, EUROS BUY COUNTERFE
CSS | 3 hours ago