list = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
94 | //
95 | // File file = new File("absh.txt");
96 | // PrintStream pw = null;
97 | // try {
98 | // pw = new PrintStream(file);
99 | // } catch (FileNotFoundException e) {
100 | // e.printStackTrace();
101 | // }
102 | //
103 | // pw.println("Anuj 56.25 77.58");
104 | // pw.println("Bharat 66.25 57.58");
105 | // pw.println("Chaman 70.25 66.74");
106 | // pw.println("Dhanush 58.25 95.74");
107 | // pw.println("Garv 58.62 95.74");
108 | //
109 | // int count = list.stream().reduce(0, (e,ee) -> e+ee);
110 | //
111 | // System.out.println(count);
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | }
123 |
124 |
125 |
126 |
127 |
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/Example2/src/module-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | /**
5 | * @author shubh
6 | *
7 | */
8 | module Example2 {
9 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DEAD LOCK
2 |
3 | 
4 |
5 |
6 | 🔒 **A GitHub Repository showcasing projects on Deadlock scenarios**
7 |
8 | This repository contains two projects that demonstrate the concept of deadlock in different scenarios.
9 |
10 |
11 |
12 | ## Projects
13 |
14 | ### Example-1: Printer Scanner
15 |
16 | 🖨️🔎
17 |
18 | This project showcases a simulation of a deadlock scenario between a printer and a scanner. The code demonstrates how two processes can deadlock when they both require exclusive access to shared resources, resulting in a deadlock state. Through this example, you will gain a better understanding of how deadlock can occur and the importance of resource allocation and synchronization.
19 |
20 | ### Example-2: Water Spices
21 |
22 | 💦🌶️
23 |
24 | The second project focuses on a deadlock scenario related to water and spices. It presents a practical example where multiple threads attempt to access resources concurrently, leading to a potential deadlock situation. By exploring this example, you will learn about the importance of resource management and techniques to avoid or resolve deadlocks.
25 |
26 | ## Getting Started
27 |
28 | To get started with these projects, follow the instructions below:
29 |
30 | 1. Clone this repository: `git clone https://github.com/Shubh2-0/Deadlock-In-Java.git`
31 | 2. Navigate to the respective project directory: `cd example-1` or `cd example-2`
32 | 3. Follow the project-specific instructions provided in the README of each project directory to run the code and observe the deadlock scenarios.
33 |
34 | ## Contributing
35 |
36 | If you would like to contribute to this repository, feel free to submit pull requests. Contributions that enhance the understanding of deadlock scenarios or provide additional examples are highly appreciated.
37 |
38 | ## 📬 Contact
39 |
40 | If you want to contact me, you can reach me through below handles.
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Happy coding! 😄🚀
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------