This repository contains code snippets and examples created while learning Java Multithreading concepts. The learning process was guided by a YouTube tutorial, with hands-on exercises to deepen the understanding of multithreading and concurrency.
The repository is organized into folders, each focusing on a specific multithreading topic:
- Basics: Introduction to Java threads,
Runnable
, andThread
classes. - Synchronization: Examples showcasing the use of synchronized blocks and methods to avoid race conditions.
- ExecutorService: Code demonstrating the
ExecutorService
framework for managing thread pools. - BookSemaphores: Solutions and examples related to semaphores, with practical problems from a semaphore book.
- ConcurrentCollection: Examples of thread-safe collections and barriers, such as
ConcurrentHashMap
,CopyOnWriteArrayList
, andCyclicBarrier
. - ForkJoin: Implementation of parallelism using the
ForkJoinPool
framework. - Locks: Usage of explicit locks (
ReentrantLock
,ReadWriteLock
) for fine-grained control over thread synchronization. - Misc: Miscellaneous concepts and examples in multithreading.
- Thread creation and lifecycle
- Synchronization and locks
- Semaphore examples and applications
- Concurrent collections and utilities
- Fork/Join framework for parallelism
- Thread pools and
ExecutorService
- Clone the repository:
git clone https://github.com/Devansh-ds/java-multithreading-basics.git