1. A computer-implemented method, comprising: establishing a single application lock and granting the lock to a first thread among a plurality of executing threads of an application program while recording information relating to execution of the application program in a computer system; detecting a call of the first thread that will be simulated during replay of the application program; releasing the application lock in response to detecting the call that will be simulated during replay and determining that the first thread and a second thread are permitted to execute in parallel; permitting performing the call; allowing the second thread to execute in parallel with the first thread while the call is ongoing; granting the lock to threads subsequent to permitting performing the call; creating and storing a record indicating an order in which the threads were granted the lock; replaying the execution of the application program and managing the threads to ensure that the application lock is granted to the threads in the same order as indicated in the record, including simulating the call of the first thread; wherein the method is performed by one or more processors.