Skip to content

dev-priyanshujain/multithreading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

multithreading

Top 10 Computer Science multithreading exercises to practice.

Problems

  1. Race Condition Multiple threads increment a shared counter without synchronization, leading to incorrect results.

  2. Deadlock Two threads each hold a lock and wait for the other's lock, causing a permanent hang.

  3. Starvation A low-priority thread never gets CPU time because a high-priority thread dominates.

  4. Livelock Two threads keep reacting to each other but neither makes progress.

  5. Producer-Consumer Coordinating a producer and consumer with a bounded buffer using wait()/notifyAll().

  6. Readers-Writers Multiple readers can read simultaneously, but a writer needs exclusive access.

  7. Dining Philosophers 5 philosophers compete for 5 shared forks; demonstrates resource contention and potential deadlock.

  8. Barrier / Rendezvous All threads must reach a synchronization point before any can proceed, using CyclicBarrier.

  9. Thread Pool Exhaustion A fixed-size thread pool is overwhelmed by long-running tasks, causing new tasks to queue up.

  10. Memory Visibility One thread's changes aren't visible to another due to CPU caching; demonstrates volatile as the fix.

About

Top 10 Computer Science multithreading exercises to practice.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages