Programming

Banker’s algorithm Implementation in Java

Program AIM: – Banker’s algorithm in Java.

Instruction to run the below code:

1.save the code in .Java file in bin folder of jdk.

2.compile the file using javac in cmd prompt

3.Run the file using java command in cmd prompt

Download Link: ย Banker Algorithm [.txt file]

Input code :

/* Program starts here:*/

Advertisements

19 thoughts on “Banker’s algorithm Implementation in Java”

    1. Thanks for Complement and Ur query’s resolution help :
      DeadLock Detection in Java,is not a Builtin feature of Java,But can be done using Management API in JDK.
      Following Links might resolve ur problem,which I suggested to one of my other friend once:
      http://www.java2s.com/Code/Java/Development-Class/PerformingdeadlockdetectionprogrammaticallywithintheapplicationusingthejavalangmanagementAPI.htm

      http://stackoverflow.com/questions/217113/deadlock-in-java

      http://stackoverflow.com/questions/1102359/programmatic-deadlock-detection-in-java

    1. Hey,Thanks for raising that Issue,I had fixed that Issue.
      Now,

      I also provided the perfect copy of this program for Download

      ,
      which has output of this code,when I run this program.

        1. Thanks man,I know that,because this program I made this program when I was learning java,so may be I may have left too many loop holes,So whenever I recall the concept in this program,I will definitively improve this program also.
          BTW thanks again for awakening me,for this blog.

          AND one more thing,if you happen to create Minimum error program,then please share with us. As I’m keen to see new implementation ways.

  1. How i can get this code to application in android 2.2 for mobile phone.
    I try put this code in NetBeans for android, not work.
    Please help me.
    regard.

  2. How i can get this code to application in android 2.2 for mobile phone.
    I try put this code in NetBeans for android, not work.
    Please help me.
    regard.

  3. There’s a problem with your algorithm. Your available matrix never gets updated. You need to add this bit of code in the main function for it to work 100% of the time.

    int sum = 0;
    for(int i = 0; i<m; i++)
    {

    for(int j = 0; j<n; j++)
    {
    sum = sum+al[j][i];
    }
    a[i]=a[i]-sum; sum=0;
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s