Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent-Programming

Java IntelliJ IDEA

A collection of Java-based concurrency examples demonstrating thread synchronization, locks, and shared resource management.


📖 About This Project

This project explores various concurrency patterns and synchronization techniques in Java. It provides practical implementations of real-world scenarios where multiple threads must interact safely with shared resources. Each module focuses on a specific concurrency primitive, such as ReentrantReadWriteLock, Semaphore, and synchronized blocks, to ensure data integrity and prevent race conditions.


✨ Features

  • 🏦 Bank Transaction System - Handles concurrent bank transfers using ReentrantReadWriteLock for safety.
  • Coffee Shop Simulation - A producer-consumer model managing coffee orders between Baristas and Customers.
  • 🚻 Bathroom Stall Management - Demonstrates resource synchronization using Semaphore for shared stalls.
  • 🧵 Multi-threading - Deep dive into Java thread management, lifecycle, and synchronization.
  • 🔒 Thread Safety - Implementation of locks and semaphores to prevent race conditions.
  • 🚀 Concurrent Execution - High-performance simulation of real-world scenarios with multiple active threads.

🛠️ Tech Stack

Layer Technology
Language Java
IDE IntelliJ IDEA

📋 Prerequisites


⚙️ Getting Started

1. Clone the repository

git clone https://github.com/PramudithaN/Concurrent-Programming.git
cd Concurrent-Programming

2. Open in IntelliJ IDEA

Simply open the project folder in IntelliJ IDEA. The IDE will recognize the .iml file and set up the modules automatically.

3. Run the Scenarios

You can run the main methods in the following files:

  • Scenario 1 (Coffee Shop): src/CoffeeShop/CoffeeShopExample.java
  • Scenario 2 (Bank System): src/BankTransactionSystem/Main.java
  • Scenario 3 (Floor Bathroom): src/FloorBathroom/FloorBathroom.java

📁 Project Structure

Concurrent-Programming/
├── src/
│   ├── BankTransactionSystem/   # Concurrent bank transfers with ReentrantReadWriteLock
│   │   ├── BankAccount.java
│   │   ├── Main.java
│   │   └── TransactionSystem.java
│   ├── CoffeeShop/              # Producer-Consumer model for coffee orders
│   │   ├── Barista.java
│   │   ├── CoffeeShop.java
│   │   ├── CoffeeShopExample.java
│   │   └── Customer.java
│   └── FloorBathroom/           # Semaphore-based shared resource access
│       └── FloorBathroom.java
├── Concurrent_CW.iml            # IntelliJ IDEA module file
└── .gitignore                   # Git ignore rules

🙋‍♂️ Connect with Me


Developed with ❤️ by Pramuditha Nadun.

About

Handling Thread concurrency concepts using java - Coursework IIT

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages