2 Replies - 1669 Views - Last Post: 01 March 2009 - 04:33 AM Rate Topic: ***** 1 Votes

#1 liz_cuesta  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 01-March 09

check my code for the java program fixed partition best-fit

Posted 01 March 2009 - 04:13 AM

import java.io.*;

public class fixedpartitionbestfit{
public static void main(String args[]) throws IOException{
BufferedReader br= new BufferedREader(new InputStreamReader(System.in));

int memory_block(0)= 99999;
int initial_memory_waste= 0;
int job_size= 0;
int subscript= 0;
int counter= 1;

System.out.print("Enter job_size:");
job_size= Integer.parseInt(br.readLine());

do{
if(job_size>memory_size(countter)){
counter= counter+1;
}else
memory_waste= memory_size(counter)-job_size;

if(initial_memory_waste>memory_waste){
subscript=counter;
initial_memory_waste=memory_waste;
counter=counter+1;

System.out.println("Memory_waste: "+memory_waste);
}

if(subscript= 0){
//put job in waiting queue

}else
//load job into memory_size(subscript)
//adjust free or busy memory lists

System.out.println("Subscript: "+subscript);

//fetch next job
//determine job's requested memory size

if(job_size>size of the largest partition){
//reject the job

System.out.println("Sorry! It is mismatch.");

memory_block(0)= 99999;

}else
subscript= 0;
counter= 1;
}while
(counter<=number of partitions in memory);

if(job_size>memory_partition_size(counter)){
counter=counter+1;

}else
if(memory_partition_size(counter)="free"){
//load job into memory_partition(counter)
//change memory_partition_status(counter) to "busy"

memory_block(0)= 99999;

}else
counter=counter+1;

System.out.println();
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: check my code for the java program fixed partition best-fit

#2 ayman_mastermind  Icon User is offline

  • human.setType("geek");
  • member icon

Reputation: 125
  • View blog
  • Posts: 1,860
  • Joined: 12-December 08

Re: check my code for the java program fixed partition best-fit

Posted 01 March 2009 - 04:22 AM

@liz_cuesta, please paste your code within code tags :code: and please specify any errors you are getting, and the specific part that you are facing difficulties or stuck in, in addition please tell us more what your program is supposed to do, thanks :)
Was This Post Helpful? 0
  • +
  • -

#3 liz_cuesta  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 01-March 09

Re: check my code for the java program fixed partition best-fit

Posted 01 March 2009 - 04:33 AM

View Postayman_mastermind, on 1 Mar, 2009 - 03:22 AM, said:

@liz_cuesta, please paste your code within code tags :code: and please specify any errors you are getting, and the specific part that you are facing difficulties or stuck in, in addition please tell us more what your program is supposed to do, thanks :)

when i try to compile my program, it says that process complete but it doesn't run. my program is about fixed partition, best-fit with deallocation wherein we need to display the table and how jobs are allocated in the free storage. the deadlin of my project will be tomorrow so i need to finish it now. thank you and God Bless. Thanks for reading my post and sparing your time.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1