Write a simulation program for disk scheduling using LOOK algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request in order in which it is served. Also display the total number of head movements.
Write a simulation program for disk scheduling using LOOK algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request in order in which it is served. Also display the total number of head movements. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int rst[50],cp,th,max,min,tt,n,i,temp; char d; printf("Enter how many blocks:"); scanf("%d",&n); printf("\nEnter current positon of head:"); scanf("%d",&cp); printf("\nEnter total number of tracks:"); scanf("%d",&tt); printf("\nEnter the direction:"); scanf(" %c",&d); printf("\nEnter Request string:"); for(i=0;i<n;i++){ scanf("%d",&rst[i]); } max=rst[0]; min=rst[0]; for(i=0;i<n;i++){ if(min>rst[i]){ min=rst[i]; } if(max<rst[i]){ m...