Skip to content

Devansh-ds/Multi-Threading

Repository files navigation

Java Multithreading Basics

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.

Repository Structure

The repository is organized into folders, each focusing on a specific multithreading topic:

  • Basics: Introduction to Java threads, Runnable, and Thread 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, and CyclicBarrier.
  • 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.

Features Covered

  • Thread creation and lifecycle
  • Synchronization and locks
  • Semaphore examples and applications
  • Concurrent collections and utilities
  • Fork/Join framework for parallelism
  • Thread pools and ExecutorService

How to Use

  1. Clone the repository:
    git clone https://github.com/Devansh-ds/java-multithreading-basics.git