Skip to main content

Posts

Showing posts with the label non-preemptive scheduling

Write the simulation program for non-preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and Turnaround time for each process and average time.

Write the simulation program for non-preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and Turnaround time for each process and average time. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int f,max[10][10]={0,0},al[10][10]={0,0},need[10][10]={0,0},av[10]={0},i,j,m,n,cp[10]={0},sf[10]; printf("\nEnter the number of processes:"); scanf("%d",&m); printf("\nEnter the number of resources:"); scanf("%d",&n); printf("\nEnter Max matrix:"); for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&max[i][j]); } } printf("Enter the allocation matrix:"); for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&al[i][j]); } } printf("Enter available matrix:"); for(i=0;i<n;i++){ scanf("%d...