1. A method of executing an algorithm in a parallel manner using a plurality of concurrent threads, comprising: generating a lock-free barrier that includes a variable that stores both a total participants count and a current participants count, the total participants count indicating a total number of threads in the plurality of concurrent threads that are participating in a current phase of the algorithm, and the current participants count indicating a total number of threads in the plurality of concurrent threads that have completed the current phase; blocking, with the barrier, the threads that have completed the current phase; dynamically updating the total participants count during execution of the current phase of the algorithm; and wherein the generating, blocking, and dynamically updating are performed by at least one processor.