Deterministic replays of multithreaded programs