Category: operating system

first fit program in java

first fit program in java

import java.io.*; class firstfit { public static void main(String args[])throws IOException { int n,i,it; DataInputStream in=new DataInputStream(System.in); System.out.println(“Enter Number of Holes”); n=Integer.parseInt(in.readLine()); int sp[]=new int[n]; for(i=0;i<n;i++) { System.out.println(“Enter size of Hole”+(i+1)); sp[i]=Integer.parseInt(in.readLine()); } System.out.println(“Before...

best fit program in java

best fit program in java

import java.io.*; class best { public static void main(String args[])throws IOException { int flag[]=new int[10]; int sm[]=new int[10]; int i,sr,nm; int sp,loc=0; int cntrl=1000; DataInputStream in=new DataInputStream(System.in); System.out.println(“Enter the no of memory segments\n”); nm=Integer.parseInt(in.readLine());...

dining philosophers problem in java

Dining Philosophers Problem: Consider five philosophers who spend time in thinking and eating.the philosophers share a common circular table surrounded by five chairs,each belonging to one philosopher.In the center of the table is a...

next fit program in java

next fit program in java

import java.io.*; class NFit { public static void main(String args[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int nh,np; System.out.println(“Enter the number of Holes:”); nh=Integer.parseInt(br.readLine()); System.out.println(“Enter the number of Processes:”); np=Integer.parseInt(br.readLine()); int P[]=new int[np];...