100% found this document useful (5 votes)
5K views2 pages

FCFS Disk Scheduling

DOWLOAD HERE: http://adf.ly/aJTy5 SCREENSHOT: http://adf.ly/aJU6s ====== copy in notepad. save as FCFS.java CSC110
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
100% found this document useful (5 votes)
5K views2 pages

FCFS Disk Scheduling

DOWLOAD HERE: http://adf.ly/aJTy5 SCREENSHOT: http://adf.ly/aJU6s ====== copy in notepad. save as FCFS.java CSC110
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 2

DISK SCHEDULING FCFS

import java.io.*; public class FCFS { public static void main(String[]args) throws IOException { BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); int a,c,x=2,y=3,thm=0,rw,r,t; int array[]=new int [30]; int anarray[]=new int [30]; System.out.print("\n\n Program Name: FCFS (Disk Scheduling)");

System.out.print("\n\nNumber of Process: "); a=Integer.parseInt(br.readLine()); System.out.print("Initial Head Movement: "); rw=Integer.parseInt(br.readLine()); System.out.print("\n"); for(c=0;c<a;c++) { t=c+1; System.out.print("Request Queue " +t+ ": "); array[c]=Integer.parseInt(br.readLine()); } for(c=0;c<a-1;c++) { anarray[c]=array[c]-array[c+1]; if (anarray[c]<0) { anarray[c]=anarray[c]*-1; } } for(c=0;c<a-1;c++) { thm=thm+anarray[c]; } r=array[0]-rw; if (r<0) { r=r*-1; } thm=thm+r; System.out.println("\nTotal Head Movement: "+thm); }

You might also like