Skip to content

Dive into the world of Golang concurrency with this repository! Featuring a range of experiments and examples that explore Go's concurrent programming capabilities. Perfect for developers seeking to master Go's unique approach to parallel tasks. 🚀🔧🐹

Notifications You must be signed in to change notification settings

sandeepkv93/concurrency-in-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrency in Golang

This repository contains a comprehensive collection of concurrency problems implemented in Go, showcasing various concurrent programming patterns and techniques.

Completed Problems ✅

Problem Description
Concurrent Merge Sort A parallel implementation of the merge sort algorithm using goroutines and channels
Even-Odd Printer A program that uses two goroutines to print even and odd numbers in sequence
Multiple Producers, Multiple Consumers A classic producer-consumer problem with multiple producers and consumers
Parallel File Uploader A program that uploads multiple files in parallel with concurrent workers
Single Producer, Multiple Consumers A producer-consumer problem with a single producer and multiple consumers
Bounded Buffer Problem Producer-consumer scenario with fixed-size buffer using condition variables and mutex synchronization
Work Stealing Scheduler Multi-worker task scheduler where workers can "steal" tasks from other workers' queues when idle
Rate Limiter Multiple rate limiting strategies: Token Bucket, Leaky Bucket, and Sliding Window algorithms
Parallel QuickSort Parallel implementation of QuickSort with worker pool management and three-way partitioning
Parallel Matrix Multiplication Multiple parallel approaches including basic parallel, blocked multiplication, and Strassen's algorithm
Parallel Web Crawler Concurrent web crawler with depth limiting, domain restrictions, and polite crawling features
Dining Philosophers Problem Multiple solution strategies: Ordered, Arbitrator, Limited, and Try-Lock approaches for deadlock prevention
Readers-Writers Problem Various fairness strategies: Readers preference, Writers preference, and Fair queue-based solutions
Sleeping Barber Problem Classic synchronization problem with single and multi-barber variants, including waiting room management
Concurrent Hash Map Thread-safe hash map with sharding for concurrent access and LRU variant with eviction support
Parallel Prim's Algorithm Parallel MST construction using Prim's algorithm with distributed version and graph partitioning
Parallel Dijkstra's Algorithm Multiple approaches: concurrent edge relaxation, delta-stepping, and bidirectional search algorithms
Concurrent LRU Cache Thread-safe LRU cache with sharding, TTL support, and size-limited variants
Parallel Text Search Concurrent file searching with regex support, streaming search, and indexed search variants
Concurrent Stock Ticker Real-time stock price monitoring from multiple sources with price aggregation and portfolio tracking
Parallel Image Processing Tile-based parallel image processing with multiple filters: Grayscale, Blur, Edge Detection, Brightness, Contrast, Rotate
Concurrent Chat Server TCP-based chat server with rooms, private messaging, command system, and connection management
Parallel Log Processor Parallel log file processing with multiple parsers (JSON, Common Log, Syslog), filters, and aggregators
Concurrent Backup Utility Comprehensive backup solution with compression, checksums, incremental backup, extraction, and verification
Parallel Monte Carlo Pi Estimation Monte Carlo simulation with adaptive estimation, distributed processing, and convergence analysis
Concurrent Job Scheduler Advanced job scheduler with priority queues, retry mechanisms, cron scheduling, worker pools, and metrics
Parallel Word Count MapReduce Complete MapReduce framework for word counting with configurable mappers/reducers and chunking support
Concurrent FTP Server Full-featured FTP server with authentication, passive mode, file transfers, middleware support, and concurrent client handling
Parallel Video Encoder Multi-threaded video encoder with segment-based parallel processing, quality control, and real-time progress tracking

Pending Problems ⏳

Problem Description
25. Concurrent DNS Resolver Implement a Domain Name System (DNS) resolver that can handle multiple queries concurrently
26. Parallel Genetic Algorithm Implement a genetic algorithm in parallel to solve an optimization problem
27. Concurrent Blockchain Miner Implement a simplified blockchain miner that mines blocks in parallel
28. Parallel Ray Tracer Implement a ray tracer that renders an image in parallel
29. Concurrent Game of Life Implement Conway's Game of Life in parallel
30. Parallel N-Body Simulation Implement an N-body simulation in parallel to simulate the gravitational interactions between a set of bodies
31. Concurrent Auction House Implement an auction house where multiple clients can bid on items concurrently
32. Parallel File Compressor Implement a program that compresses a large file in parallel
33. Concurrent Database Connection Pool Implement a connection pool for a database that can be safely accessed by multiple goroutines concurrently
34. Parallel Sudoku Solver Implement a program that solves a Sudoku puzzle in parallel
35. Concurrent API Gateway Implement an API gateway that can handle multiple requests concurrently
36. Parallel K-Means Clustering Implement the K-Means clustering algorithm in parallel
37. Concurrent Load Balancer Implement a load balancer that distributes traffic to multiple servers concurrently
38. Parallel Fast Fourier Transform (FFT) Implement the Fast Fourier Transform (FFT) algorithm in parallel
39. Concurrent Spell Checker Implement a spell checker that checks a large document in parallel
40. Parallel Ant Colony Optimization Implement the Ant Colony Optimization (ACO) algorithm in parallel to solve a combinatorial optimization problem
41. Concurrent Social Network Feed Implement a social network feed that can be updated and read by multiple users concurrently
42. Parallel Particle Swarm Optimization Implement the Particle Swarm Optimization (PSO) algorithm in parallel to solve an optimization problem
43. Concurrent Online Gaming Server Implement a server for an online game that can handle multiple players concurrently
44. Parallel Bloom Filter Implement a Bloom filter that can be safely accessed by multiple goroutines concurrently
45. Concurrent Distributed Hash Table (DHT) Implement a simplified Distributed Hash Table (DHT) where multiple nodes can join and leave the network concurrently
46. Parallel Simulated Annealing Implement the Simulated Annealing (SA) algorithm in parallel to solve an optimization problem
47. Concurrent Real-time Analytics Dashboard Implement a real-time analytics dashboard that can be updated and viewed by multiple users concurrently
48. Parallel Traveling Salesperson Problem (TSP) Solver Implement a solver for the Traveling Salesperson Problem (TSP) in parallel
49. Concurrent Version Control System Implement a simplified version control system that can handle multiple users concurrently
50. Parallel Reinforcement Learning Agent Implement a reinforcement learning agent that learns in parallel

Implementation Highlights

Concurrency Patterns Used

  • Worker Pools: Efficient task distribution across multiple goroutines
  • Producer-Consumer: Channel-based communication patterns
  • Fan-out/Fan-in: Parallel processing with result aggregation
  • Pipeline: Multi-stage concurrent processing
  • MapReduce: Distributed computing pattern for large-scale data processing
  • Actor Model: Message-passing concurrency (in chat server)
  • Semaphores: Resource limiting and access control
  • Condition Variables: Complex synchronization scenarios

Synchronization Primitives

  • Channels: Primary communication mechanism
  • Mutexes/RWMutexes: Protecting shared state
  • Atomic Operations: Lock-free programming
  • WaitGroups: Goroutine coordination
  • Context: Cancellation and timeout management
  • sync.Once: One-time initialization
  • sync.Pool: Object reuse and memory optimization

Progress

Completed: 29/50 problems (58%)
Current Focus: Problem 25 (DNS Resolver)
Next Batch: Problems 26-30 (Advanced Algorithms)

About

Dive into the world of Golang concurrency with this repository! Featuring a range of experiments and examples that explore Go's concurrent programming capabilities. Perfect for developers seeking to master Go's unique approach to parallel tasks. 🚀🔧🐹

Topics

Resources

Stars

Watchers

Forks

Languages