Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Java

  1. #1

    Default Java


    First-Fit Algorithm

    1. Set Counter to 1
    2. Do While counter <=number of blocks in memory
    If job_size> memory_size(counter)
    Then counter = counter + 1
    else
    load job into memory_size(counter)
    adjuxt free/busy memory lists
    go to step 4
    3. Put job in waiting queue
    4. Go fetch next job


    kinsay ganahan mo lingaw2x ani mga guys!

  2. #2
    Operating System first fit algorithm simulation. For what?

  3. #3
    kang remeo lagi dong..maayo kaayo to java

  4. #4
    Quote Originally Posted by _i.t_ View Post
    kinsa hawd sa html ??hehe patudlo beh
    Please don't hi-jack this thread. The thread starter posted an algorithm for First-Fit simulation for JAVA and here you are talking about HTML.

    Move a long here, or search the forums. Nagkatag na nga topic somewhere in these forums.

  5. #5

    Default Fixed partitions

    ALGORITHM TO LOAD A JOB IN A FIXED PARTITION

    1. Determine job's requested memory size
    2. If job_size > size of largest partition
    Then reject the job
    print appropriate message to operator
    go to step 1 to handle next job in line
    else
    continue with step 3

    3. Set counter to 1

    4. Do while counter <=number of partitions in memory
    If job__size > memory_partition_size(counter)
    Then counter=counter+1
    Else
    If memory_partition_size(counter)="free"
    Then load job into memory_partition(counter)
    change memory_partition_status(counter) to "busy"
    go to step 1 to handle next job in line
    Else
    counter=counter+1

    5. No partition available at this time, put job in waiting queue

    6. Go to step 1 to handle next job in line






    I have my code pero dili mao.


    tabang ko nino!!!!

    this is my code

    import java.util.*;
    public class Partitions
    {
    static final int p1=100;
    static final int p2=250;
    static final int p3=300;
    static final int p4=400;

    static Scanner rey=new Scanner(System.in);
    public static void main(String[]args)
    {
    int choose;

    try
    {
    for (int a=0; a<1;a++)
    {
    System.out.println();
    System.out.print("Preparing..... \n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    try
    {
    for (int a=0; a<1;a++)
    {
    System.out.println();
    System.out.print("Loading..... \n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }

    System.out.print("________________________________ ___\n");
    System.out.println("| 1 ------------> Fixed Partition |");
    System.out.println("| 2 ------------> Best Fit |");
    System.out.println("| 3 ------------> First Fit |");
    System.out.println("|_____________________________ ____|\n");

    System.out.print("Enter your choice:\t");
    choose=rey.nextInt();
    System.out.println();

    switch (choose)
    {
    case 1:
    {

    System.out.print("\nYou choose Fixed Partitions\n");
    try
    {
    for (int a=0; a<2;a++)
    {
    System.out.println();
    System.out.print("Loading..... \n\n\n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    int j1,j2,j3,j4;

    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" \t FREE ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");


    System.out.print("Enter job requested:\t");
    j1=rey.nextInt();
    System.out.println();

    if(j1>p1)
    {
    System.out.println("The job size is greater than the partition\n\n");
    try
    {
    for(int a=0;a<2;a++)
    {
    System.out.println("Job Rejected....\n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" \t FREE ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");

    System.out.print("Enter next job requested:\t");
    j2=rey.nextInt();
    System.out.println();
    }
    else
    {
    int counter;
    int memory_partition_size;
    int number_of_partition_in_memory=4;
    do
    {
    counter=1;
    //System.out.print("Set counter to:\t"+ counter);
    //System.out.println("\n\nThe number of partition in memory is:\t"+number_of_partition_in_memory);


    memory_partition_size=p1;
    }
    while(counter<=number_of_partition_in_memory);
    {
    if(j1>memory_partition_size)
    {
    counter=counter+1;
    }
    else
    {
    if(j1<=memory_partition_size)
    {
    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" J1("+j1+") BUSY ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");
    }
    else
    {
    counter=counter+1;
    }
    }
    }

    }

    break;
    }
    default:
    {
    System.out.print("Invalid!!!");
    }
    }
    }
    }

  6. #6
    Quote Originally Posted by neigyl_noval View Post
    Operating System first fit algorithm simulation. For what?

    Java amo gamit ani

  7. #7
    Quote Originally Posted by reyarita View Post
    Java amo gamit ani
    Unsa diay sayop ato?

  8. #8
    Quote Originally Posted by reyarita View Post
    ALGORITHM TO LOAD A JOB IN A FIXED PARTITION

    1. Determine job's requested memory size
    2. If job_size > size of largest partition
    Then reject the job
    print appropriate message to operator
    go to step 1 to handle next job in line
    else
    continue with step 3

    3. Set counter to 1

    4. Do while counter <=number of partitions in memory
    If job__size > memory_partition_size(counter)
    Then counter=counter+1
    Else
    If memory_partition_size(counter)="free"
    Then load job into memory_partition(counter)
    change memory_partition_status(counter) to "busy"
    go to step 1 to handle next job in line
    Else
    counter=counter+1

    5. No partition available at this time, put job in waiting queue

    6. Go to step 1 to handle next job in line






    I have my code pero dili mao.


    tabang ko nino!!!!

    this is my code

    import java.util.*;
    public class Partitions
    {
    static final int p1=100;
    static final int p2=250;
    static final int p3=300;
    static final int p4=400;

    static Scanner rey=new Scanner(System.in);
    public static void main(String[]args)
    {
    int choose;

    try
    {
    for (int a=0; a<1;a++)
    {
    System.out.println();
    System.out.print("Preparing..... \n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    try
    {
    for (int a=0; a<1;a++)
    {
    System.out.println();
    System.out.print("Loading..... \n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }

    System.out.print("________________________________ ___\n");
    System.out.println("| 1 ------------> Fixed Partition |");
    System.out.println("| 2 ------------> Best Fit |");
    System.out.println("| 3 ------------> First Fit |");
    System.out.println("|_____________________________ ____|\n");

    System.out.print("Enter your choice:\t");
    choose=rey.nextInt();
    System.out.println();

    switch (choose)
    {
    case 1:
    {

    System.out.print("\nYou choose Fixed Partitions\n");
    try
    {
    for (int a=0; a<2;a++)
    {
    System.out.println();
    System.out.print("Loading..... \n\n\n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    int j1,j2,j3,j4;

    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" \t FREE ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");


    System.out.print("Enter job requested:\t");
    j1=rey.nextInt();
    System.out.println();

    if(j1>p1)
    {
    System.out.println("The job size is greater than the partition\n\n");
    try
    {
    for(int a=0;a<2;a++)
    {
    System.out.println("Job Rejected....\n");
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException e)
    {
    }
    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" \t FREE ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");

    System.out.print("Enter next job requested:\t");
    j2=rey.nextInt();
    System.out.println();
    }
    else
    {
    int counter;
    int memory_partition_size;
    int number_of_partition_in_memory=4;
    do
    {
    counter=1;
    //System.out.print("Set counter to:\t"+ counter);
    //System.out.println("\n\nThe number of partition in memory is:\t"+number_of_partition_in_memory);


    memory_partition_size=p1;
    }
    while(counter<=number_of_partition_in_memory);
    {
    if(j1>memory_partition_size)
    {
    counter=counter+1;
    }
    else
    {
    if(j1<=memory_partition_size)
    {
    System.out.print("PARTITION \t PARTITION SIZE \t ACCESS \t STATUS\n");
    System.out.println("1 "+p1 +" J1("+j1+") BUSY ");
    System.out.println("2 "+p2 +" \t FREE ");
    System.out.println("3 "+p3 +" \t FREE ");
    System.out.println("4 "+p4 +" \t FREE ");
    System.out.println("\n\n\n");
    }
    else
    {
    counter=counter+1;
    }
    }
    }

    }

    break;
    }
    default:
    {
    System.out.print("Invalid!!!");
    }
    }
    }
    }
    Unsa imong gi problemahan? Be specific and Use the code tag when posting a source code.

  9. #9
    Quote Originally Posted by giftlftr_23 View Post
    Unsa imong gi problemahan? Be specific and Use the code tag when posting a source code.

    ari ko maungot sa do while statement.
    kung dili sya pariho ang job size sa partition dapat mosud sya.
    if mo reject ang job size.


    i dont know kung sakto ba ni ang code nga ako gibuhat.
    nag kuan rako sa algorithm nya.

    ALGORITHM TO LOAD A JOB IN A FIXED PARTITION

    1. Determine job's requested memory size
    2. If job_size > size of largest partition
    Then reject the job
    print appropriate message to operator
    go to step 1 to handle next job in line
    else
    continue with step 3

    3. Set counter to 1

    4. Do while counter <=number of partitions in memory
    If job__size > memory_partition_size(counter)
    Then counter=counter+1
    Else
    If memory_partition_size(counter)="free"
    Then load job into memory_partition(counter)
    change memory_partition_status(counter) to "busy"
    go to step 1 to handle next job in line
    Else
    counter=counter+1

    5. No partition available at this time, put job in waiting queue

    6. Go to step 1 to handle next job in line

  10. #10
    subaya ug maau imung code. interpret it line by line bro.. dali ra kaau na kung makasabot naka

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. Advance Java
    By gloryhunter in forum Programming
    Replies: 25
    Last Post: 11-15-2007, 10:14 AM
  2. SE K500i 3D Java Games/Application.. (?)
    By mE_bytes in forum Gizmos & Gadgets (Old)
    Replies: 1
    Last Post: 07-14-2005, 11:14 PM
  3. Java Seminar
    By polie in forum Business, Finance & Economics Discussions
    Replies: 5
    Last Post: 07-09-2005, 01:38 AM
  4. Mobile Java Games
    By Nezumix22 in forum Gizmos & Gadgets (Old)
    Replies: 23
    Last Post: 05-06-2005, 05:33 PM
  5. how to install java apps/games in motorola c651
    By 8088 in forum Gizmos & Gadgets (Old)
    Replies: 4
    Last Post: 04-18-2005, 03:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top