I am testing a CPU miner using Python multiprocessing.Each worker searches a separate nonce range. The parent process collects the reported hash count and calculates the displayed hashrate.
A simplified part of the implementation:
hashes += 1
if hashes % 100 == 0:
result["hashes"] = result.get("hashes", 0) + 100
total_hashes = result.get("hashes", 0)
hps = total_hashes / elapsed
Source code:https://github.com/loidprotagonist/Queen/blob/main/Loid_miner.py
I have two practical questions:1. Is this a reliable way to measure the actual aggregate hashrate across multiple processes?
2. Can repeatedly creating and terminating the worker processes eventually cause resource leaks, instability, or crashes?
I am looking for implementation-level feedback and reproducible tests,
not theoretical discussion.