Machine learning-based thread-parallelism regulation in software transactional memory