{"id":24374579,"url":"https://github.com/benami171/Pipeline_Leader-follower","last_synced_at":"2025-03-12T11:41:29.534Z","repository":{"id":272640043,"uuid":"917150145","full_name":"benami171/LF_PL","owner":"benami171","description":"This project emphasize the workflow of Pipeline and Leader-Follower design patterns.","archived":false,"fork":false,"pushed_at":"2025-01-15T17:53:51.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-15T20:06:48.682Z","etag":null,"topics":["cpp","design-patterns","leader-follower","linux","multithreading","pipeline","server","thread-pool","threads"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benami171.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-15T13:00:35.000Z","updated_at":"2025-01-15T17:53:52.000Z","dependencies_parsed_at":"2025-01-15T20:06:59.907Z","dependency_job_id":"612d2650-4fb7-4937-833c-6b6df535d1ba","html_url":"https://github.com/benami171/LF_PL","commit_stats":null,"previous_names":["benami171/lf_pl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benami171%2FLF_PL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benami171%2FLF_PL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benami171%2FLF_PL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benami171%2FLF_PL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benami171","download_url":"https://codeload.github.com/benami171/LF_PL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234604924,"owners_count":18859166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","design-patterns","leader-follower","linux","multithreading","pipeline","server","thread-pool","threads"],"created_at":"2025-01-19T05:40:47.625Z","updated_at":"2025-03-12T11:41:28.762Z","avatar_url":"https://github.com/benami171.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MST Graph Processing Server\n\nA high-performance, multi-threaded server implementation for processing Minimum Spanning Tree (MST) algorithms and graph analytics. This project demonstrates advanced concurrent programming patterns and design principles in C++.\n\n## 🌟 Features\n\n### Graph Algorithms\n- **MST Algorithms**\n  - Prim's Algorithm\n  - Kruskal's Algorithm\n- **Graph Analytics**\n  - Floyd-Warshall Algorithm for shortest paths\n  - Total weight calculation\n  - Average distance computation\n  - Longest/shortest distance analysis\n\n### Concurrent Design Patterns\n- **Leader-Follower Pattern**\n  - Dynamic thread pool management\n  - Efficient task distribution\n  - Leader election mechanism\n  \n- **Active Object Pattern**\n  - Asynchronous operation processing\n  - Message passing between stages\n  - Thread-safe queue management\n\n- **Pipeline Pattern**\n  - Multi-stage graph processing\n  - Parallel execution of analytics\n  - Sequential data flow management\n\n### Architecture\n- **Client-Server Model**\n  - TCP/IP communication\n  - Multi-client support\n  - Non-blocking I/O with poll\n\n- **Design Patterns**\n  - Singleton Pattern for resource management\n  - Factory Pattern for algorithm creation\n  - Strategy Pattern for algorithm selection\n\n## 🚀 Getting Started\n\n### Prerequisites\n- CMake (version 3.22 or higher)\n- C++ Compiler with C++17 support\n- pthread library\n- Linux/Unix environment\n\n### Building the Project\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n### Running the server\n```bash\n./main\n```\nThe server will start listening on port 9034 by default.\n\n## 📝 Usage\n\n### Client Commands\n- `Newgraph` - Create a new graph\n- `MST` - Calculate Minimum Spanning Tree\n- `Newedge` - Add edge to graph\n- `Removeedge` - Remove edge from graph\n- `Exit` - Close connection\n\n### Processing Modes\n- `LF` - Leader-Follower thread pool processing\n- `P` - Pipeline processing\n\n### Algorithm Selection\n- `Prim` - Use Prim's algorithm for MST\n- `Kruskal` - Use Kruskal's algorithm for MST\n\n## 🔧 Architecture Details\n\n### Thread Management\n- Thread-safe queue implementations\n- Mutex-protected shared resources\n- Condition variables for synchronization\n- Graceful shutdown mechanisms\n\n### Memory Management\n- RAII principles\n- Resource cleanup on shutdown\n\n### Error Handling\n- Exception safety\n- Error reporting\n- Graceful degradation\n\n### Coverage Analysis\n```bash\n# Generate coverage report\ncd build\ncmake -DCMAKE_BUILD_TYPE=Debug ..\nmake\n./main\nllvm-profdata merge -sparse default.profraw -o default.profdata\nllvm-cov report ./main -instr-profile=default.profdata\n```\n\nCurrent coverage metrics:\n- Lines: 88.76%\n- Functions: 98.51%\n- Branches: 78.68%\n\n## 🛠️ Development\n\n### Project Structure\n```\n.\n├── ActiveObject.{cpp,hpp}   # Active Object pattern implementation\n├── Algo.{cpp,hpp}          # Graph algorithms\n├── ClientHandler.{cpp,hpp}  # Client connection handling\n├── Graph.{cpp,hpp}         # Graph data structure\n├── LeaderFollower.{cpp,hpp} # Thread pool implementation\n├── Pipeline.{cpp,hpp}      # Pipeline pattern implementation\n├── Proactor.{cpp,hpp}      # Proactor pattern implementation\n├── Reactor.{cpp,hpp}       # Reactor pattern implementation\n├── Server.cpp              # Main server implementation\n└── Singletone.hpp         # Singleton pattern implementation\n```\n\n### Key Components\n\n#### Graph Module\n- Implements an undirected weighted graph\n- Supports dynamic edge addition/removal\n- Thread-safe operations with mutex protection\n\n#### Algorithm Module\n- MST algorithms (Prim, Kruskal)\n- Graph analytics (Floyd-Warshall, distance calculations)\n- Optimized implementations for performance\n\n#### Concurrency Patterns\n- Leader-Follower: Dynamic thread pool for task processing\n- Active Object: Asynchronous operation handling\n- Pipeline: Sequential processing stages\n\n## 🔍 Implementation Details\n\n### Thread Safety\n- Mutex protection for shared resources\n- Atomic operations where applicable\n- Lock-free data structures when possible\n\n### Memory Management\n- RAII-compliant resource handling\n- Proper cleanup in destructors\n- Prevention of memory leaks\n\n### Error Handling\n- Exception-safe code\n- Proper resource cleanup on errors\n- Meaningful error messages\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n### Coding Standards\n- Follow C++17 best practices\n- Use consistent formatting\n- Include appropriate comments\n- Write unit tests for new features\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👥 Authors\n\n- [Gal Ben Ami](https://github.com/benami171) \n- [Barak Rozenkvit](https://github.com/barakrozenkvit) \n\nConnect with us:\n- Gal: [![GitHub](https://img.shields.io/github/followers/benami171?label=follow\u0026style=social)](https://github.com/benami171)\n- Barak: [![GitHub](https://img.shields.io/github/followers/barakrozenkvit?label=follow\u0026style=social)](https://github.com/barakrozenkvit)\n\n## 📚 References\n\n1. \"Design Patterns: Elements of Reusable Object-Oriented Software\" by Gang of Four\n2. \"C++ Concurrency in Action\" by Anthony Williams\n3. \"Modern C++ Programming with Test-Driven Development\" by Jeff Langr\n\n---\n\n**Note**: This project is part of an Advanced Operating Systems course and demonstrates various concurrent programming patterns and design principles in C++.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenami171%2FPipeline_Leader-follower","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenami171%2FPipeline_Leader-follower","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenami171%2FPipeline_Leader-follower/lists"}