https://github.com/aidinhamedi/primegen_cpp_multithreaded
A multi-threaded prime number generator that efficiently finds and logs prime numbers to a file. Utilizes modern C++ features like atomic variables, mutexes, and condition variables for thread synchronization. The program dynamically adjusts the number of threads based on the hardware concurrency or a custom number, ensuring optimal performance.
https://github.com/aidinhamedi/primegen_cpp_multithreaded
Last synced: 2 months ago
JSON representation
A multi-threaded prime number generator that efficiently finds and logs prime numbers to a file. Utilizes modern C++ features like atomic variables, mutexes, and condition variables for thread synchronization. The program dynamically adjusts the number of threads based on the hardware concurrency or a custom number, ensuring optimal performance.
- Host: GitHub
- URL: https://github.com/aidinhamedi/primegen_cpp_multithreaded
- Owner: AidinHamedi
- License: mit
- Created: 2024-02-26T10:18:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-04T07:42:44.000Z (8 months ago)
- Last Synced: 2024-11-26T15:50:20.430Z (6 months ago)
- Language: C++
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Multi-Threaded Prime Number Generator

This project is a multi-threaded prime number generator written in C++. It efficiently finds prime numbers and logs them to a file.
## Getting Started
### Prerequisites
- A C++ compiler that supports C++11 or later.
- CMake (optional, for building the project).### Building
1. Clone the repository:
```
git clone https://github.com/Aydinhamedi/PrimeGen_CPP_Multithreaded.git
```
2. Navigate to the project directory:
```
cd prime-PrimeGen_CPP_Multithreaded
```
3. Compile the project:
- If you have CMake installed, you can build the project using:
```
cmake .
make
```
- Alternatively, compile the `main.cpp` file directly with your C++ compiler.
### Or simply go to the github releases.
### Running- Run the compiled binary:
```
./PrimeGen_CPP_Multithreaded.exe
```
- The program will start generating prime numbers and logging them to `Prime_nums.txt`.## Usage
The program automatically adjusts the number of threads based on the hardware concurrency or a custom number for optimal performance. It displays the speed of prime number generation in primes per second.
## Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues for any improvements or bug fixes.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.