├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── Mutual_Exclusion(Java)
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ └── cent
│ │ └── Cent.class
├── lib
│ ├── CopyLibs
│ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ └── nblibraries.properties
├── manifest.mf
├── mutex
│ ├── build.xml
│ ├── build
│ │ └── classes
│ │ │ ├── .netbeans_automatic_build
│ │ │ ├── .netbeans_update_resources
│ │ │ └── mutex
│ │ │ └── Mutex.class
│ ├── lib
│ │ ├── CopyLibs
│ │ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ │ └── nblibraries.properties
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── mutex
│ │ └── Mutex.java
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ └── private.properties
│ ├── project.properties
│ └── project.xml
└── src
│ └── cent
│ └── Cent.java
├── Mutual_Exclusion(c++)
├── mutual_exclusion.cpp
├── mutual_exclusion.exe
├── mutual_exclusion.o
├── mutual_exclusions.cpp
├── mutual_exclusions.exe
├── mutual_exclusions.o
└── mutual_op.PNG
├── README.md
├── bankersalgo
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ └── bankersalgo
│ │ └── Bankersalgo.class
├── lib
│ ├── CopyLibs
│ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ └── nblibraries.properties
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── bankersalgo
│ └── Bankersalgo.java
├── bully
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ └── bully
│ │ └── Bully.class
├── lib
│ ├── CopyLibs
│ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ └── nblibraries.properties
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── bully
│ └── Bully.java
├── calculator
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ └── calculator
│ │ ├── Calculator.class
│ │ ├── calculatorclient.class
│ │ ├── calculatorinterface.class
│ │ └── calculatorserver.class
├── lib
│ ├── CopyLibs
│ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ └── nblibraries.properties
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── calculator
│ ├── Calculator.java
│ ├── calculatorclient.java
│ ├── calculatorinterface.java
│ └── calculatorserver.java
├── ejbcalc
├── build.xml
├── build
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── ejbcalc-ejb.jar
│ ├── ejbcalc-war.war
│ └── gfv3ee6.dpf
├── dist
│ ├── ejbcalc.ear
│ └── gfdeploy
│ │ └── ejbcalc
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── ejbcalc-ejb_jar
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ ├── META-INF
│ │ │ └── MANIFEST.MF
│ │ └── test
│ │ │ └── operation.class
│ │ └── ejbcalc-war_war
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── WEB-INF
│ │ ├── classes
│ │ │ ├── .netbeans_automatic_build
│ │ │ ├── .netbeans_update_resources
│ │ │ └── result.class
│ │ └── web.xml
│ │ └── index.jsp
├── ejbcalc-ejb
│ ├── build.xml
│ ├── build
│ │ └── classes
│ │ │ ├── .netbeans_automatic_build
│ │ │ ├── .netbeans_update_resources
│ │ │ ├── META-INF
│ │ │ └── MANIFEST.MF
│ │ │ └── test
│ │ │ └── operation.class
│ ├── dist
│ │ └── ejbcalc-ejb.jar
│ ├── nbproject
│ │ ├── ant-deploy.xml
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ ├── conf
│ │ └── MANIFEST.MF
│ │ └── java
│ │ └── test
│ │ └── operation.java
├── ejbcalc-war
│ ├── build.xml
│ ├── build
│ │ └── web
│ │ │ ├── META-INF
│ │ │ └── MANIFEST.MF
│ │ │ ├── WEB-INF
│ │ │ ├── classes
│ │ │ │ ├── .netbeans_automatic_build
│ │ │ │ ├── .netbeans_update_resources
│ │ │ │ └── result.class
│ │ │ └── web.xml
│ │ │ └── index.jsp
│ ├── dist
│ │ └── ejbcalc-war.war
│ ├── nbproject
│ │ ├── ant-deploy.xml
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── project.properties
│ │ └── project.xml
│ ├── src
│ │ ├── conf
│ │ │ └── MANIFEST.MF
│ │ └── java
│ │ │ └── result.java
│ └── web
│ │ ├── WEB-INF
│ │ └── web.xml
│ │ └── index.jsp
├── lib
│ ├── CopyLibs
│ │ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
│ ├── javaee-endorsed-api-7.0
│ │ ├── javaee-doc-api.jar
│ │ ├── javax.annotation-api.jar
│ │ ├── javax.xml.soap-api.jar
│ │ ├── jaxb-api-osgi.jar
│ │ ├── jaxws-api.jar
│ │ └── jsr181-api.jar
│ └── nblibraries.properties
├── nbproject
│ ├── ant-deploy.xml
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── conf
│ └── MANIFEST.MF
└── rmilogin
└── calculator
├── build.xml
├── build
└── classes
│ ├── .netbeans_automatic_build
│ ├── .netbeans_update_resources
│ └── calculator
│ ├── Calculator.class
│ ├── calculatorclient.class
│ ├── calculatorinterface.class
│ └── calculatorserver.class
├── lib
├── CopyLibs
│ └── org-netbeans-modules-java-j2seproject-copylibstask.jar
└── nblibraries.properties
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── private
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
└── src
└── calculator
├── Calculator.java
├── calculatorclient.java
├── calculatorinterface.java
└── calculatorserver.java
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 |
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 | Steps to reproduce the behavior:
12 | 1. Go to '...'
13 | 2. Click on '....'
14 | 3. Scroll down to '....'
15 | 4. See error
16 |
17 | **Expected behavior**
18 | A clear and concise description of what you expected to happen.
19 |
20 | **Screenshots**
21 | If applicable, add screenshots to help explain your problem.
22 |
23 | **Desktop (please complete the following information):**
24 | - OS: [e.g. iOS]
25 | - Browser [e.g. chrome, safari]
26 | - Version [e.g. 22]
27 |
28 | **Smartphone (please complete the following information):**
29 | - Device: [e.g. iPhone6]
30 | - OS: [e.g. iOS8.1]
31 | - Browser [e.g. stock browser, safari]
32 | - Version [e.g. 22]
33 |
34 | **Additional context**
35 | Add any other context about the problem here.
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project cent.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/build/classes/cent/Cent.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/build/classes/cent/Cent.class
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/lib/nblibraries.properties:
--------------------------------------------------------------------------------
1 | libs.CopyLibs.classpath=\
2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
3 | libs.CopyLibs.displayName=CopyLibs Task
4 | libs.CopyLibs.prop-version=2.0
5 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project mutex.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/mutex/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/mutex/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/build/classes/mutex/Mutex.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/mutex/build/classes/mutex/Mutex.class
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/Mutual_Exclusion(Java)/mutex/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/lib/nblibraries.properties:
--------------------------------------------------------------------------------
1 | libs.CopyLibs.classpath=\
2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
3 | libs.CopyLibs.displayName=CopyLibs Task
4 | libs.CopyLibs.prop-version=2.0
5 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=58545b7e
2 | build.xml.script.CRC32=d9e36fa3
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=58545b7e
7 | nbproject/build-impl.xml.script.CRC32=5821450a
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\prasad\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | file:/C:/Users/prasad/Documents/NetBeansProjects/mutex/src/mutex/Mutex.java
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/mutex.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=mutex.Mutex
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | mutex
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | .\lib\nblibraries.properties
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/mutex/src/mutex/Mutex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package mutex;
7 | import java.util.*;
8 | /**
9 | *
10 | * @author prasad
11 | */
12 | public class Mutex {
13 |
14 | /**
15 | * @param args the command line arguments
16 | */
17 | public static void main(String[] args) {
18 | // TODO code application logic here
19 | Scanner sc = new Scanner(System.in);
20 | int opt0,opt1;
21 | int p1 = 1;
22 | int p2 = 2;
23 | int p3 = 3;
24 | int flag = 0;
25 | int cs = 0;
26 | Queue q = new LinkedList<>();
27 | do
28 | {
29 | System.out.println("....menu...");
30 | System.out.println("1.Request the critical section");
31 | System.out.println("2.Release the critical section");
32 | System.out.println("3.Exit");
33 | opt0 = sc.nextInt();
34 | switch(opt0)
35 | {
36 | case 1:
37 | {
38 | System.out.println("Select the process.");
39 | System.out.println("1.p1");
40 | System.out.println("2.p2");
41 | System.out.println("3.p3");
42 | opt1 = sc.nextInt();
43 | switch(opt1)
44 | {
45 | case 1:
46 | {
47 | if(flag==0)
48 | {
49 | cs = 1;
50 | flag = 1;
51 | }
52 | else
53 | {
54 | System.out.println("process p"+cs+"is already in critical section.");
55 | q.add(p1);
56 | }
57 |
58 | System.out.println("System Status:");
59 | System.out.println("critical section is occupoied by:"+cs);
60 | System.out.println("process waiting is: "+q);
61 | break;
62 | }
63 | case 2:
64 | {
65 | if(flag==0)
66 | {
67 | cs = 2;
68 | flag = 1;
69 | }
70 | else
71 | {
72 | System.out.println("process p"+cs+"is already in critical section.");
73 | q.add(p2);
74 | }
75 | System.out.println("System Status:");
76 | System.out.println("critical section is occupoied by:"+cs);
77 | System.out.println("process waiting is: "+q);
78 | break;
79 | }
80 | case 3:
81 | {
82 | if(flag==0)
83 | {
84 | cs = 3;
85 | flag = 1;
86 | }
87 | else
88 | {
89 | System.out.println("process p"+cs+"is already in critical section.");
90 | q.add(p3);
91 | }
92 | System.out.println("System Status:");
93 | System.out.println("critical section is occupoied by:"+cs);
94 | System.out.println("process waiting is: "+q);
95 | break;
96 | }
97 | }
98 | break;
99 | }
100 | case 2:
101 | {
102 | System.out.println("the process p"+cs+"is removed from section.");
103 | if(!q.isEmpty())
104 | {
105 | cs = q.peek();
106 | q.remove();
107 | System.out.println("System status:");
108 | System.out.println("Critical Section occupied by p"+cs);
109 | }
110 | else
111 | {
112 | System.out.println("No Process is waiting in the queue");
113 | flag = 0;
114 | }
115 | }
116 |
117 | case 3:
118 | {
119 | break;
120 | }
121 | }
122 | }
123 | while(3!=opt0);
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=09421fd1
2 | build.xml.script.CRC32=77fca5f3
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=09421fd1
7 | nbproject/build-impl.xml.script.CRC32=9831a59e
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\prasad\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/cent.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=cent.Cent
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | cent
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | .\lib\nblibraries.properties
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(Java)/src/cent/Cent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package cent;
7 |
8 | /**
9 | *
10 | * @author prasad
11 | */
12 | public class Cent {
13 |
14 | /**
15 | * @param args the command line arguments
16 | */
17 |
18 | public int flag=0;
19 | public int front=0;
20 | public int rear=-1;
21 | public boolean grant;
22 |
23 | int[] queue=new int[10];
24 | public void request(int p)
25 | {
26 |
27 | if(flag==0)
28 | {
29 | System.out.println("reply to"+p);
30 | flag=1;
31 | }
32 | else
33 | {
34 | if(flag==1)
35 | {
36 | System.out.println("process wait "+p);
37 | rear++;
38 | queue[rear]=p;
39 | }
40 | }
41 |
42 | }
43 |
44 | public void release(int p)
45 | {
46 | flag=0;
47 | if(queue[front]!=0)
48 | {
49 | System.out.println("delete from queue"+queue[front]);
50 | request(queue[front]);
51 | front=front+1;
52 | System.out.println("released"+p);
53 | }
54 |
55 |
56 |
57 | }
58 |
59 |
60 | public static void main(String[] args) {
61 | // TODO code application logic here
62 | int p = 5;
63 | Cent c = new Cent();
64 | c.request(p);
65 | c.request(6);
66 | c.request(7);
67 | c.release(p);
68 | c.release(6);
69 |
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/Mutual_Exclusion(c++)/mutual_exclusion.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | using namespace std;
3 |
4 | int main() {
5 | // your code goes here
6 | int m; // no of commands
7 | int n; // no of process
8 | int r; // no of resources
9 | int c; //co-ordinator process
10 | int req; // no request for resource
11 | int rid; // request id
12 | int pid; // process id
13 | int rrid; // release resource id
14 | int prid; // release process id
15 | int choice; //choice for options
16 | queue p; // queue for processes
17 | //queue r; // queue for resources
18 | //queue w; //waiting queue
19 | //stack q; // process in cs
20 | cout<<"*******MENU***********"<<'\n';
21 | cout<<"enter the no of process:"<>n;
23 | //cout<<"enter the no of resources:"<>r;
25 | cout<<"enter the co-ordinator process:"<>c;
27 | cout<<"enter the no of commands:"<>m;
29 | bool cs = true;
30 | while(m--)
31 | {
32 | cout<<"choice menu:-"<>choice;
38 | bool nc = false;
39 | int allocated = 0;
40 | if(choice==1)
41 | {
42 | //request goes here
43 | cout<<"Process id:"<>pid;
45 | if(cs==true)
46 | {
47 | cs = false;
48 | allocated = pid;
49 | cout<<"Resource is Granted for-"<>prid;
63 | if(allocated==prid)
64 | {
65 | cs = true;
66 | cout<<"Critical Section is released by-"<
2 | using namespace std;
3 |
4 | int main() {
5 | // your code goes here
6 | int m; // no of commands
7 | int n; // no of process
8 | int r; // no of resources
9 | int c; //co-ordinator process
10 | int req; // no request for resource
11 | int rid; // request id
12 | int pid; // process id
13 | int rrid; // release resource id
14 | int prid; // release process id
15 | int choice; //choice for options
16 | queue p; // queue for processes
17 | //queue r; // queue for resources
18 | //queue w; //waiting queue
19 | //stack q; // process in cs
20 | cout<<"*******MENU***********"<<'\n';
21 | cout<<"enter the no of process:"<>n;
23 | //cout<<"enter the no of resources:"<>r;
25 | cout<<"enter the co-ordinator process:"<>c;
27 | cout<<"enter the no of commands:"<>m;
29 | bool cs = true;
30 | while(m--)
31 | {
32 | cout<<"choice menu:-"<>choice;
38 | bool nc = false;
39 | int allocated = 0;
40 | if(choice==1)
41 | {
42 | //request goes here
43 | cout<<"Process id:"<>pid;
45 | if(cs==true)
46 | {
47 | cs = false;
48 | allocated = pid;
49 | cout<<"Resource is Granted for-"<>prid;
63 | if(allocated==prid)
64 | {
65 | cs = true;
66 | cout<<"Critical Section is released by-"<
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project bankersalgo.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/bankersalgo/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bankersalgo/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/bankersalgo/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bankersalgo/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/bankersalgo/build/classes/bankersalgo/Bankersalgo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bankersalgo/build/classes/bankersalgo/Bankersalgo.class
--------------------------------------------------------------------------------
/bankersalgo/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bankersalgo/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--------------------------------------------------------------------------------
/bankersalgo/lib/nblibraries.properties:
--------------------------------------------------------------------------------
1 | libs.CopyLibs.classpath=\
2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
3 | libs.CopyLibs.displayName=CopyLibs Task
4 | libs.CopyLibs.prop-version=2.0
5 |
--------------------------------------------------------------------------------
/bankersalgo/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/bankersalgo/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=6f4e7e74
2 | build.xml.script.CRC32=ec2c682e
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=6f4e7e74
7 | nbproject/build-impl.xml.script.CRC32=09af1b9e
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/bankersalgo/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\prasad\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/bankersalgo/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/Users/prasad/Documents/NetBeansProjects/bankersalgo/src/bankersalgo/Bankersalgo.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/bankersalgo/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/bankersalgo.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=bankersalgo.Bankersalgo
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/bankersalgo/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | bankersalgo
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | .\lib\nblibraries.properties
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/bankersalgo/src/bankersalgo/Bankersalgo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package bankersalgo;
7 |
8 | /**
9 | *
10 | * @author prasad
11 | */
12 |
13 | import java.util.Scanner;
14 |
15 | public class Bankersalgo {
16 |
17 | /**
18 | * @param args the command line arguments
19 | */
20 | int max[][];
21 |
22 | int need[][];
23 |
24 | int available[][];
25 |
26 | int allocation[][];
27 |
28 | int np,nr;
29 |
30 |
31 |
32 | public void input(){
33 |
34 | Scanner input=new Scanner(System.in);
35 |
36 | System.out.println("Enter no. of Process and no. of Resource ");
37 |
38 | np=input.nextInt();
39 |
40 | nr=input.nextInt();
41 |
42 | max=new int[np][nr];
43 |
44 | need=new int[np][nr];
45 |
46 | available=new int[1][nr];
47 |
48 | allocation=new int[np][nr];
49 |
50 |
51 |
52 | System.out.println("Enter Allocation Matrix");
53 |
54 | for(int i=0;i
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project bully.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/bully/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bully/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/bully/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bully/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/bully/build/classes/bully/Bully.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bully/build/classes/bully/Bully.class
--------------------------------------------------------------------------------
/bully/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/bully/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--------------------------------------------------------------------------------
/bully/lib/nblibraries.properties:
--------------------------------------------------------------------------------
1 | libs.CopyLibs.classpath=\
2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
3 | libs.CopyLibs.displayName=CopyLibs Task
4 | libs.CopyLibs.prop-version=2.0
5 |
--------------------------------------------------------------------------------
/bully/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/bully/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=a2cb384a
2 | build.xml.script.CRC32=66f4d565
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=a2cb384a
7 | nbproject/build-impl.xml.script.CRC32=8714dc0b
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/bully/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\prasad\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/bully/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/Users/prasad/Documents/NetBeansProjects/bully/src/bully/Bully.java
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/bully/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/bully.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=bully.Bully
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/bully/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | bully
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | .\lib\nblibraries.properties
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/bully/src/bully/Bully.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package bully;
7 |
8 | import java.util.Scanner;
9 |
10 | /**
11 | *
12 | * @author prasad
13 | */
14 | public class Bully {
15 |
16 | /**
17 | * @param args the command line arguments
18 | */
19 | static boolean state[] = new boolean[5];
20 | int coordinator;
21 | public static void up(int up)
22 | {
23 | if(state[up-1]==true)
24 | {
25 | System.out.println("process"+up+"is already up");
26 | }
27 | else
28 | {
29 | state[up-1] = true;
30 | System.out.println("process "+up+"held election");
31 | for(int i=up;i<5;i++)
32 | {
33 | System.out.println("election message sent from process"+up+"to process"+(i+1));
34 | }
35 | for(int i=up+1;i<=5;i++)
36 | {
37 | if(state[i-1]==true)
38 | {
39 | System.out.println("alive message send from process"+i+"to process"+up);
40 | break;
41 | }
42 | }
43 | }
44 | }
45 | public static void down(int down)
46 | {
47 | if(state[down-1]==false)
48 | {
49 | System.out.println("process "+down+"is already dowm.");
50 | }
51 | else
52 | {
53 | state[down-1] = false;
54 |
55 | }
56 | }
57 |
58 | public static void mess(int mess)
59 | {
60 | if(state[mess-1]==true)
61 | {
62 | if(state[4]==true)
63 | {
64 | System.out.println("0K");
65 | }
66 | else
67 | {
68 | if(state[4]==false)
69 | {
70 | System.out.println("process"+mess+"election");
71 | for(int i=mess;i<5;i++)
72 | {
73 | System.out.println("election send from process"+mess+"to process "+(i+1));
74 | }
75 |
76 | for(int i=5;i>=mess;i--)
77 | {
78 | if(state[i-1]==true)
79 | {
80 | System.out.println("Coordinator message send from process"+i+"to all");
81 | break;
82 | }
83 | }
84 | }
85 | }
86 | }
87 | else
88 | {
89 | System.out.println("Prccess"+mess+"is down");
90 | }
91 | }
92 |
93 | public static void main(String[] args) {
94 | // TODO code application logic here
95 | Scanner sc = new Scanner(System.in);
96 | int choice;
97 | for(int i=0;i<5;i++)
98 | {
99 | state[i] = true;
100 | }
101 | System.out.println("5 active process are:");
102 | System.out.println("Process up = p1 p2 p3 p4 p5");
103 | System.out.println("Process 5 is coordinator");
104 |
105 | do
106 | {
107 | System.out.println(".........");
108 | System.out.println("1 up a process.");
109 | System.out.println("2.down a process");
110 | System.out.println("3 send a message");
111 | System.out.println("4.Exit");
112 | choice = sc.nextInt();
113 | switch(choice)
114 | {
115 | case 1:
116 | {
117 | System.out.println("bring proces up");
118 | int up = sc.nextInt();
119 | if(up==5)
120 | {
121 | System.out.println("process 5 is co-ordinator");
122 | state[4] = true;
123 |
124 | }
125 | else
126 | {
127 | up(up);
128 | }
129 | }
130 | break;
131 | case 2:
132 | {
133 | System.out.println("bring down any process.");
134 | int down = sc.nextInt();
135 | down(down);
136 | }
137 | break;
138 | case 3:
139 | {
140 | System.out.println("which process will send message");
141 | int mess = sc.nextInt();
142 | mess(mess);
143 | }
144 | break;
145 |
146 | }
147 |
148 | }
149 | while(choice!=4);
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/calculator/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project calculator.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/calculator/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/calculator/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/calculator/build/classes/calculator/Calculator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/calculator/Calculator.class
--------------------------------------------------------------------------------
/calculator/build/classes/calculator/calculatorclient.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/calculator/calculatorclient.class
--------------------------------------------------------------------------------
/calculator/build/classes/calculator/calculatorinterface.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/calculator/calculatorinterface.class
--------------------------------------------------------------------------------
/calculator/build/classes/calculator/calculatorserver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/build/classes/calculator/calculatorserver.class
--------------------------------------------------------------------------------
/calculator/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/calculator/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
--------------------------------------------------------------------------------
/calculator/lib/nblibraries.properties:
--------------------------------------------------------------------------------
1 | libs.CopyLibs.classpath=\
2 | ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
3 | libs.CopyLibs.displayName=CopyLibs Task
4 | libs.CopyLibs.prop-version=2.0
5 |
--------------------------------------------------------------------------------
/calculator/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/calculator/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=86638026
2 | build.xml.script.CRC32=7618ae60
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=86638026
7 | nbproject/build-impl.xml.script.CRC32=ce151cdc
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/calculator/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\prasad\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/calculator/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/Users/prasad/Documents/NetBeansProjects/calculator/src/calculator/Calculator.java
7 | file:/C:/Users/prasad/Documents/NetBeansProjects/calculator/src/calculator/calculatorclient.java
8 | file:/C:/Users/prasad/Documents/NetBeansProjects/calculator/src/calculator/calculatorinterface.java
9 | file:/C:/Users/prasad/Documents/NetBeansProjects/calculator/src/calculator/calculatorserver.java
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/calculator/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/calculator.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=calculator.Calculator
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/calculator/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | calculator
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | .\lib\nblibraries.properties
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/calculator/src/calculator/Calculator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package calculator;
7 | import java.rmi.RemoteException;
8 | import java.rmi.*;
9 | import java.rmi.server.UnicastRemoteObject;
10 | /**
11 | *
12 | * @author prasad
13 | */
14 | public class Calculator extends UnicastRemoteObject implements calculatorinterface{
15 |
16 | public Calculator() throws RemoteException
17 | {
18 | int a,b;
19 | }
20 | @Override
21 | public int add(int a,int b) throws RemoteException
22 | {
23 | return a+b;
24 | }
25 | @Override
26 | public int sub(int a,int b) throws RemoteException
27 | {
28 | return a-b;
29 | }
30 | @Override
31 | public int mul(int a,int b) throws RemoteException
32 | {
33 | return a*b;
34 | }
35 | @Override
36 | public int div(int a,int b) throws RemoteException
37 | {
38 | return a/b;
39 | }
40 |
41 | /**
42 | * @param args the command line arguments
43 | */
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/calculator/src/calculator/calculatorclient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package calculator;
7 |
8 | import java.net.MalformedURLException;
9 | import java.rmi.Naming;
10 | import java.rmi.NotBoundException;
11 | import java.rmi.RemoteException;
12 | import java.util.Scanner;
13 |
14 | /**
15 | *
16 | * @author prasad
17 | */
18 | public class calculatorclient {
19 | public static void main(String[] args) throws NotBoundException,RemoteException, MalformedURLException {
20 | // TODO code application logic here
21 | Scanner sc = new Scanner(System.in);
22 | try
23 | {
24 | calculatorinterface c = (calculatorinterface) Naming.lookup("//localhost:1090/Calculator");
25 | System.out.println("client is connected to server");
26 | System.out.println("select any option from menu");
27 | System.out.println("1.addition \n");
28 | System.out.println("2.Substraction \n");
29 | System.out.println("3.Multiplication \n");
30 | System.out.println("4.Division \n");
31 | int choice = sc.nextInt();
32 | int x,y;
33 | switch(choice)
34 | {
35 | case 1:
36 | {
37 | System.out.println("enter two number");
38 | x = sc.nextInt();
39 | y = sc.nextInt();
40 | System.out.println("result:"+c.add(x, y));
41 | }
42 | case 2:
43 | {
44 | System.out.println("enter two number");
45 | x = sc.nextInt();
46 | y = sc.nextInt();
47 | System.out.println("result:"+c.sub(x, y));
48 | }
49 | case 3:
50 | {
51 | System.out.println("enter two number");
52 | x = sc.nextInt();
53 | y = sc.nextInt();
54 | System.out.println("result:"+c.mul(x, y));
55 | }
56 | case 4:
57 | {
58 | System.out.println("enter two number");
59 | x = sc.nextInt();
60 | y = sc.nextInt();
61 | System.out.println("result:"+c.div(x, y));
62 | }
63 | }
64 | }
65 | catch(Exception e)
66 | {
67 | System.out.println(e);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/calculator/src/calculator/calculatorinterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package calculator;
7 |
8 | import java.rmi.Remote;
9 | import java.rmi.RemoteException;
10 |
11 | /**
12 | *
13 | * @author prasad
14 | */
15 | public interface calculatorinterface extends Remote{
16 | public int add(int x,int y) throws RemoteException;
17 | public int sub(int x,int y) throws RemoteException;
18 | public int mul(int x,int y) throws RemoteException;
19 | public int div(int x,int y) throws RemoteException;
20 | }
21 |
--------------------------------------------------------------------------------
/calculator/src/calculator/calculatorserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package calculator;
7 |
8 | import java.rmi.RemoteException;
9 | import java.rmi.registry.LocateRegistry;
10 | import java.rmi.registry.Registry;
11 | import java.rmi.NotBoundException;
12 | /**
13 | *
14 | * @author prasad
15 | */
16 | public class calculatorserver {
17 | public static void main(String[] args) throws RemoteException,NotBoundException
18 | {
19 | try
20 | {
21 | Registry r = java.rmi.registry.LocateRegistry.createRegistry(1090);
22 | r.rebind("Calculator", new Calculator());
23 | System.out.println("server is running");
24 | }
25 | catch(Exception e)
26 | {
27 | System.out.println(e);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ejbcalc/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project ejbcalc.
12 |
13 |
61 |
62 |
--------------------------------------------------------------------------------
/ejbcalc/build/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/ejbcalc/build/ejbcalc-ejb.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/build/ejbcalc-ejb.jar
--------------------------------------------------------------------------------
/ejbcalc/build/ejbcalc-war.war:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/build/ejbcalc-war.war
--------------------------------------------------------------------------------
/ejbcalc/build/gfv3ee6.dpf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/build/gfv3ee6.dpf
--------------------------------------------------------------------------------
/ejbcalc/dist/ejbcalc.ear:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/ejbcalc.ear
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/.netbeans_automatic_build
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/.netbeans_update_resources
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Ant-Version: Apache Ant 1.9.7
3 | Created-By: 1.8.0_131-b11 (Oracle Corporation)
4 |
5 |
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/test/operation.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-ejb_jar/test/operation.class
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Ant-Version: Apache Ant 1.9.7
3 | Created-By: 1.8.0_131-b11 (Oracle Corporation)
4 |
5 |
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/result.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prasadgujar/DistributedSystem/b59b9e0bf050d5fd77f3cdf33652646d9fadf24b/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/classes/result.class
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | result
5 | result
6 |
7 |
8 | result
9 | /result
10 |
11 |
12 |
13 | 30
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ejbcalc/dist/gfdeploy/ejbcalc/ejbcalc-war_war/index.jsp:
--------------------------------------------------------------------------------
1 | <%--
2 | Document : index
3 | Created on : 23 Apr, 2018, 12:47:18 PM
4 | Author : prasad
5 | --%>
6 |
7 | <%@page contentType="text/html" pageEncoding="UTF-8"%>
8 |
9 |
10 |
11 |
12 | JSP Page
13 |
14 |
15 | Hello World!
16 |