1. FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are addressed in the order they arrive in the disk queue.
Programe:#include<stdio.h>
int main()
{
int head,seek=0,a[100],n,i,t=0;
printf("\nEnter how many queue you want: ");
scanf("%d",&n);
printf("Enter %d queue : \n",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nEnter head position: ");
scanf("%d",&head);
for(i=0;i<n;i++){
if(head>a[i])
{
t=head-a[i];
seek+=t;
head=a[i];
}
else if(head<a[i])
{
t=a[i]-head;
seek+=t;
head=a[i];
}
}
printf("\nSeek time is : %d\n",seek);
}
Like on Facebook click here
No comments:
Post a Comment